From owner-svn-src-all@freebsd.org Sun Aug 13 00:04:52 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 00:14:09 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 00:14:21 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 00:56:44 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 01:04:46 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 01:08:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 04:10:49 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 07:40:07 2017 Return-Path: Delivered-To: svn-src-all@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 0223EDCAFA4; Sun, 13 Aug 2017 07:40:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C37B563391; Sun, 13 Aug 2017 07:40:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D7e5iH037256; Sun, 13 Aug 2017 07:40:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D7e5GD037255; Sun, 13 Aug 2017 07:40:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708130740.v7D7e5GD037255@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 07:40:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322454 - stable/10/sys/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/10/sys/netinet X-SVN-Commit-Revision: 322454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 07:40:07 -0000 Author: tuexen Date: Sun Aug 13 07:40:05 2017 New Revision: 322454 URL: https://svnweb.freebsd.org/changeset/base/322454 Log: MFC r317244: Represent "a syncache overflow hasn't happend yet" by using -(SYNCOOKIE_LIFETIME + 1) instead of INT64_MIN, since it is good enough and works when time_t is int32 or int64. Approved by: re (kib) Modified: stable/10/sys/netinet/tcp_syncache.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Sun Aug 13 04:10:47 2017 (r322453) +++ stable/10/sys/netinet/tcp_syncache.c Sun Aug 13 07:40:05 2017 (r322454) @@ -277,7 +277,8 @@ syncache_init(void) &V_tcp_syncache.hashbase[i].sch_mtx, 0); V_tcp_syncache.hashbase[i].sch_length = 0; V_tcp_syncache.hashbase[i].sch_sc = &V_tcp_syncache; - V_tcp_syncache.hashbase[i].sch_last_overflow = INT64_MIN; + V_tcp_syncache.hashbase[i].sch_last_overflow = + -(SYNCOOKIE_LIFETIME + 1); } /* Create the syncache entry zone. */ From owner-svn-src-all@freebsd.org Sun Aug 13 13:14:06 2017 Return-Path: Delivered-To: svn-src-all@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 B544ADE0C40; Sun, 13 Aug 2017 13:14:06 +0000 (UTC) (envelope-from andre@fbsd.e4m.org) Received: from mail.g66.org (mail.g66.org [85.10.206.112]) by mx1.freebsd.org (Postfix) with ESMTP id 499096DE8A; Sun, 13 Aug 2017 13:14:05 +0000 (UTC) (envelope-from andre@fbsd.e4m.org) Received: from x55b58567.dyn.telefonica.de (x55b58567.dyn.telefonica.de [85.181.133.103]) (authenticated bits=128) by mail.g66.org (8.15.2/8.15.2) with ESMTPA id v7DDDCdF026994; Sun, 13 Aug 2017 15:13:13 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: from stationary.client ([192.168.128.2]) by gate.local (8.15.2/8.15.2) with ESMTP id v7DDDBPM005086; Sun, 13 Aug 2017 15:13:12 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: from submit.client ([127.0.0.1]) by voyager.local (8.15.2/8.15.2) with ESMTP id v7DDDBmX024496; Sun, 13 Aug 2017 15:13:11 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: (from user@localhost) by voyager.local (8.15.2/8.15.2/Submit) id v7DDDBwL024495; Sun, 13 Aug 2017 15:13:11 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Date: Sun, 13 Aug 2017 15:13:11 +0200 From: Andre Albsmeier To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, andre@fbsd.e4m.org Subject: Re: svn commit: r322345 - stable/11/lib/libc/x86/sys Message-ID: <20170813131311.GA24473@voyager> References: <201708100900.v7A90FjI094474@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708100900.v7A90FjI094474@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Virus-Scanned: clamav-milter 0.99.2 at colo X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 13:14:06 -0000 On Thu, 10-Aug-2017 at 09:00:15 +0000, Konstantin Belousov wrote: > Author: kib > Date: Thu Aug 10 09:00:15 2017 > New Revision: 322345 > URL: https://svnweb.freebsd.org/changeset/base/322345 > > Log: > MFC r321608: > Use MFENCE to serialize RDTSC on non-Intel CPUs. This broke libc on my FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) VT(vga): text 80x25 CPU: AMD-K6tm w/ multimedia extensions (199.44-MHz 586-class CPU) Origin="AuthenticAMD" Id=0x562 Family=0x5 Model=0x6 Stepping=2 Features=0x8001bf AMD Features=0x400<> On system start, it actually makes various programmes hang until Ctrl-C is pressed. Reboot is not possible (endlessly hanging with 'zillions of defunct processes). Going back to r322042 fixes it... -Andre > > Modified: > stable/11/lib/libc/x86/sys/__vdso_gettc.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c > ============================================================================== > --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Thu Aug 10 06:59:43 2017 (r322344) > +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Thu Aug 10 09:00:15 2017 (r322345) > @@ -52,57 +52,108 @@ __FBSDID("$FreeBSD$"); > #endif > #include "libc_private.h" > > +static enum LMB { > + LMB_UNKNOWN, > + LMB_NONE, > + LMB_MFENCE, > + LMB_LFENCE > +} lfence_works = LMB_UNKNOWN; > + > static void > -lfence_mb(void) > +cpuidp(u_int leaf, u_int p[4]) > { > + > + __asm __volatile( > #if defined(__i386__) > - static int lfence_works = -1; > + " pushl %%ebx\n" > +#endif > + " cpuid\n" > +#if defined(__i386__) > + " movl %%ebx,%1\n" > + " popl %%ebx" > +#endif > + : "=a" (p[0]), > +#if defined(__i386__) > + "=r" (p[1]), > +#elif defined(__amd64__) > + "=b" (p[1]), > +#else > +#error "Arch" > +#endif > + "=c" (p[2]), "=d" (p[3]) > + : "0" (leaf)); > +} > + > +static enum LMB > +select_lmb(void) > +{ > + u_int p[4]; > + static const char intel_id[] = "GenuntelineI"; > + > + cpuidp(0, p); > + return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? > + LMB_LFENCE : LMB_MFENCE); > +} > + > +static void > +init_fence(void) > +{ > +#if defined(__i386__) > u_int cpuid_supported, p[4]; > > - if (lfence_works == -1) { > - __asm __volatile( > - " pushfl\n" > - " popl %%eax\n" > - " movl %%eax,%%ecx\n" > - " xorl $0x200000,%%eax\n" > - " pushl %%eax\n" > - " popfl\n" > - " pushfl\n" > - " popl %%eax\n" > - " xorl %%eax,%%ecx\n" > - " je 1f\n" > - " movl $1,%0\n" > - " jmp 2f\n" > - "1: movl $0,%0\n" > - "2:\n" > - : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); > - if (cpuid_supported) { > - __asm __volatile( > - " pushl %%ebx\n" > - " cpuid\n" > - " movl %%ebx,%1\n" > - " popl %%ebx\n" > - : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) > - : "0" (0x1)); > - lfence_works = (p[3] & CPUID_SSE2) != 0; > - } else > - lfence_works = 0; > - } > - if (lfence_works == 1) > - lfence(); > + __asm __volatile( > + " pushfl\n" > + " popl %%eax\n" > + " movl %%eax,%%ecx\n" > + " xorl $0x200000,%%eax\n" > + " pushl %%eax\n" > + " popfl\n" > + " pushfl\n" > + " popl %%eax\n" > + " xorl %%eax,%%ecx\n" > + " je 1f\n" > + " movl $1,%0\n" > + " jmp 2f\n" > + "1: movl $0,%0\n" > + "2:\n" > + : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); > + if (cpuid_supported) { > + cpuidp(0x1, p); > + if ((p[3] & CPUID_SSE2) != 0) > + lfence_works = select_lmb(); > + } else > + lfence_works = LMB_NONE; > #elif defined(__amd64__) > - lfence(); > + lfence_works = select_lmb(); > #else > -#error "arch" > +#error "Arch" > #endif > } > > +static void > +rdtsc_mb(void) > +{ > + > +again: > + if (__predict_true(lfence_works == LMB_LFENCE)) { > + lfence(); > + return; > + } else if (lfence_works == LMB_MFENCE) { > + mfence(); > + return; > + } else if (lfence_works == LMB_NONE) { > + return; > + } > + init_fence(); > + goto again; > +} > + > static u_int > __vdso_gettc_rdtsc_low(const struct vdso_timehands *th) > { > u_int rv; > > - lfence_mb(); > + rdtsc_mb(); > __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" > : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); > return (rv); > @@ -112,7 +163,7 @@ static u_int > __vdso_rdtsc32(void) > { > > - lfence_mb(); > + rdtsc_mb(); > return (rdtsc32()); > } > > @@ -211,7 +262,7 @@ __vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int > scale = tsc_ref->tsc_scale; > ofs = tsc_ref->tsc_ofs; > > - lfence_mb(); > + rdtsc_mb(); > tsc = rdtsc(); > > /* ret = ((tsc * scale) >> 64) + ofs */ > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" -- Stuxnet? Find ich gut. Manche lernen nur auf die harte Tour... From owner-svn-src-all@freebsd.org Sun Aug 13 13:38:16 2017 Return-Path: Delivered-To: svn-src-all@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 F4165DE21EA; Sun, 13 Aug 2017 13:38:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8799C6EB35; Sun, 13 Aug 2017 13:38:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7DDbaFg067559 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 13 Aug 2017 16:37:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7DDbaFg067559 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7DDbagC067558; Sun, 13 Aug 2017 16:37:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Aug 2017 16:37:36 +0300 From: Konstantin Belousov To: Andre Albsmeier Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r322345 - stable/11/lib/libc/x86/sys Message-ID: <20170813133736.GO1700@kib.kiev.ua> References: <201708100900.v7A90FjI094474@repo.freebsd.org> <20170813131311.GA24473@voyager> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170813131311.GA24473@voyager> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 13:38:16 -0000 On Sun, Aug 13, 2017 at 03:13:11PM +0200, Andre Albsmeier wrote: > On Thu, 10-Aug-2017 at 09:00:15 +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Thu Aug 10 09:00:15 2017 > > New Revision: 322345 > > URL: https://svnweb.freebsd.org/changeset/base/322345 > > > > Log: > > MFC r321608: > > Use MFENCE to serialize RDTSC on non-Intel CPUs. > > This broke libc on my > > FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) > VT(vga): text 80x25 > CPU: AMD-K6tm w/ multimedia extensions (199.44-MHz 586-class CPU) > Origin="AuthenticAMD" Id=0x562 Family=0x5 Model=0x6 Stepping=2 > Features=0x8001bf > AMD Features=0x400<> > > On system start, it actually makes various programmes hang until > Ctrl-C is pressed. Reboot is not possible (endlessly hanging with > 'zillions of defunct processes). > > Going back to r322042 fixes it... Indeed code is broken on i386 machines which have CPUID but no SSE. Try this. diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 4ada5e7eac1..ef2ca69edf7 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -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-all@freebsd.org Sun Aug 13 13:54:45 2017 Return-Path: Delivered-To: svn-src-all@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 99C16D93389; Sun, 13 Aug 2017 13:54:45 +0000 (UTC) (envelope-from andre@fbsd.e4m.org) Received: from mail.g66.org (mail.g66.org [85.10.206.112]) by mx1.freebsd.org (Postfix) with ESMTP id 1904D6F89F; Sun, 13 Aug 2017 13:54:44 +0000 (UTC) (envelope-from andre@fbsd.e4m.org) Received: from x55b58567.dyn.telefonica.de (x55b58567.dyn.telefonica.de [85.181.133.103]) (authenticated bits=128) by mail.g66.org (8.15.2/8.15.2) with ESMTPA id v7DDsglA027313; Sun, 13 Aug 2017 15:54:43 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: from stationary.client ([192.168.128.2]) by gate.local (8.15.2/8.15.2) with ESMTP id v7DDsgHi006730; Sun, 13 Aug 2017 15:54:42 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: from submit.client ([127.0.0.1]) by voyager.local (8.15.2/8.15.2) with ESMTP id v7DDsgWF028764; Sun, 13 Aug 2017 15:54:42 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Received: (from user@localhost) by voyager.local (8.15.2/8.15.2/Submit) id v7DDsgxp028763; Sun, 13 Aug 2017 15:54:42 +0200 (CEST) (envelope-from andre@fbsd.e4m.org) Date: Sun, 13 Aug 2017 15:54:42 +0200 From: Andre Albsmeier To: Konstantin Belousov Cc: Andre Albsmeier , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r322345 - stable/11/lib/libc/x86/sys Message-ID: <20170813135442.GA28728@voyager> References: <201708100900.v7A90FjI094474@repo.freebsd.org> <20170813131311.GA24473@voyager> <20170813133736.GO1700@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170813133736.GO1700@kib.kiev.ua> User-Agent: Mutt/1.7.2 (2016-11-26) X-Virus-Scanned: clamav-milter 0.99.2 at colo X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 13:54:45 -0000 On Sun, 13-Aug-2017 at 16:37:36 +0300, Konstantin Belousov wrote: > On Sun, Aug 13, 2017 at 03:13:11PM +0200, Andre Albsmeier wrote: > > On Thu, 10-Aug-2017 at 09:00:15 +0000, Konstantin Belousov wrote: > > > Author: kib > > > Date: Thu Aug 10 09:00:15 2017 > > > New Revision: 322345 > > > URL: https://svnweb.freebsd.org/changeset/base/322345 > > > > > > Log: > > > MFC r321608: > > > Use MFENCE to serialize RDTSC on non-Intel CPUs. > > > > This broke libc on my > > > > FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) > > VT(vga): text 80x25 > > CPU: AMD-K6tm w/ multimedia extensions (199.44-MHz 586-class CPU) > > Origin="AuthenticAMD" Id=0x562 Family=0x5 Model=0x6 Stepping=2 > > Features=0x8001bf > > AMD Features=0x400<> > > > > On system start, it actually makes various programmes hang until > > Ctrl-C is pressed. Reboot is not possible (endlessly hanging with > > 'zillions of defunct processes). > > > > Going back to r322042 fixes it... > > Indeed code is broken on i386 machines which have CPUID but no SSE. Wonder how many of these still exist... > Try this. I just compiled and installed libc.so.7 with this patch on the machine in question and the test I used for hunting down the reason (ls -l /lib) was OK. I then rebooted the whole box and it looked good as well. I did not compile stuff which links libc statically and hung before (devd) but I am pretty sure this will be OK as well... Thanks, -Andre > > diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c > index 4ada5e7eac1..ef2ca69edf7 100644 > --- a/lib/libc/x86/sys/__vdso_gettc.c > +++ b/lib/libc/x86/sys/__vdso_gettc.c > @@ -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 -- My other computer is your windows box. From owner-svn-src-all@freebsd.org Sun Aug 13 14:36:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 14:42:25 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 14:50:39 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 15:15:41 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 16:39:51 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 16:40:31 2017 Return-Path: Delivered-To: svn-src-all@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 4B473DC9352; Sun, 13 Aug 2017 16:40: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 1984A75853; Sun, 13 Aug 2017 16:40: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 v7DGeUr2057785; Sun, 13 Aug 2017 16:40:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DGeUMi057784; Sun, 13 Aug 2017 16:40:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708131640.v7DGeUMi057784@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 16:40:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322460 - stable/11/sys/dev/uart X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/uart X-SVN-Commit-Revision: 322460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 16:40:31 -0000 Author: emaste Date: Sun Aug 13 16:40:29 2017 New Revision: 322460 URL: https://svnweb.freebsd.org/changeset/base/322460 Log: MFC r215837: uart: add AX99100 chipset support PR: 215837 Modified: stable/11/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/11/sys/dev/uart/uart_bus_pci.c Sun Aug 13 16:39:49 2017 (r322459) +++ stable/11/sys/dev/uart/uart_bus_pci.c Sun Aug 13 16:40:29 2017 (r322460) @@ -86,6 +86,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x103c, 0x3301, 0xffff, 0, "HP iLO serial port", 0x10 }, { 0x11c1, 0x0480, 0xffff, 0, "Agere Systems Venus Modem (V90, 56KFlex)", 0x14 }, { 0x115d, 0x0103, 0xffff, 0, "Xircom Cardbus Ethernet + 56k Modem", 0x10 }, +{ 0x125b, 0x9100, 0xa000, 0x1000, + "ASIX AX99100 PCIe 1/2/3/4-port RS-232/422/485", 0x10 }, { 0x1282, 0x6585, 0xffff, 0, "Davicom 56PDV PCI Modem", 0x10 }, { 0x12b9, 0x1008, 0xffff, 0, "3Com 56K FaxModem Model 5610", 0x10 }, { 0x131f, 0x1000, 0xffff, 0, "Siig CyberSerial (1-port) 16550", 0x18 }, From owner-svn-src-all@freebsd.org Sun Aug 13 16:44:57 2017 Return-Path: Delivered-To: svn-src-all@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 11CAADC99A5; Sun, 13 Aug 2017 16:44:57 +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 E272675EEA; Sun, 13 Aug 2017 16:44:56 +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 v7DGiu4O061729; Sun, 13 Aug 2017 16:44:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DGiufm061728; Sun, 13 Aug 2017 16:44:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708131644.v7DGiufm061728@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 16:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322461 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 16:44:57 -0000 Author: emaste Date: Sun Aug 13 16:44:55 2017 New Revision: 322461 URL: https://svnweb.freebsd.org/changeset/base/322461 Log: MFC r321298: acpidump: add ACPI NFIT (NVDIMM Firmware Interface Table) Also MFC r322351 by mav, add two NFIT fields missed in initial commit. Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 16:40:29 2017 (r322460) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 16:44:55 2017 (r322461) @@ -40,6 +40,7 @@ #include #include #include +#include #include "acpidump.h" @@ -70,6 +71,8 @@ static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFIN static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat); static void acpi_handle_srat(ACPI_TABLE_HEADER *sdp); static void acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp); +static void acpi_print_nfit(ACPI_NFIT_HEADER *nfit); +static void acpi_handle_nfit(ACPI_TABLE_HEADER *sdp); static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp); static void acpi_print_fadt(ACPI_TABLE_HEADER *sdp); static void acpi_print_facs(ACPI_TABLE_FACS *facs); @@ -79,6 +82,8 @@ static void acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp); static void acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp); static void acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first, void (*action)(ACPI_SUBTABLE_HEADER *)); +static void acpi_walk_nfit(ACPI_TABLE_HEADER *table, void *first, + void (*action)(ACPI_NFIT_HEADER *)); /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */ static int addr_size; @@ -277,6 +282,27 @@ acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *fi } static void +acpi_walk_nfit(ACPI_TABLE_HEADER *table, void *first, + void (*action)(ACPI_NFIT_HEADER *)) +{ + ACPI_NFIT_HEADER *subtable; + char *end; + + subtable = first; + end = (char *)table + table->Length; + while ((char *)subtable < end) { + printf("\n"); + if (subtable->Length < sizeof(ACPI_NFIT_HEADER)) { + warnx("invalid subtable length %u", subtable->Length); + return; + } + action(subtable); + subtable = (ACPI_NFIT_HEADER *)((char *)subtable + + subtable->Length); + } +} + +static void acpi_print_cpu(u_char cpu_id) { @@ -1137,7 +1163,177 @@ acpi_handle_srat(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); } +static const char *nfit_types[] = { + [ACPI_NFIT_TYPE_SYSTEM_ADDRESS] = "System Address", + [ACPI_NFIT_TYPE_MEMORY_MAP] = "Memory Map", + [ACPI_NFIT_TYPE_INTERLEAVE] = "Interleave", + [ACPI_NFIT_TYPE_SMBIOS] = "SMBIOS", + [ACPI_NFIT_TYPE_CONTROL_REGION] = "Control Region", + [ACPI_NFIT_TYPE_DATA_REGION] = "Data Region", + [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address" +}; + + static void +acpi_print_nfit(ACPI_NFIT_HEADER *nfit) +{ + char *uuidstr; + uint32_t status; + + ACPI_NFIT_SYSTEM_ADDRESS *sysaddr; + ACPI_NFIT_MEMORY_MAP *mmap; + ACPI_NFIT_INTERLEAVE *ileave; + ACPI_NFIT_SMBIOS *smbios; + ACPI_NFIT_CONTROL_REGION *ctlreg; + ACPI_NFIT_DATA_REGION *datareg; + ACPI_NFIT_FLUSH_ADDRESS *fladdr; + + if (nfit->Type < nitems(nfit_types)) + printf("\tType=%s\n", nfit_types[nfit->Type]); + else + printf("\tType=%u (unknown)\n", nfit->Type); + switch (nfit->Type) { + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: + sysaddr = (ACPI_NFIT_SYSTEM_ADDRESS *)nfit; + printf("\tRangeIndex=%u\n", (u_int)sysaddr->RangeIndex); + printf("\tProximityDomain=%u\n", + (u_int)sysaddr->ProximityDomain); + uuid_to_string((uuid_t *)(sysaddr->RangeGuid), + &uuidstr, &status); + if (status != uuid_s_ok) + errx(1, "uuid_to_string: status=%u", status); + printf("\tRangeGuid=%s\n", uuidstr); + free(uuidstr); + printf("\tAddress=0x%016jx\n", (uintmax_t)sysaddr->Address); + printf("\tLength=0x%016jx\n", (uintmax_t)sysaddr->Length); + printf("\tMemoryMapping=0x%016jx\n", + (uintmax_t)sysaddr->MemoryMapping); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(sysaddr->Flags, ADD_ONLINE_ONLY); + PRINTFLAG(sysaddr->Flags, PROXIMITY_VALID); + PRINTFLAG_END(); + +#undef PRINTFLAG + + break; + case ACPI_NFIT_TYPE_MEMORY_MAP: + mmap = (ACPI_NFIT_MEMORY_MAP *)nfit; + printf("\tDeviceHandle=%u\n", (u_int)mmap->DeviceHandle); + printf("\tPhysicalId=%u\n", (u_int)mmap->PhysicalId); + printf("\tRegionId=%u\n", (u_int)mmap->RegionId); + printf("\tRangeIndex=%u\n", (u_int)mmap->RangeIndex); + printf("\tRegionIndex=%u\n", (u_int)mmap->RegionIndex); + printf("\tRegionSize=0x%016jx\n", (uintmax_t)mmap->RegionSize); + printf("\tRegionOffset=0x%016jx\n", + (uintmax_t)mmap->RegionOffset); + printf("\tAddress=0x%016jx\n", (uintmax_t)mmap->Address); + printf("\tInterleaveIndex=%u\n", (u_int)mmap->InterleaveIndex); + printf("\tInterleaveWays=%u\n", (u_int)mmap->InterleaveWays); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_MEM_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(mmap->Flags, SAVE_FAILED); + PRINTFLAG(mmap->Flags, RESTORE_FAILED); + PRINTFLAG(mmap->Flags, FLUSH_FAILED); + PRINTFLAG(mmap->Flags, NOT_ARMED); + PRINTFLAG(mmap->Flags, HEALTH_OBSERVED); + PRINTFLAG(mmap->Flags, HEALTH_ENABLED); + PRINTFLAG(mmap->Flags, MAP_FAILED); + PRINTFLAG_END(); + +#undef PRINTFLAG + + break; + case ACPI_NFIT_TYPE_INTERLEAVE: + ileave = (ACPI_NFIT_INTERLEAVE *)nfit; + printf("\tInterleaveIndex=%u\n", + (u_int)ileave->InterleaveIndex); + printf("\tLineCount=%u\n", (u_int)ileave->LineCount); + printf("\tLineSize=%u\n", (u_int)ileave->LineSize); + /* XXX ileave->LineOffset[i] output is not supported */ + break; + case ACPI_NFIT_TYPE_SMBIOS: + smbios = (ACPI_NFIT_SMBIOS *)nfit; + /* XXX smbios->Data[x] output is not supported */ + break; + case ACPI_NFIT_TYPE_CONTROL_REGION: + ctlreg = (ACPI_NFIT_CONTROL_REGION *)nfit; + printf("\tRegionIndex=%u\n", (u_int)ctlreg->RegionIndex); + printf("\tVendorId=0x%04x\n", (u_int)ctlreg->VendorId); + printf("\tDeviceId=0x%04x\n", (u_int)ctlreg->DeviceId); + printf("\tRevisionId=%u\n", (u_int)ctlreg->RevisionId); + printf("\tSubsystemVendorId=0x%04x\n", + (u_int)ctlreg->SubsystemVendorId); + printf("\tSubsystemDeviceId=0x%04x\n", + (u_int)ctlreg->SubsystemDeviceId); + printf("\tSubsystemRevisionId=%u\n", + (u_int)ctlreg->SubsystemRevisionId); + printf("\tValidFields=%u\n", (u_int)ctlreg->ValidFields); + printf("\tManufacturingLocation=%u\n", + (u_int)ctlreg->ManufacturingLocation); + printf("\tManufacturingDate=%u\n", + (u_int)ctlreg->ManufacturingDate); + printf("\tSerialNumber=%u\n", + (u_int)ctlreg->SerialNumber); + printf("\tCode=0x%04x\n", (u_int)ctlreg->Code); + printf("\tWindows=%u\n", (u_int)ctlreg->Windows); + printf("\tWindowSize=0x%016jx\n", + (uintmax_t)ctlreg->WindowSize); + printf("\tCommandOffset=0x%016jx\n", + (uintmax_t)ctlreg->CommandOffset); + printf("\tCommandSize=0x%016jx\n", + (uintmax_t)ctlreg->CommandSize); + printf("\tStatusOffset=0x%016jx\n", + (uintmax_t)ctlreg->StatusOffset); + printf("\tStatusSize=0x%016jx\n", + (uintmax_t)ctlreg->StatusSize); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_## flag, #flag) + + printf("\tFlags="); + PRINTFLAG(mmap->Flags, ADD_ONLINE_ONLY); + PRINTFLAG(mmap->Flags, PROXIMITY_VALID); + PRINTFLAG_END(); + +#undef PRINTFLAG + + break; + case ACPI_NFIT_TYPE_DATA_REGION: + datareg = (ACPI_NFIT_DATA_REGION *)nfit; + printf("\tRegionIndex=%u\n", (u_int)datareg->RegionIndex); + printf("\tWindows=%u\n", (u_int)datareg->Windows); + printf("\tOffset=0x%016jx\n", (uintmax_t)datareg->Offset); + printf("\tSize=0x%016jx\n", (uintmax_t)datareg->Size); + printf("\tCapacity=0x%016jx\n", (uintmax_t)datareg->Capacity); + printf("\tStartAddress=0x%016jx\n", + (uintmax_t)datareg->StartAddress); + break; + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + fladdr = (ACPI_NFIT_FLUSH_ADDRESS *)nfit; + printf("\tDeviceHandle=%u\n", (u_int)fladdr->DeviceHandle); + printf("\tHintCount=%u\n", (u_int)fladdr->HintCount); + /* XXX fladdr->HintAddress[i] output is not supported */ + break; + } +} + +static void +acpi_handle_nfit(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_NFIT *nfit; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + nfit = (ACPI_TABLE_NFIT *)sdp; + acpi_walk_nfit(sdp, (nfit + 1), acpi_print_nfit); + printf(END_COMMENT); +} + +static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp) { printf(" "); @@ -1452,6 +1648,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_tcpa(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_DMAR, 4)) acpi_handle_dmar(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_NFIT, 4)) + acpi_handle_nfit(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); From owner-svn-src-all@freebsd.org Sun Aug 13 17:30:04 2017 Return-Path: Delivered-To: svn-src-all@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 6D7C3DCCA64; Sun, 13 Aug 2017 17:30:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3BC3E7761B; Sun, 13 Aug 2017 17:30:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DHU3al078187; Sun, 13 Aug 2017 17:30:03 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DHU3Xu078186; Sun, 13 Aug 2017 17:30:03 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708131730.v7DHU3Xu078186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 13 Aug 2017 17:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322462 - stable/10/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Group: stable-10 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/10/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Commit-Revision: 322462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 17:30:04 -0000 Author: avos Date: Sun Aug 13 17:30:03 2017 New Revision: 322462 URL: https://svnweb.freebsd.org/changeset/base/322462 Log: MFC r322124: rfcomm_pppd.8: fix a typo (SPD -> SDP). Approved by: re (marius) Modified: stable/10/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 ============================================================================== --- stable/10/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 13 16:44:55 2017 (r322461) +++ stable/10/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 13 17:30:03 2017 (r322462) @@ -348,7 +348,7 @@ label. The .Nm utility in server mode will try to register the Bluetooth LAN Access Over PPP -service with the local SPD daemon. +service with the local SDP daemon. If the local SDP daemon is not running, .Nm will exit with an error. From owner-svn-src-all@freebsd.org Sun Aug 13 18:06:40 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 18:09:23 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 18:10:25 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 18:12:57 2017 Return-Path: Delivered-To: svn-src-all@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 E26D1DCFCC2; Sun, 13 Aug 2017 18:12:57 +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 AED737D26A; Sun, 13 Aug 2017 18:12:57 +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 v7DICuGW098642; Sun, 13 Aug 2017 18:12:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DICugT098641; Sun, 13 Aug 2017 18:12:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708131812.v7DICugT098641@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 18:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322466 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:12:58 -0000 Author: emaste Date: Sun Aug 13 18:12:56 2017 New Revision: 322466 URL: https://svnweb.freebsd.org/changeset/base/322466 Log: MFC r304000 (maxim): acpidump: move variable initialization out of assert(3) This fixes acpidump(8) compiled with "WITHOUT_ASSERT_DEBUG=yes" that removes assert(3)'s from the code. Submitted by: Alexander Nedotsukov Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 18:10:24 2017 (r322465) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 18:12:56 2017 (r322466) @@ -1772,8 +1772,8 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HE perror("mkdtemp tmp working dir"); return; } - assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname) - <= sizeof(tmpstr) - 1); + len = (size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname); + assert(len <= sizeof(tmpstr) - 1); fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) { perror("iasl tmp file"); @@ -1805,8 +1805,8 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HE } /* Dump iasl's output to stdout */ - assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname) - <= sizeof(tmpstr) -1); + len = (size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname); + assert(len <= sizeof(tmpstr) - 1); fp = fopen(tmpstr, "r"); if (unlink(tmpstr) < 0) { perror("unlink"); From owner-svn-src-all@freebsd.org Sun Aug 13 18:14:25 2017 Return-Path: Delivered-To: svn-src-all@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 5E9BFDCFF06; Sun, 13 Aug 2017 18:14: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 2B77B7D4A4; Sun, 13 Aug 2017 18:14:25 +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 v7DIEO4S098744; Sun, 13 Aug 2017 18:14:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DIEOtG098743; Sun, 13 Aug 2017 18:14:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708131814.v7DIEOtG098743@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 18:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322467 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:14:25 -0000 Author: emaste Date: Sun Aug 13 18:14:24 2017 New Revision: 322467 URL: https://svnweb.freebsd.org/changeset/base/322467 Log: MFC r320736: acpidump: warn and exit loop on invalid subtable length Submitted by: Guangyuan Yang Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 18:12:56 2017 (r322466) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Sun Aug 13 18:14:24 2017 (r322467) @@ -275,6 +275,10 @@ acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *fi end = (char *)table + table->Length; while ((char *)subtable < end) { printf("\n"); + if (subtable->Length < sizeof(ACPI_SUBTABLE_HEADER)) { + warnx("invalid subtable length %u", subtable->Length); + return; + } action(subtable); subtable = (ACPI_SUBTABLE_HEADER *)((char *)subtable + subtable->Length); From owner-svn-src-all@freebsd.org Sun Aug 13 18:54:52 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 18:59:20 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 19:04:33 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 19:15:51 2017 Return-Path: Delivered-To: svn-src-all@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 D6605DD3FEA for ; Sun, 13 Aug 2017 19:15:51 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from cow.apple.relay.mailchannels.net (cow.apple.relay.mailchannels.net [23.83.208.41]) (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 94E037F7F6 for ; Sun, 13 Aug 2017 19:15:51 +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 02F8410799F 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 7B26A107C18 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.62.11]) (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:34 +0000 X-MC-Relay: Forwarding X-MailChannels-SenderId: _forwarded-from|73.78.92.27 X-MailChannels-Auth-Id: duocircle X-Cooperative-Name: 2b7112ab5da084f9_1502651194887_2072918843 X-MC-Loop-Signature: 1502651194887:1509316457 X-MC-Ingress-Time: 1502651194887 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 19:15:51 -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-all@freebsd.org Sun Aug 13 19:35:49 2017 Return-Path: Delivered-To: svn-src-all@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 6AA58DD5548; Sun, 13 Aug 2017 19:35:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 372D48027F; Sun, 13 Aug 2017 19:35:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DJZmOm031535; Sun, 13 Aug 2017 19:35:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DJZmKG031534; Sun, 13 Aug 2017 19:35:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708131935.v7DJZmKG031534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 13 Aug 2017 19:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322472 - stable/11/kerberos5/libexec/ipropd-master X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/11/kerberos5/libexec/ipropd-master X-SVN-Commit-Revision: 322472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 19:35:49 -0000 Author: cy Date: Sun Aug 13 19:35:48 2017 New Revision: 322472 URL: https://svnweb.freebsd.org/changeset/base/322472 Log: MFC r322113: Remove dead target introduced in r178828. Modified: stable/11/kerberos5/libexec/ipropd-master/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/kerberos5/libexec/ipropd-master/Makefile ============================================================================== --- stable/11/kerberos5/libexec/ipropd-master/Makefile Sun Aug 13 18:59:19 2017 (r322471) +++ stable/11/kerberos5/libexec/ipropd-master/Makefile Sun Aug 13 19:35:48 2017 (r322472) @@ -10,9 +10,6 @@ DPADD= ${LDAPDPADD} LDADD= ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} -foo:: - echo ${LIBHX509} - .include .PATH: ${KRB5DIR}/lib/kadm5 From owner-svn-src-all@freebsd.org Sun Aug 13 21:02:42 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 21:11:50 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 21:45:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Aug 13 22:07:44 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Mon Aug 14 00:00:25 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 00:12:16 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 02:23:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 02:49:32 2017 Return-Path: Delivered-To: svn-src-all@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 ACB04DCBCCF; Mon, 14 Aug 2017 02:49:32 +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 889C76872D; Mon, 14 Aug 2017 02:49:32 +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 v7E2nVOU006561; Mon, 14 Aug 2017 02:49:31 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E2nV6o006560; Mon, 14 Aug 2017 02:49:31 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708140249.v7E2nV6o006560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 14 Aug 2017 02:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322480 - stable/11/sys/geom/journal X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/geom/journal X-SVN-Commit-Revision: 322480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 02:49:32 -0000 Author: mckusick Date: Mon Aug 14 02:49:31 2017 New Revision: 322480 URL: https://svnweb.freebsd.org/changeset/base/322480 Log: MFC r322178 Bug 198500 reports bad sysctl values for gjournal cache limit. PR: 198500 Submitted by: Dr. Andreas Longwitz Reported by: Eugene Grosbein Discussed with: kib Modified: stable/11/sys/geom/journal/g_journal.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/journal/g_journal.c ============================================================================== --- stable/11/sys/geom/journal/g_journal.c Mon Aug 14 02:23:10 2017 (r322479) +++ stable/11/sys/geom/journal/g_journal.c Mon Aug 14 02:49:31 2017 (r322480) @@ -130,26 +130,26 @@ SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entri SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW, &g_journal_do_optimize, 0, "Try to combine bios on flush and copy"); -static u_int g_journal_cache_used = 0; -static u_int g_journal_cache_limit = 64 * 1024 * 1024; +static u_long g_journal_cache_used = 0; +static u_long g_journal_cache_limit = 64 * 1024 * 1024; static u_int g_journal_cache_divisor = 2; static u_int g_journal_cache_switch = 90; static u_int g_journal_cache_misses = 0; static u_int g_journal_cache_alloc_failures = 0; -static u_int g_journal_cache_low = 0; +static u_long g_journal_cache_low = 0; static SYSCTL_NODE(_kern_geom_journal, OID_AUTO, cache, CTLFLAG_RW, 0, "GEOM_JOURNAL cache"); -SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, +SYSCTL_ULONG(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, &g_journal_cache_used, 0, "Number of allocated bytes"); static int g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) { - u_int limit; + u_long limit; int error; limit = g_journal_cache_limit; - error = sysctl_handle_int(oidp, &limit, 0, req); + error = sysctl_handle_long(oidp, &limit, 0, req); if (error != 0 || req->newptr == NULL) return (error); g_journal_cache_limit = limit; @@ -157,7 +157,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) return (0); } SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit, - CTLTYPE_UINT | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", + CTLTYPE_ULONG | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I", "Maximum number of allocated bytes"); SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN, &g_journal_cache_divisor, 0, @@ -3046,9 +3046,9 @@ g_journal_switcher(void *arg) kproc_exit(0); } if (error == 0 && g_journal_sync_requested == 0) { - GJ_DEBUG(1, "Out of cache, force switch (used=%u " - "limit=%u).", g_journal_cache_used, - g_journal_cache_limit); + GJ_DEBUG(1, "Out of cache, force switch (used=%jd " + "limit=%jd).", (intmax_t)g_journal_cache_used, + (intmax_t)g_journal_cache_limit); } GJ_TIMER_START(1, &bt); g_journal_do_switch(mp); From owner-svn-src-all@freebsd.org Mon Aug 14 04:47:00 2017 Return-Path: Delivered-To: svn-src-all@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 6D381DD33A8; Mon, 14 Aug 2017 04:47:00 +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 3BBF76C61C; Mon, 14 Aug 2017 04:47:00 +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 v7E4kxKg055155; Mon, 14 Aug 2017 04:46:59 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E4kxdO055154; Mon, 14 Aug 2017 04:46:59 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708140446.v7E4kxdO055154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Aug 2017 04:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322481 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 04:47:00 -0000 Author: delphij Date: Mon Aug 14 04:46:59 2017 New Revision: 322481 URL: https://svnweb.freebsd.org/changeset/base/322481 Log: Order alphabetically. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Aug 14 02:49:31 2017 (r322480) +++ svnadmin/conf/access Mon Aug 14 04:46:59 2017 (r322481) @@ -21,9 +21,9 @@ ache achim adrian ae -allanjude alc alfred +allanjude ambrisko andreast andrew From owner-svn-src-all@freebsd.org Mon Aug 14 04:48:36 2017 Return-Path: Delivered-To: svn-src-all@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 BC159DD34EE; Mon, 14 Aug 2017 04:48:36 +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 89A476C759; Mon, 14 Aug 2017 04:48:36 +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 v7E4mZM6055252; Mon, 14 Aug 2017 04:48:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E4mZil055250; Mon, 14 Aug 2017 04:48:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708140448.v7E4mZil055250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Aug 2017 04:48:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322482 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 04:48:36 -0000 Author: delphij Date: Mon Aug 14 04:48:35 2017 New Revision: 322482 URL: https://svnweb.freebsd.org/changeset/base/322482 Log: Restore gordon’s src commit bit. Welcome back! Gordon will be mentored by emaste and myself for a brief period. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Aug 14 04:46:59 2017 (r322481) +++ svnadmin/conf/access Mon Aug 14 04:48:35 2017 (r322482) @@ -83,6 +83,7 @@ gjb glebius gnn gonzo +gordon grehan grog gshapiro freebsd-cvs-committers@g.gshapiro.net Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Aug 14 04:46:59 2017 (r322481) +++ svnadmin/conf/mentors Mon Aug 14 04:48:35 2017 (r322482) @@ -15,6 +15,7 @@ anish neel Co-mentor: grehan dab vangyzen def pjd eri ae Co-mentor: thompsa +gordon delphij Co-mentor: emaste ivadasz adrian Co-mentor: cognet jceel trasz jkh rwatson From owner-svn-src-all@freebsd.org Mon Aug 14 05:30:03 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 05:31:52 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 05:40:53 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 05:46:51 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 05:55:17 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 06:00:53 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 06:28:07 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 06:29:26 2017 Return-Path: Delivered-To: svn-src-all@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 072B6DD825B; Mon, 14 Aug 2017 06:29:26 +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 C279C6FBB7; Mon, 14 Aug 2017 06:29:25 +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 v7E6TOxE096034; Mon, 14 Aug 2017 06:29:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E6TOBf096032; Mon, 14 Aug 2017 06:29:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140629.v7E6TOBf096032@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:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322489 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 06:29:26 -0000 Author: sephe Date: Mon Aug 14 06:29:24 2017 New Revision: 322489 URL: https://svnweb.freebsd.org/changeset/base/322489 Log: MFC 322299 hyperv/hn: Implement transparent mode network VF. How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 06:00:50 2017 (r322488) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 06:29:24 2017 (r322489) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #define HN_VFMAP_SIZE_DEF 8 +#define HN_XPNT_VF_ATTWAIT_MIN 2 /* seconds */ + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -263,6 +265,7 @@ static void hn_ifnet_event(void *, struct ifnet *, i static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static void hn_ifnet_lnkevent(void *, struct ifnet *, int); static bool hn_ismyvf(const struct hn_softc *, const struct ifnet *); @@ -270,6 +273,15 @@ static void hn_rxvf_change(struct hn_softc *, struct ifnet *, bool); static void hn_rxvf_set(struct hn_softc *, struct ifnet *); static void hn_rxvf_set_task(void *, int); +static void hn_xpnt_vf_input(struct ifnet *, struct mbuf *); +static int hn_xpnt_vf_iocsetflags(struct hn_softc *); +static int hn_xpnt_vf_iocsetcaps(struct hn_softc *, + struct ifreq *); +static void hn_xpnt_vf_saveifflags(struct hn_softc *); +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 int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -322,6 +334,8 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -352,6 +366,7 @@ static void hn_disable_rx(struct hn_softc *); static void hn_drain_rxtx(struct hn_softc *, int); static void hn_polling(struct hn_softc *, u_int); static void hn_chan_polling(struct vmbus_channel *, u_int); +static void hn_mtu_change_fixup(struct hn_softc *); static void hn_update_link_status(struct hn_softc *); static void hn_change_network(struct hn_softc *); @@ -529,6 +544,22 @@ SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTL SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); +/* Transparent VF */ +static int hn_xpnt_vf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_transparent, CTLFLAG_RDTUN, + &hn_xpnt_vf, 0, "Transparent VF mod"); + +/* Accurate BPF support for Transparent VF */ +static int hn_xpnt_vf_accbpf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_accbpf, CTLFLAG_RDTUN, + &hn_xpnt_vf_accbpf, 0, "Accurate BPF for transparent VF"); + +/* Extra wait for transparent VF attach routing; unit seconds. */ +static int hn_xpnt_vf_attwait = HN_XPNT_VF_ATTWAIT_MIN; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_attwait, CTLFLAG_RWTUN, + &hn_xpnt_vf_attwait, 0, + "Extra wait for transparent VF attach routing; unit: seconds"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ @@ -807,8 +838,12 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_RXVF)) { + /* + * If the non-transparent mode VF is activated, we don't know how + * its RX filter is configured, so stick the synthetic device in + * the promiscous mode. + */ + if ((ifp->if_flags & IFF_PROMISC) || (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -1086,7 +1121,7 @@ hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, } hn_nvs_set_datapath(sc, - rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTH); hn_rxvf_set(sc, rxvf ? ifp : NULL); @@ -1126,7 +1161,323 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } +static int +hn_xpnt_vf_iocsetcaps(struct hn_softc *sc, struct ifreq *ifr) +{ + struct ifnet *ifp, *vf_ifp; + uint64_t tmp; + int error; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + ifr->ifr_reqcap &= ifp->if_capabilities; + /* Pass SIOCSIFCAP to VF. */ + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFCAP, (caddr_t)ifr); + + /* + * NOTE: + * The error will be propagated to the callers, however, it + * is _not_ useful here. + */ + + /* + * Merge VF's enabled capabilities. + */ + ifp->if_capenable = vf_ifp->if_capenable & ifp->if_capabilities; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP6_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP6_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + return (error); +} + +static int +hn_xpnt_vf_iocsetflags(struct hn_softc *sc) +{ + struct ifnet *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + vf_ifp = sc->hn_vf_ifp; + + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_flags = vf_ifp->if_flags & 0xffff; + ifr.ifr_flagshigh = vf_ifp->if_flags >> 16; + return (vf_ifp->if_ioctl(vf_ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); +} + static void +hn_xpnt_vf_saveifflags(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + int allmulti = 0; + + HN_LOCK_ASSERT(sc); + + /* XXX vlan(4) style mcast addr maintenance */ + if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) + allmulti = IFF_ALLMULTI; + + /* Always set the VF's if_flags */ + sc->hn_vf_ifp->if_flags = ifp->if_flags | allmulti; +} + +static void +hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) +{ + struct rm_priotracker pt; + struct ifnet *hn_ifp = NULL; + struct mbuf *mn; + + /* + * XXX racy, if hn(4) ever detached. + */ + rm_rlock(&hn_vfmap_lock, &pt); + if (vf_ifp->if_index < hn_vfmap_size) + hn_ifp = hn_vfmap[vf_ifp->if_index]; + 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. */ + ETHER_BPF_MTAP(vf_ifp, mn); + mn->m_pkthdr.rcvif = hn_ifp; + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + } + hn_ifp->if_input(hn_ifp, m); + } else { + /* + * In the middle of the transition; free this + * mbuf chain. + */ + while (m != NULL) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + m = mn; + } + } +} + +static void +hn_mtu_change_fixup(struct hn_softc *sc) +{ + struct ifnet *ifp; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif +} + +static void +hn_xpnt_vf_setready(struct hn_softc *sc) +{ + struct ifnet *ifp, *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Mark the VF ready. + */ + sc->hn_vf_rdytick = 0; + + /* + * Save information for restoration. + */ + sc->hn_saved_caps = ifp->if_capabilities; + sc->hn_saved_tsomax = ifp->if_hw_tsomax; + sc->hn_saved_tsosegcnt = ifp->if_hw_tsomaxsegcount; + sc->hn_saved_tsosegsz = ifp->if_hw_tsomaxsegsize; + + /* + * Intersect supported/enabled capabilities. + * + * NOTE: + * if_hwassist is not changed here. + */ + ifp->if_capabilities &= vf_ifp->if_capabilities; + ifp->if_capenable &= ifp->if_capabilities; + + /* + * Fix TSO settings. + */ + if (ifp->if_hw_tsomax > vf_ifp->if_hw_tsomax) + ifp->if_hw_tsomax = vf_ifp->if_hw_tsomax; + if (ifp->if_hw_tsomaxsegcount > vf_ifp->if_hw_tsomaxsegcount) + ifp->if_hw_tsomaxsegcount = vf_ifp->if_hw_tsomaxsegcount; + if (ifp->if_hw_tsomaxsegsize > vf_ifp->if_hw_tsomaxsegsize) + ifp->if_hw_tsomaxsegsize = vf_ifp->if_hw_tsomaxsegsize; + + /* + * Change VF's enabled capabilities. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_reqcap = ifp->if_capenable; + hn_xpnt_vf_iocsetcaps(sc, &ifr); + + if (ifp->if_mtu != ETHERMTU) { + int error; + + /* + * Change VF's MTU. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = ifp->if_mtu; + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, (caddr_t)&ifr); + if (error) { + if_printf(ifp, "%s SIOCSIFMTU %u failed\n", + vf_ifp->if_xname, ifp->if_mtu); + if (ifp->if_mtu > ETHERMTU) { + if_printf(ifp, "change MTU to %d\n", ETHERMTU); + + /* + * XXX + * No need to adjust the synthetic parts' MTU; + * failure of the adjustment will cause us + * infinite headache. + */ + ifp->if_mtu = ETHERMTU; + hn_mtu_change_fixup(sc); + } + } + } +} + +static bool +hn_xpnt_vf_isready(struct hn_softc *sc) +{ + + HN_LOCK_ASSERT(sc); + + if (!hn_xpnt_vf || sc->hn_vf_ifp == NULL) + return (false); + + if (sc->hn_vf_rdytick == 0) + return (true); + + if (sc->hn_vf_rdytick > ticks) + return (false); + + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + return (true); +} + +static void +hn_xpnt_vf_init(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); + + if (bootverbose) { + if_printf(sc->hn_ifp, "try bringing up %s\n", + sc->hn_vf_ifp->if_xname); + } + + /* + * Bring the VF up. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags |= IFF_UP; + error = hn_xpnt_vf_iocsetflags(sc); + if (error) { + if_printf(sc->hn_ifp, "bringing up %s failed: %d\n", + sc->hn_vf_ifp->if_xname, error); + return; + } + + /* + * NOTE: + * Datapath setting must happen _after_ bringing the VF up. + */ + 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); +} + +static void +hn_xpnt_vf_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + goto done; + if (sc->hn_vf_ifp == NULL) + goto done; + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + goto done; + + if (sc->hn_vf_rdytick != 0) { + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + } + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* + * Delayed VF initialization. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "delayed initialize %s\n", + sc->hn_vf_ifp->if_xname); + } + hn_xpnt_vf_init(sc); + } +done: + HN_UNLOCK(sc); +} + +static void hn_ifnet_attevent(void *xsc, struct ifnet *ifp) { struct hn_softc *sc = xsc; @@ -1145,6 +1496,16 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) goto done; } + if (hn_xpnt_vf && ifp->if_start != NULL) { + /* + * ifnet.if_start is _not_ supported by transparent + * mode VF; mainly due to the IFF_DRV_OACTIVE flag. + */ + if_printf(sc->hn_ifp, "%s uses if_start, which is unsupported " + "in transparent VF mode.\n", ifp->if_xname); + goto done; + } + rm_wlock(&hn_vfmap_lock); if (ifp->if_index >= hn_vfmap_size) { @@ -1168,7 +1529,37 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) rm_wunlock(&hn_vfmap_lock); + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); sc->hn_vf_ifp = ifp; + rm_wunlock(&sc->hn_vf_lock); + + if (hn_xpnt_vf) { + int wait_ticks; + + /* + * Install if_input for vf_ifp, which does vf_ifp -> hn_ifp. + * Save vf_ifp's current if_input for later restoration. + */ + sc->hn_vf_input = ifp->if_input; + ifp->if_input = hn_xpnt_vf_input; + + /* + * Stop link status management; use the VF's. + */ + hn_suspend_mgmt(sc); + + /* + * Give VF sometime to complete its attach routing. + */ + wait_ticks = hn_xpnt_vf_attwait * hz; + sc->hn_vf_rdytick = ticks + wait_ticks; + + taskqueue_enqueue_timeout(sc->hn_vf_taskq, &sc->hn_vf_init, + wait_ticks); + } done: HN_UNLOCK(sc); } @@ -1186,7 +1577,61 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) if (!hn_ismyvf(sc, ifp)) goto done; + if (hn_xpnt_vf) { + /* + * Make sure that the delayed initialization is not running. + * + * NOTE: + * - This lock _must_ be released, since the hn_vf_init task + * will try holding this lock. + * - It is safe to release this lock here, since the + * hn_ifnet_attevent() is interlocked by the hn_vf_ifp. + * + * XXX racy, if hn(4) ever detached. + */ + HN_UNLOCK(sc); + taskqueue_drain_timeout(sc->hn_vf_taskq, &sc->hn_vf_init); + HN_LOCK(sc); + + KASSERT(sc->hn_vf_input != NULL, ("%s VF input is not saved", + sc->hn_ifp->if_xname)); + ifp->if_input = sc->hn_vf_input; + sc->hn_vf_input = NULL; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + if (sc->hn_vf_rdytick == 0) { + /* + * The VF was ready; restore some settings. + */ + sc->hn_ifp->if_capabilities = sc->hn_saved_caps; + /* + * NOTE: + * There is _no_ need to fixup if_capenable and + * if_hwassist, since the if_capabilities before + * restoration was an intersection of the VF's + * if_capabilites and the synthetic device's + * if_capabilites. + */ + sc->hn_ifp->if_hw_tsomax = sc->hn_saved_tsomax; + sc->hn_ifp->if_hw_tsomaxsegcount = + sc->hn_saved_tsosegcnt; + sc->hn_ifp->if_hw_tsomaxsegsize = sc->hn_saved_tsosegsz; + } + + /* + * Resume link status management, which was suspended + * by hn_ifnet_attevent(). + */ + 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); rm_wlock(&hn_vfmap_lock); @@ -1205,6 +1650,15 @@ done: HN_UNLOCK(sc); } +static void +hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int link_state) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_vf_ifp == ifp) + 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, @@ -1236,6 +1690,9 @@ hn_attach(device_t dev) sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); HN_LOCK_INIT(sc); + rm_init(&sc->hn_vf_lock, "hnvf"); + if (hn_xpnt_vf && hn_xpnt_vf_accbpf) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; /* * Initialize these tunables once. @@ -1275,6 +1732,18 @@ hn_attach(device_t dev) TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, hn_netchg_status_taskfunc, sc); + if (hn_xpnt_vf) { + /* + * Setup taskqueue for VF tasks, e.g. delayed VF bringing up. + */ + sc->hn_vf_taskq = taskqueue_create("hn_vf", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_vf_taskq); + taskqueue_start_threads(&sc->hn_vf_taskq, 1, PI_NET, "%s vf", + device_get_nameunit(dev)); + TIMEOUT_TASK_INIT(sc->hn_vf_taskq, &sc->hn_vf_init, 0, + hn_xpnt_vf_init_taskfunc, sc); + } + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after @@ -1401,6 +1870,14 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_max", + CTLFLAG_RD, &ifp->if_hw_tsomax, 0, "max TSO size"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegcnt", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegcount, 0, + "max # of TSO segments"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegsz", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegsize, 0, + "max size of TSO segment"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); @@ -1445,9 +1922,20 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); - SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, - hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + if (!hn_xpnt_vf) { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + } else { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_enabled", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_enabled_sysctl, "I", + "Transparent VF enabled"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_accbpf", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_accbpf_sysctl, "I", + "Accurate BPF for transparent VF"); + } /* * Setup the ifmedia, which has been initialized earlier. @@ -1480,7 +1968,7 @@ hn_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO | IFCAP_LINKSTATE; #ifdef foo /* We can't diff IPv6 packets from IPv4 packets on RX path. */ ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; @@ -1515,7 +2003,13 @@ hn_attach(device_t dev) ifp->if_hwassist &= ~(HN_CSUM_IP6_MASK | CSUM_IP6_TSO); if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + /* + * Lock hn_set_tso_maxsize() to simplify its + * internal logic. + */ + HN_LOCK(sc); hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + HN_UNLOCK(sc); ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; ifp->if_hw_tsomaxsegsize = PAGE_SIZE; } @@ -1536,10 +2030,15 @@ hn_attach(device_t dev) sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; hn_update_link_status(sc); - sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, - hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, - hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + if (!hn_xpnt_vf) { + sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, + hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, + hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + } else { + sc->hn_ifnet_lnkhand = EVENTHANDLER_REGISTER(ifnet_link_event, + hn_ifnet_lnkevent, sc, EVENTHANDLER_PRI_ANY); + } /* * NOTE: @@ -1566,6 +2065,14 @@ hn_detach(device_t dev) struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_ifp, *vf_ifp; + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { + /* + * In case that the vmbus missed the orphan handler + * installation. + */ + vmbus_xact_ctx_orphan(sc->hn_xact); + } + if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) @@ -1578,20 +2085,14 @@ hn_detach(device_t dev) EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->hn_ifnet_dethand); } + if (sc->hn_ifnet_lnkhand != NULL) + EVENTHANDLER_DEREGISTER(ifnet_link_event, sc->hn_ifnet_lnkhand); vf_ifp = sc->hn_vf_ifp; __compiler_membar(); if (vf_ifp != NULL) hn_ifnet_detevent(sc, vf_ifp); - if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { - /* - * In case that the vmbus missed the orphan handler - * installation. - */ - vmbus_xact_ctx_orphan(sc->hn_xact); - } - if (device_is_attached(dev)) { HN_LOCK(sc); if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { @@ -1621,6 +2122,8 @@ hn_detach(device_t dev) free(sc->hn_tx_taskqs, M_DEVBUF); } taskqueue_free(sc->hn_mgmt_taskq0); + if (sc->hn_vf_taskq != NULL) + taskqueue_free(sc->hn_vf_taskq); if (sc->hn_xact != NULL) { /* @@ -1634,6 +2137,7 @@ hn_detach(device_t dev) if_free(ifp); HN_LOCK_DESTROY(sc); + rm_destroy(&sc->hn_vf_lock); return (0); } @@ -2699,7 +3203,8 @@ static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct hn_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; + struct ifreq *ifr = (struct ifreq *)data, ifr_vf; + struct ifnet *vf_ifp; int mask, error = 0; switch (cmd) { @@ -2728,6 +3233,21 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) { + vf_ifp = sc->hn_vf_ifp; + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, + (caddr_t)&ifr_vf); + if (error) { + HN_UNLOCK(sc); + if_printf(ifp, "%s SIOCSIFMTU %d failed: %d\n", + vf_ifp->if_xname, ifr->ifr_mtu, error); + break; + } + } + /* * Suspend this interface before the synthetic parts * are ripped. @@ -2756,23 +3276,32 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu = ifr->ifr_mtu; /* - * Make sure that various parameters based on MTU are - * still valid, after the MTU change. + * Synthetic parts' reattach may change the chimney + * sending size; update it. */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); -#if __FreeBSD_version >= 1100099 - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ + hn_mtu_change_fixup(sc); + + /* * All done! Resume the interface now. */ hn_resume(sc); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + /* + * Since we have reattached the NVS part, + * change the datapath to VF again; in case + * that it is lost, after the NVS was detached. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + } + HN_UNLOCK(sc); break; @@ -2784,6 +3313,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) + hn_xpnt_vf_saveifflags(sc); + if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* @@ -2794,6 +3326,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_NO_SLEEPING(sc); hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + error = hn_xpnt_vf_iocsetflags(sc); } else { hn_init_locked(sc); } @@ -2808,8 +3343,23 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: HN_LOCK(sc); - mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if (hn_xpnt_vf_isready(sc)) { + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, sc->hn_vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = hn_xpnt_vf_iocsetcaps(sc, &ifr_vf); + HN_UNLOCK(sc); + break; + } + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + mask = (ifr->ifr_reqcap & ifp->if_capabilities) ^ + ifp->if_capenable; + if (mask & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; if (ifp->if_capenable & IFCAP_TXCSUM) @@ -2873,11 +3423,42 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_SLEEPING_OK(sc); } + /* XXX vlan(4) style mcast addr maintenance */ + if (hn_xpnt_vf_isready(sc)) { + int old_if_flags; + + old_if_flags = sc->hn_vf_ifp->if_flags; + hn_xpnt_vf_saveifflags(sc); + + if ((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) && + ((old_if_flags ^ sc->hn_vf_ifp->if_flags) & + IFF_ALLMULTI)) + error = hn_xpnt_vf_iocsetflags(sc); + } + HN_UNLOCK(sc); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: + HN_LOCK(sc); + if (hn_xpnt_vf_isready(sc)) { + /* + * SIOCGIFMEDIA expects ifmediareq, so don't + * create and pass ifr_vf to the VF here; just + * replace the ifr_name. + */ + vf_ifp = sc->hn_vf_ifp; + strlcpy(ifr->ifr_name, vf_ifp->if_xname, + sizeof(ifr->ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, cmd, data); + /* Restore the ifr_name. */ + strlcpy(ifr->ifr_name, ifp->if_xname, + sizeof(ifr->ifr_name)); + HN_UNLOCK(sc); + break; + } + HN_UNLOCK(sc); error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); break; @@ -2899,11 +3480,37 @@ hn_stop(struct hn_softc *sc, bool detaching) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); + /* Clear RUNNING bit ASAP. */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + /* Disable polling. */ hn_polling(sc, 0); - /* Clear RUNNING bit _before_ hn_suspend_data() */ - atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + 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); + + /* + * NOTE: + * Datapath setting must happen _before_ bringing + * the VF down. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + /* + * Bring the VF down. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags &= ~IFF_UP; + hn_xpnt_vf_iocsetflags(sc); + } + + /* Suspend data transfers. */ hn_suspend_data(sc); /* Clear OACTIVE bit. */ @@ -2912,8 +3519,8 @@ hn_stop(struct hn_softc *sc, bool detaching) sc->hn_tx_ring[i].hn_oactive = 0; /* - * If the VF is active, make sure the filter is not 0, even if - * the synthetic NIC is down. + * If the non-transparent mode VF is active, make sure + * that the RX filter still allows packet reception. */ if (!detaching && (sc->hn_flags & HN_FLAG_RXVF)) hn_rxfilter_config(sc); @@ -2944,6 +3551,11 @@ hn_init_locked(struct hn_softc *sc) /* Clear TX 'suspended' bit. */ hn_resume_tx(sc, sc->hn_tx_ring_inuse); + if (hn_xpnt_vf_isready(sc)) { + /* Initialize transparent VF. */ + hn_xpnt_vf_init(sc); + } + /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); @@ -3567,6 +4179,42 @@ hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int error, onoff = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ACCBPF) + onoff = 1; + error = sysctl_handle_int(oidp, &onoff, 0, req); + if (error || req->newptr == NULL) + return (error); + + HN_LOCK(sc); + /* NOTE: hn_vf_lock for hn_transmit() */ + rm_wlock(&sc->hn_vf_lock); + if (onoff) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; + else + sc->hn_xvf_flags &= ~HN_XVFFLAG_ACCBPF; + rm_wunlock(&sc->hn_vf_lock); + HN_UNLOCK(sc); + + return (0); +} + +static int +hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int enabled = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + enabled = 1; + return (sysctl_handle_int(oidp, &enabled, 0, req)); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -4282,8 +4930,11 @@ static void hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) { struct ifnet *ifp = sc->hn_ifp; + u_int hw_tsomax; int tso_minlen; + HN_LOCK_ASSERT(sc); + if ((ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) == 0) return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 14 06:46:17 2017 Return-Path: Delivered-To: svn-src-all@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 43018DD8AC4; Mon, 14 Aug 2017 06:46: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 1326970424; Mon, 14 Aug 2017 06:46: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 v7E6kGdm004134; Mon, 14 Aug 2017 06:46:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E6kF3Z004130; Mon, 14 Aug 2017 06:46:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140646.v7E6kF3Z004130@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:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322490 - in stable/11/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 322490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 06:46:17 -0000 Author: sephe Date: Mon Aug 14 06:46:15 2017 New Revision: 322490 URL: https://svnweb.freebsd.org/changeset/base/322490 Log: MFC 322323 by jkim 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: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/i386/include/md_var.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/amd64/amd64/machdep.c Mon Aug 14 06:46:15 2017 (r322490) @@ -1544,6 +1544,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 */ @@ -1650,7 +1651,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: stable/11/sys/i386/include/md_var.h ============================================================================== --- stable/11/sys/i386/include/md_var.h Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/i386/include/md_var.h Mon Aug 14 06:46:15 2017 (r322490) @@ -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: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/x86/include/x86_var.h Mon Aug 14 06:46:15 2017 (r322490) @@ -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: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/x86/x86/identcpu.c Mon Aug 14 06:46:15 2017 (r322490) @@ -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(); From owner-svn-src-all@freebsd.org Mon Aug 14 06:47:03 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 11:04:07 2017 Return-Path: Delivered-To: svn-src-all@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 B6695DE31C2; Mon, 14 Aug 2017 11:04:07 +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 84A977766F; Mon, 14 Aug 2017 11:04:07 +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 v7EB46DR015190; Mon, 14 Aug 2017 11:04:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EB46pD015189; Mon, 14 Aug 2017 11:04:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141104.v7EB46pD015189@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:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322491 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:04:07 -0000 Author: kib Date: Mon Aug 14 11:04:06 2017 New Revision: 322491 URL: https://svnweb.freebsd.org/changeset/base/322491 Log: MFC r322171: Explain why delayed invalidation is not required in pmap_protect() and pmap_remove_pages(). Modified: stable/11/sys/amd64/amd64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Mon Aug 14 06:46:15 2017 (r322490) +++ stable/11/sys/amd64/amd64/pmap.c Mon Aug 14 11:04:06 2017 (r322491) @@ -4055,6 +4055,26 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t PG_RW = pmap_rw_bit(pmap); anychanged = FALSE; + /* + * Although this function delays and batches the invalidation + * of stale TLB entries, it does not need to call + * pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(), because it does not + * ordinarily destroy mappings. Stale TLB entries from + * protection-only changes need only be invalidated before the + * pmap lock is released, because protection-only changes do + * not destroy PV entries. Even operations that iterate over + * a physical page's PV list of mappings, like + * pmap_remove_write(), acquire the pmap lock for each + * mapping. Consequently, for protection-only changes, the + * pmap lock suffices to synchronize both page table and TLB + * updates. + * + * This function only destroys a mapping if pmap_demote_pde() + * fails. In that case, stale TLB entries are immediately + * invalidated. + */ + PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { @@ -5378,6 +5398,15 @@ pmap_page_is_mapped(vm_page_t m) * no processor is currently accessing the user address space. In * particular, a page table entry's dirty bit won't change state once * this function starts. + * + * Although this function destroys all of the pmap's managed, + * non-wired mappings, it can delay and batch the invalidation of TLB + * entries without calling pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(). Because the pmap is not active on + * any other processor, none of these TLB entries will ever be used + * before their eventual invalidation. Consequently, there is no need + * for either pmap_remove_all() or pmap_remove_write() to wait for + * that eventual TLB invalidation. */ void pmap_remove_pages(pmap_t pmap) From owner-svn-src-all@freebsd.org Mon Aug 14 11:06:10 2017 Return-Path: Delivered-To: svn-src-all@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 80994DE32E5; Mon, 14 Aug 2017 11:06:10 +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 56826777B8; Mon, 14 Aug 2017 11:06:10 +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 v7EB69PI015311; Mon, 14 Aug 2017 11:06:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EB6915015310; Mon, 14 Aug 2017 11:06:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141106.v7EB6915015310@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:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322492 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:06:10 -0000 Author: kib Date: Mon Aug 14 11:06:09 2017 New Revision: 322492 URL: https://svnweb.freebsd.org/changeset/base/322492 Log: MFC r322175: Avoid DI recursion when reclaim_pv_chunk() is called from pmap_advise() or pmap_remove(). Modified: stable/11/sys/amd64/amd64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Mon Aug 14 11:04:06 2017 (r322491) +++ stable/11/sys/amd64/amd64/pmap.c Mon Aug 14 11:06:09 2017 (r322492) @@ -430,8 +430,15 @@ static struct lock_object invl_gen_ts = { .lo_name = "invlts", }; +static bool +pmap_not_in_di(void) +{ + + return (curthread->td_md.md_invl_gen.gen == 0); +} + #define PMAP_ASSERT_NOT_IN_DI() \ - KASSERT(curthread->td_md.md_invl_gen.gen == 0, ("DI already started")) + KASSERT(pmap_not_in_di(), ("DI already started")) /* * Start a new Delayed Invalidation (DI) block of code, executed by @@ -2847,6 +2854,19 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG "Current number of spare pv entries"); #endif +static void +reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked_pmap, bool start_di) +{ + + if (pmap == NULL) + return; + pmap_invalidate_all(pmap); + if (pmap != locked_pmap) + PMAP_UNLOCK(pmap); + if (start_di) + pmap_delayed_invl_finished(); +} + /* * We are in a serious low memory condition. Resort to * drastic measures to free some pages so we can allocate @@ -2874,6 +2894,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l struct spglist free; uint64_t inuse; int bit, field, freed; + bool start_di; PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); @@ -2882,19 +2903,21 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PG_G = PG_A = PG_M = PG_RW = 0; SLIST_INIT(&free); TAILQ_INIT(&new_tail); - pmap_delayed_invl_started(); + + /* + * A delayed invalidation block should already be active if + * pmap_advise() or pmap_remove() called this function by way + * of pmap_demote_pde_locked(). + */ + start_di = pmap_not_in_di(); + mtx_lock(&pv_chunks_mutex); while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && SLIST_EMPTY(&free)) { TAILQ_REMOVE(&pv_chunks, pc, pc_lru); mtx_unlock(&pv_chunks_mutex); if (pmap != pc->pc_pmap) { - if (pmap != NULL) { - pmap_invalidate_all(pmap); - if (pmap != locked_pmap) - PMAP_UNLOCK(pmap); - } - pmap_delayed_invl_finished(); - pmap_delayed_invl_started(); + reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, + start_di); pmap = pc->pc_pmap; /* Avoid deadlock and lock recursion. */ if (pmap > locked_pmap) { @@ -2911,6 +2934,8 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PG_A = pmap_accessed_bit(pmap); PG_M = pmap_modified_bit(pmap); PG_RW = pmap_rw_bit(pmap); + if (start_di) + pmap_delayed_invl_started(); } /* @@ -2985,12 +3010,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l } TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); mtx_unlock(&pv_chunks_mutex); - if (pmap != NULL) { - pmap_invalidate_all(pmap); - if (pmap != locked_pmap) - PMAP_UNLOCK(pmap); - } - pmap_delayed_invl_finished(); + reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di); if (m_pc == NULL && !SLIST_EMPTY(&free)) { m_pc = SLIST_FIRST(&free); SLIST_REMOVE_HEAD(&free, plinks.s.ss); From owner-svn-src-all@freebsd.org Mon Aug 14 11:19:33 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 11:20:13 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 11:20:56 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 11:23:08 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 12:37:00 2017 Return-Path: Delivered-To: svn-src-all@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 04D9EDC4565; Mon, 14 Aug 2017 12:37:00 +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 C74597F15D; Mon, 14 Aug 2017 12:36:59 +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 v7ECawJd052327; Mon, 14 Aug 2017 12:36:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ECawGh052326; Mon, 14 Aug 2017 12:36:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141236.v7ECawGh052326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 12:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322497 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 12:37:00 -0000 Author: hselasky Date: Mon Aug 14 12:36:58 2017 New Revision: 322497 URL: https://svnweb.freebsd.org/changeset/base/322497 Log: MFC r322305: Increment queue drops in the network statistics when transmitted packets are dropped by the mlx4en(4) driver. Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Mon Aug 14 11:23:07 2017 (r322496) +++ stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Mon Aug 14 12:36:58 2017 (r322497) @@ -1073,6 +1073,10 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) taskqueue_enqueue(cq->tq, &cq->cq_task); } +#if __FreeBSD_version >= 1100000 + if (unlikely(err != 0)) + if_inc_counter(dev, IFCOUNTER_IQDROPS, 1); +#endif return (err); } From owner-svn-src-all@freebsd.org Mon Aug 14 12:45:56 2017 Return-Path: Delivered-To: svn-src-all@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 61ECFDC4C3B; Mon, 14 Aug 2017 12:45:56 +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 2C3937F6B8; Mon, 14 Aug 2017 12:45:56 +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 v7ECjtHn056208; Mon, 14 Aug 2017 12:45:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ECjtbD056207; Mon, 14 Aug 2017 12:45:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141245.v7ECjtbD056207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 12:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322498 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 12:45:56 -0000 Author: hselasky Date: Mon Aug 14 12:45:55 2017 New Revision: 322498 URL: https://svnweb.freebsd.org/changeset/base/322498 Log: MFC r314878: Add support for constant pointer constructs to READ_ONCE() in the LinuxKPI. When the type of the argument is constant the temporary variable cannot be assigned after the barrier. Instead assign the temporary variable by initialization. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h Mon Aug 14 12:36:58 2017 (r322497) +++ stable/11/sys/compat/linuxkpi/common/include/linux/compiler.h Mon Aug 14 12:45:55 2017 (r322498) @@ -86,9 +86,10 @@ } while (0) #define READ_ONCE(x) ({ \ - __typeof(x) __var; \ - barrier(); \ - __var = ACCESS_ONCE(x); \ + __typeof(x) __var = ({ \ + barrier(); \ + ACCESS_ONCE(x); \ + }); \ barrier(); \ __var; \ }) From owner-svn-src-all@freebsd.org Mon Aug 14 12:47:17 2017 Return-Path: Delivered-To: svn-src-all@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 E701FDC4E47; Mon, 14 Aug 2017 12:47:17 +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 C2C0F7F97E; Mon, 14 Aug 2017 12:47:17 +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 v7EClHXh056312; Mon, 14 Aug 2017 12:47:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EClHbA056311; Mon, 14 Aug 2017 12:47:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141247.v7EClHbA056311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 12:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322499 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 12:47:18 -0000 Author: hselasky Date: Mon Aug 14 12:47:16 2017 New Revision: 322499 URL: https://svnweb.freebsd.org/changeset/base/322499 Log: MFC r322304: Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_port.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 12:45:55 2017 (r322498) +++ stable/11/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 12:47:16 2017 (r322499) @@ -124,11 +124,45 @@ out: return err; } +static void mlx4_en_fold_software_stats(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + u64 packets, bytes; + int i; + + if (!priv->port_up || mlx4_is_master(mdev->dev)) + return; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->rx_ring_num; i++) { + const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.rx_packets = packets; + priv->pkstats.rx_bytes = bytes; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->tx_ring_num; i++) { + const struct mlx4_en_tx_ring *ring = priv->tx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.tx_packets = packets; + priv->pkstats.tx_bytes = bytes; +} + int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) { struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct net_device *dev = mdev->pndev[port]; + struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox = NULL; struct mlx4_cmd_mailbox *mailbox_flow = NULL; @@ -138,7 +172,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u int do_if_stat = 1; unsigned long period = (unsigned long) (jiffies - priv->last_ifq_jiffies); struct mlx4_en_vport_stats tmp_vport_stats; - struct net_device *dev; if (jiffies_to_msecs(period) < EN_IFQ_MIN_INTERVAL || priv->counter_index == 0xff) @@ -523,8 +556,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u be64_to_cpu(flowstats[i].tx_pause_transition); } - memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + mlx4_en_fold_software_stats(dev); + spin_unlock(&priv->stats_lock); + + memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + err = mlx4_get_vport_ethtool_stats(mdev->dev, port, &tmp_vport_stats, reset); spin_lock(&priv->stats_lock); @@ -547,42 +584,37 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u vport_stats->tx_errors = tmp_vport_stats.tx_errors; } - if (!mlx4_is_mfunc(mdev->dev)) { -/* netdevice stats format */ #if __FreeBSD_version >= 1100000 - if (reset == 0) { - dev = mdev->pndev[port]; - if_inc_counter(dev, IFCOUNTER_IPACKETS, - priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); - if_inc_counter(dev, IFCOUNTER_OPACKETS, - priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); - if_inc_counter(dev, IFCOUNTER_IBYTES, - priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); - if_inc_counter(dev, IFCOUNTER_OBYTES, - priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); - if_inc_counter(dev, IFCOUNTER_IERRORS, - priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); - if_inc_counter(dev, IFCOUNTER_IQDROPS, - priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); - if_inc_counter(dev, IFCOUNTER_IMCASTS, - priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); - if_inc_counter(dev, IFCOUNTER_OMCASTS, - priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); - } - priv->pkstats_last = priv->pkstats; + if (reset == 0) { + if_inc_counter(dev, IFCOUNTER_IPACKETS, + priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); + if_inc_counter(dev, IFCOUNTER_OPACKETS, + priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); + if_inc_counter(dev, IFCOUNTER_IBYTES, + priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); + if_inc_counter(dev, IFCOUNTER_OBYTES, + priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); + if_inc_counter(dev, IFCOUNTER_IERRORS, + priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); + if_inc_counter(dev, IFCOUNTER_IQDROPS, + priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); + if_inc_counter(dev, IFCOUNTER_IMCASTS, + priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); + if_inc_counter(dev, IFCOUNTER_OMCASTS, + priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); + } + priv->pkstats_last = priv->pkstats; #else - dev = mdev->pndev[port]; - dev->if_ipackets = priv->pkstats.rx_packets; - dev->if_opackets = priv->pkstats.tx_packets; - dev->if_ibytes = priv->pkstats.rx_bytes; - dev->if_obytes = priv->pkstats.tx_bytes; - dev->if_ierrors = priv->pkstats.rx_errors; - dev->if_iqdrops = priv->pkstats.rx_dropped; - dev->if_imcasts = priv->pkstats.rx_multicast_packets; - dev->if_omcasts = priv->pkstats.tx_multicast_packets; - dev->if_collisions = 0; + dev->if_ipackets = priv->pkstats.rx_packets; + dev->if_opackets = priv->pkstats.tx_packets; + dev->if_ibytes = priv->pkstats.rx_bytes; + dev->if_obytes = priv->pkstats.tx_bytes; + dev->if_ierrors = priv->pkstats.rx_errors; + dev->if_iqdrops = priv->pkstats.rx_dropped; + dev->if_imcasts = priv->pkstats.rx_multicast_packets; + dev->if_omcasts = priv->pkstats.tx_multicast_packets; + dev->if_collisions = 0; #endif - } spin_unlock(&priv->stats_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 12:59:15 2017 Return-Path: Delivered-To: svn-src-all@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 86629DC57A4; Mon, 14 Aug 2017 12:59:15 +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 525EA8014B; Mon, 14 Aug 2017 12:59:15 +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 v7ECxErc061130; Mon, 14 Aug 2017 12:59:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ECxEu5061129; Mon, 14 Aug 2017 12:59:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141259.v7ECxEu5061129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 12:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322500 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/include/linux X-SVN-Commit-Revision: 322500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 12:59:15 -0000 Author: hselasky Date: Mon Aug 14 12:59:14 2017 New Revision: 322500 URL: https://svnweb.freebsd.org/changeset/base/322500 Log: MFC r314878: Add support for constant pointer constructs to READ_ONCE() in the LinuxKPI. When the type of the argument is constant the temporary variable cannot be assigned after the barrier. Instead assign the temporary variable by initialization. Approved by: re (kib) Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/compiler.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/compiler.h ============================================================================== --- stable/10/sys/ofed/include/linux/compiler.h Mon Aug 14 12:47:16 2017 (r322499) +++ stable/10/sys/ofed/include/linux/compiler.h Mon Aug 14 12:59:14 2017 (r322500) @@ -80,9 +80,10 @@ } while (0) #define READ_ONCE(x) ({ \ - __typeof(x) __var; \ - barrier(); \ - __var = ACCESS_ONCE(x); \ + __typeof(x) __var = ({ \ + barrier(); \ + ACCESS_ONCE(x); \ + }); \ barrier(); \ __var; \ }) From owner-svn-src-all@freebsd.org Mon Aug 14 13:15:14 2017 Return-Path: Delivered-To: svn-src-all@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 951F4DC651A; Mon, 14 Aug 2017 13:15:14 +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 60C4480AF8; Mon, 14 Aug 2017 13:15:14 +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 v7EDFD6g069270; Mon, 14 Aug 2017 13:15:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDFDQa069269; Mon, 14 Aug 2017 13:15:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141315.v7EDFDQa069269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322501 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/include/linux X-SVN-Commit-Revision: 322501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:15:14 -0000 Author: hselasky Date: Mon Aug 14 13:15:13 2017 New Revision: 322501 URL: https://svnweb.freebsd.org/changeset/base/322501 Log: MFC r292537 and r314878: Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE(). Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/compiler.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/compiler.h ============================================================================== --- stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 12:59:14 2017 (r322500) +++ stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 13:15:13 2017 (r322501) @@ -63,4 +63,21 @@ #define uninitialized_var(x) x = x +#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) + +#define WRITE_ONCE(x,v) do { \ + barrier(); \ + ACCESS_ONCE(x) = (v); \ + barrier(); \ +} while (0) + +#define READ_ONCE(x) ({ \ + __typeof(x) __var = ({ \ + barrier(); \ + ACCESS_ONCE(x); \ + }); \ + barrier(); \ + __var; \ +}) + #endif /* _LINUX_COMPILER_H_ */ From owner-svn-src-all@freebsd.org Mon Aug 14 13:25:37 2017 Return-Path: Delivered-To: svn-src-all@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 13BC8DC7002; Mon, 14 Aug 2017 13:25: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 D1D3A81434; Mon, 14 Aug 2017 13:25:36 +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 v7EDPZ4S073462; Mon, 14 Aug 2017 13:25:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDPZlw073460; Mon, 14 Aug 2017 13:25:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141325.v7EDPZlw073460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322502 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/include/linux X-SVN-Commit-Revision: 322502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:25:37 -0000 Author: hselasky Date: Mon Aug 14 13:25:35 2017 New Revision: 322502 URL: https://svnweb.freebsd.org/changeset/base/322502 Log: MFC r289577: Merge LinuxKPI changes from DragonflyBSD: - Map more Linux compiler related defines to FreeBSD ones. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/compiler.h stable/9/sys/ofed/include/linux/types.h Modified: stable/9/sys/ofed/include/linux/compiler.h ============================================================================== --- stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 13:15:13 2017 (r322501) +++ stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 13:25:35 2017 (r322502) @@ -2,7 +2,8 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2015 François Tigeot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,6 +63,13 @@ #define typeof(x) __typeof(x) #define uninitialized_var(x) x = x +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) +#define __always_unused __unused +#define __must_check __result_use_check + +#define __printf(a,b) __printflike(a,b) + +#define barrier() __asm__ __volatile__("": : :"memory") #define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) Modified: stable/9/sys/ofed/include/linux/types.h ============================================================================== --- stable/9/sys/ofed/include/linux/types.h Mon Aug 14 13:15:13 2017 (r322501) +++ stable/9/sys/ofed/include/linux/types.h Mon Aug 14 13:25:35 2017 (r322502) @@ -36,8 +36,6 @@ #include #include -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) - #ifndef __bitwise__ #ifdef __CHECKER__ #define __bitwise__ __attribute__((bitwise)) From owner-svn-src-all@freebsd.org Mon Aug 14 13:27:09 2017 Return-Path: Delivered-To: svn-src-all@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 75554DC7253; Mon, 14 Aug 2017 13:27:09 +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 4EDC1815D1; Mon, 14 Aug 2017 13:27:09 +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 v7EDR8Wi073570; Mon, 14 Aug 2017 13:27:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDR8rL073569; Mon, 14 Aug 2017 13:27:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141327.v7EDR8rL073569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322503 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:27:09 -0000 Author: hselasky Date: Mon Aug 14 13:27:08 2017 New Revision: 322503 URL: https://svnweb.freebsd.org/changeset/base/322503 Log: MFC r322304: Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 13:25:35 2017 (r322502) +++ stable/9/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 13:27:08 2017 (r322503) @@ -124,11 +124,45 @@ out: return err; } +static void mlx4_en_fold_software_stats(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + u64 packets, bytes; + int i; + + if (!priv->port_up || mlx4_is_master(mdev->dev)) + return; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->rx_ring_num; i++) { + const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.rx_packets = packets; + priv->pkstats.rx_bytes = bytes; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->tx_ring_num; i++) { + const struct mlx4_en_tx_ring *ring = priv->tx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.tx_packets = packets; + priv->pkstats.tx_bytes = bytes; +} + int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) { struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct net_device *dev = mdev->pndev[port]; + struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox = NULL; struct mlx4_cmd_mailbox *mailbox_flow = NULL; @@ -138,7 +172,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u int do_if_stat = 1; unsigned long period = (unsigned long) (jiffies - priv->last_ifq_jiffies); struct mlx4_en_vport_stats tmp_vport_stats; - struct net_device *dev; if (jiffies_to_msecs(period) < EN_IFQ_MIN_INTERVAL || priv->counter_index == 0xff) @@ -523,8 +556,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u be64_to_cpu(flowstats[i].tx_pause_transition); } - memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + mlx4_en_fold_software_stats(dev); + spin_unlock(&priv->stats_lock); + + memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + err = mlx4_get_vport_ethtool_stats(mdev->dev, port, &tmp_vport_stats, reset); spin_lock(&priv->stats_lock); @@ -547,19 +584,37 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u vport_stats->tx_errors = tmp_vport_stats.tx_errors; } - if (!mlx4_is_mfunc(mdev->dev)) { - /* netdevice stats format */ - dev = mdev->pndev[port]; - dev->if_ipackets = priv->pkstats.rx_packets; - dev->if_opackets = priv->pkstats.tx_packets; - dev->if_ibytes = priv->pkstats.rx_bytes; - dev->if_obytes = priv->pkstats.tx_bytes; - dev->if_ierrors = priv->pkstats.rx_errors; - dev->if_iqdrops = priv->pkstats.rx_dropped; - dev->if_imcasts = priv->pkstats.rx_multicast_packets; - dev->if_omcasts = priv->pkstats.tx_multicast_packets; - dev->if_collisions = 0; +#if __FreeBSD_version >= 1100000 + if (reset == 0) { + if_inc_counter(dev, IFCOUNTER_IPACKETS, + priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); + if_inc_counter(dev, IFCOUNTER_OPACKETS, + priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); + if_inc_counter(dev, IFCOUNTER_IBYTES, + priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); + if_inc_counter(dev, IFCOUNTER_OBYTES, + priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); + if_inc_counter(dev, IFCOUNTER_IERRORS, + priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); + if_inc_counter(dev, IFCOUNTER_IQDROPS, + priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); + if_inc_counter(dev, IFCOUNTER_IMCASTS, + priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); + if_inc_counter(dev, IFCOUNTER_OMCASTS, + priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); } + priv->pkstats_last = priv->pkstats; +#else + dev->if_ipackets = priv->pkstats.rx_packets; + dev->if_opackets = priv->pkstats.tx_packets; + dev->if_ibytes = priv->pkstats.rx_bytes; + dev->if_obytes = priv->pkstats.tx_bytes; + dev->if_ierrors = priv->pkstats.rx_errors; + dev->if_iqdrops = priv->pkstats.rx_dropped; + dev->if_imcasts = priv->pkstats.rx_multicast_packets; + dev->if_omcasts = priv->pkstats.tx_multicast_packets; + dev->if_collisions = 0; +#endif spin_unlock(&priv->stats_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 13:28:42 2017 Return-Path: Delivered-To: svn-src-all@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 2C02CDC7396; Mon, 14 Aug 2017 13:28:42 +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 0273481726; Mon, 14 Aug 2017 13:28:41 +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 v7EDSfNk073662; Mon, 14 Aug 2017 13:28:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDSfgV073661; Mon, 14 Aug 2017 13:28:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141328.v7EDSfgV073661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322504 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:28:42 -0000 Author: hselasky Date: Mon Aug 14 13:28:40 2017 New Revision: 322504 URL: https://svnweb.freebsd.org/changeset/base/322504 Log: MFC r322304: Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Approved by: re (kib) Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 13:27:08 2017 (r322503) +++ stable/10/sys/ofed/drivers/net/mlx4/en_port.c Mon Aug 14 13:28:40 2017 (r322504) @@ -124,11 +124,45 @@ out: return err; } +static void mlx4_en_fold_software_stats(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + u64 packets, bytes; + int i; + + if (!priv->port_up || mlx4_is_master(mdev->dev)) + return; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->rx_ring_num; i++) { + const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.rx_packets = packets; + priv->pkstats.rx_bytes = bytes; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->tx_ring_num; i++) { + const struct mlx4_en_tx_ring *ring = priv->tx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.tx_packets = packets; + priv->pkstats.tx_bytes = bytes; +} + int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) { struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct net_device *dev = mdev->pndev[port]; + struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox = NULL; struct mlx4_cmd_mailbox *mailbox_flow = NULL; @@ -138,7 +172,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u int do_if_stat = 1; unsigned long period = (unsigned long) (jiffies - priv->last_ifq_jiffies); struct mlx4_en_vport_stats tmp_vport_stats; - struct net_device *dev; if (jiffies_to_msecs(period) < EN_IFQ_MIN_INTERVAL || priv->counter_index == 0xff) @@ -523,8 +556,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u be64_to_cpu(flowstats[i].tx_pause_transition); } - memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + mlx4_en_fold_software_stats(dev); + spin_unlock(&priv->stats_lock); + + memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + err = mlx4_get_vport_ethtool_stats(mdev->dev, port, &tmp_vport_stats, reset); spin_lock(&priv->stats_lock); @@ -547,19 +584,37 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u vport_stats->tx_errors = tmp_vport_stats.tx_errors; } - if (!mlx4_is_mfunc(mdev->dev)) { - /* netdevice stats format */ - dev = mdev->pndev[port]; - dev->if_ipackets = priv->pkstats.rx_packets; - dev->if_opackets = priv->pkstats.tx_packets; - dev->if_ibytes = priv->pkstats.rx_bytes; - dev->if_obytes = priv->pkstats.tx_bytes; - dev->if_ierrors = priv->pkstats.rx_errors; - dev->if_iqdrops = priv->pkstats.rx_dropped; - dev->if_imcasts = priv->pkstats.rx_multicast_packets; - dev->if_omcasts = priv->pkstats.tx_multicast_packets; - dev->if_collisions = 0; +#if __FreeBSD_version >= 1100000 + if (reset == 0) { + if_inc_counter(dev, IFCOUNTER_IPACKETS, + priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); + if_inc_counter(dev, IFCOUNTER_OPACKETS, + priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); + if_inc_counter(dev, IFCOUNTER_IBYTES, + priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); + if_inc_counter(dev, IFCOUNTER_OBYTES, + priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); + if_inc_counter(dev, IFCOUNTER_IERRORS, + priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); + if_inc_counter(dev, IFCOUNTER_IQDROPS, + priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); + if_inc_counter(dev, IFCOUNTER_IMCASTS, + priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); + if_inc_counter(dev, IFCOUNTER_OMCASTS, + priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); } + priv->pkstats_last = priv->pkstats; +#else + dev->if_ipackets = priv->pkstats.rx_packets; + dev->if_opackets = priv->pkstats.tx_packets; + dev->if_ibytes = priv->pkstats.rx_bytes; + dev->if_obytes = priv->pkstats.tx_bytes; + dev->if_ierrors = priv->pkstats.rx_errors; + dev->if_iqdrops = priv->pkstats.rx_dropped; + dev->if_imcasts = priv->pkstats.rx_multicast_packets; + dev->if_omcasts = priv->pkstats.tx_multicast_packets; + dev->if_collisions = 0; +#endif spin_unlock(&priv->stats_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 13:32:25 2017 Return-Path: Delivered-To: svn-src-all@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 81320DC82DB; Mon, 14 Aug 2017 13:32:25 +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 11AFB81FE4; Mon, 14 Aug 2017 13:32:22 +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 v7EDWL73077965; Mon, 14 Aug 2017 13:32:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDWLWE077964; Mon, 14 Aug 2017 13:32:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141332.v7EDWLWE077964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322505 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:32:25 -0000 Author: hselasky Date: Mon Aug 14 13:32:21 2017 New Revision: 322505 URL: https://svnweb.freebsd.org/changeset/base/322505 Log: MFC r322306: Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:28:40 2017 (r322504) +++ stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:32:21 2017 (r322505) @@ -1771,7 +1771,8 @@ static int mlx4_en_change_mtu(struct net_device *dev, (unsigned)dev->if_mtu, (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { - en_err(priv, "Bad MTU size:%d.\n", new_mtu); + en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, + priv->max_mtu); return -EPERM; } mutex_lock(&mdev->state_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 13:37:47 2017 Return-Path: Delivered-To: svn-src-all@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 4C2EFDC8ED9; Mon, 14 Aug 2017 13:37:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15B6982575; Mon, 14 Aug 2017 13:37:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EDbkXc078222; Mon, 14 Aug 2017 13:37:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDbkvq078221; Mon, 14 Aug 2017 13:37:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141337.v7EDbkvq078221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322506 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:37:47 -0000 Author: hselasky Date: Mon Aug 14 13:37:46 2017 New Revision: 322506 URL: https://svnweb.freebsd.org/changeset/base/322506 Log: MFC r322306: Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:32:21 2017 (r322505) +++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:37:46 2017 (r322506) @@ -1772,7 +1772,8 @@ static int mlx4_en_change_mtu(struct net_device *dev, (unsigned)dev->if_mtu, (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { - en_err(priv, "Bad MTU size:%d.\n", new_mtu); + en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, + priv->max_mtu); return -EPERM; } mutex_lock(&mdev->state_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 13:42:37 2017 Return-Path: Delivered-To: svn-src-all@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 7C4B7DC941B; Mon, 14 Aug 2017 13:42: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 4876D829CD; Mon, 14 Aug 2017 13:42: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 v7EDga3c081964; Mon, 14 Aug 2017 13:42:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EDgacT081963; Mon, 14 Aug 2017 13:42:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708141342.v7EDgacT081963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 14 Aug 2017 13:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322507 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 13:42:37 -0000 Author: hselasky Date: Mon Aug 14 13:42:36 2017 New Revision: 322507 URL: https://svnweb.freebsd.org/changeset/base/322507 Log: MFC r322306: Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Approved by: re (marius, gjb) Submitted by: Sepherosa Ziehau Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:37:46 2017 (r322506) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 14 13:42:36 2017 (r322507) @@ -1772,7 +1772,8 @@ static int mlx4_en_change_mtu(struct net_device *dev, (unsigned)dev->if_mtu, (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { - en_err(priv, "Bad MTU size:%d.\n", new_mtu); + en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, + priv->max_mtu); return -EPERM; } mutex_lock(&mdev->state_lock); From owner-svn-src-all@freebsd.org Mon Aug 14 14:16:57 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 15:08:51 2017 Return-Path: Delivered-To: svn-src-all@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 5F2ADDCF87B; Mon, 14 Aug 2017 15:08:51 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3AB3D1607; Mon, 14 Aug 2017 15:08:51 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EF8oNu014469; Mon, 14 Aug 2017 15:08:50 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EF8oRu014465; Mon, 14 Aug 2017 15:08:50 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201708141508.v7EF8oRu014465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Mon, 14 Aug 2017 15:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322509 - in stable/11: contrib/top usr.bin/top X-SVN-Group: stable-11 X-SVN-Commit-Author: gahr X-SVN-Commit-Paths: in stable/11: contrib/top usr.bin/top X-SVN-Commit-Revision: 322509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 15:08:51 -0000 Author: gahr (ports committer) Date: Mon Aug 14 15:08:49 2017 New Revision: 322509 URL: https://svnweb.freebsd.org/changeset/base/322509 Log: MFC r322139 Enhance top(1) to filter on multiple usernames Reviewed by: cognet, bapt Approved by: cognet Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11840 Modified: stable/11/contrib/top/machine.h stable/11/contrib/top/top.c stable/11/contrib/top/top.xs stable/11/usr.bin/top/machine.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/top/machine.h ============================================================================== --- stable/11/contrib/top/machine.h Mon Aug 14 14:16:56 2017 (r322508) +++ stable/11/contrib/top/machine.h Mon Aug 14 15:08:49 2017 (r322509) @@ -70,7 +70,8 @@ struct process_select int self; /* show self */ int system; /* show system processes */ int thread; /* show threads */ - int uid; /* only this uid (unless uid == -1) */ +#define TOP_MAX_UIDS 8 + int uid[TOP_MAX_UIDS]; /* only these uids (unless uid[0] == -1) */ int wcpu; /* show weighted cpu */ int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ Modified: stable/11/contrib/top/top.c ============================================================================== --- stable/11/contrib/top/top.c Mon Aug 14 14:16:56 2017 (r322508) +++ stable/11/contrib/top/top.c Mon Aug 14 15:08:49 2017 (r322509) @@ -133,7 +133,110 @@ void (*d_process)() = i_process; void reset_display(void); +static void +reset_uids() +{ + for (size_t i = 0; i < TOP_MAX_UIDS; ++i) + ps.uid[i] = -1; +} +static int +add_uid(int uid) +{ + size_t i = 0; + + /* Add the uid if there's room */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1 || ps.uid[i] == uid) + { + ps.uid[i] = uid; + break; + } + } + + return (i == TOP_MAX_UIDS); +} + +static void +rem_uid(int uid) +{ + size_t i = 0; + size_t where = TOP_MAX_UIDS; + + /* Look for the user to remove - no problem if it's not there */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1) + break; + if (ps.uid[i] == uid) + where = i; + } + + /* Make sure we don't leave a hole in the middle */ + if (where != TOP_MAX_UIDS) + { + ps.uid[where] = ps.uid[i-1]; + ps.uid[i-1] = -1; + } +} + +static int +handle_user(char *buf, size_t buflen) +{ + int rc = 0; + int uid = -1; + char *buf2 = buf; + + new_message(MT_standout, "Username to show (+ for all): "); + if (readline(buf, buflen, No) <= 0) + { + clear_message(); + return rc; + } + + if (buf[0] == '+' || buf[0] == '-') + { + if (buf[1] == '\0') + { + reset_uids(); + goto end; + } + else + ++buf2; + } + + if ((uid = userid(buf2)) == -1) + { + new_message(MT_standout, " %s: unknown user", buf2); + rc = 1; + goto end; + } + + if (buf2 == buf) + { + reset_uids(); + ps.uid[0] = uid; + goto end; + } + + if (buf[0] == '+') + { + if (add_uid(uid)) + { + new_message(MT_standout, " too many users, reset with '+'"); + rc = 1; + goto end; + } + } + else + rem_uid(uid); + +end: + putchar('\r'); + return rc; +} + int main(argc, argv) @@ -251,7 +354,7 @@ char *argv[]; ps.idle = Yes; ps.self = -1; ps.system = No; - ps.uid = -1; + reset_uids(); ps.thread = No; ps.wcpu = 1; ps.jid = -1; @@ -298,7 +401,7 @@ char *argv[]; break; case 'U': /* display only username's processes */ - if ((ps.uid = userid(optarg)) == -1) + if ((ps.uid[0] = userid(optarg)) == -1) { fprintf(stderr, "%s: unknown user\n", optarg); exit(1); @@ -1003,31 +1106,8 @@ restart: break; case CMD_user: - new_message(MT_standout, - "Username to show (+ for all): "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) - { - if (tempbuf2[0] == '+' && - tempbuf2[1] == '\0') - { - ps.uid = -1; - } - else if ((i = userid(tempbuf2)) == -1) - { - new_message(MT_standout, - " %s: unknown user", tempbuf2); - no_command = Yes; - } - else - { - ps.uid = i; - } - putchar('\r'); - } - else - { - clear_message(); - } + if (handle_user(tempbuf2, sizeof(tempbuf2))) + no_command = Yes; break; case CMD_thrtog: Modified: stable/11/contrib/top/top.xs ============================================================================== --- stable/11/contrib/top/top.xs Mon Aug 14 14:16:56 2017 (r322508) +++ stable/11/contrib/top/top.xs Mon Aug 14 15:08:49 2017 (r322509) @@ -307,9 +307,11 @@ This acts similarly to the command .IR renice (8)). .TP .B u -Display only processes owned by a specific username (prompt for username). -If the username specified is simply \*(lq+\*(rq, then processes belonging -to all users will be displayed. +Display only processes owned by a specific set of usernames (prompt for +username). If the username specified is simply \*(lq+\*(rq or \*(lq-\*(rq, +then processes belonging to all users will be displayed. Usernames can be added +to and removed from the set by prepending them with \*(lq+\*(rq and +\*(lq-\*(rq, respectively. .TP .B o Change the order in which the display is sorted. This command is not Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Mon Aug 14 14:16:56 2017 (r322508) +++ stable/11/usr.bin/top/machine.c Mon Aug 14 15:08:49 2017 (r322509) @@ -273,7 +273,19 @@ static const char *format_nice(const struct kinfo_proc static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); static void update_layout(void); +static int find_uid(uid_t needle, int *haystack); +static int +find_uid(uid_t needle, int *haystack) +{ + size_t i = 0; + + for (; i < TOP_MAX_UIDS; ++i) + if ((uid_t)haystack[i] == needle) + return 1; + return 0; +} + void toggle_pcpustats(void) { @@ -847,7 +859,7 @@ get_process_info(struct system_info *si, struct proces show_jid = sel->jid != -1; show_self = sel->self == -1; show_system = sel->system; - show_uid = sel->uid != -1; + show_uid = sel->uid[0] != -1; show_command = sel->command != NULL; show_kidle = sel->kidle; @@ -906,7 +918,7 @@ get_process_info(struct system_info *si, struct proces /* skip proc. that don't belong to the selected JID */ continue; - if (show_uid && pp->ki_ruid != (uid_t)sel->uid) + if (show_uid && !find_uid(pp->ki_ruid, sel->uid)) /* skip proc. that don't belong to the selected UID */ continue; From owner-svn-src-all@freebsd.org Mon Aug 14 18:49:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 19:03:07 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 19:03:57 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 19:12:53 2017 Return-Path: Delivered-To: svn-src-all@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 3F216DDE9B6; Mon, 14 Aug 2017 19:12:53 +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 02FBF6B1BD; Mon, 14 Aug 2017 19:12:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EJCqVr017836; Mon, 14 Aug 2017 19:12:52 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EJCqsc017835; Mon, 14 Aug 2017 19:12:52 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708141912.v7EJCqsc017835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 14 Aug 2017 19:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322513 - stable/10/sys/geom/journal X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sys/geom/journal X-SVN-Commit-Revision: 322513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 19:12:53 -0000 Author: mckusick Date: Mon Aug 14 19:12:51 2017 New Revision: 322513 URL: https://svnweb.freebsd.org/changeset/base/322513 Log: MFC of 322178: Bug 198500 reports bad sysctl values for gjournal cache limit. PR: 198500 Submitted by: Dr. Andreas Longwitz Reported by: Eugene Grosbein Discussed with: kib Approved by: re (marius) Modified: stable/10/sys/geom/journal/g_journal.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/journal/g_journal.c ============================================================================== --- stable/10/sys/geom/journal/g_journal.c Mon Aug 14 19:03:55 2017 (r322512) +++ stable/10/sys/geom/journal/g_journal.c Mon Aug 14 19:12:51 2017 (r322513) @@ -131,28 +131,28 @@ SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entri SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW, &g_journal_do_optimize, 0, "Try to combine bios on flush and copy"); -static u_int g_journal_cache_used = 0; -static u_int g_journal_cache_limit = 64 * 1024 * 1024; +static u_long g_journal_cache_used = 0; +static u_long g_journal_cache_limit = 64 * 1024 * 1024; TUNABLE_INT("kern.geom.journal.cache.limit", &g_journal_cache_limit); static u_int g_journal_cache_divisor = 2; TUNABLE_INT("kern.geom.journal.cache.divisor", &g_journal_cache_divisor); static u_int g_journal_cache_switch = 90; static u_int g_journal_cache_misses = 0; static u_int g_journal_cache_alloc_failures = 0; -static u_int g_journal_cache_low = 0; +static u_long g_journal_cache_low = 0; static SYSCTL_NODE(_kern_geom_journal, OID_AUTO, cache, CTLFLAG_RW, 0, "GEOM_JOURNAL cache"); -SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, +SYSCTL_ULONG(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD, &g_journal_cache_used, 0, "Number of allocated bytes"); static int g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) { - u_int limit; + u_long limit; int error; limit = g_journal_cache_limit; - error = sysctl_handle_int(oidp, &limit, 0, req); + error = sysctl_handle_long(oidp, &limit, 0, req); if (error != 0 || req->newptr == NULL) return (error); g_journal_cache_limit = limit; @@ -160,7 +160,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) return (0); } SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit, - CTLTYPE_UINT | CTLFLAG_RW, NULL, 0, g_journal_cache_limit_sysctl, "I", + CTLTYPE_ULONG | CTLFLAG_RW, NULL, 0, g_journal_cache_limit_sysctl, "I", "Maximum number of allocated bytes"); SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN, &g_journal_cache_divisor, 0, @@ -3059,9 +3059,9 @@ g_journal_switcher(void *arg) kproc_exit(0); } if (error == 0 && g_journal_sync_requested == 0) { - GJ_DEBUG(1, "Out of cache, force switch (used=%u " - "limit=%u).", g_journal_cache_used, - g_journal_cache_limit); + GJ_DEBUG(1, "Out of cache, force switch (used=%jd " + "limit=%jd).", (intmax_t)g_journal_cache_used, + (intmax_t)g_journal_cache_limit); } GJ_TIMER_START(1, &bt); g_journal_do_switch(mp); From owner-svn-src-all@freebsd.org Mon Aug 14 19:18:51 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 19:21:48 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 21:48:51 2017 Return-Path: Delivered-To: svn-src-all@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 C3392DC2452; Mon, 14 Aug 2017 21:48:51 +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 8CD0B70244; Mon, 14 Aug 2017 21:48:51 +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 v7ELmoDS078924; Mon, 14 Aug 2017 21:48:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ELmoMo078922; Mon, 14 Aug 2017 21:48:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708142148.v7ELmoMo078922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 14 Aug 2017 21:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322520 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 21:48:51 -0000 Author: kevans Date: Mon Aug 14 21:48:50 2017 New Revision: 322520 URL: https://svnweb.freebsd.org/changeset/base/322520 Log: MFC r313948: bsdgrep: fix EOF handling with --mmap Rework part of the loop in grep_fgetln to return the rest of the line and ensure that we still advance the buffer by the length of the rest of the line. PR: 165471 Approved by: emaste (mentor) Modified: stable/11/usr.bin/grep/file.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/file.c ============================================================================== --- stable/11/usr.bin/grep/file.c Mon Aug 14 20:53:01 2017 (r322519) +++ stable/11/usr.bin/grep/file.c Mon Aug 14 21:48:50 2017 (r322520) @@ -219,12 +219,18 @@ grep_fgetln(struct file *f, size_t *lenp) if (bufrem == 0) /* EOF: return partial line */ break; - if ((p = memchr(bufpos, '\n', bufrem)) == NULL) + if ((p = memchr(bufpos, '\n', bufrem)) == NULL && + filebehave != FILE_MMAP) continue; - /* got it: finish up the line (like code above) */ - ++p; - diff = p - bufpos; - len += diff; + if (p == NULL) { + /* mmap EOF: return partial line, consume buffer */ + diff = len; + } else { + /* got it: finish up the line (like code above) */ + ++p; + diff = p - bufpos; + len += diff; + } if (grep_lnbufgrow(len)) goto error; memcpy(lnbuf + off, bufpos, diff); From owner-svn-src-all@freebsd.org Mon Aug 14 22:25:22 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 22:38:55 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Aug 14 23:46:12 2017 Return-Path: Delivered-To: svn-src-all@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 9856FDC97BA; Mon, 14 Aug 2017 23:46:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 724157440A; Mon, 14 Aug 2017 23:46:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ENkBNs028021; Mon, 14 Aug 2017 23:46:11 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ENkACH028018; Mon, 14 Aug 2017 23:46:10 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708142346.v7ENkACH028018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 14 Aug 2017 23:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322523 - in stable/10/sys: amd64/amd64 amd64/include x86/x86 X-SVN-Group: stable-10 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 amd64/include x86/x86 X-SVN-Commit-Revision: 322523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 23:46:12 -0000 Author: jkim Date: Mon Aug 14 23:46:10 2017 New Revision: 322523 URL: https://svnweb.freebsd.org/changeset/base/322523 Log: MFC: r322323 Split identify_cpu() into two functions for amd64 as we do for i386. This fixes a regression introduced in r322205. Approved by: re (marius) Modified: stable/10/sys/amd64/amd64/machdep.c stable/10/sys/amd64/include/md_var.h stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Mon Aug 14 22:38:54 2017 (r322522) +++ stable/10/sys/amd64/amd64/machdep.c Mon Aug 14 23:46:10 2017 (r322523) @@ -1853,6 +1853,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); #endif + identify_cpu(); identify_hypervisor(); /* Init basic tunables, hz etc */ @@ -1950,7 +1951,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) MODINFO_METADATA | MODINFOMD_EFI_MAP) != 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: stable/10/sys/amd64/include/md_var.h ============================================================================== --- stable/10/sys/amd64/include/md_var.h Mon Aug 14 22:38:54 2017 (r322522) +++ stable/10/sys/amd64/include/md_var.h Mon Aug 14 23:46:10 2017 (r322523) @@ -119,6 +119,7 @@ void fsbase_load_fault(void) __asm(__STRING(fsbase_loa void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); 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: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Mon Aug 14 22:38:54 2017 (r322522) +++ stable/10/sys/x86/x86/identcpu.c Mon Aug 14 23:46:10 2017 (r322523) @@ -1346,23 +1346,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]; @@ -1375,6 +1364,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(); From owner-svn-src-all@freebsd.org Tue Aug 15 00:54:18 2017 Return-Path: Delivered-To: svn-src-all@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 5362BDCDDC5; Tue, 15 Aug 2017 00:54:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F65E76706; Tue, 15 Aug 2017 00:54:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7F0sHKk056381; Tue, 15 Aug 2017 00:54:17 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F0sHVF056379; Tue, 15 Aug 2017 00:54:17 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708150054.v7F0sHVF056379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 15 Aug 2017 00:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322524 - in stable/11/lib/libc: gen tests/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/11/lib/libc: gen tests/gen X-SVN-Commit-Revision: 322524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 00:54:18 -0000 Author: pfg Date: Tue Aug 15 00:54:16 2017 New Revision: 322524 URL: https://svnweb.freebsd.org/changeset/base/322524 Log: MFC r322368, r322371: fnmatch(3): improve POSIX conformance. In a recent interpretation[1], "\\" shall return a non-zero value (indicating either no match or an error). The fix involves a change over r254091 and now the behavior matches the Sun/IBM/HP closed source implementations and also likely musl libc. Submitted by: Joerg Schilling [1] http://austingroupbugs.net/view.php?id=806 Modified: stable/11/lib/libc/gen/fnmatch.c stable/11/lib/libc/tests/gen/fnmatch_testcases.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/fnmatch.c ============================================================================== --- stable/11/lib/libc/gen/fnmatch.c Mon Aug 14 23:46:10 2017 (r322523) +++ stable/11/lib/libc/gen/fnmatch.c Tue Aug 15 00:54:16 2017 (r322524) @@ -184,7 +184,8 @@ fnmatch1(const char *pattern, const char *string, cons if (!(flags & FNM_NOESCAPE)) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); - if (pclen == (size_t)-1 || pclen == (size_t)-2) + if (pclen == 0 || pclen == (size_t)-1 || + pclen == (size_t)-2) return (FNM_NOMATCH); pattern += pclen; } Modified: stable/11/lib/libc/tests/gen/fnmatch_testcases.h ============================================================================== --- stable/11/lib/libc/tests/gen/fnmatch_testcases.h Mon Aug 14 23:46:10 2017 (r322523) +++ stable/11/lib/libc/tests/gen/fnmatch_testcases.h Tue Aug 15 00:54:16 2017 (r322524) @@ -131,7 +131,7 @@ struct testcase { { "\\(", "\\(", 0, FNM_NOMATCH }, { "\\a", "\\a", 0, FNM_NOMATCH }, { "\\", "\\", 0, FNM_NOMATCH }, - { "\\", "", 0, 0 }, + { "\\", "", 0, FNM_NOMATCH }, { "\\*", "\\*", FNM_NOESCAPE, 0 }, { "\\?", "\\?", FNM_NOESCAPE, 0 }, { "\\", "\\", FNM_NOESCAPE, 0 }, From owner-svn-src-all@freebsd.org Tue Aug 15 01:22:41 2017 Return-Path: Delivered-To: svn-src-all@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 610C9DD061E; Tue, 15 Aug 2017 01:22:41 +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 2F52077AE6; Tue, 15 Aug 2017 01:22:41 +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 v7F1MeGx068432; Tue, 15 Aug 2017 01:22:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F1MdN2068429; Tue, 15 Aug 2017 01:22:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708150122.v7F1MdN2068429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 15 Aug 2017 01:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322525 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 01:22:41 -0000 Author: kevans Date: Tue Aug 15 01:22:39 2017 New Revision: 322525 URL: https://svnweb.freebsd.org/changeset/base/322525 Log: bsdgrep: treat rgrep as grep -r and install rgrep symlink MFC r316473: bsdgrep: treat rgrep as grep -r MFC r316484: bsdgrep(1): create rgrep link Create a convenience rgrep link for bsdgrep(1) that observes 'grep -r' behavior. A follow-up to r316473. Approved by: emaste (mentor) Modified: stable/11/usr.bin/grep/Makefile stable/11/usr.bin/grep/grep.1 stable/11/usr.bin/grep/grep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/Makefile ============================================================================== --- stable/11/usr.bin/grep/Makefile Tue Aug 15 00:54:16 2017 (r322524) +++ stable/11/usr.bin/grep/Makefile Tue Aug 15 01:22:39 2017 (r322525) @@ -25,12 +25,14 @@ CFLAGS.gcc+= --param max-inline-insns-single=500 .if ${MK_BSD_GREP} == "yes" LINKS= ${BINDIR}/grep ${BINDIR}/egrep \ ${BINDIR}/grep ${BINDIR}/fgrep \ + ${BINDIR}/grep ${BINDIR}/rgrep \ ${BINDIR}/grep ${BINDIR}/zgrep \ ${BINDIR}/grep ${BINDIR}/zegrep \ ${BINDIR}/grep ${BINDIR}/zfgrep MLINKS= grep.1 egrep.1 \ grep.1 fgrep.1 \ + grep.1 rgrep.1 \ grep.1 zgrep.1 \ grep.1 zegrep.1 \ grep.1 zfgrep.1 Modified: stable/11/usr.bin/grep/grep.1 ============================================================================== --- stable/11/usr.bin/grep/grep.1 Tue Aug 15 00:54:16 2017 (r322524) +++ stable/11/usr.bin/grep/grep.1 Tue Aug 15 01:22:39 2017 (r322525) @@ -34,7 +34,7 @@ .Dt GREP 1 .Os .Sh NAME -.Nm grep , egrep , fgrep , +.Nm grep , egrep , fgrep , rgrep , .Nm zgrep , zegrep , zfgrep .Nd file pattern searcher .Sh SYNOPSIS @@ -341,6 +341,10 @@ will only search a file until a match has been found, making searches potentially less expensive. .It Fl R , Fl r , Fl Fl recursive Recursively search subdirectories listed. +(i.e. force +.Nm grep +to behave as +.Nm rgrep ) . .It Fl S If .Fl R Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Tue Aug 15 00:54:16 2017 (r322524) +++ stable/11/usr.bin/grep/grep.c Tue Aug 15 01:22:39 2017 (r322525) @@ -361,6 +361,9 @@ main(int argc, char *argv[]) } else if (pn[0] == 'l' && pn[1] == 'z') { filebehave = FILE_LZMA; pn += 2; + } else if (pn[0] == 'r') { + dirbehave = DIR_RECURSE; + Hflag = true; } else if (pn[0] == 'z') { filebehave = FILE_GZIP; pn += 1; From owner-svn-src-all@freebsd.org Tue Aug 15 02:21:03 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 03:20:59 2017 Return-Path: Delivered-To: svn-src-all@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 EBDBADD968A; Tue, 15 Aug 2017 03:20:59 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) (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 C399C7FF44; Tue, 15 Aug 2017 03:20:59 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-pg0-x236.google.com with SMTP id y129so59373940pgy.4; Mon, 14 Aug 2017 20:20:59 -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=zHkZFHJmGo+esicOM/HBGt2HlLczuE5XYr35q9wRMVE=; b=q4H2wm+ZK0lWEIwzfmF5Zgdq1YZb7ZExQvZyV1PQ8B8D1h1Gsk/5LwKs8ku2CHpqXs zbWFgyoyPjkQN9056aknuIAr8JmOtrnVnb+FSLtAj9D6flLH7rU2aUapCKvNlUfYNTQo 1btJC5IkPiBTGIuEi5aACtFyFxjaJwOnpTQSq62wFJoPAlz3lhpvZnNqQVyMdgZm5/ij KF/B2XgKc25H9YCniNeGnZdw/nPAtCYgMGwF0XdhHErUaIoX1ccZYYqwnqiWvOEDOCE3 VqNtarLr0QXlDBEGrJJfPi3zL7TdE8tvmmDDkwbjCnJvBlpTJbMfrsQTDfSYYLPEPODT FodQ== 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=zHkZFHJmGo+esicOM/HBGt2HlLczuE5XYr35q9wRMVE=; b=KSFXAZHEHsfBYNpI+P74dnK7wLyrNKAvwcLaLB9cESR1BaxNJECRXmAqbG1LLBF5Zo aPQDgaGdGAMf4Li0O5JrXdpu6rfOEhcgrwpW4WZEZ2NZSo1qkNiL1bV7UynOV8dEc08J 159URPq3exCA5XmZEtakmHTzb5j5Msf59t2tHM8LQuHlBxRi0dnW8Tnjze9u8829NyLi TZE3GOacSY1MN2FCpZixaw6i//VmqbWh7nI4OuopAzo1XpvD3oQJwqBQ1awbbtqvcc6I 4GtXePYy7RGT37Flk1MY5EAfFRObml55HE6gu+jxCi0AKaaXFQXx8Cm69xyQc6zAV/ON HOng== X-Gm-Message-State: AHYfb5hkzlDI6AW7xgeIplfQxAHSxQS5dwW9SNLBVR8Vk/NXUb9gZMRR Gpb9QZL7fdx9oy0gVs3zqzCOJ4c6Qg== X-Received: by 10.84.231.2 with SMTP id f2mr30586467plk.253.1502767259155; Mon, 14 Aug 2017 20:20:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.128.28 with HTTP; Mon, 14 Aug 2017 20:20:58 -0700 (PDT) In-Reply-To: <201708142346.v7ENkACH028018@repo.freebsd.org> References: <201708142346.v7ENkACH028018@repo.freebsd.org> From: Sepherosa Ziehau Date: Tue, 15 Aug 2017 11:20:58 +0800 Message-ID: Subject: Re: svn commit: r322523 - in stable/10/sys: amd64/amd64 amd64/include x86/x86 To: Jung-uk Kim Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 03:21:00 -0000 Thank you! On Tue, Aug 15, 2017 at 7:46 AM, Jung-uk Kim wrote: > Author: jkim > Date: Mon Aug 14 23:46:10 2017 > New Revision: 322523 > URL: https://svnweb.freebsd.org/changeset/base/322523 > > Log: > MFC: r322323 > > Split identify_cpu() into two functions for amd64 as we do for i386. This > fixes a regression introduced in r322205. > > Approved by: re (marius) > > Modified: > stable/10/sys/amd64/amd64/machdep.c > stable/10/sys/amd64/include/md_var.h > stable/10/sys/x86/x86/identcpu.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/amd64/amd64/machdep.c > ============================================================================== > --- stable/10/sys/amd64/amd64/machdep.c Mon Aug 14 22:38:54 2017 (r322522) > +++ stable/10/sys/amd64/amd64/machdep.c Mon Aug 14 23:46:10 2017 (r322523) > @@ -1853,6 +1853,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); > #endif > > + identify_cpu(); > identify_hypervisor(); > > /* Init basic tunables, hz etc */ > @@ -1950,7 +1951,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > MODINFO_METADATA | MODINFOMD_EFI_MAP) != 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: stable/10/sys/amd64/include/md_var.h > ============================================================================== > --- stable/10/sys/amd64/include/md_var.h Mon Aug 14 22:38:54 2017 (r322522) > +++ stable/10/sys/amd64/include/md_var.h Mon Aug 14 23:46:10 2017 (r322523) > @@ -119,6 +119,7 @@ void fsbase_load_fault(void) __asm(__STRING(fsbase_loa > void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); > 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: stable/10/sys/x86/x86/identcpu.c > ============================================================================== > --- stable/10/sys/x86/x86/identcpu.c Mon Aug 14 22:38:54 2017 (r322522) > +++ stable/10/sys/x86/x86/identcpu.c Mon Aug 14 23:46:10 2017 (r322523) > @@ -1346,23 +1346,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]; > @@ -1375,6 +1364,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-all@freebsd.org Tue Aug 15 06:01:37 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 08:29:05 2017 Return-Path: Delivered-To: svn-src-all@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 6D724DC4507; Tue, 15 Aug 2017 08:29:05 +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 479A1653BC; Tue, 15 Aug 2017 08:29:05 +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 v7F8T4bA038010; Tue, 15 Aug 2017 08:29:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F8T41G038004; Tue, 15 Aug 2017 08:29:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708150829.v7F8T41G038004@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:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322529 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 08:29:05 -0000 Author: hselasky Date: Tue Aug 15 08:29:03 2017 New Revision: 322529 URL: https://svnweb.freebsd.org/changeset/base/322529 Log: MFC r322248: Fix for mlx4en(4) to properly call m_defrag(). The m_defrag() function can only defrag mbuf chains which have a valid mbuf packet header. In r291699 when the mlx4en(4) driver was converted into using BUSDMA(9), the call to m_defrag() was moved after the part of the transmit routine which strips the header from the mbuf chain. This effectivly disabled the mbuf defrag mechanism and such packets simply got dropped. This patch removes the stripping of mbufs from a chain and loads all mbufs using busdma. If busdma finds there are no segments, unload the DMA map and free the mbuf right away, because that means all data in the mbuf has been inlined in the TX ring. Else proceed as usual. Add a per-ring rounter for the number of defrag attempts and make sure the oversized_packets counter gets zeroed while at it. The counters are per-ring to avoid excessive cache misses in the TX path. Submitted by: mjoras@ Differential Revision: https://reviews.freebsd.org/D11683 Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c stable/11/sys/ofed/drivers/net/mlx4/en_port.c stable/11/sys/ofed/drivers/net/mlx4/en_tx.c stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 07:21:47 2017 (r322528) +++ stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 08:29:03 2017 (r322529) @@ -2682,6 +2682,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload", CTLFLAG_RD, &priv->port_stats.tx_chksum_offload, "TX checksum offloads"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", CTLFLAG_RD, + &priv->port_stats.defrag_attempts, "Oversized chains defragged"); /* Could strdup the names and add in a loop. This is simpler. */ SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD, @@ -2775,6 +2777,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets", + CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts", + CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains defragged"); } for (i = 0; i < priv->rx_ring_num; i++) { Modified: stable/11/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 07:21:47 2017 (r322528) +++ stable/11/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 08:29:03 2017 (r322529) @@ -224,11 +224,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->port_stats.tx_chksum_offload = 0; priv->port_stats.queue_stopped = 0; priv->port_stats.wake_queue = 0; + priv->port_stats.oversized_packets = 0; + priv->port_stats.tso_packets = 0; + priv->port_stats.defrag_attempts = 0; for (i = 0; i < priv->tx_ring_num; i++) { priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; + priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets; + priv->port_stats.defrag_attempts += priv->tx_ring[i]->defrag_attempts; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: stable/11/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 07:21:47 2017 (r322528) +++ stable/11/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 08:29:03 2017 (r322529) @@ -793,7 +793,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int num_pkts = DIV_ROUND_UP(payload_len, mss); ring->bytes += payload_len + (num_pkts * ihs); ring->packets += num_pkts; - priv->port_stats.tso_packets++; + ring->tso_packets++; /* store pointer to inline header */ dseg_inline = dseg; /* copy data inline */ @@ -814,20 +814,11 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int } m_adj(mb, ihs); - /* trim off empty mbufs */ - while (mb->m_len == 0) { - mb = m_free(mb); - /* check if all data has been inlined */ - if (mb == NULL) { - nr_segs = 0; - goto skip_dma; - } - } - err = bus_dmamap_load_mbuf_sg(ring->dma_tag, tx_info->dma_map, mb, segs, &nr_segs, BUS_DMA_NOWAIT); if (unlikely(err == EFBIG)) { /* Too many mbuf fragments */ + ring->defrag_attempts++; m = m_defrag(mb, M_NOWAIT); if (m == NULL) { ring->oversized_packets++; @@ -843,11 +834,18 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int ring->oversized_packets++; goto tx_drop; } - /* make sure all mbuf data is written to RAM */ - bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, - BUS_DMASYNC_PREWRITE); + /* If there were no errors and we didn't load anything, don't sync. */ + if (nr_segs != 0) { + /* make sure all mbuf data is written to RAM */ + bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, + BUS_DMASYNC_PREWRITE); + } else { + /* All data was inlined, free the mbuf. */ + bus_dmamap_unload(ring->dma_tag, tx_info->dma_map); + m_freem(mb); + mb = NULL; + } -skip_dma: /* compute number of DS needed */ ds_cnt = (dseg - ((volatile struct mlx4_wqe_data_seg *)tx_desc)) + nr_segs; Modified: stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 07:21:47 2017 (r322528) +++ stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 08:29:03 2017 (r322529) @@ -278,6 +278,8 @@ struct mlx4_en_tx_ring { unsigned long queue_stopped; unsigned long oversized_packets; unsigned long wake_queue; + unsigned long tso_packets; + unsigned long defrag_attempts; struct mlx4_bf bf; bool bf_enabled; int hwtstamp_tx_type; Modified: stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 07:21:47 2017 (r322528) +++ stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 08:29:03 2017 (r322529) @@ -126,6 +126,7 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; + unsigned long defrag_attempts; }; struct mlx4_en_perf_stats { From owner-svn-src-all@freebsd.org Tue Aug 15 08:44:37 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 09:21:48 2017 Return-Path: Delivered-To: svn-src-all@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 A8F67DC6FF2; Tue, 15 Aug 2017 09:21:48 +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 830EE66EE9; Tue, 15 Aug 2017 09:21:48 +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 v7F9Llcm059116; Tue, 15 Aug 2017 09:21:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F9LlPc059111; Tue, 15 Aug 2017 09:21:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708150921.v7F9LlPc059111@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 09:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322531 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 09:21:48 -0000 Author: hselasky Date: Tue Aug 15 09:21:46 2017 New Revision: 322531 URL: https://svnweb.freebsd.org/changeset/base/322531 Log: MFC r322248: Fix for mlx4en(4) to properly call m_defrag(). The m_defrag() function can only defrag mbuf chains which have a valid mbuf packet header. In r291699 when the mlx4en(4) driver was converted into using BUSDMA(9), the call to m_defrag() was moved after the part of the transmit routine which strips the header from the mbuf chain. This effectivly disabled the mbuf defrag mechanism and such packets simply got dropped. This patch removes the stripping of mbufs from a chain and loads all mbufs using busdma. If busdma finds there are no segments, unload the DMA map and free the mbuf right away, because that means all data in the mbuf has been inlined in the TX ring. Else proceed as usual. Add a per-ring rounter for the number of defrag attempts and make sure the oversized_packets counter gets zeroed while at it. The counters are per-ring to avoid excessive cache misses in the TX path. Approved by: re (kib) Submitted by: mjoras@ Differential Revision: https://reviews.freebsd.org/D11683 Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c stable/10/sys/ofed/drivers/net/mlx4/en_port.c stable/10/sys/ofed/drivers/net/mlx4/en_tx.c stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 08:44:36 2017 (r322530) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 09:21:46 2017 (r322531) @@ -2681,6 +2681,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload", CTLFLAG_RD, &priv->port_stats.tx_chksum_offload, "TX checksum offloads"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", CTLFLAG_RD, + &priv->port_stats.defrag_attempts, "Oversized chains defragged"); /* Could strdup the names and add in a loop. This is simpler. */ SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD, @@ -2774,6 +2776,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets", + CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts", + CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains defragged"); } for (i = 0; i < priv->rx_ring_num; i++) { Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 08:44:36 2017 (r322530) +++ stable/10/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 09:21:46 2017 (r322531) @@ -224,11 +224,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->port_stats.tx_chksum_offload = 0; priv->port_stats.queue_stopped = 0; priv->port_stats.wake_queue = 0; + priv->port_stats.oversized_packets = 0; + priv->port_stats.tso_packets = 0; + priv->port_stats.defrag_attempts = 0; for (i = 0; i < priv->tx_ring_num; i++) { priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; + priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets; + priv->port_stats.defrag_attempts += priv->tx_ring[i]->defrag_attempts; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 08:44:36 2017 (r322530) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 09:21:46 2017 (r322531) @@ -788,7 +788,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int num_pkts = DIV_ROUND_UP(payload_len, mss); ring->bytes += payload_len + (num_pkts * ihs); ring->packets += num_pkts; - priv->port_stats.tso_packets++; + ring->tso_packets++; /* store pointer to inline header */ dseg_inline = dseg; /* copy data inline */ @@ -809,20 +809,11 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int } m_adj(mb, ihs); - /* trim off empty mbufs */ - while (mb->m_len == 0) { - mb = m_free(mb); - /* check if all data has been inlined */ - if (mb == NULL) { - nr_segs = 0; - goto skip_dma; - } - } - err = bus_dmamap_load_mbuf_sg(ring->dma_tag, tx_info->dma_map, mb, segs, &nr_segs, BUS_DMA_NOWAIT); if (unlikely(err == EFBIG)) { /* Too many mbuf fragments */ + ring->defrag_attempts++; m = m_defrag(mb, M_NOWAIT); if (m == NULL) { ring->oversized_packets++; @@ -838,11 +829,18 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int ring->oversized_packets++; goto tx_drop; } - /* make sure all mbuf data is written to RAM */ - bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, - BUS_DMASYNC_PREWRITE); + /* If there were no errors and we didn't load anything, don't sync. */ + if (nr_segs != 0) { + /* make sure all mbuf data is written to RAM */ + bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, + BUS_DMASYNC_PREWRITE); + } else { + /* All data was inlined, free the mbuf. */ + bus_dmamap_unload(ring->dma_tag, tx_info->dma_map); + m_freem(mb); + mb = NULL; + } -skip_dma: /* compute number of DS needed */ ds_cnt = (dseg - ((volatile struct mlx4_wqe_data_seg *)tx_desc)) + nr_segs; Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 08:44:36 2017 (r322530) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 09:21:46 2017 (r322531) @@ -278,6 +278,8 @@ struct mlx4_en_tx_ring { unsigned long queue_stopped; unsigned long oversized_packets; unsigned long wake_queue; + unsigned long tso_packets; + unsigned long defrag_attempts; struct mlx4_bf bf; bool bf_enabled; int hwtstamp_tx_type; Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 08:44:36 2017 (r322530) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 09:21:46 2017 (r322531) @@ -126,6 +126,7 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; + unsigned long defrag_attempts; }; struct mlx4_en_perf_stats { From owner-svn-src-all@freebsd.org Tue Aug 15 09:36:01 2017 Return-Path: Delivered-To: svn-src-all@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 F2E0FDC7B59; Tue, 15 Aug 2017 09:36:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAED567534; Tue, 15 Aug 2017 09:36:01 +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 v7F9a0D3066452; Tue, 15 Aug 2017 09:36:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F9a0CD066451; Tue, 15 Aug 2017 09:36:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708150936.v7F9a0CD066451@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 09:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322532 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 322532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 09:36:02 -0000 Author: kib Date: Tue Aug 15 09:36:00 2017 New Revision: 322532 URL: https://svnweb.freebsd.org/changeset/base/322532 Log: MFC r322256: Fix logic error in the the assert, causing the condition to be always true. PR: 217741 Modified: stable/11/sys/dev/hwpmc/hwpmc_piv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_piv.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 09:21:46 2017 (r322531) +++ stable/11/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 09:36:00 2017 (r322532) @@ -809,8 +809,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) mtx_lock_spin(&pc->pc_mtx); cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri); - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); KASSERT(cfgflags == 0 || phw->phw_pmc, @@ -835,8 +835,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) phw->phw_pmc = NULL; } - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags); From owner-svn-src-all@freebsd.org Tue Aug 15 09:40:58 2017 Return-Path: Delivered-To: svn-src-all@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 6E5C5DC7F4F; Tue, 15 Aug 2017 09:40:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CE1B677CE; Tue, 15 Aug 2017 09:40:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7F9evs7066688; Tue, 15 Aug 2017 09:40:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F9evNg066687; Tue, 15 Aug 2017 09:40:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708150940.v7F9evNg066687@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 09:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322533 - stable/11/lib/libc/string X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/string X-SVN-Commit-Revision: 322533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 09:40:58 -0000 Author: kib Date: Tue Aug 15 09:40:57 2017 New Revision: 322533 URL: https://svnweb.freebsd.org/changeset/base/322533 Log: MFC r322426: Fix indent. Modified: stable/11/lib/libc/string/memset_s.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/string/memset_s.c ============================================================================== --- stable/11/lib/libc/string/memset_s.c Tue Aug 15 09:36:00 2017 (r322532) +++ stable/11/lib/libc/string/memset_s.c Tue Aug 15 09:40:57 2017 (r322533) @@ -49,7 +49,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) __throw_constraint_handler_s("memset_s : s is NULL", ret); } else if (smax > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : smax > RSIZE_MAX", - ret); + ret); } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { From owner-svn-src-all@freebsd.org Tue Aug 15 09:44:20 2017 Return-Path: Delivered-To: svn-src-all@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 55AD7DC8381; Tue, 15 Aug 2017 09:44:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2433367B90; Tue, 15 Aug 2017 09:44:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7F9iJDb070371; Tue, 15 Aug 2017 09:44:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F9iJnf070370; Tue, 15 Aug 2017 09:44:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708150944.v7F9iJnf070370@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 09:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322534 - stable/11/lib/libc/x86/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/x86/sys X-SVN-Commit-Revision: 322534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 09:44:20 -0000 Author: kib Date: Tue Aug 15 09:44:18 2017 New Revision: 322534 URL: https://svnweb.freebsd.org/changeset/base/322534 Log: MFC r322456: On i386 with CPUID but without SSE2, set lfence_works to LMB_NONE instead of looping. Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Tue Aug 15 09:40:57 2017 (r322533) +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Tue Aug 15 09:44:18 2017 (r322534) @@ -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-all@freebsd.org Tue Aug 15 12:26:45 2017 Return-Path: Delivered-To: svn-src-all@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 169AADD0CF4; Tue, 15 Aug 2017 12:26:45 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D94D06D4F9; Tue, 15 Aug 2017 12:26:44 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FCQi49035136; Tue, 15 Aug 2017 12:26:44 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FCQiSt035135; Tue, 15 Aug 2017 12:26:44 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708151226.v7FCQiSt035135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 15 Aug 2017 12:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322535 - stable/10/kerberos5/libexec/ipropd-master X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/10/kerberos5/libexec/ipropd-master X-SVN-Commit-Revision: 322535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 12:26:45 -0000 Author: cy Date: Tue Aug 15 12:26:43 2017 New Revision: 322535 URL: https://svnweb.freebsd.org/changeset/base/322535 Log: MFC r322113: Remove dead target introduced in r178828. Approved by: re (marius) Modified: stable/10/kerberos5/libexec/ipropd-master/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/kerberos5/libexec/ipropd-master/Makefile ============================================================================== --- stable/10/kerberos5/libexec/ipropd-master/Makefile Tue Aug 15 09:44:18 2017 (r322534) +++ stable/10/kerberos5/libexec/ipropd-master/Makefile Tue Aug 15 12:26:43 2017 (r322535) @@ -11,9 +11,6 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVE -lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} -foo:: - echo ${LIBHX509} - .include .PATH: ${KRB5DIR}/lib/kadm5 From owner-svn-src-all@freebsd.org Tue Aug 15 12:28:17 2017 Return-Path: Delivered-To: svn-src-all@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 9F90BDD0E71; Tue, 15 Aug 2017 12:28:17 +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 7C0566D66F; Tue, 15 Aug 2017 12:28:17 +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 v7FCSGQp035251; Tue, 15 Aug 2017 12:28:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FCSGPh035246; Tue, 15 Aug 2017 12:28:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708151228.v7FCSGPh035246@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 12:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322536 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 322536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 12:28:17 -0000 Author: hselasky Date: Tue Aug 15 12:28:16 2017 New Revision: 322536 URL: https://svnweb.freebsd.org/changeset/base/322536 Log: MFC r322248: Fix for mlx4en(4) to properly call m_defrag(). The m_defrag() function can only defrag mbuf chains which have a valid mbuf packet header. In r291699 when the mlx4en(4) driver was converted into using BUSDMA(9), the call to m_defrag() was moved after the part of the transmit routine which strips the header from the mbuf chain. This effectivly disabled the mbuf defrag mechanism and such packets simply got dropped. This patch removes the stripping of mbufs from a chain and loads all mbufs using busdma. If busdma finds there are no segments, unload the DMA map and free the mbuf right away, because that means all data in the mbuf has been inlined in the TX ring. Else proceed as usual. Add a per-ring rounter for the number of defrag attempts and make sure the oversized_packets counter gets zeroed while at it. The counters are per-ring to avoid excessive cache misses in the TX path. Submitted by: mjoras@ Differential Revision: https://reviews.freebsd.org/D11683 Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c stable/9/sys/ofed/drivers/net/mlx4/en_port.c stable/9/sys/ofed/drivers/net/mlx4/en_tx.c stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 12:26:43 2017 (r322535) +++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Tue Aug 15 12:28:16 2017 (r322536) @@ -2682,6 +2682,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload", CTLFLAG_RD, &priv->port_stats.tx_chksum_offload, "TX checksum offloads"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", CTLFLAG_RD, + &priv->port_stats.defrag_attempts, "Oversized chains defragged"); /* Could strdup the names and add in a loop. This is simpler. */ SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD, @@ -2775,6 +2777,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets", + CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets"); + SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts", + CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains defragged"); } for (i = 0; i < priv->rx_ring_num; i++) { Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 12:26:43 2017 (r322535) +++ stable/9/sys/ofed/drivers/net/mlx4/en_port.c Tue Aug 15 12:28:16 2017 (r322536) @@ -224,11 +224,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->port_stats.tx_chksum_offload = 0; priv->port_stats.queue_stopped = 0; priv->port_stats.wake_queue = 0; + priv->port_stats.oversized_packets = 0; + priv->port_stats.tso_packets = 0; + priv->port_stats.defrag_attempts = 0; for (i = 0; i < priv->tx_ring_num; i++) { priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; + priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets; + priv->port_stats.defrag_attempts += priv->tx_ring[i]->defrag_attempts; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: stable/9/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 12:26:43 2017 (r322535) +++ stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Tue Aug 15 12:28:16 2017 (r322536) @@ -789,7 +789,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int num_pkts = DIV_ROUND_UP(payload_len, mss); ring->bytes += payload_len + (num_pkts * ihs); ring->packets += num_pkts; - priv->port_stats.tso_packets++; + ring->tso_packets++; /* store pointer to inline header */ dseg_inline = dseg; /* copy data inline */ @@ -810,20 +810,11 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int } m_adj(mb, ihs); - /* trim off empty mbufs */ - while (mb->m_len == 0) { - mb = m_free(mb); - /* check if all data has been inlined */ - if (mb == NULL) { - nr_segs = 0; - goto skip_dma; - } - } - err = bus_dmamap_load_mbuf_sg(ring->dma_tag, tx_info->dma_map, mb, segs, &nr_segs, BUS_DMA_NOWAIT); if (unlikely(err == EFBIG)) { /* Too many mbuf fragments */ + ring->defrag_attempts++; m = m_defrag(mb, M_NOWAIT); if (m == NULL) { ring->oversized_packets++; @@ -839,11 +830,18 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int ring->oversized_packets++; goto tx_drop; } - /* make sure all mbuf data is written to RAM */ - bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, - BUS_DMASYNC_PREWRITE); + /* If there were no errors and we didn't load anything, don't sync. */ + if (nr_segs != 0) { + /* make sure all mbuf data is written to RAM */ + bus_dmamap_sync(ring->dma_tag, tx_info->dma_map, + BUS_DMASYNC_PREWRITE); + } else { + /* All data was inlined, free the mbuf. */ + bus_dmamap_unload(ring->dma_tag, tx_info->dma_map); + m_freem(mb); + mb = NULL; + } -skip_dma: /* compute number of DS needed */ ds_cnt = (dseg - ((volatile struct mlx4_wqe_data_seg *)tx_desc)) + nr_segs; Modified: stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 12:26:43 2017 (r322535) +++ stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h Tue Aug 15 12:28:16 2017 (r322536) @@ -278,6 +278,8 @@ struct mlx4_en_tx_ring { unsigned long queue_stopped; unsigned long oversized_packets; unsigned long wake_queue; + unsigned long tso_packets; + unsigned long defrag_attempts; struct mlx4_bf bf; bool bf_enabled; int hwtstamp_tx_type; Modified: stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 12:26:43 2017 (r322535) +++ stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h Tue Aug 15 12:28:16 2017 (r322536) @@ -126,6 +126,7 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; + unsigned long defrag_attempts; }; struct mlx4_en_perf_stats { From owner-svn-src-all@freebsd.org Tue Aug 15 12:30:12 2017 Return-Path: Delivered-To: svn-src-all@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 D20D7DD0F95; Tue, 15 Aug 2017 12:30:12 +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 9F2606D819; Tue, 15 Aug 2017 12:30:12 +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 v7FCUBPE035392; Tue, 15 Aug 2017 12:30:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FCUBRr035391; Tue, 15 Aug 2017 12:30:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708151230.v7FCUBRr035391@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 12:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322537 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 12:30:12 -0000 Author: hselasky Date: Tue Aug 15 12:30:11 2017 New Revision: 322537 URL: https://svnweb.freebsd.org/changeset/base/322537 Log: MFC r322251: Make sure the received IP header gets 32-bit aligned for short packets in the mlx5en(4) driver. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 15 12:28:16 2017 (r322536) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 15 12:30:11 2017 (r322537) @@ -355,9 +355,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) rq->stats.wqe_err++; goto wq_ll_pop; } - - if (MHLEN >= byte_cnt && + if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + /* get IP header aligned */ + mb->m_data += MLX5E_NET_IP_ALIGN; + bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t), byte_cnt); } else { From owner-svn-src-all@freebsd.org Tue Aug 15 12:54:20 2017 Return-Path: Delivered-To: svn-src-all@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 7DF76DD240D; Tue, 15 Aug 2017 12:54:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CB446E8A5; Tue, 15 Aug 2017 12:54:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FCsJUY047462; Tue, 15 Aug 2017 12:54:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FCsJns047461; Tue, 15 Aug 2017 12:54:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708151254.v7FCsJns047461@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 12:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322538 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 12:54:20 -0000 Author: hselasky Date: Tue Aug 15 12:54:19 2017 New Revision: 322538 URL: https://svnweb.freebsd.org/changeset/base/322538 Log: MFC r322251: Make sure the received IP header gets 32-bit aligned for short packets in the mlx5en(4) driver. Approved by: re (kib) Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 15 12:30:11 2017 (r322537) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Aug 15 12:54:19 2017 (r322538) @@ -358,9 +358,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) rq->stats.wqe_err++; goto wq_ll_pop; } - - if (MHLEN >= byte_cnt && + if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt && (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + /* get IP header aligned */ + mb->m_data += MLX5E_NET_IP_ALIGN; + bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t), byte_cnt); } else { From owner-svn-src-all@freebsd.org Tue Aug 15 12:56:44 2017 Return-Path: Delivered-To: svn-src-all@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 1788BDD260A; Tue, 15 Aug 2017 12:56:44 +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 D575D6EAA4; Tue, 15 Aug 2017 12:56:43 +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 v7FCugf2047753; Tue, 15 Aug 2017 12:56:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FCugIv047752; Tue, 15 Aug 2017 12:56:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708151256.v7FCugIv047752@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 12:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322539 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 12:56:44 -0000 Author: hselasky Date: Tue Aug 15 12:56:42 2017 New Revision: 322539 URL: https://svnweb.freebsd.org/changeset/base/322539 Log: MFC r322250: Count drop events due to lack of PCI bandwidth as queue drops and not as input errors in the mlx5en(4) driver. This improves the sysadmin view of physical port errors. Submitted by: gallatin@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 15 12:54:19 2017 (r322538) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 15 12:56:42 2017 (r322539) @@ -552,7 +552,6 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -561,7 +560,8 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.too_long_errors + priv->stats.pport.undersize_pkts + priv->stats.pport.unsupported_op_rx; - ifp->if_iqdrops = s->rx_out_of_buffer; + ifp->if_iqdrops = s->rx_out_of_buffer + + priv->stats.pport.drop_events; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -2467,7 +2467,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -2478,7 +2477,8 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.unsupported_op_rx; break; case IFCOUNTER_IQDROPS: - retval = priv->stats.vport.rx_out_of_buffer; + retval = priv->stats.vport.rx_out_of_buffer + + priv->stats.pport.drop_events; break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; From owner-svn-src-all@freebsd.org Tue Aug 15 13:10:14 2017 Return-Path: Delivered-To: svn-src-all@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 38B9EDD318C; Tue, 15 Aug 2017 13:10:14 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1546F1F4; Tue, 15 Aug 2017 13:10:14 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1129) id 6B754D67A; Tue, 15 Aug 2017 13:10:13 +0000 (UTC) Date: Tue, 15 Aug 2017 13:10:13 +0000 From: Li-Wen Hsu To: Kirk McKusick Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r322513 - stable/10/sys/geom/journal Message-ID: <20170815131013.GA29681@freefall.freebsd.org> References: <201708141912.v7EJCqsc017835@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708141912.v7EJCqsc017835@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 13:10:14 -0000 On Mon, Aug 14, 2017 at 19:12:52 +0000, Kirk McKusick wrote: > Author: mckusick > Date: Mon Aug 14 19:12:51 2017 > New Revision: 322513 > URL: https://svnweb.freebsd.org/changeset/base/322513 > > Log: > MFC of 322178: > > Bug 198500 reports bad sysctl values for gjournal cache limit. > > PR: 198500 > Submitted by: Dr. Andreas Longwitz > Reported by: Eugene Grosbein > Discussed with: kib > Approved by: re (marius) > > Modified: > stable/10/sys/geom/journal/g_journal.c > Directory Properties: > stable/10/ (props changed) This change seems breaking build: /usr/src/sys/modules/geom/geom_journal/../../../geom/journal/g_journal.c:136:1: error: incompatible pointer types initializing 'int *' with an expression of type 'u_long *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types] TUNABLE_INT("kern.geom.journal.cache.limit", &g_journal_cache_limit); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @/sys/kernel.h:287:3: note: expanded from macro 'TUNABLE_INT' (var), \ ^~~~~ /usr/src/sys/modules/geom/geom_journal/../../../geom/journal/g_journal.c:178:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] if (cswitch < 0 || cswitch > 100) ~~~~~~~ ^ ~ Could you help check this one? https://ci.freebsd.org/job/FreeBSD-stable-10-amd64-build/1157/console Thanks, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-all@freebsd.org Tue Aug 15 13:37:05 2017 Return-Path: Delivered-To: svn-src-all@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 CB247DD4BD6; Tue, 15 Aug 2017 13:37:05 +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 97EDE701B5; Tue, 15 Aug 2017 13:37:05 +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 v7FDb4Xd064220; Tue, 15 Aug 2017 13:37:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FDb4rW064219; Tue, 15 Aug 2017 13:37:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708151337.v7FDb4rW064219@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 13:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322540 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 13:37:05 -0000 Author: hselasky Date: Tue Aug 15 13:37:04 2017 New Revision: 322540 URL: https://svnweb.freebsd.org/changeset/base/322540 Log: MFC r322250: Count drop events due to lack of PCI bandwidth as queue drops and not as input errors in the mlx5en(4) driver. This improves the sysadmin view of physical port errors. Approved by: re (kib) Submitted by: gallatin@ Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 15 12:56:42 2017 (r322539) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Aug 15 13:37:04 2017 (r322540) @@ -552,7 +552,6 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -561,7 +560,8 @@ mlx5e_update_stats_work(struct work_struct *work) priv->stats.pport.too_long_errors + priv->stats.pport.undersize_pkts + priv->stats.pport.unsupported_op_rx; - ifp->if_iqdrops = s->rx_out_of_buffer; + ifp->if_iqdrops = s->rx_out_of_buffer + + priv->stats.pport.drop_events; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -2474,7 +2474,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.alignment_err + priv->stats.pport.check_seq_err + priv->stats.pport.crc_align_errors + - priv->stats.pport.drop_events + priv->stats.pport.in_range_len_errors + priv->stats.pport.jabbers + priv->stats.pport.out_of_range_len + @@ -2485,7 +2484,8 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt) priv->stats.pport.unsupported_op_rx; break; case IFCOUNTER_IQDROPS: - retval = priv->stats.vport.rx_out_of_buffer; + retval = priv->stats.vport.rx_out_of_buffer + + priv->stats.pport.drop_events; break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; From owner-svn-src-all@freebsd.org Tue Aug 15 14:02:58 2017 Return-Path: Delivered-To: svn-src-all@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 F2181DD5D67; Tue, 15 Aug 2017 14:02:58 +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 BEE9670F2D; Tue, 15 Aug 2017 14:02:58 +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 v7FE2vtl075874; Tue, 15 Aug 2017 14:02:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FE2vNH075873; Tue, 15 Aug 2017 14:02:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708151402.v7FE2vNH075873@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 14:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322541 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 322541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 14:02:59 -0000 Author: gjb Date: Tue Aug 15 14:02:57 2017 New Revision: 322541 URL: https://svnweb.freebsd.org/changeset/base/322541 Log: Document r322244, pci_vendors version 2017.07.27. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Aug 15 13:37:04 2017 (r322540) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Aug 15 14:02:57 2017 (r322541) @@ -260,6 +260,9 @@ bmake has been updated to version 20170720. + + pci_vendors has + been updated to version 2017.07.27. From owner-svn-src-all@freebsd.org Tue Aug 15 14:03:28 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 14:21:45 2017 Return-Path: Delivered-To: svn-src-all@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 8DCAFDD70CC; Tue, 15 Aug 2017 14:21:45 +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 5CD6F71995; Tue, 15 Aug 2017 14:21:45 +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 v7FELiNo084284; Tue, 15 Aug 2017 14:21:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FELiLr084283; Tue, 15 Aug 2017 14:21:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708151421.v7FELiLr084283@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 14:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322543 - stable/10/sys/dev/hwpmc X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/dev/hwpmc X-SVN-Commit-Revision: 322543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 14:21:45 -0000 Author: kib Date: Tue Aug 15 14:21:44 2017 New Revision: 322543 URL: https://svnweb.freebsd.org/changeset/base/322543 Log: MFC r322256: Fix logic error in the the assert, causing the condition to be always true. PR: 217741 Approved by: re (gjb) Modified: stable/10/sys/dev/hwpmc/hwpmc_piv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hwpmc/hwpmc_piv.c ============================================================================== --- stable/10/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 14:03:26 2017 (r322542) +++ stable/10/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 14:21:44 2017 (r322543) @@ -812,8 +812,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) mtx_lock_spin(&pc->pc_mtx); cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri); - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); KASSERT(cfgflags == 0 || phw->phw_pmc, @@ -838,8 +838,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm) phw->phw_pmc = NULL; } - KASSERT(cfgflags >= 0 || cfgflags <= 3, - ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__, + KASSERT((cfgflags & ~0x3) == 0, + ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__, cfgflags, cpu, ri)); P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags); From owner-svn-src-all@freebsd.org Tue Aug 15 15:08:20 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 15:13:34 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 16:39:50 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 17:52:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 19:21:29 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 19:29:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 22:16:17 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 22:49:31 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Aug 15 22:50:09 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Wed Aug 16 00:12:25 2017 Return-Path: Delivered-To: svn-src-all@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 CEC43DD7453; Wed, 16 Aug 2017 00:12:25 +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 9853B65E9F; Wed, 16 Aug 2017 00:12:25 +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 v7G0COtt024706; Wed, 16 Aug 2017 00:12:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0CMMl024686; Wed, 16 Aug 2017 00:12:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160012.v7G0CMMl024686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322555 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Commit-Revision: 322555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:12:25 -0000 Author: kevans Date: Wed Aug 16 00:12:22 2017 New Revision: 322555 URL: https://svnweb.freebsd.org/changeset/base/322555 Log: bsdgrep: Fix matching behavior and add regression tests MFC r316477: bsdgrep: fix matching behaviour - Set REG_NOTBOL if we've already matched beginning of line and we're examining later parts - For each pattern we examine, apply it to the remaining bits of the line rather than (potentially) smaller subsets - Check for REG_NOSUB after we've looked at all patterns initially matching the line - Keep track of the last match we made to later determine if we're simply not matching any longer or if we need to proceed another byte because we hit a zero-length match - Match the earliest and longest bit of each line before moving the beginning of what we match to further in the line, past the end of the longest match; this generally matches how gnugrep(1) seems to behave, and seems like pretty good behavior to me - Finally, bail out of printing any matches if we were set to print all (empty pattern) but -o (output matches) was set MFC r316489: bsdgrep: Initialize vars to avoid a false positive GCC warning MFC r316491: bsdgrep: revert color changes from r316477 r316477 changed the color output to match exactly the in-tree GNU grep, but introduces unnecessary escape sequences. MFC r316536: bsdgrep: create additional tests for coverage on recent fixes Create additional tests to cover regressions that were discovered by PRs linked to reviews D10098, D10102, and D10104. It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base system currently pass all of these tests, and gnugrep(1) not quite being up to snuff was also noted in at least one of the PRs. MFC r317052: bsdgrep: fix zero-length matches without the -o flag r316477 broke zero-length matches when not using the -o flag, by skipping over them entirely. Add a regression test so that it doesn't break again in the future. PR: 175314, 180990, 181263, 195763, 197531, 197555, 202022, 209116 Approved by: emaste (mentor, blanket MFC) Relnotes: yes Added: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_c.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_escmap.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out - copied unchanged from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/tests/Makefile stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in) @@ -0,0 +1 @@ +abcd* Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_a.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out) @@ -0,0 +1 @@ +abcd* Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in) @@ -0,0 +1,5 @@ +fojeiwuroiuwet +ljfajsljkfabcdddjlfkajlkj +abcaaa +zzzabc + Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_b.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out) @@ -0,0 +1,3 @@ +ljfajsljkfabcdddjlfkajlkj +abcaaa +zzzabc Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_c.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_color_c.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out) @@ -0,0 +1,3 @@ +ljfajsljkfabcdddjlfkajlkj +abcaaa +zzzabc Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_escmap.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_escmap.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in) @@ -0,0 +1 @@ +f.oo Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in) @@ -0,0 +1,2 @@ +Fish zebra monkey suits + Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in) @@ -0,0 +1 @@ +01:1:01 Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out) @@ -0,0 +1,3 @@ +0 +: +:0 Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in) @@ -0,0 +1 @@ +1:1:01 Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out) @@ -0,0 +1,2 @@ +: +:0 Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in) @@ -0,0 +1 @@ +bla bla Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out) @@ -0,0 +1,2 @@ +bla +bla Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in) @@ -0,0 +1,3 @@ +bla +bla + Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in) @@ -0,0 +1 @@ +abcdef Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out (from r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out Wed Aug 16 00:12:22 2017 (r322555, copy of r316536, head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out) @@ -0,0 +1 @@ +ab Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:04:57 2017 (r322554) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:12:22 2017 (r322555) @@ -226,10 +226,116 @@ context2_body() atf_check -o file:"$(atf_get_srcdir)/d_context2_c.out" \ grep -z -C1 cod test1 test2 } +# Begin FreeBSD +atf_test_case oflag_zerolen +oflag_zerolen_head() +{ + atf_set "descr" "Check behavior of zero-length matches with -o flag (PR 195763)" +} +oflag_zerolen_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_a.out" \ + grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_b.out" \ + grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_b.in" + + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_c.out" \ + grep -Eo '[[:alnum:]]*' "$(atf_get_srcdir)/d_oflag_zerolen_c.in" + + atf_check -o empty grep -Eo '' "$(atf_get_srcdir)/d_oflag_zerolen_d.in" + + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \ + grep -o -e 'ab' -e 'bc' "$(atf_get_srcdir)/d_oflag_zerolen_e.in" + + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \ + grep -o -e 'bc' -e 'ab' "$(atf_get_srcdir)/d_oflag_zerolen_e.in" +} + +atf_test_case xflag +xflag_head() +{ + atf_set "descr" "Check that we actually get a match with -x flag (PR 180990)" +} +xflag_body() +{ + echo 128 > match_file + seq 1 128 > pattern_file + grep -xf pattern_file match_file +} + +atf_test_case color +color_head() +{ + atf_set "descr" "Check --color support" +} +color_body() +{ + echo 'abcd*' > grepfile + echo 'abc$' >> grepfile + echo '^abc' >> grepfile + + atf_check -o file:"$(atf_get_srcdir)/d_color_a.out" \ + grep --color=auto -e '.*' -e 'a' "$(atf_get_srcdir)/d_color_a.in" + + atf_check -o file:"$(atf_get_srcdir)/d_color_b.out" \ + grep --color=auto -f grepfile "$(atf_get_srcdir)/d_color_b.in" + + atf_check -o file:"$(atf_get_srcdir)/d_color_c.out" \ + grep --color=always -f grepfile "$(atf_get_srcdir)/d_color_b.in" +} + +atf_test_case f_file_empty +f_file_empty_head() +{ + atf_set "descr" "Check for handling of a null byte in empty file, specified by -f (PR 202022)" +} +f_file_empty_body() +{ + printf "\0\n" > nulpat + + atf_check -s exit:1 grep -f nulpat "$(atf_get_srcdir)/d_f_file_empty.in" +} + +atf_test_case escmap +escmap_head() +{ + atf_set "descr" "Check proper handling of escaped vs. unescaped dot expressions (PR 175314)" +} +escmap_body() +{ + atf_check -s exit:1 grep -o 'f.o\.' "$(atf_get_srcdir)/d_escmap.in" + atf_check -o not-empty grep -o 'f.o.' "$(atf_get_srcdir)/d_escmap.in" +} + +atf_test_case egrep_empty_invalid +egrep_empty_invalid_head() +{ + atf_set "descr" "Check for handling of an invalid empty pattern (PR 194823)" +} +egrep_empty_invalid_body() +{ + atf_check -s exit:1 egrep '{' /dev/null +} + +atf_test_case zerolen +zerolen_head() +{ + atf_set "descr" "Check for successful zero-length matches with ^$" +} +zerolen_body() +{ + printf "Eggs\n\nCheese" > test1 + + atf_check -o inline:"\n" grep -e "^$" test1 + + atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1 +} +# End FreeBSD + atf_init_test_cases() { - atf_add_test_case basic + atf_add_test_case basic atf_add_test_case binary atf_add_test_case recurse atf_add_test_case recurse_symlink @@ -245,4 +351,13 @@ atf_init_test_cases() atf_add_test_case zgrep atf_add_test_case nonexistent atf_add_test_case context2 +# Begin FreeBSD + atf_add_test_case oflag_zerolen + atf_add_test_case xflag + atf_add_test_case color + atf_add_test_case f_file_empty + atf_add_test_case escmap + atf_add_test_case egrep_empty_invalid + atf_add_test_case zerolen +# End FreeBSD } Modified: stable/11/usr.bin/grep/tests/Makefile ============================================================================== --- stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 00:04:57 2017 (r322554) +++ stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 00:12:22 2017 (r322555) @@ -8,6 +8,11 @@ ${PACKAGE}FILES+= d_basic.out ${PACKAGE}FILES+= d_begin_end_a.out ${PACKAGE}FILES+= d_begin_end_b.out ${PACKAGE}FILES+= d_binary.out +${PACKAGE}FILES+= d_color_a.in +${PACKAGE}FILES+= d_color_a.out +${PACKAGE}FILES+= d_color_b.in +${PACKAGE}FILES+= d_color_b.out +${PACKAGE}FILES+= d_color_c.out ${PACKAGE}FILES+= d_context2_a.out ${PACKAGE}FILES+= d_context2_b.out ${PACKAGE}FILES+= d_context2_c.out @@ -18,12 +23,23 @@ ${PACKAGE}FILES+= d_context_b.out ${PACKAGE}FILES+= d_context_c.out ${PACKAGE}FILES+= d_context_d.out ${PACKAGE}FILES+= d_egrep.out +${PACKAGE}FILES+= d_escmap.in +${PACKAGE}FILES+= d_f_file_empty.in ${PACKAGE}FILES+= d_file_exp.in ${PACKAGE}FILES+= d_file_exp.out ${PACKAGE}FILES+= d_ignore_case.out ${PACKAGE}FILES+= d_input ${PACKAGE}FILES+= d_invert.in ${PACKAGE}FILES+= d_invert.out +${PACKAGE}FILES+= d_oflag_zerolen_a.in +${PACKAGE}FILES+= d_oflag_zerolen_a.out +${PACKAGE}FILES+= d_oflag_zerolen_b.in +${PACKAGE}FILES+= d_oflag_zerolen_b.out +${PACKAGE}FILES+= d_oflag_zerolen_c.in +${PACKAGE}FILES+= d_oflag_zerolen_c.out +${PACKAGE}FILES+= d_oflag_zerolen_d.in +${PACKAGE}FILES+= d_oflag_zerolen_e.in +${PACKAGE}FILES+= d_oflag_zerolen_e.out ${PACKAGE}FILES+= d_recurse.out ${PACKAGE}FILES+= d_recurse_symlink.err ${PACKAGE}FILES+= d_recurse_symlink.out Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 00:04:57 2017 (r322554) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 00:12:22 2017 (r322555) @@ -271,28 +271,32 @@ static int procline(struct str *l, int nottext) { regmatch_t matches[MAX_LINE_MATCHES]; - regmatch_t pmatch; - size_t st = 0; + regmatch_t pmatch, lastmatch; + size_t st = 0, nst = 0; unsigned int i; - int c = 0, m = 0, r = 0; + int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags; + int startm = 0; + /* Initialize to avoid a false positive warning from GCC. */ + lastmatch.rm_so = lastmatch.rm_eo = 0; + /* Loop to process the whole line */ while (st <= l->len) { - pmatch.rm_so = st; - pmatch.rm_eo = l->len; - + lastmatches = 0; + startm = m; + if (st > 0) + leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ for (i = 0; i < patterns; i++) { + pmatch.rm_so = st; + pmatch.rm_eo = l->len; if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], - l->dat, 1, &pmatch, eflags); + l->dat, 1, &pmatch, leflags); else r = regexec(&r_pattern[i], l->dat, 1, - &pmatch, eflags); + &pmatch, leflags); r = (r == 0) ? 0 : REG_NOMATCH; - st = (cflags & REG_NOSUB) - ? (size_t)l->len - : (size_t)pmatch.rm_eo; if (r == REG_NOMATCH) continue; /* Check for full match */ @@ -319,10 +323,26 @@ procline(struct str *l, int nottext) r = REG_NOMATCH; } if (r == 0) { + lastmatches++; + lastmatch = pmatch; if (m == 0) c++; - if (m < MAX_LINE_MATCHES) - matches[m++] = pmatch; + + if (m < MAX_LINE_MATCHES) { + /* Replace previous match if the new one is earlier and/or longer */ + if (m > startm) { + if (pmatch.rm_so < matches[m-1].rm_so || + (pmatch.rm_so == matches[m-1].rm_so && (pmatch.rm_eo - pmatch.rm_so) > (matches[m-1].rm_eo - matches[m-1].rm_so))) { + matches[m-1] = pmatch; + nst = pmatch.rm_eo; + } + } else { + /* Advance as normal if not */ + matches[m++] = pmatch; + nst = pmatch.rm_eo; + } + } + /* matches - skip further patterns */ if ((color == NULL && !oflag) || qflag || lflag) @@ -339,8 +359,19 @@ procline(struct str *l, int nottext) if (!wflag && ((color == NULL && !oflag) || qflag || lflag || Lflag)) break; - if (st == (size_t)pmatch.rm_so) - break; /* No matches */ + /* If we didn't have any matches or REG_NOSUB set */ + if (lastmatches == 0 || (cflags & REG_NOSUB)) + nst = l->len; + + if (lastmatches == 0) + /* No matches */ + break; + else if (st == nst && lastmatch.rm_so == lastmatch.rm_eo) + /* Zero-length match -- advance one more so we don't get stuck */ + nst++; + + /* Advance st based on previous matches */ + st = nst; } @@ -439,6 +470,10 @@ printline(struct str *line, int sep, regmatch_t *match size_t a = 0; int i, n = 0; + /* If matchall, everything matches but don't actually print for -o */ + if (oflag && matchall) + return; + if (!hflag) { if (!nullflag) { fputs(line->file, stdout); @@ -465,6 +500,9 @@ printline(struct str *line, int sep, regmatch_t *match /* --color and -o */ if ((oflag || color) && m > 0) { for (i = 0; i < m; i++) { + /* Don't output zero length matches */ + if (matches[i].rm_so == matches[i].rm_eo) + continue; if (!oflag) fwrite(line->dat + a, matches[i].rm_so - a, 1, stdout); From owner-svn-src-all@freebsd.org Wed Aug 16 00:20:00 2017 Return-Path: Delivered-To: svn-src-all@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 9486FDD7CB3; Wed, 16 Aug 2017 00:20:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 702D666366; Wed, 16 Aug 2017 00:20:00 +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 v7G0JxDF025967; Wed, 16 Aug 2017 00:19:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0JxQx025966; Wed, 16 Aug 2017 00:19:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160019.v7G0JxQx025966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322556 - stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Commit-Revision: 322556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:20:00 -0000 Author: kevans Date: Wed Aug 16 00:19:59 2017 New Revision: 322556 URL: https://svnweb.freebsd.org/changeset/base/322556 Log: MFC r316750 (ngie): Fix expectations for testcases per bsdgrep vs gnu grep The following failures occur with various versions of grep: BSD grep: - :context - :context2 GNU grep (base): - :color - :oflag_zerolen GNU grep (ports): - :recurse_symlink Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:12:22 2017 (r322555) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:19:59 2017 (r322556) @@ -69,6 +69,12 @@ recurse_symlink_head() } recurse_symlink_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_GNU ]; then + atf_expect_fail "this test doesn't pass with gnu grep from ports" + fi + # End FreeBSD mkdir -p test/c/d (cd test/c/d && ln -s ../d .) echo "Test string" > test/c/match @@ -153,6 +159,12 @@ context_head() } context_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test doesn't pass with BSD grep yet" + fi + # End FreeBSD cp $(atf_get_srcdir)/d_context_*.* . atf_check -o file:d_context_a.out grep -C2 bamboo d_context_a.in @@ -214,6 +226,12 @@ context2_head() } context2_body() { + # Begin FreeBSD + grep_type + if [ $? -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test doesn't pass with BSD grep yet" + fi + # End FreeBSD printf "haddock\000cod\000plaice\000" > test1 printf "mackeral\000cod\000crab\000" > test2 @@ -227,6 +245,38 @@ context2_body() grep -z -C1 cod test1 test2 } # Begin FreeBSD + +# What grep(1) are we working with? +# - 0 : bsdgrep +# - 1 : gnu grep 2.51 (base) +# - 2 : gnu grep (ports) +GREP_TYPE_BSD=0 +GREP_TYPE_GNU_FREEBSD=1 +GREP_TYPE_GNU=2 +GREP_TYPE_UNKNOWN=3 + +grep_type() +{ + local grep_version=$(grep --version) + + case "$grep_version" in + *"BSD grep"*) + return $GREP_TYPE_BSD + ;; + *"GNU grep"*) + case "$grep_version" in + *2.5.1-FreeBSD*) + return $GREP_TYPE_GNU_FREEBSD + ;; + *) + return $GREP_TYPE_GNU + ;; + esac + ;; + esac + atf_fail "unknown grep type: $grep_version" +} + atf_test_case oflag_zerolen oflag_zerolen_head() { @@ -234,6 +284,11 @@ oflag_zerolen_head() } oflag_zerolen_body() { + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test doesn't pass with gnu grep in base" + fi + atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_a.out" \ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_a.in" @@ -271,6 +326,11 @@ color_head() } color_body() { + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test doesn't pass with gnu grep in base" + fi + echo 'abcd*' > grepfile echo 'abc$' >> grepfile echo '^abc' >> grepfile From owner-svn-src-all@freebsd.org Wed Aug 16 00:24:00 2017 Return-Path: Delivered-To: svn-src-all@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 B175DDD8178; Wed, 16 Aug 2017 00:24:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 881E4667AA; Wed, 16 Aug 2017 00:24:00 +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 v7G0NxAi029803; Wed, 16 Aug 2017 00:23:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0NxG3029799; Wed, 16 Aug 2017 00:23:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160023.v7G0NxG3029799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322557 - in stable/11/usr.bin/grep: . regex X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/grep: . regex X-SVN-Commit-Revision: 322557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:24:00 -0000 Author: kevans Date: Wed Aug 16 00:23:59 2017 New Revision: 322557 URL: https://svnweb.freebsd.org/changeset/base/322557 Log: MFC r316492: bsdgrep(1): Rip out "xmalloc" bits xmalloc was a debug malloc implementation, but the x{malloc,calloc,free} functions default to calling the malloc(3) equivalents. Instead of relying on this malloc shim, we can devise better ways to debug malloc issues that aren't misleading upon initial inspection. (I.e., using jemalloc's various built-in debugging capabilities.) Approved by: emaste (mentor, blanket MFC) Deleted: stable/11/usr.bin/grep/regex/xmalloc.c stable/11/usr.bin/grep/regex/xmalloc.h Modified: stable/11/usr.bin/grep/Makefile stable/11/usr.bin/grep/regex/fastmatch.c stable/11/usr.bin/grep/regex/tre-compile.c stable/11/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/Makefile ============================================================================== --- stable/11/usr.bin/grep/Makefile Wed Aug 16 00:19:59 2017 (r322556) +++ stable/11/usr.bin/grep/Makefile Wed Aug 16 00:23:59 2017 (r322557) @@ -17,7 +17,7 @@ SRCS= file.c grep.c queue.c util.c # Extra files ported backported form some regex improvements .PATH: ${.CURDIR}/regex -SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c +SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c CFLAGS+=-I${.CURDIR}/regex CFLAGS.gcc+= --param max-inline-insns-single=500 Modified: stable/11/usr.bin/grep/regex/fastmatch.c ============================================================================== --- stable/11/usr.bin/grep/regex/fastmatch.c Wed Aug 16 00:19:59 2017 (r322556) +++ stable/11/usr.bin/grep/regex/fastmatch.c Wed Aug 16 00:23:59 2017 (r322557) @@ -34,7 +34,6 @@ #include #include "tre-fastmatch.h" -#include "xmalloc.h" int tre_fixncomp(fastmatch_t *preg, const char *regex, size_t n, int cflags) Modified: stable/11/usr.bin/grep/regex/tre-compile.c ============================================================================== --- stable/11/usr.bin/grep/regex/tre-compile.c Wed Aug 16 00:19:59 2017 (r322556) +++ stable/11/usr.bin/grep/regex/tre-compile.c Wed Aug 16 00:23:59 2017 (r322557) @@ -9,8 +9,6 @@ #include #include -#include "xmalloc.h" - int tre_convert_pattern(const char *regex, size_t n, tre_char_t **w, size_t *wn) @@ -19,7 +17,7 @@ tre_convert_pattern(const char *regex, size_t n, tre_c tre_char_t *wregex; size_t wlen; - wregex = xmalloc(sizeof(tre_char_t) * (n + 1)); + wregex = malloc(sizeof(tre_char_t) * (n + 1)); if (wregex == NULL) return REG_ESPACE; @@ -60,13 +58,13 @@ tre_convert_pattern(const char *regex, size_t n, tre_c consumed = 1; else { - xfree(wregex); + free(wregex); return REG_BADPAT; } break; case -1: DPRINT(("mbrtowc: error %d: %s.\n", errno, strerror(errno))); - xfree(wregex); + free(wregex); return REG_BADPAT; case -2: /* The last character wasn't complete. Let's not call it a @@ -98,6 +96,6 @@ void tre_free_pattern(tre_char_t *wregex) { #if TRE_WCHAR - xfree(wregex); + free(wregex); #endif } Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 00:19:59 2017 (r322556) +++ stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 00:23:59 2017 (r322557) @@ -42,7 +42,6 @@ #include "hashtable.h" #include "tre-fastmatch.h" -#include "xmalloc.h" static int fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type); @@ -53,9 +52,9 @@ static int fastcmp(const fastmatch_t *fg, const void * #define FAIL_COMP(errcode) \ { \ if (fg->pattern) \ - xfree(fg->pattern); \ + free(fg->pattern); \ if (fg->wpattern) \ - xfree(fg->wpattern); \ + free(fg->wpattern); \ if (fg->qsBc_table) \ hashtable_free(fg->qsBc_table); \ fg = NULL; \ @@ -92,7 +91,7 @@ static int fastcmp(const fastmatch_t *fg, const void * if (siz == (size_t)-1) \ return REG_BADPAT; \ fg->len = siz; \ - fg->pattern = xmalloc(siz + 1); \ + fg->pattern = malloc(siz + 1); \ if (fg->pattern == NULL) \ return REG_ESPACE; \ wcstombs(fg->pattern, fg->wpattern, siz); \ @@ -340,7 +339,7 @@ static int fastcmp(const fastmatch_t *fg, const void * #define FILL_BMGS \ if (!fg->hasdot) \ { \ - fg->sbmGs = xmalloc(fg->len * sizeof(int)); \ + fg->sbmGs = malloc(fg->len * sizeof(int)); \ if (!fg->sbmGs) \ return REG_ESPACE; \ if (fg->len == 1) \ @@ -356,7 +355,7 @@ static int fastcmp(const fastmatch_t *fg, const void * #define FILL_BMGS_WIDE \ if (!fg->hasdot) \ { \ - fg->bmGs = xmalloc(fg->wlen * sizeof(int)); \ + fg->bmGs = malloc(fg->wlen * sizeof(int)); \ if (!fg->bmGs) \ return REG_ESPACE; \ if (fg->wlen == 1) \ @@ -376,13 +375,13 @@ static int fastcmp(const fastmatch_t *fg, const void * { \ if (fg->icase) \ { \ - wp = xmalloc(plen * sizeof(tre_char_t)); \ + wp = malloc(plen * sizeof(tre_char_t)); \ if (wp == NULL) \ return REG_ESPACE; \ for (unsigned int i = 0; i < plen; i++) \ wp[i] = towlower(pat[i]); \ _CALC_BMGS(arr, wp, plen); \ - xfree(wp); \ + free(wp); \ } \ else \ _CALC_BMGS(arr, pat, plen); \ @@ -391,13 +390,13 @@ static int fastcmp(const fastmatch_t *fg, const void * { \ if (fg->icase) \ { \ - p = xmalloc(plen); \ + p = malloc(plen); \ if (p == NULL) \ return REG_ESPACE; \ for (unsigned int i = 0; i < plen; i++) \ p[i] = tolower((unsigned char)pat[i]); \ _CALC_BMGS(arr, p, plen); \ - xfree(p); \ + free(p); \ } \ else \ _CALC_BMGS(arr, pat, plen); \ @@ -408,7 +407,7 @@ static int fastcmp(const fastmatch_t *fg, const void * { \ int f = 0, g; \ \ - int *suff = xmalloc(plen * sizeof(int)); \ + int *suff = malloc(plen * sizeof(int)); \ if (suff == NULL) \ return REG_ESPACE; \ \ @@ -440,7 +439,7 @@ static int fastcmp(const fastmatch_t *fg, const void * for (unsigned int i = 0; i <= plen - 2; i++) \ arr[plen - 1 - suff[i]] = plen - 1 - i; \ \ - xfree(suff); \ + free(suff); \ } /* @@ -449,7 +448,7 @@ static int fastcmp(const fastmatch_t *fg, const void * */ #define SAVE_PATTERN(src, srclen, dst, dstlen) \ dstlen = srclen; \ - dst = xmalloc((dstlen + 1) * sizeof(tre_char_t)); \ + dst = malloc((dstlen + 1) * sizeof(tre_char_t)); \ if (dst == NULL) \ return REG_ESPACE; \ if (dstlen > 0) \ @@ -489,11 +488,11 @@ static int fastcmp(const fastmatch_t *fg, const void * if (n == 0) \ { \ fg->matchall = true; \ - fg->pattern = xmalloc(sizeof(char)); \ + fg->pattern = malloc(sizeof(char)); \ if (!fg->pattern) \ FAIL_COMP(REG_ESPACE); \ fg->pattern[0] = '\0'; \ - fg->wpattern = xmalloc(sizeof(tre_char_t)); \ + fg->wpattern = malloc(sizeof(tre_char_t)); \ if (!fg->wpattern) \ FAIL_COMP(REG_ESPACE); \ fg->wpattern[0] = TRE_CHAR('\0'); \ @@ -580,7 +579,7 @@ tre_compile_fast(fastmatch_t *fg, const tre_char_t *pa if (fg->word && (TRE_MB_CUR_MAX > 1)) return REG_BADPAT; - tmp = xmalloc((n + 1) * sizeof(tre_char_t)); + tmp = malloc((n + 1) * sizeof(tre_char_t)); if (tmp == NULL) return REG_ESPACE; @@ -631,10 +630,10 @@ tre_compile_fast(fastmatch_t *fg, const tre_char_t *pa if (escaped) { if (!_escmap) - _escmap = xmalloc(n * sizeof(bool)); + _escmap = malloc(n * sizeof(bool)); if (!_escmap) { - xfree(tmp); + free(tmp); return REG_ESPACE; } _escmap[i] = true; @@ -688,7 +687,7 @@ tre_compile_fast(fastmatch_t *fg, const tre_char_t *pa } continue; badpat: - xfree(tmp); + free(tmp); DPRINT(("tre_compile_fast: compilation of pattern failed, falling" "back to NFA\n")); return REG_BADPAT; @@ -715,7 +714,7 @@ badpat: { if (fg->wescmap != NULL) { - fg->escmap = xmalloc(fg->len * sizeof(bool)); + fg->escmap = malloc(fg->len * sizeof(bool)); if (!fg->escmap) { tre_free_fast(fg); @@ -746,7 +745,7 @@ badpat: fg->escmap = _escmap; #endif - xfree(tmp); + free(tmp); DPRINT(("tre_compile_fast: pattern: %s, len %zu, bol %c, eol %c, " "icase: %c, word: %c, newline %c\n", fg->pattern, fg->len, @@ -977,16 +976,16 @@ tre_free_fast(fastmatch_t *fg) #ifdef TRE_WCHAR hashtable_free(fg->qsBc_table); if (!fg->hasdot) - xfree(fg->bmGs); + free(fg->bmGs); if (fg->wescmap) - xfree(fg->wescmap); - xfree(fg->wpattern); + free(fg->wescmap); + free(fg->wpattern); #endif if (!fg->hasdot) - xfree(fg->sbmGs); + free(fg->sbmGs); if (fg->escmap) - xfree(fg->escmap); - xfree(fg->pattern); + free(fg->escmap); + free(fg->pattern); } /* From owner-svn-src-all@freebsd.org Wed Aug 16 00:40:15 2017 Return-Path: Delivered-To: svn-src-all@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 1CFB2DD912B; Wed, 16 Aug 2017 00:40:15 +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 E048C66EE3; Wed, 16 Aug 2017 00:40:14 +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 v7G0eEoM034110; Wed, 16 Aug 2017 00:40:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0eEN4034109; Wed, 16 Aug 2017 00:40:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160040.v7G0eEN4034109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322558 - stable/11/usr.bin/grep/regex X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep/regex X-SVN-Commit-Revision: 322558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:40:15 -0000 Author: kevans Date: Wed Aug 16 00:40:13 2017 New Revision: 322558 URL: https://svnweb.freebsd.org/changeset/base/322558 Log: MFC r316495: bsdgrep(1): Fix errors with invalid expressions Invalid expressions with an ultimate compiled pattern length of 0 (e.g., "grep -E {") were not taken into account and caused a segfault while trying to fill in the good suffix table. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 00:23:59 2017 (r322557) +++ stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 00:40:13 2017 (r322558) @@ -337,7 +337,7 @@ static int fastcmp(const fastmatch_t *fg, const void * * Fills in the good suffix table for SB/MB strings. */ #define FILL_BMGS \ - if (!fg->hasdot) \ + if (fg->len > 0 && !fg->hasdot) \ { \ fg->sbmGs = malloc(fg->len * sizeof(int)); \ if (!fg->sbmGs) \ @@ -353,7 +353,7 @@ static int fastcmp(const fastmatch_t *fg, const void * * Fills in the good suffix table for wide strings. */ #define FILL_BMGS_WIDE \ - if (!fg->hasdot) \ + if (fg->wlen > 0 && !fg->hasdot) \ { \ fg->bmGs = malloc(fg->wlen * sizeof(int)); \ if (!fg->bmGs) \ From owner-svn-src-all@freebsd.org Wed Aug 16 00:42:53 2017 Return-Path: Delivered-To: svn-src-all@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 16712DD957C; Wed, 16 Aug 2017 00:42:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6A27672BC; Wed, 16 Aug 2017 00:42:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7G0gqf3037746; Wed, 16 Aug 2017 00:42:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0gqZM037745; Wed, 16 Aug 2017 00:42:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160042.v7G0gqZM037745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322559 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:42:53 -0000 Author: kevans Date: Wed Aug 16 00:42:51 2017 New Revision: 322559 URL: https://svnweb.freebsd.org/changeset/base/322559 Log: MFC r316542: bsdgrep: Handle special case of single-byte NUL pattern PR: 202022 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/grep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 00:40:13 2017 (r322558) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 00:42:51 2017 (r322559) @@ -315,8 +315,12 @@ read_patterns(const char *fn) } len = 0; line = NULL; - while ((rlen = getline(&line, &len, f)) != -1) + while ((rlen = getline(&line, &len, f)) != -1) { + if (line[0] == '\0') + continue; add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen); + } + free(line); if (ferror(f)) err(2, "%s", fn); From owner-svn-src-all@freebsd.org Wed Aug 16 00:47:55 2017 Return-Path: Delivered-To: svn-src-all@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 CA6CADD9983; Wed, 16 Aug 2017 00:47:55 +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 9564E674A0; Wed, 16 Aug 2017 00:47:55 +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 v7G0lsJR038014; Wed, 16 Aug 2017 00:47:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0lrwM037998; Wed, 16 Aug 2017 00:47:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160047.v7G0lrwM037998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322560 - in stable/11/usr.bin/grep: . nls X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/grep: . nls X-SVN-Commit-Revision: 322560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:47:55 -0000 Author: kevans Date: Wed Aug 16 00:47:53 2017 New Revision: 322560 URL: https://svnweb.freebsd.org/changeset/base/322560 Log: bsdgrep: add -z/--null-data support and update NLS catalogs accordingly MFC r317049: bsdgrep: add -z/--null-data support -z treats input and output data as sequences of lines terminated by a zero byte instead of a newline. This brings it more in line with GNU grep and brings us closer to passing the current tests with BSD grep. MFC r317679: bsdgrep: correct nls usage data after r317049 r317049 added -z/--null-data to BSD grep but missed the update to nls catalogs. Approved by: emaste (mentor, blanket MFC) Relnotes: yes Modified: stable/11/usr.bin/grep/file.c stable/11/usr.bin/grep/grep.1 stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/nls/C.msg stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/file.c ============================================================================== --- stable/11/usr.bin/grep/file.c Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/file.c Wed Aug 16 00:47:53 2017 (r322560) @@ -197,7 +197,7 @@ grep_fgetln(struct file *f, size_t *lenp) } /* Look for a newline in the remaining part of the buffer */ - if ((p = memchr(bufpos, '\n', bufrem)) != NULL) { + if ((p = memchr(bufpos, fileeol, bufrem)) != NULL) { ++p; /* advance over newline */ ret = bufpos; len = p - bufpos; @@ -219,7 +219,7 @@ grep_fgetln(struct file *f, size_t *lenp) if (bufrem == 0) /* EOF: return partial line */ break; - if ((p = memchr(bufpos, '\n', bufrem)) == NULL && + if ((p = memchr(bufpos, fileeol, bufrem)) == NULL && filebehave != FILE_MMAP) continue; if (p == NULL) { @@ -322,7 +322,8 @@ grep_open(const char *path) goto error2; /* Check for binary stuff, if necessary */ - if (binbehave != BINFILE_TEXT && memchr(bufpos, '\0', bufrem) != NULL) + if (binbehave != BINFILE_TEXT && fileeol != '\0' && + memchr(bufpos, '\0', bufrem) != NULL) f->binary = true; return (f); Modified: stable/11/usr.bin/grep/grep.1 ============================================================================== --- stable/11/usr.bin/grep/grep.1 Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/grep.1 Wed Aug 16 00:47:53 2017 (r322560) @@ -30,7 +30,7 @@ .\" .\" @(#)grep.1 8.3 (Berkeley) 4/18/94 .\" -.Dd July 28, 2010 +.Dd April 17, 2017 .Dt GREP 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm grep .Bk -words -.Op Fl abcdDEFGHhIiJLlmnOopqRSsUVvwxZ +.Op Fl abcdDEFGHhIiJLlmnOopqRSsUVvwxZz .Op Fl A Ar num .Op Fl B Ar num .Op Fl C Ns Op Ar num @@ -378,7 +378,10 @@ expression are considered to be matching lines. Equivalent to .Fl i . Obsoleted. -.It Fl Z , Fl z , Fl Fl decompress +.It Fl z , Fl Fl null-data +Treat input and output data as sequences of lines terminated by a +zero-byte instead of a newline. +.It Fl Z , Fl Fl decompress Force .Nm grep to behave as Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 00:47:53 2017 (r322560) @@ -67,7 +67,7 @@ const char *errstr[] = { /* 1*/ "(standard input)", /* 2*/ "cannot read bzip2 compressed file", /* 3*/ "unknown %s option", -/* 4*/ "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n", +/* 4*/ "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n", /* 5*/ "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n", /* 6*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n", /* 7*/ "\t[--null] [pattern] [file ...]\n", @@ -110,6 +110,7 @@ bool lflag; /* -l: only show names of files with mat bool mflag; /* -m x: stop reading the files after x matches */ long long mcount; /* count for -m */ long long mlimit; /* requested value for -m */ +char fileeol; /* indicator for eol */ bool nflag; /* -n: show line numbers in front of matching lines */ bool oflag; /* -o: print only matching part */ bool qflag; /* -q: quiet mode (don't output anything) */ @@ -166,7 +167,7 @@ usage(void) exit(2); } -static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy"; +static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXyz"; static const struct option long_options[] = { @@ -216,6 +217,7 @@ static const struct option long_options[] = {"word-regexp", no_argument, NULL, 'w'}, {"line-regexp", no_argument, NULL, 'x'}, {"xz", no_argument, NULL, 'X'}, + {"null-data", no_argument, NULL, 'z'}, {"decompress", no_argument, NULL, 'Z'}, {NULL, no_argument, NULL, 0} }; @@ -385,6 +387,7 @@ main(int argc, char *argv[]) newarg = 1; prevoptind = 1; needpattern = 1; + fileeol = '\n'; eopts = getenv("GREP_OPTIONS"); @@ -605,6 +608,9 @@ main(int argc, char *argv[]) break; case 'X': filebehave = FILE_XZ; + break; + case 'z': + fileeol = '\0'; break; case 'Z': filebehave = FILE_GZIP; Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/grep.h Wed Aug 16 00:47:53 2017 (r322560) @@ -116,6 +116,7 @@ extern bool dexclude, dinclude, fexclude, finclude, l extern unsigned long long Aflag, Bflag; extern long long mcount; extern long long mlimit; +extern char fileeol; extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; Modified: stable/11/usr.bin/grep/nls/C.msg ============================================================================== --- stable/11/usr.bin/grep/nls/C.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/C.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(standard input)" 2 "cannot read bzip2 compressed file" 3 "unknown %s option" -4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" +4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n" 5 "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n" 6 "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n" 7 "\t[--null] [pattern] [file ...]\n" Modified: stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(entrada estándar)" 2 "no se puede leer el fichero comprimido bzip2" 3 "opción desconocida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n" 5 "\t[-e pauta] [-f fichero] [--binary-files=valor] [--color=cuando]\n" 6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n" 7 "\t[--null] [pauta] [fichero ...]\n" Modified: stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(entrada estándar)" 2 "non se pode ler o ficheiro comprimido bzip2" 3 "opción descoñecida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n" 5 "\t[-e pauta] [-f ficheiro] [--binary-files=valor] [--color=cando]\n" 6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n" 7 "\t[--null] [pauta] [ficheiro ...]\n" Modified: stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg ============================================================================== --- stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(szabványos bemenet)" 2 "bzip2 tömörített fájl nem olvasható" 3 "ismeretlen %s opció" -4 "használat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A szám] [-B szám] [-C[szám]]\n" +4 "használat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A szám] [-B szám] [-C[szám]]\n" 5 "\t[-e minta] [-f fájl] [--binary-files=érték] [--color=mikor]\n" 6 "\t[--context[=szám]] [--directories=mûvelet] [--label] [--line-buffered]\n" 7 "\t[--null] [minta] [fájl ...]\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(•W€“ü—Í)" 2 "bzip2 ˆ³kƒtƒ@ƒCƒ‹‚ð“Ç‚Ýž‚Þ‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ" 3 "%s ƒIƒvƒVƒ‡ƒ“‚ÌŽw’è’l‚ÉŒë‚肪‚ ‚è‚Ü‚·" -4 "Žg‚¢•û: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ”Žš] [-B ”Žš] [-C[”Žš]]\n" +4 "Žg‚¢•û: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ”Žš] [-B ”Žš] [-C[”Žš]]\n" 5 "\t[-e ƒpƒ^[ƒ“] [-f ƒtƒ@ƒCƒ‹–¼] [--binary-files=’l] [--color=’l]\n" 6 "\t[--context[=”Žš]] [--directories=“®ì] [--label] [--line-buffered]\n" 7 "\t[--null] [ƒpƒ^[ƒ“] [ƒtƒ@ƒCƒ‹–¼ ...]\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(標準入力)" 2 "bzip2 圧縮ファイルを読ã¿è¾¼ã‚€ã“ã¨ãŒã§ãã¾ã›ã‚“" 3 "%s オプションã®æŒ‡å®šå€¤ã«èª¤ã‚ŠãŒã‚ã‚Šã¾ã™" -4 "使ã„æ–¹: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A æ•°å­—] [-B æ•°å­—] [-C[æ•°å­—]]\n" +4 "使ã„æ–¹: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A æ•°å­—] [-B æ•°å­—] [-C[æ•°å­—]]\n" 5 "\t[-e パターン] [-f ファイルå] [--binary-files=値] [--color=値]\n" 6 "\t[--context[=æ•°å­—]] [--directories=動作] [--label] [--line-buffered]\n" 7 "\t[--null] [パターン] [ファイルå ...]\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(ɸ½àÆþÎÏ)" 2 "bzip2 °µ½Ì¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" 3 "%s ¥ª¥×¥·¥ç¥ó¤Î»ØÄêÃͤ˸í¤ê¤¬¤¢¤ê¤Þ¤¹" -4 "»È¤¤Êý: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ¿ô»ú] [-B ¿ô»ú] [-C[¿ô»ú]]\n" +4 "»È¤¤Êý: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ¿ô»ú] [-B ¿ô»ú] [-C[¿ô»ú]]\n" 5 "\t[-e ¥Ñ¥¿¡¼¥ó] [-f ¥Õ¥¡¥¤¥ë̾] [--binary-files=ÃÍ] [--color=ÃÍ]\n" 6 "\t[--context[=¿ô»ú]] [--directories=Æ°ºî] [--label] [--line-buffered]\n" 7 "\t[--null] [¥Ñ¥¿¡¼¥ó] [¥Õ¥¡¥¤¥ë̾ ...]\n" Modified: stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(entrada padrão)" 2 "não se posso ler o fichero comprimido bzip2" 3 "opcão não conhecida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n" 5 "\t[-e padrão] [-f arquivo] [--binary-files=valor] [--color=quando]\n" 6 "\t[--context[=num]] [--directories=ação] [--label] [--line-buffered]\n" 7 "\t[--null] [padrão] [arquivo ...]\n" Modified: stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(ÓÔÁÎÄÁÒÔÎÙÊ ××ÏÄ)" 2 "ÎÅ ÍÏÇÕ ÐÒÏÞÉÔÁÔØ ÓÖÁÔÙÊ × bzip2 ÆÁÊÌ" 3 "ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ %s" -4 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ÞÉÓ] [-B ÞÉÓ] [-C[ÞÉÓ]]\n" +4 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ÞÉÓ] [-B ÞÉÓ] [-C[ÞÉÓ]]\n" 5 "\t[-e ÛÁÂÌÏÎ] [-f ÆÁÊÌ] [--binary-files=ÚÎÁÞÅÎÉÅ] [--color=ËÏÇÄÁ]\n" 6 "\t[--context[=ÞÉÓ]] [--directories=ÄÅÊÓÔ×ÉÅ] [--label] [--line-buffered]\n" 7 "\t[--null] [ÛÁÂÌÏÎ] [ÆÁÊÌ ...]\n" Modified: stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -4,7 +4,7 @@ $quote " 1 "(Ñтандартний ввід)" 2 "не можу прочитати ÑтиÑнутий bzip2 файл" 3 "невiдома Ð¾Ð¿Ñ†Ñ–Ñ %s" -4 "викориÑтаннÑ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A чиÑ] [-B чиÑ] [-C[чиÑ]]\n" +4 "викориÑтаннÑ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A чиÑ] [-B чиÑ] [-C[чиÑ]]\n" 5 "\t[-e шаблон] [-f файл] [--binary-files=значеннÑ] [--color=коли]\n" 6 "\t[--context[=чиÑ] [--directories=діÑ] [--label] [--line-buffered]\n" 7 "\t[--null] [шаблон] [файл ...]\n" Modified: stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg Wed Aug 16 00:47:53 2017 (r322560) @@ -5,7 +5,7 @@ $quote " 1 "(标准输入)" 2 "è¯»å– bzip2 压缩文件时出错" 3 "选项 %s 无法识别" -4 "用法: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A 行数] [-B 行数] [-C[行数]]\n" +4 "用法: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A 行数] [-B 行数] [-C[行数]]\n" 5 "\t[-e 模å¼] [-f 文件] [--binary-files=值] [--color=何时]\n" 6 "\t[--context[=行数]] [--directories=动作] [--label] [--line-buffered]\n" 7 "\t[--null] [模å¼] [文件å ...]\n" Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 00:42:51 2017 (r322559) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 00:47:53 2017 (r322560) @@ -216,7 +216,7 @@ procfile(const char *fn) else break; } - if (ln.len > 0 && ln.dat[ln.len - 1] == '\n') + if (ln.len > 0 && ln.dat[ln.len - 1] == fileeol) --ln.len; ln.line_no++; @@ -525,6 +525,6 @@ printline(struct str *line, int sep, regmatch_t *match } } else { fwrite(line->dat, line->len, 1, stdout); - putchar('\n'); + putchar(fileeol); } } From owner-svn-src-all@freebsd.org Wed Aug 16 00:55:58 2017 Return-Path: Delivered-To: svn-src-all@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 246D5DDA183; Wed, 16 Aug 2017 00:55:58 +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 EFC226799B; Wed, 16 Aug 2017 00:55:57 +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 v7G0tu6A042079; Wed, 16 Aug 2017 00:55:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G0tun2042078; Wed, 16 Aug 2017 00:55:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160055.v7G0tun2042078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 00:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322561 - stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Commit-Revision: 322561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 00:55:58 -0000 Author: kevans Date: Wed Aug 16 00:55:56 2017 New Revision: 322561 URL: https://svnweb.freebsd.org/changeset/base/322561 Log: bsdgrep: Revise tests based on recent fixes and future changes MFC r317297: Remove the expected failures for :context and :context2 with bsdgrep(1) They're no longer needed after recent fixes made to bsdgrep(1). MFC r317299: Add more sanity tests for grep, egrep, and fgrep The test suite currently lacks basic sanity checks to ensure that egrep, fgrep, and grep are actually matching the right expression types, i.e. passing the right flags to regcomp(3). Amend the test suite to make sure that not only are the individual versions doing the right thing, but also that we don't have some kind of frankenregex situation happening where egrep is accepting a BRE or grep an ERE. I've chosen to not expand the 'basic' test but to add the 'grep_sanity' checks to their own test case since this is testing for more than just 'grep matches things', but actual expression types. MFC r317694: bsdgrep: revise test case which will soon become a failure Work in progress (D10315) is going to make egrep_empty_invalid an actually invalid regex, to be consistent with the equivalent BRE "{" behavior, when using regex(3). Any non-0 exit value is acceptable, depending on how the installed grep interprets the expression. GNU grep interprets it as non-matching, and in the future BSD grep will interpret it is an error. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:47:53 2017 (r322560) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 00:55:56 2017 (r322561) @@ -159,12 +159,6 @@ context_head() } context_body() { - # Begin FreeBSD - grep_type - if [ $? -eq $GREP_TYPE_BSD ]; then - atf_expect_fail "this test doesn't pass with BSD grep yet" - fi - # End FreeBSD cp $(atf_get_srcdir)/d_context_*.* . atf_check -o file:d_context_a.out grep -C2 bamboo d_context_a.in @@ -226,12 +220,6 @@ context2_head() } context2_body() { - # Begin FreeBSD - grep_type - if [ $? -eq $GREP_TYPE_BSD ]; then - atf_expect_fail "this test doesn't pass with BSD grep yet" - fi - # End FreeBSD printf "haddock\000cod\000plaice\000" > test1 printf "mackeral\000cod\000crab\000" > test2 @@ -375,7 +363,7 @@ egrep_empty_invalid_head() } egrep_empty_invalid_body() { - atf_check -s exit:1 egrep '{' /dev/null + atf_check -e ignore -s not-exit:0 egrep '{' /dev/null } atf_test_case zerolen @@ -391,6 +379,66 @@ zerolen_body() atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1 } + +atf_test_case fgrep_sanity +fgrep_sanity_head() +{ + atf_set "descr" "Check for fgrep sanity, literal expressions only" +} +fgrep_sanity_body() +{ + printf "Foo" > test1 + + atf_check -o inline:"Foo\n" fgrep -e "Foo" test1 + + atf_check -s exit:1 -o empty fgrep -e "Fo." test1 +} + +atf_test_case egrep_sanity +egrep_sanity_head() +{ + atf_set "descr" "Check for egrep sanity, EREs only" +} +egrep_sanity_body() +{ + printf "Foobar(ed)" > test1 + printf "M{1}" > test2 + + atf_check -o inline:"Foo\n" egrep -o -e "F.." test1 + + atf_check -o inline:"Foobar\n" egrep -o -e "F[a-z]*" test1 + + atf_check -o inline:"Fo\n" egrep -o -e "F(o|p)" test1 + + atf_check -o inline:"(ed)\n" egrep -o -e "\(ed\)" test1 + + atf_check -o inline:"M\n" egrep -o -e "M{1}" test2 + + atf_check -o inline:"M{1}\n" egrep -o -e "M\{1\}" test2 +} + +atf_test_case grep_sanity +grep_sanity_head() +{ + atf_set "descr" "Check for basic grep sanity, BREs only" +} +grep_sanity_body() +{ + printf "Foobar(ed)" > test1 + printf "M{1}" > test2 + + atf_check -o inline:"Foo\n" grep -o -e "F.." test1 + + atf_check -o inline:"Foobar\n" grep -o -e "F[a-z]*" test1 + + atf_check -o inline:"Fo\n" grep -o -e "F\(o\)" test1 + + atf_check -o inline:"(ed)\n" grep -o -e "(ed)" test1 + + atf_check -o inline:"M{1}\n" grep -o -e "M{1}" test2 + + atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2 +} # End FreeBSD atf_init_test_cases() @@ -419,5 +467,8 @@ atf_init_test_cases() atf_add_test_case escmap atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen + atf_add_test_case fgrep_sanity + atf_add_test_case egrep_sanity + atf_add_test_case grep_sanity # End FreeBSD } From owner-svn-src-all@freebsd.org Wed Aug 16 01:03:05 2017 Return-Path: Delivered-To: svn-src-all@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 86C23DDA8B7; Wed, 16 Aug 2017 01:03:05 +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 61CA867E3E; Wed, 16 Aug 2017 01:03:05 +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 v7G134O9046028; Wed, 16 Aug 2017 01:03:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G134AS046027; Wed, 16 Aug 2017 01:03:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160103.v7G134AS046027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 01:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322562 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 01:03:05 -0000 Author: kevans Date: Wed Aug 16 01:03:04 2017 New Revision: 322562 URL: https://svnweb.freebsd.org/changeset/base/322562 Log: MFC r317051: bsdgrep: remove output separators between overlapping segments Make bsdgrep more sensitive to context overlaps. If it's printing context that either overlaps or is immediately adjacent to another bit of context, don't print a separator. - Non-overlapping segments no longer have two separators between them - Overlapping segments no longer have separators between them with overlapping sections repeated Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 00:55:56 2017 (r322561) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 01:03:04 2017 (r322562) @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); static int linesqueued; static int procline(struct str *l, int); +static int lasta; +static bool ctxover; + bool file_matching(const char *fname) { @@ -204,8 +207,10 @@ procfile(const char *fn) strcpy(ln.file, fn); ln.line_no = 0; ln.len = 0; + ctxover = false; linesqueued = 0; tail = 0; + lasta = 0; ln.off = -1; for (c = 0; c == 0 || !(lflag || qflag); ) { @@ -227,10 +232,24 @@ procfile(const char *fn) free(f); return (0); } - /* Process the file line-by-line */ + + /* Process the file line-by-line, enqueue non-matching lines */ if ((t = procline(&ln, f->binary)) == 0 && Bflag > 0) { - enqueue(&ln); - linesqueued++; + /* Except don't enqueue lines that appear in -A ctx */ + if (ln.line_no == 0 || lasta != ln.line_no) { + /* queue is maxed to Bflag number of lines */ + enqueue(&ln); + linesqueued++; + ctxover = false; + } else { + /* + * Indicate to procline() that we have ctx + * overlap and make sure queue is empty. + */ + if (!ctxover) + clearqueue(); + ctxover = true; + } } c += t; if (mflag && mcount <= 0) @@ -385,17 +404,19 @@ procline(struct str *l, int nottext) /* Dealing with the context */ if ((tail || c) && !cflag && !qflag && !lflag && !Lflag) { if (c) { - if (!first && !prev && !tail && Aflag) + if (!first && !prev && !tail && (Bflag || Aflag) && + !ctxover) printf("--\n"); tail = Aflag; if (Bflag > 0) { - if (!first && !prev) - printf("--\n"); printqueue(); + ctxover = false; } linesqueued = 0; printline(l, ':', matches, m); } else { + /* Print -A lines following matches */ + lasta = l->line_no; printline(l, '-', matches, m); tail--; } From owner-svn-src-all@freebsd.org Wed Aug 16 01:45:54 2017 Return-Path: Delivered-To: svn-src-all@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 A38C5DDD72B; Wed, 16 Aug 2017 01:45:54 +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 7FFEA69D3E; Wed, 16 Aug 2017 01:45:54 +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 v7G1jrLa062483; Wed, 16 Aug 2017 01:45:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G1jrLW062479; Wed, 16 Aug 2017 01:45:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708160145.v7G1jrLW062479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 01:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322564 - in stable/11/usr.bin/grep: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/grep: . tests X-SVN-Commit-Revision: 322564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 01:45:54 -0000 Author: kevans Date: Wed Aug 16 01:45:53 2017 New Revision: 322564 URL: https://svnweb.freebsd.org/changeset/base/322564 Log: bsdgrep: Use implied working directory for -r if no directories are passed MFC r317050: bsdgrep: for -r, use the working directory if none specified This is more sensible than the previous behaviour of grepping stdin, and matches newer GNU grep behaviour. MFC r317300 (ngie): Only expect :grep_r_implied to pass with bsdgrep(1) The test fails with gnu grep from base and ports. MFC r319002 (ngie): :rgrep : use atf-check to check the exit code/save the output of grep -r instead of calling grep -r without it, and saving the output to a file This ensures that any errors thrown via grep -r are caught, not lost, and uses existing atf-sh idioms for saving files. PR: 216307 Approved by: emaste (mentor, blanket MFC) Relnotes: yes Added: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh - copied, changed from r317050, head/usr.bin/grep/tests/grep_freebsd_test.sh Modified: stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/tests/Makefile stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 01:27:48 2017 (r322563) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 01:45:53 2017 (r322564) @@ -739,7 +739,7 @@ main(int argc, char *argv[]) if ((aargc == 0 || aargc == 1) && !Hflag) hflag = true; - if (aargc == 0) + if (aargc == 0 && dirbehave != DIR_RECURSE) exit(!procfile("-")); if (dirbehave == DIR_RECURSE) Modified: stable/11/usr.bin/grep/tests/Makefile ============================================================================== --- stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 01:27:48 2017 (r322563) +++ stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 01:45:53 2017 (r322564) @@ -2,6 +2,7 @@ PACKAGE= tests +ATF_TESTS_SH+= grep_freebsd_test NETBSD_ATF_TESTS_SH= grep_test ${PACKAGE}FILES+= d_basic.out Copied and modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh (from r317050, head/usr.bin/grep/tests/grep_freebsd_test.sh) ============================================================================== --- head/usr.bin/grep/tests/grep_freebsd_test.sh Mon Apr 17 13:22:39 2017 (r317050, copy source) +++ stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Wed Aug 16 01:45:53 2017 (r322564) @@ -25,11 +25,45 @@ # # $FreeBSD$ +# What grep(1) are we working with? +# - 0 : bsdgrep +# - 1 : gnu grep 2.51 (base) +# - 2 : gnu grep (ports) +GREP_TYPE_BSD=0 +GREP_TYPE_GNU_FREEBSD=1 +GREP_TYPE_GNU=2 +GREP_TYPE_UNKNOWN=3 + +grep_type() +{ + local grep_version=$(grep --version) + + case "$grep_version" in + *"BSD grep"*) + return $GREP_TYPE_BSD + ;; + *"GNU grep"*) + case "$grep_version" in + *2.5.1-FreeBSD*) + return $GREP_TYPE_GNU_FREEBSD + ;; + *) + return $GREP_TYPE_GNU + ;; + esac + ;; + esac + atf_fail "unknown grep type: $grep_version" +} + atf_test_case grep_r_implied grep_r_implied_body() { - (cd "$(atf_get_srcdir)" && grep -r -e "test" < /dev/null) || - atf_skip "Implied working directory is not supported with your version of grep(1)" + grep_type + if [ $? -ne $GREP_TYPE_BSD ]; then + atf_skip "this test only works with bsdgrep(1)" + fi + (cd "$(atf_get_srcdir)" && grep -r --exclude="*.out" -e "test" .) > d_grep_r_implied.out atf_check -s exit:0 -x \ @@ -43,8 +77,7 @@ rgrep_head() } rgrep_body() { - grep -r --exclude="*.out" -e "test" "$(atf_get_srcdir)" > d_grep_r_implied.out - + atf_check -o save:d_grep_r_implied.out grep -r --exclude="*.out" -e "test" "$(atf_get_srcdir)" atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e "test" "$(atf_get_srcdir)" } Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 01:27:48 2017 (r322563) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 01:45:53 2017 (r322564) @@ -109,6 +109,7 @@ grep_tree(char **argv) FTSENT *p; int c, fts_flags; bool ok; + const char *wd[] = { ".", NULL }; c = fts_flags = 0; @@ -126,7 +127,9 @@ grep_tree(char **argv) fts_flags |= FTS_NOSTAT | FTS_NOCHDIR; - if (!(fts = fts_open(argv, fts_flags, NULL))) + fts = fts_open((argv[0] == NULL) ? + __DECONST(char * const *, wd) : argv, fts_flags, NULL); + if (fts == NULL) err(2, "fts_open"); while ((p = fts_read(fts)) != NULL) { switch (p->fts_info) { From owner-svn-src-all@freebsd.org Wed Aug 16 05:02:32 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 05:51:06 2017 Return-Path: Delivered-To: svn-src-all@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 63C25DC6CAE; Wed, 16 Aug 2017 05:51:06 +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 3053D7135F; Wed, 16 Aug 2017 05:51:06 +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 v7G5p5VL062896; Wed, 16 Aug 2017 05:51:05 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G5p5bi062895; Wed, 16 Aug 2017 05:51:05 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708160551.v7G5p5bi062895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 16 Aug 2017 05:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322566 - stable/10/sys/geom/journal X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sys/geom/journal X-SVN-Commit-Revision: 322566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 05:51:06 -0000 Author: mckusick Date: Wed Aug 16 05:51:05 2017 New Revision: 322566 URL: https://svnweb.freebsd.org/changeset/base/322566 Log: Correct compile error triggered in nanobsd i386 by 322513 (MFC of 322178) Reported by: Li-Wen Hsu Fix by: kib Approved by: re (delphij) Modified: stable/10/sys/geom/journal/g_journal.c Modified: stable/10/sys/geom/journal/g_journal.c ============================================================================== --- stable/10/sys/geom/journal/g_journal.c Wed Aug 16 05:02:31 2017 (r322565) +++ stable/10/sys/geom/journal/g_journal.c Wed Aug 16 05:51:05 2017 (r322566) @@ -133,7 +133,7 @@ SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CT static u_long g_journal_cache_used = 0; static u_long g_journal_cache_limit = 64 * 1024 * 1024; -TUNABLE_INT("kern.geom.journal.cache.limit", &g_journal_cache_limit); +TUNABLE_LONG("kern.geom.journal.cache.limit", &g_journal_cache_limit); static u_int g_journal_cache_divisor = 2; TUNABLE_INT("kern.geom.journal.cache.divisor", &g_journal_cache_divisor); static u_int g_journal_cache_switch = 90; From owner-svn-src-all@freebsd.org Wed Aug 16 06:33:49 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 07:59:59 2017 Return-Path: Delivered-To: svn-src-all@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 55EDADCBD59; Wed, 16 Aug 2017 07:59:59 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3195474A5B; Wed, 16 Aug 2017 07:59:59 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7G7xwx8012976; Wed, 16 Aug 2017 07:59:58 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G7xw0b012972; Wed, 16 Aug 2017 07:59:58 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201708160759.v7G7xw0b012972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Wed, 16 Aug 2017 07:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322569 - in stable/11/sys/amd64: amd64 include linux X-SVN-Group: stable-11 X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: in stable/11/sys/amd64: amd64 include linux X-SVN-Commit-Revision: 322569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 07:59:59 -0000 Author: truckman Date: Wed Aug 16 07:59:57 2017 New Revision: 322569 URL: https://svnweb.freebsd.org/changeset/base/322569 Log: MFC r321899 Lower the amd64 shared page, which contains the signal trampoline, from the top of user memory to one page lower on machines with the Ryzen (AMD Family 17h) CPU. This pushes ps_strings and the stack down by one page as well. On Ryzen there is some sort of interaction between code running at the top of user memory address space and interrupts that can cause FreeBSD to either hang or silently reset. This sounds similar to the problem found with DragonFly BSD that was fixed with this commit: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/b48dd28447fc8ef62fbc963accd301557fd9ac20 but our signal trampoline location was already lower than the address that DragonFly moved their signal trampoline to. It also does not appear to be related to SMT as described here: https://www.phoronix.com/forums/forum/hardware/processors-memory/955368-some-ryzen-linux-users-are-facing-issues-with-heavy-compilation-loads?p=955498#post955498 "Hi, Matt Dillon here. Yes, I did find what I believe to be a hardware issue with Ryzen related to concurrent operations. In a nutshell, for any given hyperthread pair, if one hyperthread is in a cpu-bound loop of any kind (can be in user mode), and the other hyperthread is returning from an interrupt via IRETQ, the hyperthread issuing the IRETQ can stall indefinitely until the other hyperthread with the cpu-bound loop pauses (aka HLT until next interrupt). After this situation occurs, the system appears to destabilize. The situation does not occur if the cpu-bound loop is on a different core than the core doing the IRETQ. The %rip the IRETQ returns to (e.g. userland %rip address) matters a *LOT*. The problem occurs more often with high %rip addresses such as near the top of the user stack, which is where DragonFly's signal trampoline traditionally resides. So a user program taking a signal on one thread while another thread is cpu-bound can cause this behavior. Changing the location of the signal trampoline makes it more difficult to reproduce the problem. I have not been because the able to completely mitigate it. When a cpu-thread stalls in this manner it appears to stall INSIDE the microcode for IRETQ. It doesn't make it to the return pc, and the cpu thread cannot take any IPIs or other hardware interrupts while in this state." since the system instability has been observed on FreeBSD with SMT disabled. Interrupts to appear to play a factor since running a signal-intensive process on the first CPU core, which handles most of the interrupts on my machine, is far more likely to trigger the problem than running such a process on any other core. Also lower sv_maxuser to prevent a malicious user from using mmap() to load and execute code in the top page of user memory that was made available when the shared page was moved down. Make the same changes to the 64-bit Linux emulator. PR: 219399 Reported by: nbe@renzel.net Reviewed by: kib Reviewed by: dchagin (previous version) Tested by: nbe@renzel.net (earlier version) Differential Revision: https://reviews.freebsd.org/D11780 Modified: stable/11/sys/amd64/amd64/elf_machdep.c stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/amd64/include/md_var.h stable/11/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/elf_machdep.c Wed Aug 16 06:43:50 2017 (r322568) +++ stable/11/sys/amd64/amd64/elf_machdep.c Wed Aug 16 07:59:57 2017 (r322569) @@ -84,6 +84,25 @@ struct sysentvec elf64_freebsd_sysvec = { }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); +void +amd64_lower_shared_page(struct sysentvec *sv) +{ + if (hw_lower_amd64_sharedpage != 0) { + sv->sv_maxuser -= PAGE_SIZE; + sv->sv_shared_page_base -= PAGE_SIZE; + sv->sv_usrstack -= PAGE_SIZE; + sv->sv_psstrings -= PAGE_SIZE; + } +} + +/* + * Do this fixup before INIT_SYSENTVEC (SI_ORDER_ANY) because the latter + * uses the value of sv_shared_page_base. + */ +SYSINIT(elf64_sysvec_fixup, SI_SUB_EXEC, SI_ORDER_FIRST, + (sysinit_cfunc_t) amd64_lower_shared_page, + &elf64_freebsd_sysvec); + static Elf64_Brandinfo freebsd_brand_info = { .brand = ELFOSABI_FREEBSD, .machine = EM_X86_64, Modified: stable/11/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/11/sys/amd64/amd64/initcpu.c Wed Aug 16 06:43:50 2017 (r322568) +++ stable/11/sys/amd64/amd64/initcpu.c Wed Aug 16 07:59:57 2017 (r322569) @@ -48,6 +48,11 @@ __FBSDID("$FreeBSD$"); static int hw_instruction_sse; SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD, &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU"); +static int lower_sharedpage_init; +int hw_lower_amd64_sharedpage; +SYSCTL_INT(_hw, OID_AUTO, lower_amd64_sharedpage, CTLFLAG_RDTUN, + &hw_lower_amd64_sharedpage, 0, + "Lower sharedpage to work around Ryzen issue with executing code near the top of user memory"); /* * -1: automatic (default) * 0: keep enable CLFLUSH @@ -120,6 +125,28 @@ init_amd(void) msr = rdmsr(0xc0011020); msr |= (uint64_t)1 << 15; wrmsr(0xc0011020, msr); + } + } + + /* + * Work around a problem on Ryzen that is triggered by executing + * code near the top of user memory, in our case the signal + * trampoline code in the shared page on amd64. + * + * This function is executed once for the BSP before tunables take + * effect so the value determined here can be overridden by the + * tunable. This function is then executed again for each AP and + * also on resume. Set a flag the first time so that value set by + * the tunable is not overwritten. + * + * The stepping and/or microcode versions should be checked after + * this issue is fixed by AMD so that we don't use this mode if not + * needed. + */ + if (lower_sharedpage_init == 0) { + lower_sharedpage_init = 1; + if (CPUID_TO_FAMILY(cpu_id) == 0x17) { + hw_lower_amd64_sharedpage = 1; } } } Modified: stable/11/sys/amd64/include/md_var.h ============================================================================== --- stable/11/sys/amd64/include/md_var.h Wed Aug 16 06:43:50 2017 (r322568) +++ stable/11/sys/amd64/include/md_var.h Wed Aug 16 07:59:57 2017 (r322569) @@ -34,11 +34,14 @@ #include -extern uint64_t *vm_page_dump; +extern uint64_t *vm_page_dump; +extern int hw_lower_amd64_sharedpage; struct savefpu; +struct sysentvec; void amd64_db_resume_dbreg(void); +void amd64_lower_shared_page(struct sysentvec *); void amd64_syscall(struct thread *td, int traced); void doreti_iret(void) __asm(__STRING(doreti_iret)); void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 16 06:43:50 2017 (r322568) +++ stable/11/sys/amd64/linux/linux_sysvec.c Wed Aug 16 07:59:57 2017 (r322569) @@ -833,6 +833,8 @@ static void linux_vdso_install(void *param) { + amd64_lower_shared_page(&elf_linux_sysvec); + linux_szsigcode = (&_binary_linux_locore_o_end - &_binary_linux_locore_o_start); From owner-svn-src-all@freebsd.org Wed Aug 16 08:49:13 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 10:28:35 2017 Return-Path: Delivered-To: svn-src-all@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 AF3ECDD2AAC; Wed, 16 Aug 2017 10:28:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87CDA7D289; Wed, 16 Aug 2017 10:28:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GASYAT073910; Wed, 16 Aug 2017 10:28:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GASY4O073906; Wed, 16 Aug 2017 10:28:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708161028.v7GASY4O073906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 16 Aug 2017 10:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322572 - in stable/11/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Commit-Revision: 322572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 10:28:35 -0000 Author: mav Date: Wed Aug 16 10:28:34 2017 New Revision: 322572 URL: https://svnweb.freebsd.org/changeset/base/322572 Log: MFC r322308: Add new Intel Lewisburg and Union Point chipset PCI IDs. While there, polish some old AHCI ones, since they are still reused. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/sound/pci/hda/hdac.c stable/11/sys/dev/sound/pci/hda/hdac.h stable/11/sys/dev/usb/controller/xhci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Wed Aug 16 08:49:11 2017 (r322571) +++ stable/11/sys/dev/ahci/ahci_pci.c Wed Aug 16 10:28:34 2017 (r322572) @@ -92,10 +92,10 @@ static const struct { {0x27c58086, 0x00, "Intel ICH7M", 0}, {0x27c68086, 0x00, "Intel ICH7M", 0}, {0x28218086, 0x00, "Intel ICH8", 0}, - {0x28228086, 0x00, "Intel ICH8", 0}, + {0x28228086, 0x00, "Intel ICH8+ (RAID)", 0}, {0x28248086, 0x00, "Intel ICH8", 0}, {0x28298086, 0x00, "Intel ICH8M", 0}, - {0x282a8086, 0x00, "Intel ICH8M", 0}, + {0x282a8086, 0x00, "Intel ICH8M+ (RAID)", 0}, {0x29228086, 0x00, "Intel ICH9", 0}, {0x29238086, 0x00, "Intel ICH9", 0}, {0x29248086, 0x00, "Intel ICH9", 0}, @@ -108,23 +108,24 @@ static const struct { {0x292f8086, 0x00, "Intel ICH9M", 0}, {0x294d8086, 0x00, "Intel ICH9", 0}, {0x294e8086, 0x00, "Intel ICH9M", 0}, - {0x3a058086, 0x00, "Intel ICH10", 0}, + {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, - {0x3a258086, 0x00, "Intel ICH10", 0}, + {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, - {0x1c048086, 0x00, "Intel Cougar Point", 0}, - {0x1c058086, 0x00, "Intel Cougar Point", 0}, + {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c058086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c068086, 0x00, "Intel Cougar Point (RAID)", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, - {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, + {0x28268086, 0x00, "Intel Patsburg+ (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, {0x1e048086, 0x00, "Intel Panther Point (RAID)", 0}, @@ -150,8 +151,6 @@ static const struct { {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, - {0x28238086, 0x00, "Intel Wellsburg (RAID)", 0}, - {0x28278086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, @@ -175,6 +174,8 @@ static const struct { {0x8d648086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d668086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d6e8086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x28238086, 0x00, "Intel Wellsburg+ (RAID)", 0}, + {0x28278086, 0x00, "Intel Wellsburg+ (RAID)", 0}, {0x9c028086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c038086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c048086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, @@ -192,6 +193,17 @@ static const struct { {0xa1068086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa1078086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa10f8086, 0x00, "Intel Sunrise Point (RAID)", 0}, + {0xa1828086, 0x00, "Intel Lewisburg", 0}, + {0xa1868086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa1d28086, 0x00, "Intel Lewisburg", 0}, + {0xa1d68086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2028086, 0x00, "Intel Lewisburg", 0}, + {0xa2068086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2528086, 0x00, "Intel Lewisburg", 0}, + {0xa2568086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2828086, 0x00, "Intel Union Point", 0}, + {0xa2868086, 0x00, "Intel Union Point (RAID)", 0}, + {0xa28e8086, 0x00, "Intel Union Point (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, Modified: stable/11/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.c Wed Aug 16 08:49:11 2017 (r322571) +++ stable/11/sys/dev/sound/pci/hda/hdac.c Wed Aug 16 10:28:34 2017 (r322572) @@ -97,6 +97,8 @@ static const struct { { HDA_INTEL_KBLKLP, "Intel Kabylake-LP", 0, 0 }, { HDA_INTEL_SRPT, "Intel Sunrise Point", 0, 0 }, { HDA_INTEL_KBLK, "Intel Kabylake", 0, 0 }, + { HDA_INTEL_KBLKH, "Intel Kabylake-H", 0, 0 }, + { HDA_INTEL_CFLK, "Intel Coffelake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: stable/11/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.h Wed Aug 16 08:49:11 2017 (r322571) +++ stable/11/sys/dev/sound/pci/hda/hdac.h Wed Aug 16 10:28:34 2017 (r322572) @@ -73,6 +73,8 @@ #define HDA_INTEL_KBLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x9d71) #define HDA_INTEL_SRPT HDA_MODEL_CONSTRUCT(INTEL, 0xa170) #define HDA_INTEL_KBLK HDA_MODEL_CONSTRUCT(INTEL, 0xa171) +#define HDA_INTEL_KBLKH HDA_MODEL_CONSTRUCT(INTEL, 0xa2f0) +#define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ Modified: stable/11/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci_pci.c Wed Aug 16 08:49:11 2017 (r322571) +++ stable/11/sys/dev/usb/controller/xhci_pci.c Wed Aug 16 10:28:34 2017 (r322572) @@ -132,6 +132,10 @@ xhci_pci_match(device_t self) return ("Intel Sunrise Point-LP USB 3.0 controller"); case 0xa12f8086: return ("Intel Sunrise Point USB 3.0 controller"); + case 0xa1af8086: + return ("Intel Lewisburg USB 3.0 controller"); + case 0xa2af8086: + return ("Intel Union Point USB 3.0 controller"); case 0xa01b177d: return ("Cavium ThunderX USB 3.0 controller"); From owner-svn-src-all@freebsd.org Wed Aug 16 10:30:24 2017 Return-Path: Delivered-To: svn-src-all@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 B9975DD2BC1; Wed, 16 Aug 2017 10:30:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9095D7D3DD; Wed, 16 Aug 2017 10:30:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GAUNdm074052; Wed, 16 Aug 2017 10:30:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GAUN9x074048; Wed, 16 Aug 2017 10:30:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708161030.v7GAUN9x074048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 16 Aug 2017 10:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322573 - in stable/11/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Commit-Revision: 322573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 10:30:24 -0000 Author: mav Date: Wed Aug 16 10:30:23 2017 New Revision: 322573 URL: https://svnweb.freebsd.org/changeset/base/322573 Log: MFC r322309, r322316: Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets. This is shorter and unifies naming with later chipsets. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/ata/ata-pci.h stable/11/sys/dev/ata/chipsets/ata-intel.c stable/11/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Wed Aug 16 10:28:34 2017 (r322572) +++ stable/11/sys/dev/ahci/ahci_pci.c Wed Aug 16 10:30:23 2017 (r322573) @@ -111,12 +111,12 @@ static const struct { {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, - {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b228086, 0x00, "Intel Ibex Peak", 0}, + {0x3b238086, 0x00, "Intel Ibex Peak", 0}, + {0x3b258086, 0x00, "Intel Ibex Peak (RAID)", 0}, + {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, + {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, + {0x3b2f8086, 0x00, "Intel Ibex Peak-M", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, Modified: stable/11/sys/dev/ata/ata-pci.h ============================================================================== --- stable/11/sys/dev/ata/ata-pci.h Wed Aug 16 10:28:34 2017 (r322572) +++ stable/11/sys/dev/ata/ata-pci.h Wed Aug 16 10:30:23 2017 (r322573) @@ -193,12 +193,12 @@ struct ata_pci_controller { #define ATA_I82801JI_S1 0x3a208086 #define ATA_I82801JI_S2 0x3a268086 -#define ATA_5Series_S1 0x3b208086 -#define ATA_5Series_S2 0x3b218086 -#define ATA_5Series_S3 0x3b268086 -#define ATA_5Series_S4 0x3b288086 -#define ATA_5Series_S5 0x3b2d8086 -#define ATA_5Series_S6 0x3b2e8086 +#define ATA_IBP_S1 0x3b208086 +#define ATA_IBP_S2 0x3b218086 +#define ATA_IBP_S3 0x3b268086 +#define ATA_IBP_S4 0x3b288086 +#define ATA_IBP_S5 0x3b2d8086 +#define ATA_IBP_S6 0x3b2e8086 #define ATA_CPT_S1 0x1c008086 #define ATA_CPT_S2 0x1c018086 Modified: stable/11/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/11/sys/dev/ata/chipsets/ata-intel.c Wed Aug 16 10:28:34 2017 (r322572) +++ stable/11/sys/dev/ata/chipsets/ata-intel.c Wed Aug 16 10:30:23 2017 (r322573) @@ -149,12 +149,12 @@ ata_intel_probe(device_t dev) { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, - { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_IBP_S1, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S4, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S5, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S6, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, Modified: stable/11/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.c Wed Aug 16 10:28:34 2017 (r322572) +++ stable/11/sys/dev/sound/pci/hda/hdac.c Wed Aug 16 10:30:23 2017 (r322573) @@ -106,8 +106,8 @@ static const struct { { HDA_INTEL_82801I, "Intel 82801I", 0, 0 }, { HDA_INTEL_82801JI, "Intel 82801JI", 0, 0 }, { HDA_INTEL_82801JD, "Intel 82801JD", 0, 0 }, - { HDA_INTEL_PCH, "Intel 5 Series/3400 Series", 0, 0 }, - { HDA_INTEL_PCH2, "Intel 5 Series/3400 Series", 0, 0 }, + { HDA_INTEL_PCH, "Intel Ibex Peak", 0, 0 }, + { HDA_INTEL_PCH2, "Intel Ibex Peak", 0, 0 }, { HDA_INTEL_SCH, "Intel SCH", 0, 0 }, { HDA_NVIDIA_MCP51, "NVIDIA MCP51", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_MCP55, "NVIDIA MCP55", 0, HDAC_QUIRK_MSI }, From owner-svn-src-all@freebsd.org Wed Aug 16 10:38:07 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 10:59:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 12:01:23 2017 Return-Path: Delivered-To: svn-src-all@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 B9712DD7636; Wed, 16 Aug 2017 12:01:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79D2D8006E; Wed, 16 Aug 2017 12:01:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GC1M2d013185; Wed, 16 Aug 2017 12:01:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GC1MfD013184; Wed, 16 Aug 2017 12:01:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708161201.v7GC1MfD013184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 16 Aug 2017 12:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322576 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 322576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 12:01:23 -0000 Author: ae Date: Wed Aug 16 12:01:22 2017 New Revision: 322576 URL: https://svnweb.freebsd.org/changeset/base/322576 Log: MFC r322328: Make user supplied data checks a bit stricter. key_msg2sp() is used for parsing data from setsockopt(IP[V6]_IPSEC_POLICY) call. This socket option is usually used to configure IPsec bypass for socket. Only privileged user can set this socket option. The message syntax is described here http://www.kame.net/newsletter/20021210/ and our libipsec is usually used to create the correct request. Add additional checks: * that sadb_x_ipsecrequest_len is not out of bounds of user supplied buffer * that src/dst's sa_len is the same * that 2*sa_len is not out of bounds of user supplied buffer * that 2*sa_len fits into bounds of sadb_x_ipsecrequest Reported by: Ilja van Sprundel Modified: stable/11/sys/netipsec/key.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/key.c ============================================================================== --- stable/11/sys/netipsec/key.c Wed Aug 16 10:59:37 2017 (r322575) +++ stable/11/sys/netipsec/key.c Wed Aug 16 12:01:22 2017 (r322576) @@ -1403,7 +1403,8 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int while (tlen > 0) { /* length check */ - if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr)) { + if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr) || + xisr->sadb_x_ipsecrequest_len > tlen) { ipseclog((LOG_DEBUG, "%s: invalid ipsecrequest " "length.\n", __func__)); key_freesp(&newsp); @@ -1517,10 +1518,12 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) { struct sockaddr *paddr; + len = tlen - sizeof(*xisr); paddr = (struct sockaddr *)(xisr + 1); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.src)) { + if (len < sizeof(struct sockaddr) || + len < 2 * paddr->sa_len || + paddr->sa_len > sizeof(isr->saidx.src)) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); @@ -1528,13 +1531,26 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int *error = EINVAL; return NULL; } + /* + * Request length should be enough to keep + * source and destination addresses. + */ + if (xisr->sadb_x_ipsecrequest_len < + sizeof(*xisr) + 2 * paddr->sa_len) { + ipseclog((LOG_DEBUG, "%s: invalid " + "ipsecrequest length.\n", + __func__)); + key_freesp(&newsp); + *error = EINVAL; + return (NULL); + } bcopy(paddr, &isr->saidx.src, paddr->sa_len); paddr = (struct sockaddr *)((caddr_t)paddr + paddr->sa_len); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.dst)) { + if (paddr->sa_len != + isr->saidx.src.sa.sa_len) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); From owner-svn-src-all@freebsd.org Wed Aug 16 13:06:27 2017 Return-Path: Delivered-To: svn-src-all@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 A3865DDAEAE; Wed, 16 Aug 2017 13:06:27 +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 7031482A36; Wed, 16 Aug 2017 13:06:27 +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 v7GD6Qtr038623; Wed, 16 Aug 2017 13:06:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GD6QwQ038621; Wed, 16 Aug 2017 13:06:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161306.v7GD6QwQ038621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 13:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322577 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 13:06:27 -0000 Author: kevans Date: Wed Aug 16 13:06:26 2017 New Revision: 322577 URL: https://svnweb.freebsd.org/changeset/base/322577 Log: MFC r303444 (ed): Call basename() in a portable way. Pull a copy of the filename string before calling basename(). Change the loop to not return on its own, so we can put a free() statement at the bottom. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 12:01:22 2017 (r322576) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 13:06:26 2017 (r322577) @@ -61,21 +61,26 @@ static bool ctxover; bool file_matching(const char *fname) { - char *fname_base; + char *fname_base, *fname_buf; bool ret; ret = finclude ? false : true; - fname_base = basename(fname); + fname_buf = strdup(fname); + if (fname_buf == NULL) + err(2, "strdup"); + fname_base = basename(fname_buf); for (unsigned int i = 0; i < fpatterns; ++i) { if (fnmatch(fpattern[i].pat, fname, 0) == 0 || fnmatch(fpattern[i].pat, fname_base, 0) == 0) { - if (fpattern[i].mode == EXCL_PAT) - return (false); - else + if (fpattern[i].mode == EXCL_PAT) { + ret = false; + break; + } else ret = true; } } + free(fname_buf); return (ret); } From owner-svn-src-all@freebsd.org Wed Aug 16 13:44:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 14:15:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 15:14:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 16:51:56 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 17:22:43 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 17:38:39 2017 Return-Path: Delivered-To: svn-src-all@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 6B2C5DC30FA; Wed, 16 Aug 2017 17:38:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44ACA677A6; Wed, 16 Aug 2017 17:38:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GHcche050839; Wed, 16 Aug 2017 17:38:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHcbii050832; Wed, 16 Aug 2017 17:38:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161738.v7GHcbii050832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 17:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322582 - in stable/11: share/man/man5 share/mk tools/build/options usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/man/man5 share/mk tools/build/options usr.bin/grep X-SVN-Commit-Revision: 322582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:38:39 -0000 Author: kevans Date: Wed Aug 16 17:38:37 2017 New Revision: 322582 URL: https://svnweb.freebsd.org/changeset/base/322582 Log: MFC r317254: bsdgrep: add BSD_GREP_FASTMATCH knob for built-in fastmatch Bugs have been found in the fastmatch implementation as used in bsdgrep. Some have been fixed (r316495) while fixes for others are in review (D10098). In comparison with the fastmatch implementation, Kyle Evans found that: - regex(3)'s performance with literal expressions offers a speed improvement over fastmatch - regex(3)'s performance, both with simple BREs and EREs, seems to be comparable The regex implementation was imported in r226035, and the commit message reports: This is a temporary solution until the whole regex library is not replaced so that BSD grep development can continue and the backported code gets some review and testing. This change only improves scalability slightly, there is no big performance boost yet but several minor bugs have been found and fixed. Introduce a WITH_/WITHOUT_BSD_GREP_FASTMATCH knob to support testing of both approaches. Regenerate src.conf(5) as per the original commit PR: 175314, 194823 Approved by: emaste (mentor, blanket MFC) Added: stable/11/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH - copied unchanged from r317254, head/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH Modified: stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk stable/11/usr.bin/grep/Makefile stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/share/man/man5/src.conf.5 Wed Aug 16 17:38:37 2017 (r322582) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd August 5, 2017 +.Dd August 16, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -214,6 +214,11 @@ Set to not build the BSD licensed version of cpio base .Xr libarchive 3 . .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. +.It Va WITHOUT_BSD_GREP_FASTMATCH +Set this option to exclude the fastmatch implementation from +.Xr bsdgrep 1 , +instead using only +.Xr regex 3 . .It Va WITHOUT_BSNMP Set to not build or install .Xr bsnmpd 1 Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/share/mk/src.opts.mk Wed Aug 16 17:38:37 2017 (r322582) @@ -62,6 +62,7 @@ __DEFAULT_YES_OPTIONS = \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ + BSD_GREP_FASTMATCH \ BSDINSTALL \ BSNMP \ BZIP2 \ Copied: stable/11/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH (from r317254, head/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH Wed Aug 16 17:38:37 2017 (r322582, copy of r317254, head/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set this option to exclude the fastmatch implementation from +.Xr bsdgrep 1 , +instead using only +.Xr regex 3 . Modified: stable/11/usr.bin/grep/Makefile ============================================================================== --- stable/11/usr.bin/grep/Makefile Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/usr.bin/grep/Makefile Wed Aug 16 17:38:37 2017 (r322582) @@ -15,10 +15,14 @@ bsdgrep.1: grep.1 .endif SRCS= file.c grep.c queue.c util.c -# Extra files ported backported form some regex improvements +.if ${MK_BSD_GREP_FASTMATCH} == "yes" +# Extra files ported backported for some regex improvements .PATH: ${.CURDIR}/regex SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c CFLAGS+=-I${.CURDIR}/regex +.else +CFLAGS+= -DWITHOUT_FASTMATCH +.endif CFLAGS.gcc+= --param max-inline-insns-single=500 Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 17:38:37 2017 (r322582) @@ -50,7 +50,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_FASTMATCH #include "fastmatch.h" +#endif #include "grep.h" #ifndef WITHOUT_NLS @@ -87,7 +89,9 @@ unsigned int patterns; static unsigned int pattern_sz; struct pat *pattern; regex_t *r_pattern; +#ifndef WITHOUT_FASTMATCH fastmatch_t *fg_pattern; +#endif /* Filename exclusion/inclusion patterns */ unsigned int fpatterns, dpatterns; @@ -716,20 +720,25 @@ main(int argc, char *argv[]) usage(); } +#ifndef WITHOUT_FASTMATCH fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern)); +#endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { +#ifndef WITHOUT_FASTMATCH + /* Attempt compilation with fastmatch regex and fallback to + regex(3) if it fails. */ if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) != 0) { - /* Fall back to full regex library */ - c = regcomp(&r_pattern[i], pattern[i].pat, cflags); - if (c != 0) { - regerror(c, &r_pattern[i], re_error, - RE_ERROR_BUF); - errx(2, "%s", re_error); - } + pattern[i].len, cflags) == 0) + continue; +#endif + c = regcomp(&r_pattern[i], pattern[i].pat, cflags); + if (c != 0) { + regerror(c, &r_pattern[i], re_error, + RE_ERROR_BUF); + errx(2, "%s", re_error); } } Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/usr.bin/grep/grep.h Wed Aug 16 17:38:37 2017 (r322582) @@ -36,7 +36,9 @@ #include #include +#ifndef WITHOUT_FASTMATCH #include "fastmatch.h" +#endif #ifdef WITHOUT_NLS #define getstr(n) errstr[n] @@ -127,7 +129,9 @@ extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; extern regex_t *er_pattern, *r_pattern; +#ifndef WITHOUT_FASTMATCH extern fastmatch_t *fg_pattern; +#endif /* For regex errors */ #define RE_ERROR_BUF 512 Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 17:22:42 2017 (r322581) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 17:38:37 2017 (r322582) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_FASTMATCH #include "fastmatch.h" +#endif #include "grep.h" static int linesqueued; @@ -317,10 +319,12 @@ procline(struct str *l, int nottext) for (i = 0; i < patterns; i++) { pmatch.rm_so = st; pmatch.rm_eo = l->len; +#ifndef WITHOUT_FASTMATCH if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], l->dat, 1, &pmatch, leflags); else +#endif r = regexec(&r_pattern[i], l->dat, 1, &pmatch, leflags); r = (r == 0) ? 0 : REG_NOMATCH; @@ -332,7 +336,11 @@ procline(struct str *l, int nottext) (size_t)pmatch.rm_eo != l->len) r = REG_NOMATCH; /* Check for whole word match */ +#ifndef WITHOUT_FASTMATCH if (r == 0 && (wflag || fg_pattern[i].word)) { +#else + if (r == 0 && wflag) { +#endif wchar_t wbegin, wend; wbegin = wend = L' '; From owner-svn-src-all@freebsd.org Wed Aug 16 17:42:40 2017 Return-Path: Delivered-To: svn-src-all@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 77C6EDC3721; Wed, 16 Aug 2017 17:42:40 +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 5333B67D1F; Wed, 16 Aug 2017 17:42:40 +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 v7GHgdjS054783; Wed, 16 Aug 2017 17:42:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHgdB4054781; Wed, 16 Aug 2017 17:42:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161742.v7GHgdB4054781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 17:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322583 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:42:40 -0000 Author: kevans Date: Wed Aug 16 17:42:39 2017 New Revision: 322583 URL: https://svnweb.freebsd.org/changeset/base/322583 Log: MFC r317665: bsdgrep: fix -w -v matching improperly with certain patterns -w and -v flag matching was mostly functional but had some minor problems: 1. -w flag processing only allowed one iteration through pattern matching on a line. This was problematic if one pattern could match more than once, or if there were multiple patterns and the earliest/ longest match was not the most ideal, and 2. Previous work "fixed" things to not further process a line if the first iteration through patterns produced no matches. This is clearly wrong if we're dealing with the more restrictive -w matching. #2 breakage could have also occurred before recent broad rewrites, but it would be more arbitrary based on input patterns as to whether or not it actually affected things. Fix both of these by forcing a retry of the patterns after advancing just past the start of the first match if we're doing more restrictive -w matching and we didn't get any hits to start with. Also move -v flag processing outside of the loop so that we have a greater change to match in the more restrictive cases. This wasn't strictly wrong, but it could be a little more error prone. While here, introduce some regressions tests for this behavior and fix some excessive wrapping nearby that hindered readability. GNU grep passes these new tests. PR: 218467, 218811 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 17:38:37 2017 (r322582) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 17:42:39 2017 (r322583) @@ -93,6 +93,12 @@ word_regexps_body() { atf_check -o file:"$(atf_get_srcdir)/d_word_regexps.out" \ grep -w separated $(atf_get_srcdir)/d_input + + # Begin FreeBSD + printf "xmatch pmatch\n" > test1 + + atf_check -o inline:"pmatch\n" grep -Eow "(match )?pmatch" test1 + # End FreeBSD } atf_test_case begin_end @@ -439,6 +445,23 @@ grep_sanity_body() atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2 } + +atf_test_case wv_combo_break +wv_combo_break_head() +{ + atf_set "descr" "Check for incorrectly matching lines with both -w and -v flags (PR 218467)" +} +wv_combo_break_body() +{ + printf "x xx\n" > test1 + printf "xx x\n" > test2 + + atf_check -o file:test1 grep -w "x" test1 + atf_check -o file:test2 grep -w "x" test2 + + atf_check -s exit:1 grep -v -w "x" test1 + atf_check -s exit:1 grep -v -w "x" test2 +} # End FreeBSD atf_init_test_cases() @@ -467,6 +490,7 @@ atf_init_test_cases() atf_add_test_case escmap atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen + atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity atf_add_test_case grep_sanity Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 17:38:37 2017 (r322582) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 17:42:39 2017 (r322583) @@ -305,6 +305,7 @@ procline(struct str *l, int nottext) unsigned int i; int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags; int startm = 0; + int retry; /* Initialize to avoid a false positive warning from GCC. */ lastmatch.rm_so = lastmatch.rm_eo = 0; @@ -313,6 +314,7 @@ procline(struct str *l, int nottext) while (st <= l->len) { lastmatches = 0; startm = m; + retry = 0; if (st > 0) leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ @@ -356,6 +358,17 @@ procline(struct str *l, int nottext) else if (iswword(wbegin) || iswword(wend)) r = REG_NOMATCH; + /* + * If we're doing whole word matching and we + * matched once, then we should try the pattern + * again after advancing just past the start of + * the earliest match. This allows the pattern + * to match later on in the line and possibly + * still match a whole word. + */ + if (r == REG_NOMATCH && + (retry == 0 || pmatch.rm_so + 1 < retry)) + retry = pmatch.rm_so + 1; } if (r == 0) { lastmatches++; @@ -385,9 +398,14 @@ procline(struct str *l, int nottext) } } - if (vflag) { - c = !c; - break; + /* + * Advance to just past the start of the earliest match, try + * again just in case we still have a chance to match later in + * the string. + */ + if (lastmatches == 0 && retry > 0) { + st = retry; + continue; } /* One pass if we are not recording matches */ @@ -409,6 +427,9 @@ procline(struct str *l, int nottext) st = nst; } + + if (vflag) + c = !c; /* Count the matches if we have a match limit */ if (mflag) From owner-svn-src-all@freebsd.org Wed Aug 16 17:46:48 2017 Return-Path: Delivered-To: svn-src-all@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 2B834DC3D60; Wed, 16 Aug 2017 17:46:48 +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 06D086829F; Wed, 16 Aug 2017 17:46:47 +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 v7GHklMY055168; Wed, 16 Aug 2017 17:46:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHkjcC055154; Wed, 16 Aug 2017 17:46:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161746.v7GHkjcC055154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 17:46:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322584 - in stable/11/usr.bin/grep: . nls X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/grep: . nls X-SVN-Commit-Revision: 322584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:46:48 -0000 Author: kevans Date: Wed Aug 16 17:46:45 2017 New Revision: 322584 URL: https://svnweb.freebsd.org/changeset/base/322584 Log: MFC r317678: bsdgrep: Add GNU compatible version string indicator As reported in r218614 it's useful to have an indication of whether or not BSD grep was built with GNU_GREP_COMPAT. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/Makefile stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/nls/C.msg stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/Makefile ============================================================================== --- stable/11/usr.bin/grep/Makefile Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/Makefile Wed Aug 16 17:46:45 2017 (r322584) @@ -82,7 +82,7 @@ CFLAGS+= -DWITHOUT_BZIP2 .endif .if ${MK_GNU_GREP_COMPAT} != "no" -CFLAGS+= -I${DESTDIR}/usr/include/gnu +CFLAGS+= -I${DESTDIR}/usr/include/gnu -DWITH_GNU LIBADD+= gnuregex .endif Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 17:46:45 2017 (r322584) @@ -75,6 +75,7 @@ const char *errstr[] = { /* 7*/ "\t[--null] [pattern] [file ...]\n", /* 8*/ "Binary file %s matches\n", /* 9*/ "%s (BSD grep) %s\n", +/* 10*/ "%s (BSD grep, GNU compatible) %s\n", }; /* Flags passed to regcomp() and regexec() */ @@ -597,7 +598,11 @@ main(int argc, char *argv[]) filebehave = FILE_MMAP; break; case 'V': +#ifdef WITH_GNU + printf(getstr(10), getprogname(), VERSION); +#else printf(getstr(9), getprogname(), VERSION); +#endif exit(0); case 'v': vflag = true; Modified: stable/11/usr.bin/grep/nls/C.msg ============================================================================== --- stable/11/usr.bin/grep/nls/C.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/C.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pattern] [file ...]\n" 8 "Binary file %s matches\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/es_ES.ISO8859-1.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pauta] [fichero ...]\n" 8 "fichero binario %s se ajusta\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pauta] [ficheiro ...]\n" 8 "ficheiro binario %s conforma\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg ============================================================================== --- stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [minta] [fájl ...]\n" 8 "%s bináris fájl illeszkedik\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/ja_JP.SJIS.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [ƒpƒ^[ƒ“] [ƒtƒ@ƒCƒ‹–¼ ...]\n" 8 "ƒoƒCƒiƒŠƒtƒ@ƒCƒ‹ %s ‚Ƀ}ƒbƒ`‚µ‚Ü‚µ‚½\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/ja_JP.UTF-8.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [パターン] [ファイルå ...]\n" 8 "ãƒã‚¤ãƒŠãƒªãƒ•ã‚¡ã‚¤ãƒ« %s ã«ãƒžãƒƒãƒã—ã¾ã—ãŸ\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/ja_JP.eucJP.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [¥Ñ¥¿¡¼¥ó] [¥Õ¥¡¥¤¥ë̾ ...]\n" 8 "¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë %s ¤Ë¥Þ¥Ã¥Á¤·¤Þ¤·¤¿\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg ============================================================================== --- stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [padrão] [arquivo ...]\n" 8 "arquivo binário %s casa com o padrão\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg ============================================================================== --- stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/ru_RU.KOI8-R.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [ÛÁÂÌÏÎ] [ÆÁÊÌ ...]\n" 8 "Ä×ÏÉÞÎÙÊ ÆÁÊÌ %s ÓÏ×ÐÁÄÁÅÔ\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/uk_UA.UTF-8.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -10,3 +10,4 @@ $quote " 7 "\t[--null] [шаблон] [файл ...]\n" 8 "двійковий файл %s Ñпівпадає\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg ============================================================================== --- stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg Wed Aug 16 17:42:39 2017 (r322583) +++ stable/11/usr.bin/grep/nls/zh_CN.UTF-8.msg Wed Aug 16 17:46:45 2017 (r322584) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [模å¼] [文件å ...]\n" 8 "二进制文件 %s 包å«æ¨¡å¼\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" From owner-svn-src-all@freebsd.org Wed Aug 16 17:54:26 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 17:54:31 2017 Return-Path: Delivered-To: svn-src-all@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 258D7DC54C6; Wed, 16 Aug 2017 17:54:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0277E687BB; Wed, 16 Aug 2017 17:54:30 +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 v7GHsU5q059236; Wed, 16 Aug 2017 17:54:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHsU0n059235; Wed, 16 Aug 2017 17:54:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161754.v7GHsU0n059235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 17:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322586 - stable/11/usr.bin/grep/regex X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep/regex X-SVN-Commit-Revision: 322586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:54:31 -0000 Author: kevans Date: Wed Aug 16 17:54:29 2017 New Revision: 322586 URL: https://svnweb.freebsd.org/changeset/base/322586 Log: bsdgrep: fix escape map building when using TRE (BSD_GREP_FASTMATCH) MFC r317700: bsdgrep: use calloc where appropriate in grep's tre-fastmatch Also apply style(9) to a related NULL check. MFC r317701: bsdgrep: correct test sense from r317700 Kyle's change in review D10098 was correct. I introduced the error when extracting a portion of that change. MFC r317704: bsdgrep: fix escape map building for multibyte strings In BSD grep, fix escape map building in the regex parser. It was previously using memory not explicitly initialized, and the MBS escape map was being built based on a version of the pattern with escapes already parsed out. This is Kyle's change, but I restored the broken style that already exists in this file. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 17:54:24 2017 (r322585) +++ stable/11/usr.bin/grep/regex/tre-fastmatch.c Wed Aug 16 17:54:29 2017 (r322586) @@ -98,6 +98,18 @@ static int fastcmp(const fastmatch_t *fg, const void * fg->pattern[siz] = '\0'; \ } \ +#define CONV_MBS_PAT(src, dest, destsz) \ + { \ + destsz = wcstombs(NULL, src, 0); \ + if (destsz == (size_t)-1) \ + return REG_BADPAT; \ + dest = malloc(destsz + 1); \ + if (dest == NULL) \ + return REG_ESPACE; \ + wcstombs(dest, src, destsz); \ + dest[destsz] = '\0'; \ + } \ + #define IS_OUT_OF_BOUNDS \ ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ @@ -630,7 +642,7 @@ tre_compile_fast(fastmatch_t *fg, const tre_char_t *pa if (escaped) { if (!_escmap) - _escmap = malloc(n * sizeof(bool)); + _escmap = calloc(n, sizeof(bool)); if (!_escmap) { free(tmp); @@ -714,8 +726,8 @@ badpat: { if (fg->wescmap != NULL) { - fg->escmap = malloc(fg->len * sizeof(bool)); - if (!fg->escmap) + fg->escmap = calloc(fg->len, sizeof(bool)); + if (fg->escmap == NULL) { tre_free_fast(fg); return REG_ESPACE; @@ -723,15 +735,29 @@ badpat: } escaped = false; - for (unsigned int i = 0; i < fg->len; i++) - if (fg->pattern[i] == '\\') - escaped = !escaped; - else if (fg->pattern[i] == '.' && fg->escmap && escaped) + char *_checkpat = NULL; + size_t _checklen = 0; + unsigned int escofs = 0; + /* + * Make a copy here of the original pattern, because fg->pattern has + * already been stripped of all escape sequences in the above processing. + * This is necessary if we wish to later treat fg->escmap as an actual, + * functional replacement of fg->wescmap. + */ + CONV_MBS_PAT(pat, _checkpat, _checklen); + for (unsigned int i = 0; i < n; i++) + if (_checkpat[i] == '\\') { - fg->escmap[i] = true; + escaped = !escaped; + if (escaped) + ++escofs; + } + else if (_checkpat[i] == '.' && fg->escmap != NULL && escaped) + { + fg->escmap[i - escofs] = true; escaped = false; } - else if (fg->pattern[i] == '.' && !escaped) + else if (_checkpat[i] == '.' && !escaped) { hasdot = i; if (firstdot == -1) @@ -739,6 +765,7 @@ badpat: } else escaped = false; + free(_checkpat); } #else SAVE_PATTERN(tmp, pos, fg->pattern, fg->len); From owner-svn-src-all@freebsd.org Wed Aug 16 18:00:34 2017 Return-Path: Delivered-To: svn-src-all@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 B923BDC5A05; Wed, 16 Aug 2017 18:00:34 +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 0C0FD68B37; Wed, 16 Aug 2017 18:00:33 +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 v7GI0Xc1059565; Wed, 16 Aug 2017 18:00:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GI0W8A059555; Wed, 16 Aug 2017 18:00:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708161800.v7GI0W8A059555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 18:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322587 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Commit-Revision: 322587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 18:00:34 -0000 Author: kevans Date: Wed Aug 16 18:00:32 2017 New Revision: 322587 URL: https://svnweb.freebsd.org/changeset/base/322587 Log: bsdgrep: fix -w flag matching with an empty pattern MFC r317703: bsdgrep: fix -w flag matching with an empty pattern -w flag matching with an empty pattern was generally 'broken', allowing matches to occur on any line whether or not it actually matches -w criteria. This fix required a good amount of refactoring to address. procline() is altered to *only* process the line and return whether it was a match or not, necessary to be able to short-circuit the whole function in case of this matchall flag. -m flag handling is moved out as well because it suffers from the same fate as context handling if we bypass any actual pattern matching. The matching context (matches, mostly) didn't previously exist outside of procline(), so we go ahead and create context object for file processing bits to pass around. grep_printline() was created due to this, for the scenarios where the matches don't actually matter and we just want to print a line or two, a la flushing the context queue and no -o or --color specified. Damage from this broken behavior would have been mitigated by the fact that it is unlikely users would invoke grep -w with an empty pattern. This was identified while checking PR 105221 for problems it this may cause in BSD grep, but PR 105221 is *not* a report of this behavior. MFC r317741: bsdgrep: correct uninitialized variable introduced in r317703 MFC r317842: bsdgrep: don't ouptut matches with -c, -l, -L Refactoring done in r317703 broke -c, -l, and -L flags implying suppression of match printing. Fortunately this is just a matter of not doing any printing of the resulting matches and context printing was not broken in this refactoring. Add some regression tests since this area may still see further refactoring, include different context flags as well even though they were not broken in this case. PR: 219077 Approved by: emaste (mentor, blanket MFC) Added: stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.in - copied unchanged from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.out - copied unchanged from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_f.out - copied unchanged from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_g.out - copied unchanged from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/queue.c stable/11/usr.bin/grep/tests/Makefile stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.in (from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.in Wed Aug 16 18:00:32 2017 (r322587, copy of r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in) @@ -0,0 +1,10 @@ +monkey +banana +apple +fruit +monkey +banna +apple +fruit +apple +monkey Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.out (from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_e.out Wed Aug 16 18:00:32 2017 (r322587, copy of r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out) @@ -0,0 +1,9 @@ +monkey +banana +apple +fruit +monkey +banna +-- +apple +monkey Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_f.out (from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_f.out Wed Aug 16 18:00:32 2017 (r322587, copy of r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out) @@ -0,0 +1,9 @@ +monkey +banana +apple +fruit +monkey +banna +apple +fruit +apple Copied: stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_g.out (from r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/d_context_g.out Wed Aug 16 18:00:32 2017 (r322587, copy of r317703, head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out) @@ -0,0 +1,8 @@ +apple +fruit +-- +banna +apple +fruit +apple +monkey Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 16 18:00:32 2017 (r322587) @@ -171,6 +171,12 @@ context_body() atf_check -o file:d_context_b.out grep -A3 tilt d_context_a.in atf_check -o file:d_context_c.out grep -B4 Whig d_context_a.in atf_check -o file:d_context_d.out grep -C1 pig d_context_a.in d_context_b.in + atf_check -o file:d_context_e.out \ + grep -E -C1 '(banana|monkey)' d_context_e.in + atf_check -o file:d_context_f.out \ + grep -Ev -B2 '(banana|monkey|fruit)' d_context_e.in + atf_check -o file:d_context_g.out \ + grep -Ev -A1 '(banana|monkey|fruit)' d_context_e.in } atf_test_case file_exp @@ -386,6 +392,32 @@ zerolen_body() atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1 } +atf_test_case wflag_emptypat +wflag_emptypat_head() +{ + atf_set "descr" "Check for proper handling of -w with an empty pattern (PR 105221)" +} +wflag_emptypat_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + + printf "" > test1 + printf "\n" > test2 + printf "qaz" > test3 + printf " qaz\n" > test4 + + atf_check -s exit:1 -o empty grep -w -e "" test1 + + atf_check -o file:test2 grep -w -e "" test2 + + atf_check -s exit:1 -o empty grep -w -e "" test3 + + atf_check -o file:test4 grep -w -e "" test4 +} + atf_test_case fgrep_sanity fgrep_sanity_head() { @@ -462,6 +494,34 @@ wv_combo_break_body() atf_check -s exit:1 grep -v -w "x" test1 atf_check -s exit:1 grep -v -w "x" test2 } + +atf_test_case grep_nomatch_flags +grep_nomatch_flags_head() +{ + atf_set "descr" "Check for no match (-c, -l, -L, -q) flags not producing line matches or context (PR 219077)" +} + +grep_nomatch_flags_body() +{ + printf "A\nB\nC\n" > test1 + + atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -B 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -A 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 + + atf_check -o inline:"test1\n" grep -l -e "B" test1 + atf_check -o inline:"test1\n" grep -l -B 1 -e "B" test1 + atf_check -o inline:"test1\n" grep -l -A 1 -e "B" test1 + atf_check -o inline:"test1\n" grep -l -C 1 -e "B" test1 + + atf_check -s exit:1 -o inline:"test1\n" grep -L -e "D" test1 + + atf_check -o empty grep -q -e "B" test1 + atf_check -o empty grep -q -B 1 -e "B" test1 + atf_check -o empty grep -q -A 1 -e "B" test1 + atf_check -o empty grep -q -C 1 -e "B" test1 +} # End FreeBSD atf_init_test_cases() @@ -490,9 +550,11 @@ atf_init_test_cases() atf_add_test_case escmap atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen + atf_add_test_case wflag_emptypat atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity atf_add_test_case grep_sanity + atf_add_test_case grep_nomatch_flags # End FreeBSD } Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 18:00:32 2017 (r322587) @@ -82,7 +82,13 @@ const char *errstr[] = { int cflags = REG_NOSUB; int eflags = REG_STARTEND; -/* Shortcut for matching all cases like empty regex */ +/* XXX TODO: Get rid of this flag. + * matchall is a gross hack that means that an empty pattern was passed to us. + * It is a necessary evil at the moment because our regex(3) implementation + * does not allow for empty patterns, as supported by POSIX's definition of + * grammar for BREs/EREs. When libregex becomes available, it would be wise + * to remove this and let regex(3) handle the dirty details of empty patterns. + */ bool matchall; /* Searching patterns */ @@ -154,9 +160,6 @@ enum { static inline const char *init_color(const char *); /* Housekeeping */ -bool first = true; /* flag whether we are processing the first match */ -bool prev; /* flag whether or not the previous line matched */ -int tail; /* lines left to print */ bool file_err; /* file reading error */ /* @@ -730,20 +733,25 @@ main(int argc, char *argv[]) #endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); - /* Check if cheating is allowed (always is for fgrep). */ - for (i = 0; i < patterns; ++i) { + /* Don't process any patterns if we have a blank one */ + if (!matchall) { + /* Check if cheating is allowed (always is for fgrep). */ + for (i = 0; i < patterns; ++i) { #ifndef WITHOUT_FASTMATCH - /* Attempt compilation with fastmatch regex and fallback to - regex(3) if it fails. */ - if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) == 0) - continue; + /* + * Attempt compilation with fastmatch regex and + * fallback to regex(3) if it fails. + */ + if (fastncomp(&fg_pattern[i], pattern[i].pat, + pattern[i].len, cflags) == 0) + continue; #endif - c = regcomp(&r_pattern[i], pattern[i].pat, cflags); - if (c != 0) { - regerror(c, &r_pattern[i], re_error, - RE_ERROR_BUF); - errx(2, "%s", re_error); + c = regcomp(&r_pattern[i], pattern[i].pat, cflags); + if (c != 0) { + regerror(c, &r_pattern[i], re_error, + RE_ERROR_BUF); + errx(2, "%s", re_error); + } } } Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/usr.bin/grep/grep.h Wed Aug 16 18:00:32 2017 (r322587) @@ -123,8 +123,7 @@ extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; -extern bool file_err, first, matchall, prev; -extern int tail; +extern bool file_err, matchall; extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; @@ -145,10 +144,10 @@ void *grep_malloc(size_t size); void *grep_calloc(size_t nmemb, size_t size); void *grep_realloc(void *ptr, size_t size); char *grep_strdup(const char *str); -void printline(struct str *line, int sep, regmatch_t *matches, int m); +void grep_printline(struct str *line, int sep); /* queue.c */ -void enqueue(struct str *x); +bool enqueue(struct str *x); void printqueue(void); void clearqueue(void); Modified: stable/11/usr.bin/grep/queue.c ============================================================================== --- stable/11/usr.bin/grep/queue.c Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/usr.bin/grep/queue.c Wed Aug 16 18:00:32 2017 (r322587) @@ -53,7 +53,10 @@ static unsigned long long count; static struct qentry *dequeue(void); -void +/* + * Enqueue another line; return true if we've dequeued a line as a result + */ +bool enqueue(struct str *x) { struct qentry *item; @@ -72,7 +75,9 @@ enqueue(struct str *x) item = dequeue(); free(item->data.dat); free(item); + return (true); } + return (false); } static struct qentry * @@ -95,7 +100,7 @@ printqueue(void) struct qentry *item; while ((item = dequeue()) != NULL) { - printline(&item->data, '-', NULL, 0); + grep_printline(&item->data, '-'); free(item->data.dat); free(item); } Modified: stable/11/usr.bin/grep/tests/Makefile ============================================================================== --- stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/usr.bin/grep/tests/Makefile Wed Aug 16 18:00:32 2017 (r322587) @@ -20,9 +20,13 @@ ${PACKAGE}FILES+= d_context2_c.out ${PACKAGE}FILES+= d_context_a.in ${PACKAGE}FILES+= d_context_a.out ${PACKAGE}FILES+= d_context_b.in +${PACKAGE}FILES+= d_context_e.in ${PACKAGE}FILES+= d_context_b.out ${PACKAGE}FILES+= d_context_c.out ${PACKAGE}FILES+= d_context_d.out +${PACKAGE}FILES+= d_context_e.out +${PACKAGE}FILES+= d_context_f.out +${PACKAGE}FILES+= d_context_g.out ${PACKAGE}FILES+= d_egrep.out ${PACKAGE}FILES+= d_escmap.in ${PACKAGE}FILES+= d_f_file_empty.in Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Wed Aug 16 17:54:29 2017 (r322586) +++ stable/11/usr.bin/grep/util.c Wed Aug 16 18:00:32 2017 (r322587) @@ -54,12 +54,24 @@ __FBSDID("$FreeBSD$"); #endif #include "grep.h" -static int linesqueued; -static int procline(struct str *l, int); +static bool first_match = true; -static int lasta; -static bool ctxover; +/* + * Parsing context; used to hold things like matches made and + * other useful bits + */ +struct parsec { + regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ + struct str ln; /* Current line */ + size_t matchidx; /* Latest used match index */ + bool binary; /* Binary file? */ +}; + +static int procline(struct parsec *pc); +static void printline(struct parsec *pc, int sep); +static void printline_metadata(struct str *line, int sep); + bool file_matching(const char *fname) { @@ -183,14 +195,14 @@ grep_tree(char **argv) int procfile(const char *fn) { + struct parsec pc; struct file *f; struct stat sb; - struct str ln; + struct str *ln; mode_t s; - int c, t; + int c, last_outed, t, tail; + bool doctx, printmatch, same_file; - mcount = mlimit; - if (strcmp(fn, "-") == 0) { fn = label != NULL ? label : getstr(1); f = grep_open(NULL); @@ -213,57 +225,99 @@ procfile(const char *fn) return (0); } - ln.file = grep_malloc(strlen(fn) + 1); - strcpy(ln.file, fn); - ln.line_no = 0; - ln.len = 0; - ctxover = false; - linesqueued = 0; + /* Convenience */ + ln = &pc.ln; + pc.ln.file = grep_malloc(strlen(fn) + 1); + strcpy(pc.ln.file, fn); + pc.ln.line_no = 0; + pc.ln.len = 0; + pc.ln.off = -1; + pc.binary = f->binary; tail = 0; - lasta = 0; - ln.off = -1; + last_outed = 0; + same_file = false; + doctx = false; + printmatch = true; + if ((pc.binary && binbehave == BINFILE_BIN) || cflag || qflag || + lflag || Lflag) + printmatch = false; + if (printmatch && (Aflag != 0 || Bflag != 0)) + doctx = true; + mcount = mlimit; for (c = 0; c == 0 || !(lflag || qflag); ) { - ln.off += ln.len + 1; - if ((ln.dat = grep_fgetln(f, &ln.len)) == NULL || ln.len == 0) { - if (ln.line_no == 0 && matchall) - exit(0); + /* Reset match count for every line processed */ + pc.matchidx = 0; + pc.ln.off += pc.ln.len + 1; + if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || + pc.ln.len == 0) { + if (pc.ln.line_no == 0 && matchall) + /* + * An empty file with an empty pattern and the + * -w flag does not match + */ + exit(matchall && wflag ? 1 : 0); else break; } - if (ln.len > 0 && ln.dat[ln.len - 1] == fileeol) - --ln.len; - ln.line_no++; + if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol) + --pc.ln.len; + pc.ln.line_no++; + /* Return if we need to skip a binary file */ - if (f->binary && binbehave == BINFILE_SKIP) { + if (pc.binary && binbehave == BINFILE_SKIP) { grep_close(f); - free(ln.file); + free(pc.ln.file); free(f); return (0); } - /* Process the file line-by-line, enqueue non-matching lines */ - if ((t = procline(&ln, f->binary)) == 0 && Bflag > 0) { - /* Except don't enqueue lines that appear in -A ctx */ - if (ln.line_no == 0 || lasta != ln.line_no) { - /* queue is maxed to Bflag number of lines */ - enqueue(&ln); - linesqueued++; - ctxover = false; + if ((t = procline(&pc)) == 0) + ++c; + + /* Deal with any -B context or context separators */ + if (t == 0 && doctx) { + if (!first_match && (!same_file || last_outed > 0)) + printf("--\n"); + if (Bflag > 0) + printqueue(); + tail = Aflag; + } + /* Print the matching line, but only if not quiet/binary */ + if (t == 0 && printmatch) { + printline(&pc, ':'); + first_match = false; + same_file = true; + last_outed = 0; + } + if (t != 0 && doctx) { + /* Deal with any -A context */ + if (tail > 0) { + printline(&pc, '-'); + tail--; + if (Bflag > 0) + clearqueue(); } else { /* - * Indicate to procline() that we have ctx - * overlap and make sure queue is empty. + * Enqueue non-matching lines for -B context. + * If we're not actually doing -B context or if + * the enqueue resulted in a line being rotated + * out, then go ahead and increment last_outed + * to signify a gap between context/match. */ - if (!ctxover) - clearqueue(); - ctxover = true; + if (Bflag == 0 || (Bflag > 0 && enqueue(ln))) + ++last_outed; } } - c += t; - if (mflag && mcount <= 0) - break; + + /* Count the matches if we have a match limit */ + if (t == 0 && mflag) { + --mcount; + if (mflag && mcount <= 0) + break; + } + } if (Bflag > 0) clearqueue(); @@ -271,7 +325,7 @@ procfile(const char *fn) if (cflag) { if (!hflag) - printf("%s:", ln.file); + printf("%s:", pc.ln.file); printf("%u\n", c); } if (lflag && !qflag && c != 0) @@ -282,7 +336,7 @@ procfile(const char *fn) binbehave == BINFILE_BIN && f->binary && !qflag) printf(getstr(8), fn); - free(ln.file); + free(pc.ln.file); free(f); return (c); } @@ -297,62 +351,72 @@ procfile(const char *fn) * appropriate output. */ static int -procline(struct str *l, int nottext) +procline(struct parsec *pc) { - regmatch_t matches[MAX_LINE_MATCHES]; - regmatch_t pmatch, lastmatch; + regmatch_t pmatch, lastmatch, chkmatch; + wchar_t wbegin, wend; size_t st = 0, nst = 0; unsigned int i; - int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags; - int startm = 0; + int c = 0, r = 0, lastmatches = 0, leflags = eflags; + size_t startm = 0, matchidx; int retry; + matchidx = pc->matchidx; + + /* Special case: empty pattern with -w flag, check first character */ + if (matchall && wflag) { + if (pc->ln.len == 0) + return (0); + wend = L' '; + if (sscanf(&pc->ln.dat[0], "%lc", &wend) != 1 || iswword(wend)) + return (1); + else + return (0); + } else if (matchall) + return (0); + /* Initialize to avoid a false positive warning from GCC. */ lastmatch.rm_so = lastmatch.rm_eo = 0; /* Loop to process the whole line */ - while (st <= l->len) { + while (st <= pc->ln.len) { lastmatches = 0; - startm = m; + startm = matchidx; retry = 0; if (st > 0) leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ for (i = 0; i < patterns; i++) { pmatch.rm_so = st; - pmatch.rm_eo = l->len; + pmatch.rm_eo = pc->ln.len; #ifndef WITHOUT_FASTMATCH if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], - l->dat, 1, &pmatch, leflags); + pc->ln.dat, 1, &pmatch, leflags); else #endif - r = regexec(&r_pattern[i], l->dat, 1, + r = regexec(&r_pattern[i], pc->ln.dat, 1, &pmatch, leflags); - r = (r == 0) ? 0 : REG_NOMATCH; - if (r == REG_NOMATCH) + if (r != 0) continue; /* Check for full match */ - if (r == 0 && xflag) - if (pmatch.rm_so != 0 || - (size_t)pmatch.rm_eo != l->len) - r = REG_NOMATCH; + if (xflag && (pmatch.rm_so != 0 || + (size_t)pmatch.rm_eo != pc->ln.len)) + continue; /* Check for whole word match */ #ifndef WITHOUT_FASTMATCH - if (r == 0 && (wflag || fg_pattern[i].word)) { + if (wflag || fg_pattern[i].word) { #else - if (r == 0 && wflag) { + if (wflag) { #endif - wchar_t wbegin, wend; - wbegin = wend = L' '; if (pmatch.rm_so != 0 && - sscanf(&l->dat[pmatch.rm_so - 1], + sscanf(&pc->ln.dat[pmatch.rm_so - 1], "%lc", &wbegin) != 1) r = REG_NOMATCH; else if ((size_t)pmatch.rm_eo != - l->len && - sscanf(&l->dat[pmatch.rm_eo], + pc->ln.len && + sscanf(&pc->ln.dat[pmatch.rm_eo], "%lc", &wend) != 1) r = REG_NOMATCH; else if (iswword(wbegin) || @@ -361,7 +425,7 @@ procline(struct str *l, int nottext) /* * If we're doing whole word matching and we * matched once, then we should try the pattern - * again after advancing just past the start of + * again after advancing just past the start of * the earliest match. This allows the pattern * to match later on in the line and possibly * still match a whole word. @@ -369,33 +433,40 @@ procline(struct str *l, int nottext) if (r == REG_NOMATCH && (retry == 0 || pmatch.rm_so + 1 < retry)) retry = pmatch.rm_so + 1; + if (r == REG_NOMATCH) + continue; } - if (r == 0) { - lastmatches++; - lastmatch = pmatch; - if (m == 0) - c++; - if (m < MAX_LINE_MATCHES) { - /* Replace previous match if the new one is earlier and/or longer */ - if (m > startm) { - if (pmatch.rm_so < matches[m-1].rm_so || - (pmatch.rm_so == matches[m-1].rm_so && (pmatch.rm_eo - pmatch.rm_so) > (matches[m-1].rm_eo - matches[m-1].rm_so))) { - matches[m-1] = pmatch; - nst = pmatch.rm_eo; - } - } else { - /* Advance as normal if not */ - matches[m++] = pmatch; - nst = pmatch.rm_eo; - } - } + lastmatches++; + lastmatch = pmatch; - /* matches - skip further patterns */ - if ((color == NULL && !oflag) || - qflag || lflag) - break; + if (matchidx == 0) + c++; + + /* + * Replace previous match if the new one is earlier + * and/or longer. This will lead to some amount of + * extra work if -o/--color are specified, but it's + * worth it from a correctness point of view. + */ + if (matchidx > startm) { + chkmatch = pc->matches[matchidx - 1]; + if (pmatch.rm_so < chkmatch.rm_so || + (pmatch.rm_so == chkmatch.rm_so && + (pmatch.rm_eo - pmatch.rm_so) > + (chkmatch.rm_eo - chkmatch.rm_so))) { + pc->matches[matchidx - 1] = pmatch; + nst = pmatch.rm_eo; + } + } else { + /* Advance as normal if not */ + pc->matches[matchidx++] = pmatch; + nst = pmatch.rm_eo; } + /* avoid excessive matching - skip further patterns */ + if ((color == NULL && !oflag) || qflag || lflag || + matchidx >= MAX_LINE_MATCHES) + break; } /* @@ -414,7 +485,7 @@ procline(struct str *l, int nottext) /* If we didn't have any matches or REG_NOSUB set */ if (lastmatches == 0 || (cflags & REG_NOSUB)) - nst = l->len; + nst = pc->ln.len; if (lastmatches == 0) /* No matches */ @@ -427,45 +498,11 @@ procline(struct str *l, int nottext) st = nst; } - + /* Reflect the new matchidx in the context */ + pc->matchidx = matchidx; if (vflag) c = !c; - - /* Count the matches if we have a match limit */ - if (mflag) - mcount -= c; - - if (c && binbehave == BINFILE_BIN && nottext) - return (c); /* Binary file */ - - /* Dealing with the context */ - if ((tail || c) && !cflag && !qflag && !lflag && !Lflag) { - if (c) { - if (!first && !prev && !tail && (Bflag || Aflag) && - !ctxover) - printf("--\n"); - tail = Aflag; - if (Bflag > 0) { - printqueue(); - ctxover = false; - } - linesqueued = 0; - printline(l, ':', matches, m); - } else { - /* Print -A lines following matches */ - lasta = l->line_no; - printline(l, '-', matches, m); - tail--; - } - } - - if (c) { - prev = true; - first = false; - } else - prev = false; - - return (c); + return (c ? 0 : 1); } /* @@ -520,69 +557,89 @@ grep_strdup(const char *str) } /* - * Prints a matching line according to the command line options. + * Print an entire line as-is, there are no inline matches to consider. This is + * used for printing context. */ -void -printline(struct str *line, int sep, regmatch_t *matches, int m) +void grep_printline(struct str *line, int sep) { + printline_metadata(line, sep); + fwrite(line->dat, line->len, 1, stdout); + putchar(fileeol); +} + +static void +printline_metadata(struct str *line, int sep) { - size_t a = 0; - int i, n = 0; + bool printsep; - /* If matchall, everything matches but don't actually print for -o */ - if (oflag && matchall) - return; - + printsep = false; if (!hflag) { if (!nullflag) { fputs(line->file, stdout); - ++n; + printsep = true; } else { printf("%s", line->file); putchar(0); } } if (nflag) { - if (n > 0) + if (printsep) putchar(sep); printf("%d", line->line_no); - ++n; + printsep = true; } if (bflag) { - if (n > 0) + if (printsep) putchar(sep); printf("%lld", (long long)line->off); - ++n; + printsep = true; } - if (n) + if (printsep) putchar(sep); +} + +/* + * Prints a matching line according to the command line options. + */ +static void +printline(struct parsec *pc, int sep) +{ + size_t a = 0; + size_t i, matchidx; + regmatch_t match; + + /* If matchall, everything matches but don't actually print for -o */ + if (oflag && matchall) + return; + + matchidx = pc->matchidx; + /* --color and -o */ - if ((oflag || color) && m > 0) { - for (i = 0; i < m; i++) { + if ((oflag || color) && matchidx > 0) { + printline_metadata(&pc->ln, sep); + for (i = 0; i < matchidx; i++) { + match = pc->matches[i]; /* Don't output zero length matches */ - if (matches[i].rm_so == matches[i].rm_eo) + if (match.rm_so == match.rm_eo) continue; if (!oflag) - fwrite(line->dat + a, matches[i].rm_so - a, 1, + fwrite(pc->ln.dat + a, match.rm_so - a, 1, stdout); - if (color) + if (color) fprintf(stdout, "\33[%sm\33[K", color); - - fwrite(line->dat + matches[i].rm_so, - matches[i].rm_eo - matches[i].rm_so, 1, - stdout); - if (color) + fwrite(pc->ln.dat + match.rm_so, + match.rm_eo - match.rm_so, 1, stdout); + if (color) fprintf(stdout, "\33[m\33[K"); - a = matches[i].rm_eo; + a = match.rm_eo; if (oflag) putchar('\n'); } if (!oflag) { - if (line->len - a > 0) - fwrite(line->dat + a, line->len - a, 1, stdout); + if (pc->ln.len - a > 0) + fwrite(pc->ln.dat + a, pc->ln.len - a, 1, + stdout); putchar('\n'); } - } else { - fwrite(line->dat, line->len, 1, stdout); - putchar(fileeol); - } + } else + grep_printline(&pc->ln, sep); } From owner-svn-src-all@freebsd.org Wed Aug 16 18:48:55 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 18:55:40 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 19:40:08 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 19:52:33 2017 Return-Path: Delivered-To: svn-src-all@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 6844ADCC8D1; Wed, 16 Aug 2017 19:52:33 +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 32B786CF8C; Wed, 16 Aug 2017 19:52:33 +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 v7GJqWPw007857; Wed, 16 Aug 2017 19:52:32 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GJqWhQ007856; Wed, 16 Aug 2017 19:52:32 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201708161952.v7GJqWhQ007856@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:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322591 - stable/11/sys/netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netpfil/pf X-SVN-Commit-Revision: 322591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 19:52:33 -0000 Author: kp Date: Wed Aug 16 19:52:31 2017 New Revision: 322591 URL: https://svnweb.freebsd.org/changeset/base/322591 Log: MFC r322280: pf_get_sport(): Prevent possible endless loop when searching for an unused nat port This is an import of Alexander Bluhm's OpenBSD commit r1.60, the first chunk had to be modified because on OpenBSD the 'cut' declaration is located elsewhere. Upstream report by Jingmin Zhou: https://marc.info/?l=openbsd-pf&m=150020133510896&w=2 OpenBSD commit message: Use a 32 bit variable to detect integer overflow when searching for an unused nat port. Prevents a possible endless loop if high port is 65535 or low port is 0. report and analysis Jingmin Zhou; OK sashan@ visa@ Quoted from: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_lb.c PR: 221201 Submitted by: Fabian Keil Obtained from: OpenBSD via ElectroBSD Modified: stable/11/sys/netpfil/pf/pf_lb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/pf_lb.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_lb.c Wed Aug 16 19:40:07 2017 (r322590) +++ stable/11/sys/netpfil/pf/pf_lb.c Wed Aug 16 19:52:31 2017 (r322591) @@ -259,7 +259,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } else { - uint16_t tmp, cut; + uint32_t tmp; + uint16_t cut; if (low > high) { tmp = low; @@ -269,7 +270,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf /* low < high */ cut = arc4random() % (1 + high - low) + low; /* low <= cut <= high */ - for (tmp = cut; tmp <= high; ++(tmp)) { + for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { @@ -277,7 +278,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } - for (tmp = cut - 1; tmp >= low; --(tmp)) { + tmp = cut; + for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { From owner-svn-src-all@freebsd.org Wed Aug 16 20:06:39 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 20:08:57 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 20:09:41 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 20:43:29 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 20:54:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 21:42:29 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Aug 16 22:00:57 2017 Return-Path: Delivered-To: svn-src-all@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 C8E3BDD4BFD; Wed, 16 Aug 2017 22:00:57 +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 91E12718F0; Wed, 16 Aug 2017 22:00:57 +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 v7GM0uxw059313; Wed, 16 Aug 2017 22:00:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GM0u6O059312; Wed, 16 Aug 2017 22:00:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708162200.v7GM0u6O059312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 16 Aug 2017 22:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322597 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 22:00:57 -0000 Author: kevans Date: Wed Aug 16 22:00:56 2017 New Revision: 322597 URL: https://svnweb.freebsd.org/changeset/base/322597 Log: MFC r317705: bsdgrep: avoid use of magic number for REG_NOSPEC Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/grep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Wed Aug 16 21:42:27 2017 (r322596) +++ stable/11/usr.bin/grep/grep.c Wed Aug 16 22:00:56 2017 (r322597) @@ -717,8 +717,13 @@ main(int argc, char *argv[]) case GREP_BASIC: break; case GREP_FIXED: - /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */ - cflags |= 0020; +#if defined(REG_NOSPEC) + cflags |= REG_NOSPEC; +#elif defined(REG_LITERAL) + cflags |= REG_LITERAL; +#else + errx(2, "literal expressions not supported at compile time"); +#endif break; case GREP_EXTENDED: cflags |= REG_EXTENDED; From owner-svn-src-all@freebsd.org Wed Aug 16 22:54:37 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Thu Aug 17 01:31:39 2017 Return-Path: Delivered-To: svn-src-all@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 50400DE15FA; Thu, 17 Aug 2017 01:31: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 130B67D031; Thu, 17 Aug 2017 01:31:38 +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 v7H1Vc9x044275; Thu, 17 Aug 2017 01:31:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H1Vcwg044274; Thu, 17 Aug 2017 01:31:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708170131.v7H1Vcwg044274@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 01:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322604 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 322604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 01:31:39 -0000 Author: emaste Date: Thu Aug 17 01:31:37 2017 New Revision: 322604 URL: https://svnweb.freebsd.org/changeset/base/322604 Log: MFC r322356: Mark PROFILE option as broken when targetting mips64 The assembly in sys/mips/include/profile.h will only work for o32 ABI. Submitted by: Alexander Richardson Modified: stable/11/share/mk/src.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Thu Aug 17 00:20:50 2017 (r322603) +++ stable/11/share/mk/src.opts.mk Thu Aug 17 01:31:37 2017 (r322604) @@ -273,7 +273,10 @@ BROKEN_OPTIONS+=LIBSOFT .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif - +.if ${__T:Mmips64*} +# profiling won't work on MIPS64 because there is only assembly for o32 +BROKEN_OPTIONS+=PROFILE +.endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T} == "powerpc64" || ${__T} == "sparc64" __DEFAULT_YES_OPTIONS+=CXGBETOOL From owner-svn-src-all@freebsd.org Thu Aug 17 03:48:52 2017 Return-Path: Delivered-To: svn-src-all@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 A13B3DC6796; Thu, 17 Aug 2017 03:48:52 +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 3E667834E8; Thu, 17 Aug 2017 03:48:52 +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 v7H3mpTB099611; Thu, 17 Aug 2017 03:48:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H3mpWN099609; Thu, 17 Aug 2017 03:48:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708170348.v7H3mpWN099609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 17 Aug 2017 03:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322605 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 03:48:52 -0000 Author: sephe Date: Thu Aug 17 03:48:50 2017 New Revision: 322605 URL: https://svnweb.freebsd.org/changeset/base/322605 Log: MFC 322483,322485-322487 322483 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11948 322485 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. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11978 322486 hyperv/hn: Minor cleanup Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11979 322487 hyperv/hn: Re-set datapath after synthetic parts reattached. Do this even for non-transparent mode VF. Better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11981 Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Aug 17 01:31:37 2017 (r322604) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Aug 17 03:48:50 2017 (r322605) @@ -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 *); @@ -578,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), @@ -1266,16 +1274,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 { /* @@ -1406,6 +1435,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; @@ -1438,10 +1501,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 @@ -1627,11 +1688,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); @@ -1659,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; } @@ -2973,13 +3024,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) { /* @@ -2993,10 +3047,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); @@ -3017,7 +3076,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); } @@ -3025,7 +3084,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 */ @@ -3066,8 +3125,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) { @@ -3122,6 +3182,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; @@ -3171,15 +3262,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; @@ -3192,10 +3304,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); } @@ -3293,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 @@ -3490,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: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Thu Aug 17 01:31:37 2017 (r322604) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Thu Aug 17 03:48:50 2017 (r322605) @@ -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-all@freebsd.org Thu Aug 17 03:56:44 2017 Return-Path: Delivered-To: svn-src-all@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 11411DC75CE; Thu, 17 Aug 2017 03:56:44 +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 CE1EB83C99; Thu, 17 Aug 2017 03:56:43 +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 v7H3ugeM003602; Thu, 17 Aug 2017 03:56:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H3ugCU003601; Thu, 17 Aug 2017 03:56:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708170356.v7H3ugCU003601@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 03:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322606 - stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/contrib/netbsd-tests/usr.bin/grep X-SVN-Commit-Revision: 322606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 03:56:44 -0000 Author: kevans Date: Thu Aug 17 03:56:42 2017 New Revision: 322606 URL: https://svnweb.freebsd.org/changeset/base/322606 Log: MFC r318004 (ngie): Remove expected failure that no longer fails with gnu grep in base Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 03:48:50 2017 (r322605) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 03:56:42 2017 (r322606) @@ -399,11 +399,6 @@ wflag_emptypat_head() } wflag_emptypat_body() { - grep_type - if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then - atf_expect_fail "this test does not pass with GNU grep in base" - fi - printf "" > test1 printf "\n" > test2 printf "qaz" > test3 From owner-svn-src-all@freebsd.org Thu Aug 17 04:04:43 2017 Return-Path: Delivered-To: svn-src-all@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 B7B03DC7F0A; Thu, 17 Aug 2017 04:04:43 +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 8E8B5208; Thu, 17 Aug 2017 04:04:43 +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 v7H44gpi007767; Thu, 17 Aug 2017 04:04:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H44gg0007762; Thu, 17 Aug 2017 04:04:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708170404.v7H44gg0007762@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 04:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322607 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 04:04:43 -0000 Author: kevans Date: Thu Aug 17 04:04:42 2017 New Revision: 322607 URL: https://svnweb.freebsd.org/changeset/base/322607 Log: bsdgrep: Don't allow negative context flags, add more tests MFC r318302: bsdgrep: don't allow negative -A / -B / -C Previously, when given a negative -A/-B/-C argument bsdgrep would overflow the respective context flag(s) and exhibited surprising behavior. Fix this by removing unsignedness of Aflag/Bflag and erroring out if we're given a value < 0. Also adjust the type used to track 'tail' context in procfile() so that it accurately reflects the Aflag value rather than overflowing and losing trailing context. This also fixes an inconsistency previously existing between -n and -C "n" behavior. They are now both limited to LLONG_MAX, to be consistent. Add some test cases to make sure grep errors out properly for both negative context values as well as non-numeric context values rather than giving bogus matches. MFC r318317: bsdgrep: add more tests for different binary flags The existing 'binary' test in netbsd-tests/ does a basic check of the default treatment for binary behavior, but not much more than that. Given some opportunity for breakage recently that did not trigger any failures, add some tests to cover the three different binary file behaviors (a, -I, -U) and their --binary-files= equivalent values. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/queue.c stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 03:56:42 2017 (r322606) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:04:42 2017 (r322607) @@ -517,6 +517,63 @@ grep_nomatch_flags_body() atf_check -o empty grep -q -A 1 -e "B" test1 atf_check -o empty grep -q -C 1 -e "B" test1 } + +atf_test_case badcontext +badcontext_head() +{ + atf_set "descr" "Check for handling of invalid context arguments" +} +badcontext_body() +{ + printf "A\nB\nC\n" > test1 + + atf_check -s not-exit:0 -e ignore grep -A "-1" "B" test1 + + atf_check -s not-exit:0 -e ignore grep -B "-1" "B" test1 + + atf_check -s not-exit:0 -e ignore grep -C "-1" "B" test1 + + atf_check -s not-exit:0 -e ignore grep -A "B" "B" test1 + + atf_check -s not-exit:0 -e ignore grep -B "B" "B" test1 + + atf_check -s not-exit:0 -e ignore grep -C "B" "B" test1 +} + +atf_test_case binary_flags +binary_flags_head() +{ + atf_set "descr" "Check output for binary flags (-a, -I, -U, --binary-files)" +} +binary_flags_body() +{ + printf "A\000B\000C" > test1 + printf "A\n\000B\n\000C" > test2 + binmatchtext="Binary file test1 matches\n" + + # Binaries not treated as text (default, -U) + atf_check -o inline:"${binmatchtext}" grep 'B' test1 + atf_check -o inline:"${binmatchtext}" grep 'B' -C 1 test1 + + atf_check -o inline:"${binmatchtext}" grep -U 'B' test1 + atf_check -o inline:"${binmatchtext}" grep -U 'B' -C 1 test1 + + # Binary, -a, no newlines + atf_check -o inline:"A\000B\000C\n" grep -a 'B' test1 + atf_check -o inline:"A\000B\000C\n" grep -a 'B' -C 1 test1 + + # Binary, -a, newlines + atf_check -o inline:"\000B\n" grep -a 'B' test2 + atf_check -o inline:"A\n\000B\n\000C\n" grep -a 'B' -C 1 test2 + + # Binary files ignored + atf_check -s exit:1 grep -I 'B' test2 + + # --binary-files equivalence + atf_check -o inline:"${binmatchtext}" grep --binary-files=binary 'B' test1 + atf_check -o inline:"A\000B\000C\n" grep --binary-files=text 'B' test1 + atf_check -s exit:1 grep --binary-files=without-match 'B' test2 +} # End FreeBSD atf_init_test_cases() @@ -551,5 +608,7 @@ atf_init_test_cases() atf_add_test_case egrep_sanity atf_add_test_case grep_sanity atf_add_test_case grep_nomatch_flags + atf_add_test_case binary_flags + atf_add_test_case badcontext # End FreeBSD } Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Thu Aug 17 03:56:42 2017 (r322606) +++ stable/11/usr.bin/grep/grep.c Thu Aug 17 04:04:42 2017 (r322607) @@ -109,8 +109,8 @@ struct epat *dpattern, *fpattern; char re_error[RE_ERROR_BUF + 1]; /* Command-line flags */ -unsigned long long Aflag; /* -A x: print x lines trailing each match */ -unsigned long long Bflag; /* -B x: print x lines leading each match */ +long long Aflag; /* -A x: print x lines trailing each match */ +long long Bflag; /* -B x: print x lines leading each match */ bool Hflag; /* -H: always print file name */ bool Lflag; /* -L: only show names of files with no matches */ bool bflag; /* -b: show block numbers for each match */ @@ -352,7 +352,7 @@ main(int argc, char *argv[]) char **aargv, **eargv, *eopts; char *ep; const char *pn; - unsigned long long l; + long long l; unsigned int aargc, eargc, i; int c, lastc, needpattern, newarg, prevoptind; @@ -439,10 +439,11 @@ main(int argc, char *argv[]) case '5': case '6': case '7': case '8': case '9': if (newarg || !isdigit(lastc)) Aflag = 0; - else if (Aflag > LLONG_MAX / 10) { + else if (Aflag > LLONG_MAX / 10 - 1) { errno = ERANGE; err(2, NULL); } + Aflag = Bflag = (Aflag * 10) + (c - '0'); break; case 'C': @@ -455,14 +456,17 @@ main(int argc, char *argv[]) /* FALLTHROUGH */ case 'B': errno = 0; - l = strtoull(optarg, &ep, 10); - if (((errno == ERANGE) && (l == ULLONG_MAX)) || - ((errno == EINVAL) && (l == 0))) + l = strtoll(optarg, &ep, 10); + if (errno == ERANGE || errno == EINVAL) err(2, NULL); else if (ep[0] != '\0') { errno = EINVAL; err(2, NULL); + } else if (l < 0) { + errno = EINVAL; + err(2, "context argument must be non-negative"); } + if (c == 'A') Aflag = l; else if (c == 'B') Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Thu Aug 17 03:56:42 2017 (r322606) +++ stable/11/usr.bin/grep/grep.h Thu Aug 17 04:04:42 2017 (r322607) @@ -115,7 +115,7 @@ extern bool Eflag, Fflag, Gflag, Hflag, Lflag, bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag, qflag, sflag, vflag, wflag, xflag; extern bool dexclude, dinclude, fexclude, finclude, lbflag, nullflag; -extern unsigned long long Aflag, Bflag; +extern long long Aflag, Bflag; extern long long mcount; extern long long mlimit; extern char fileeol; Modified: stable/11/usr.bin/grep/queue.c ============================================================================== --- stable/11/usr.bin/grep/queue.c Thu Aug 17 03:56:42 2017 (r322606) +++ stable/11/usr.bin/grep/queue.c Thu Aug 17 04:04:42 2017 (r322607) @@ -49,7 +49,7 @@ struct qentry { }; static STAILQ_HEAD(, qentry) queue = STAILQ_HEAD_INITIALIZER(queue); -static unsigned long long count; +static long long count; static struct qentry *dequeue(void); Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 03:56:42 2017 (r322606) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 04:04:42 2017 (r322607) @@ -196,11 +196,12 @@ int procfile(const char *fn) { struct parsec pc; + long long tail; struct file *f; struct stat sb; struct str *ln; mode_t s; - int c, last_outed, t, tail; + int c, last_outed, t; bool doctx, printmatch, same_file; if (strcmp(fn, "-") == 0) { From owner-svn-src-all@freebsd.org Thu Aug 17 04:18:32 2017 Return-Path: Delivered-To: svn-src-all@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 6EFA4DC8FDE; Thu, 17 Aug 2017 04:18:32 +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 46072BFE; Thu, 17 Aug 2017 04:18:32 +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 v7H4IVMR012004; Thu, 17 Aug 2017 04:18:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H4IVEM012002; Thu, 17 Aug 2017 04:18:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708170418.v7H4IVEM012002@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 04:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322608 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 04:18:32 -0000 Author: kevans Date: Thu Aug 17 04:18:31 2017 New Revision: 322608 URL: https://svnweb.freebsd.org/changeset/base/322608 Log: bsdgrep: fix segfault with --mmap and add relevant test MFC r318565: bsdgrep: fix segfault with --mmap r313948 partially fixed --mmap behavior but was incomplete. This commit generally reverts it and does it the more correct way- by just consuming the rest of the buffer and moving on. MFC r318908: bsdgrep: add --mmap tests Basic sanity tests as well as coverage for the bug fixed in r318565. PR: 219402 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/file.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:04:42 2017 (r322607) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:18:31 2017 (r322608) @@ -574,6 +574,46 @@ binary_flags_body() atf_check -o inline:"A\000B\000C\n" grep --binary-files=text 'B' test1 atf_check -s exit:1 grep --binary-files=without-match 'B' test2 } + +atf_test_case mmap +mmap_head() +{ + atf_set "descr" "Check basic matching with --mmap flag" +} +mmap_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU ]; then + atf_expect_fail "gnu grep from ports has no --mmap option" + fi + + printf "A\nB\nC\n" > test1 + + atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1 + atf_check -s exit:1 grep --mmap -e "Z" test1 +} + +atf_test_case mmap_eof_not_eol +mmap_eof_not_eol_head() +{ + atf_set "descr" "Check --mmap flag handling of encountering EOF without EOL (PR 165471, 219402)" +} +mmap_eof_not_eol_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU ]; then + atf_expect_fail "gnu grep from ports has no --mmap option" + fi + + printf "ABC" > test1 + jot -b " " -s "" 4096 >> test2 + + atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1 + # Dependency on jemalloc(3) to detect buffer overflow, otherwise this + # unreliably produces a SIGSEGV or SIGBUS + atf_check -s exit:0 -o not-empty \ + env MALLOC_CONF="redzone:true" grep --mmap -e " " test2 +} # End FreeBSD atf_init_test_cases() @@ -610,5 +650,7 @@ atf_init_test_cases() atf_add_test_case grep_nomatch_flags atf_add_test_case binary_flags atf_add_test_case badcontext + atf_add_test_case mmap + atf_add_test_case mmap_eof_not_eol # End FreeBSD } Modified: stable/11/usr.bin/grep/file.c ============================================================================== --- stable/11/usr.bin/grep/file.c Thu Aug 17 04:04:42 2017 (r322607) +++ stable/11/usr.bin/grep/file.c Thu Aug 17 04:18:31 2017 (r322608) @@ -213,24 +213,24 @@ grep_fgetln(struct file *f, size_t *lenp) if (grep_lnbufgrow(len + LNBUFBUMP)) goto error; memcpy(lnbuf + off, bufpos, len - off); + /* With FILE_MMAP, this is EOF; there's no more to refill */ + if (filebehave == FILE_MMAP) { + bufrem -= len; + break; + } off = len; + /* Fetch more to try and find EOL/EOF */ if (grep_refill(f) != 0) goto error; if (bufrem == 0) /* EOF: return partial line */ break; - if ((p = memchr(bufpos, fileeol, bufrem)) == NULL && - filebehave != FILE_MMAP) + if ((p = memchr(bufpos, fileeol, bufrem)) == NULL) continue; - if (p == NULL) { - /* mmap EOF: return partial line, consume buffer */ - diff = len; - } else { - /* got it: finish up the line (like code above) */ - ++p; - diff = p - bufpos; - len += diff; - } + /* got it: finish up the line (like code above) */ + ++p; + diff = p - bufpos; + len += diff; if (grep_lnbufgrow(len)) goto error; memcpy(lnbuf + off, bufpos, diff); From owner-svn-src-all@freebsd.org Thu Aug 17 04:26:05 2017 Return-Path: Delivered-To: svn-src-all@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 E3353DC98E7; Thu, 17 Aug 2017 04:26:05 +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 A1E891188; Thu, 17 Aug 2017 04:26:05 +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 v7H4Q4dX015846; Thu, 17 Aug 2017 04:26:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H4Q4SL015844; Thu, 17 Aug 2017 04:26:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708170426.v7H4Q4SL015844@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 04:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322609 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 04:26:06 -0000 Author: kevans Date: Thu Aug 17 04:26:04 2017 New Revision: 322609 URL: https://svnweb.freebsd.org/changeset/base/322609 Log: MFC r318571: bsdgrep: emit more than MAX_LINE_MATCHES per line We should not set an arbitrary cap on the number of matches on a line, and in any case MAX_LINE_MATCHES of 32 is much too low. Instead, if we match more than MAX_LINE_MATCHES, keep processing and matching from the last match until all are found. For the regression test, we produce 4096 matches (larger than we expect we'll ever set MAX_LINE_MATCHES) and make sure we actually get 4096 lines of output with the -o flag. We'll also make sure that every distinct line is getting its own line number to detect line metadata not being printed as appropriate along the way. PR: 218811 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:18:31 2017 (r322608) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:26:04 2017 (r322609) @@ -413,6 +413,26 @@ wflag_emptypat_body() atf_check -o file:test4 grep -w -e "" test4 } +atf_test_case excessive_matches +excessive_matches_head() +{ + atf_set "descr" "Check for proper handling of lines with excessive matches (PR 218811)" +} +excessive_matches_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + + for i in $(jot 4096); do + printf "x" >> test.in + done + + atf_check -s exit:0 -x '[ $(grep -o x test.in | wc -l) -eq 4096 ]' + #atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"' +} + atf_test_case fgrep_sanity fgrep_sanity_head() { @@ -643,6 +663,7 @@ atf_init_test_cases() atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen atf_add_test_case wflag_emptypat + atf_add_test_case excessive_matches atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 04:18:31 2017 (r322608) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 04:26:04 2017 (r322609) @@ -63,6 +63,7 @@ static bool first_match = true; struct parsec { regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ struct str ln; /* Current line */ + size_t lnstart; /* Start of line processing */ size_t matchidx; /* Latest used match index */ bool binary; /* Binary file? */ }; @@ -247,8 +248,9 @@ procfile(const char *fn) mcount = mlimit; for (c = 0; c == 0 || !(lflag || qflag); ) { - /* Reset match count for every line processed */ + /* Reset match count and line start for every line processed */ pc.matchidx = 0; + pc.lnstart = 0; pc.ln.off += pc.ln.len + 1; if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || pc.ln.len == 0) { @@ -288,6 +290,14 @@ procfile(const char *fn) /* Print the matching line, but only if not quiet/binary */ if (t == 0 && printmatch) { printline(&pc, ':'); + while (pc.matchidx >= MAX_LINE_MATCHES) { + /* Reset matchidx and try again */ + pc.matchidx = 0; + if (procline(&pc) == 0) + printline(&pc, ':'); + else + break; + } first_match = false; same_file = true; last_outed = 0; @@ -356,11 +366,11 @@ procline(struct parsec *pc) { regmatch_t pmatch, lastmatch, chkmatch; wchar_t wbegin, wend; - size_t st = 0, nst = 0; + size_t st, nst; unsigned int i; int c = 0, r = 0, lastmatches = 0, leflags = eflags; size_t startm = 0, matchidx; - int retry; + unsigned int retry; matchidx = pc->matchidx; @@ -376,6 +386,8 @@ procline(struct parsec *pc) } else if (matchall) return (0); + st = pc->lnstart; + nst = 0; /* Initialize to avoid a false positive warning from GCC. */ lastmatch.rm_so = lastmatch.rm_eo = 0; @@ -432,12 +444,12 @@ procline(struct parsec *pc) * still match a whole word. */ if (r == REG_NOMATCH && - (retry == 0 || pmatch.rm_so + 1 < retry)) + (retry == pc->lnstart || + pmatch.rm_so + 1 < retry)) retry = pmatch.rm_so + 1; if (r == REG_NOMATCH) continue; } - lastmatches++; lastmatch = pmatch; @@ -466,8 +478,11 @@ procline(struct parsec *pc) } /* avoid excessive matching - skip further patterns */ if ((color == NULL && !oflag) || qflag || lflag || - matchidx >= MAX_LINE_MATCHES) + matchidx >= MAX_LINE_MATCHES) { + pc->lnstart = nst; + lastmatches = 0; break; + } } /* @@ -475,7 +490,7 @@ procline(struct parsec *pc) * again just in case we still have a chance to match later in * the string. */ - if (lastmatches == 0 && retry > 0) { + if (lastmatches == 0 && retry > pc->lnstart) { st = retry; continue; } @@ -497,6 +512,7 @@ procline(struct parsec *pc) /* Advance st based on previous matches */ st = nst; + pc->lnstart = st; } /* Reflect the new matchidx in the context */ From owner-svn-src-all@freebsd.org Thu Aug 17 04:30:33 2017 Return-Path: Delivered-To: svn-src-all@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 2FB86DC9E37; Thu, 17 Aug 2017 04:30:33 +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 060801457; Thu, 17 Aug 2017 04:30:32 +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 v7H4UVIg016094; Thu, 17 Aug 2017 04:30:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H4UVws016090; Thu, 17 Aug 2017 04:30:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708170430.v7H4UVws016090@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 04:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322610 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 04:30:33 -0000 Author: kevans Date: Thu Aug 17 04:30:31 2017 New Revision: 322610 URL: https://svnweb.freebsd.org/changeset/base/322610 Log: MFC r318574: bsdgrep: Correct per-line line metadata printing Metadata printing with -b, -H, or -n flags suffered from a few flaws: 1) -b/offset printing was broken when used in conjunction with -o 2) With -o, bsdgrep did not print metadata for every match/line, just the first match of a line 3) There were no tests for this Address these issues by outputting this data per-match if the -o flag is specified, and prior to outputting any matches if -o but not --color, since --color alone will not generate a new line of output for every iteration over the matches. To correct -b output, fudge the line offset as we're printing matches. While here, make sure we're using grep_printline in -A context. Context printing should *never* look at the parsing context, just the line. The tests included do not pass with gnugrep in base due to it exhibiting similar quirky behavior that bsdgrep previously exhibited. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/queue.c stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:26:04 2017 (r322609) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 17 04:30:31 2017 (r322610) @@ -430,7 +430,7 @@ excessive_matches_body() done atf_check -s exit:0 -x '[ $(grep -o x test.in | wc -l) -eq 4096 ]' - #atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"' + atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"' } atf_test_case fgrep_sanity @@ -510,6 +510,39 @@ wv_combo_break_body() atf_check -s exit:1 grep -v -w "x" test2 } +atf_test_case ocolor_metadata +ocolor_metadata_head() +{ + atf_set "descr" "Check for -n/-b producing per-line metadata output" +} +ocolor_metadata_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + + printf "xxx\nyyyy\nzzz\nfoobarbaz\n" > test1 + check_expr="^[^:]*[0-9][^:]*:[^:]+$" + + atf_check -o inline:"1:1:xx\n" grep -bon "xx$" test1 + + atf_check -o inline:"2:4:yyyy\n" grep -bn "yy" test1 + + atf_check -o inline:"2:6:yy\n" grep -bon "yy$" test1 + + # These checks ensure that grep isn't producing bogus line numbering + # in the middle of a line. + atf_check -s exit:1 -x \ + "grep -Eon 'x|y|z|f' test1 | grep -Ev '${check_expr}'" + + atf_check -s exit:1 -x \ + "grep -En 'x|y|z|f' --color=always test1 | grep -Ev '${check_expr}'" + + atf_check -s exit:1 -x \ + "grep -Eon 'x|y|z|f' --color=always test1 | grep -Ev '${check_expr}'" +} + atf_test_case grep_nomatch_flags grep_nomatch_flags_head() { @@ -668,6 +701,7 @@ atf_init_test_cases() atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity atf_add_test_case grep_sanity + atf_add_test_case ocolor_metadata atf_add_test_case grep_nomatch_flags atf_add_test_case binary_flags atf_add_test_case badcontext Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Thu Aug 17 04:26:04 2017 (r322609) +++ stable/11/usr.bin/grep/grep.h Thu Aug 17 04:30:31 2017 (r322610) @@ -90,6 +90,7 @@ struct file { }; struct str { + off_t boff; off_t off; size_t len; char *dat; Modified: stable/11/usr.bin/grep/queue.c ============================================================================== --- stable/11/usr.bin/grep/queue.c Thu Aug 17 04:26:04 2017 (r322609) +++ stable/11/usr.bin/grep/queue.c Thu Aug 17 04:30:31 2017 (r322610) @@ -65,6 +65,7 @@ enqueue(struct str *x) item->data.dat = grep_malloc(sizeof(char) * x->len); item->data.len = x->len; item->data.line_no = x->line_no; + item->data.boff = x->boff; item->data.off = x->off; memcpy(item->data.dat, x->dat, x->len); item->data.file = x->file; Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 04:26:04 2017 (r322609) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 04:30:31 2017 (r322610) @@ -61,11 +61,12 @@ static bool first_match = true; * other useful bits */ struct parsec { - regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ - struct str ln; /* Current line */ - size_t lnstart; /* Start of line processing */ - size_t matchidx; /* Latest used match index */ - bool binary; /* Binary file? */ + regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ + struct str ln; /* Current line */ + size_t lnstart; /* Position in line */ + size_t matchidx; /* Latest match index */ + int printed; /* Metadata printed? */ + bool binary; /* Binary file? */ }; @@ -233,8 +234,10 @@ procfile(const char *fn) strcpy(pc.ln.file, fn); pc.ln.line_no = 0; pc.ln.len = 0; + pc.ln.boff = 0; pc.ln.off = -1; pc.binary = f->binary; + pc.printed = 0; tail = 0; last_outed = 0; same_file = false; @@ -248,9 +251,11 @@ procfile(const char *fn) mcount = mlimit; for (c = 0; c == 0 || !(lflag || qflag); ) { - /* Reset match count and line start for every line processed */ + /* Reset per-line statistics */ + pc.printed = 0; pc.matchidx = 0; pc.lnstart = 0; + pc.ln.boff = 0; pc.ln.off += pc.ln.len + 1; if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || pc.ln.len == 0) { @@ -305,7 +310,7 @@ procfile(const char *fn) if (t != 0 && doctx) { /* Deal with any -A context */ if (tail > 0) { - printline(&pc, '-'); + grep_printline(&pc.ln, '-'); tail--; if (Bflag > 0) clearqueue(); @@ -607,7 +612,7 @@ printline_metadata(struct str *line, int sep) if (bflag) { if (printsep) putchar(sep); - printf("%lld", (long long)line->off); + printf("%lld", (long long)(line->off + line->boff)); printsep = true; } if (printsep) @@ -632,13 +637,22 @@ printline(struct parsec *pc, int sep) /* --color and -o */ if ((oflag || color) && matchidx > 0) { - printline_metadata(&pc->ln, sep); + /* Only print metadata once per line if --color */ + if (!oflag && pc->printed == 0) + printline_metadata(&pc->ln, sep); for (i = 0; i < matchidx; i++) { match = pc->matches[i]; /* Don't output zero length matches */ if (match.rm_so == match.rm_eo) continue; - if (!oflag) + /* + * Metadata is printed on a per-line basis, so every + * match gets file metadata with the -o flag. + */ + if (oflag) { + pc->ln.boff = match.rm_so; + printline_metadata(&pc->ln, sep); + } else fwrite(pc->ln.dat + a, match.rm_so - a, 1, stdout); if (color) @@ -659,4 +673,5 @@ printline(struct parsec *pc, int sep) } } else grep_printline(&pc->ln, sep); + pc->printed++; } From owner-svn-src-all@freebsd.org Thu Aug 17 04:37:29 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 05:09:25 2017 Return-Path: Delivered-To: svn-src-all@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 97BC5DCC7C1; Thu, 17 Aug 2017 05:09:25 +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 543832CA1; Thu, 17 Aug 2017 05:09:25 +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 v7H59OV2032361; Thu, 17 Aug 2017 05:09:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H59M1b032343; Thu, 17 Aug 2017 05:09:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708170509.v7H59M1b032343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 17 Aug 2017 05:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322612 - in stable/11/sys/dev/hyperv: include netvsc pcib storvsc utilities vmbus vmbus/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in stable/11/sys/dev/hyperv: include netvsc pcib storvsc utilities vmbus vmbus/amd64 X-SVN-Commit-Revision: 322612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 05:09:25 -0000 Author: sephe Date: Thu Aug 17 05:09:22 2017 New Revision: 322612 URL: https://svnweb.freebsd.org/changeset/base/322612 Log: MFC 322488 hyperv: Update copyright for the files changed in 2017 Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11982 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hn_nvs.c stable/11/sys/dev/hyperv/netvsc/hn_nvs.h stable/11/sys/dev/hyperv/netvsc/hn_rndis.c stable/11/sys/dev/hyperv/netvsc/hn_rndis.h stable/11/sys/dev/hyperv/netvsc/if_hn.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/vmbus_timesync.c stable/11/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_et.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/include/hyperv.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/hn_nvs.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hn_nvs.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/hn_nvs.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/hn_nvs.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hn_nvs.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/hn_nvs.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/hn_rndis.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hn_rndis.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/hn_rndis.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/hn_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hn_rndis.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/hn_rndis.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c ============================================================================== --- stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/utilities/vmbus_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/vmbus_timesync.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/utilities/vmbus_timesync.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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: stable/11/sys/dev/hyperv/vmbus/vmbus_et.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_et.c Thu Aug 17 04:37:27 2017 (r322611) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_et.c Thu Aug 17 05:09:22 2017 (r322612) @@ -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-all@freebsd.org Thu Aug 17 06:36:22 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 07:20:10 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 07:43:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 10:48:57 2017 Return-Path: Delivered-To: svn-src-all@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 B8683DDA855; Thu, 17 Aug 2017 10:48:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81C026BE8A; Thu, 17 Aug 2017 10:48:57 +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 v7HAmuk6070276; Thu, 17 Aug 2017 10:48:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HAmu3h070275; Thu, 17 Aug 2017 10:48:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708171048.v7HAmu3h070275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 17 Aug 2017 10:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322615 - stable/11/usr.sbin/cpucontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.sbin/cpucontrol X-SVN-Commit-Revision: 322615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 10:48:57 -0000 Author: kib Date: Thu Aug 17 10:48:56 2017 New Revision: 322615 URL: https://svnweb.freebsd.org/changeset/base/322615 Log: MFC r322493: Remove confusion in the line explaining syntax of the msr read. Specify words order in the display. Modified: stable/11/usr.sbin/cpucontrol/cpucontrol.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- stable/11/usr.sbin/cpucontrol/cpucontrol.8 Thu Aug 17 07:20:09 2017 (r322614) +++ stable/11/usr.sbin/cpucontrol/cpucontrol.8 Thu Aug 17 10:48:56 2017 (r322615) @@ -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-all@freebsd.org Thu Aug 17 10:56:24 2017 Return-Path: Delivered-To: svn-src-all@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 21108DDACAC; Thu, 17 Aug 2017 10:56:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB27F6C406; Thu, 17 Aug 2017 10:56:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HAuMGR074313; Thu, 17 Aug 2017 10:56:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HAuMYd074312; Thu, 17 Aug 2017 10:56:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708171056.v7HAuMYd074312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 17 Aug 2017 10:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322616 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 10:56:24 -0000 Author: kib Date: Thu Aug 17 10:56:22 2017 New Revision: 322616 URL: https://svnweb.freebsd.org/changeset/base/322616 Log: MFC r322494: Style. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Thu Aug 17 10:48:56 2017 (r322615) +++ stable/11/sys/amd64/amd64/trap.c Thu Aug 17 10:56:22 2017 (r322616) @@ -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; PCPU_INC(cnt.v_trap); type = frame->tf_trapno; From owner-svn-src-all@freebsd.org Thu Aug 17 11:36:40 2017 Return-Path: Delivered-To: svn-src-all@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 AB3DADDCAB0; Thu, 17 Aug 2017 11:36:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 748F56D801; Thu, 17 Aug 2017 11:36:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HBad5p090688; Thu, 17 Aug 2017 11:36:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HBadsQ090687; Thu, 17 Aug 2017 11:36:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708171136.v7HBadsQ090687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 17 Aug 2017 11:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322617 - stable/10/usr.sbin/cpucontrol X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/usr.sbin/cpucontrol X-SVN-Commit-Revision: 322617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 11:36:40 -0000 Author: kib Date: Thu Aug 17 11:36:39 2017 New Revision: 322617 URL: https://svnweb.freebsd.org/changeset/base/322617 Log: MFC r322493: Remove confusion in the line explaining syntax of the msr read. Specify words order in the display. Approved by: re (marius) Modified: stable/10/usr.sbin/cpucontrol/cpucontrol.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- stable/10/usr.sbin/cpucontrol/cpucontrol.8 Thu Aug 17 10:56:22 2017 (r322616) +++ stable/10/usr.sbin/cpucontrol/cpucontrol.8 Thu Aug 17 11:36:39 2017 (r322617) @@ -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-all@freebsd.org Thu Aug 17 13:40:46 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 13:48:47 2017 Return-Path: Delivered-To: svn-src-all@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 A9C7ADE2DAC; Thu, 17 Aug 2017 13:48:47 +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 73C4372B8C; Thu, 17 Aug 2017 13:48:47 +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 v7HDmkx8045348; Thu, 17 Aug 2017 13:48:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HDmkqe045347; Thu, 17 Aug 2017 13:48:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708171348.v7HDmkqe045347@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:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322619 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 13:48:47 -0000 Author: kevans Date: Thu Aug 17 13:48:46 2017 New Revision: 322619 URL: https://svnweb.freebsd.org/changeset/base/322619 Log: bsdgrep: fix build when linking against libgnuregex MFC r322618: bsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex Approved by: emaste (mentor) Modified: stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 13:40:45 2017 (r322618) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 13:48:46 2017 (r322619) @@ -450,7 +450,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-all@freebsd.org Thu Aug 17 13:55:12 2017 Return-Path: Delivered-To: svn-src-all@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 04756DE328A for ; Thu, 17 Aug 2017 13:55:12 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wr0-x234.google.com (mail-wr0-x234.google.com [IPv6:2a00:1450:400c:c0c::234]) (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 84C777318D for ; Thu, 17 Aug 2017 13:55:11 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wr0-x234.google.com with SMTP id y96so41402388wrc.1 for ; Thu, 17 Aug 2017 06:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=kG/qGSgkJJFq2gw1jF3gOeY3oBHNAtqAqIPcYxYEppE=; b=y8RPT93jp4BA7lP9YYaRP3p6oZViDfrZ9Cq7okq5Pl/UTem5jpXShC2OkJRkGlWV09 UTYfBsEutTSg7lDNIaT4KpiiiE/FFPMxVROiKm2DUioavwSI6KpHtSIuY4/OeQvlHyJf oM9cKBGwqgflrNSMwPKLkAXEVU9oFs3FLUd6Xd0N77aUVX76sf+S3WJk4Kze5FERml1j PC2u7359esCkGXa5ZbASoiMq9i+eVkA9v5/aUmMIUF2k1T+OV5bCcbOP47StPtqLMGPz ItWjIQ8omx/X2VNpedkNcV6UMbCu9XzcxZn63Un5214GLabs7q+bb7uBe9shJSoF9R/C F2rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=kG/qGSgkJJFq2gw1jF3gOeY3oBHNAtqAqIPcYxYEppE=; b=qMoVZ0JjeCkEPz3KSEwDBTRYvrBSPvZ6h6g5xPEIUnl4hh/IG/g5BXL3AYZkJ262Bn 7bpnx9hF4HMPoyNbbA08vp6AUasQYWeXhYFuSfFuf6eGjh/bGnxtTe+PfJR7TWBo5sLT ESoUgUBBj9YBAv1I6irUh4zo0ehsg2M6T0anCMexyX1jlTv3KPzCEngsNmJymQX0/Nxg IQAelSZXdhzaNZJvP+ZuUhrAuIQlwJWyMjNgMDxFGT1iGRUEtN/QSeHgztWZVHOL7W10 d6IKVX/Hop3r8h4tiBWOYrGEdIJ9LG6b0yE+k4RKetLC8jn+TPNDSvZhNxUBDSWZPQzY mUpQ== X-Gm-Message-State: AHYfb5iro9VcTRjfQ9Z1rK5UgtyHHRCwpCYhdFojXHbPJwdCmhhyAkhx ovJ2mDjJabWJaSu7 X-Received: by 10.28.105.5 with SMTP id e5mr1295670wmc.42.1502978109938; Thu, 17 Aug 2017 06:55:09 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.15]) by smtp.gmail.com with ESMTPSA id n17sm3288241wra.6.2017.08.17.06.55.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2017 06:55:09 -0700 (PDT) Subject: Re: svn commit: r322619 - stable/11/usr.bin/grep To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201708171348.v7HDmkqe045347@repo.freebsd.org> From: Steven Hartland Message-ID: Date: Thu, 17 Aug 2017 14:55:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201708171348.v7HDmkqe045347@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 13:55:12 -0000 This seems a little quick considering it only hit head 8 mins ago. On 17/08/2017 14:48, Kyle Evans wrote: > Author: kevans > Date: Thu Aug 17 13:48:46 2017 > New Revision: 322619 > URL: https://svnweb.freebsd.org/changeset/base/322619 > > Log: > bsdgrep: fix build when linking against libgnuregex > > MFC r322618: bsdgrep: cast pmatch.rm_so to fix build when linking against > libgnuregex > > Approved by: emaste (mentor) > > Modified: > stable/11/usr.bin/grep/util.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/usr.bin/grep/util.c > ============================================================================== > --- stable/11/usr.bin/grep/util.c Thu Aug 17 13:40:45 2017 (r322618) > +++ stable/11/usr.bin/grep/util.c Thu Aug 17 13:48:46 2017 (r322619) > @@ -450,7 +450,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-all@freebsd.org Thu Aug 17 14:04:19 2017 Return-Path: Delivered-To: svn-src-all@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 75FB1DE3901; Thu, 17 Aug 2017 14:04:19 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com [209.85.217.177]) (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 2F77573676; Thu, 17 Aug 2017 14:04:18 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-ua0-f177.google.com with SMTP id k43so25086576uaf.3; Thu, 17 Aug 2017 07:04:18 -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; bh=COTzbNz5kX+SMYWqMhDIxP8Ud4tjb3qhiTrEq1fghNg=; b=isD7bYMN7cfHmh3RSZ98DjhKlhCF7CvV5h/YLD0Pu7UbNzceMsmEhombzGEERWScqn 60E5rRvB2LkJDlEunn/H2U9RCK7znUHofN6par+kD7JsbAEtbrD1PTxcduWG3iy3bOHZ b5vfxEUJeQudpUtd3pVpekF5OtCViZ/Rb8dKccl+2JQytZSMrDIcWWBe/KYOfZs7wjif +KmgWWrfIF2euTShAiZUpfpyzSkrAdIVUfvwSYfTYF9vazr/L+eKFAqvXl12ctUX/ZLs NHklLPfJYAKDLTtZpYaqwaN+T1jcM9fgDdiaanfOgCpO6q2Z41DPJVvIfby4fdX1Kc3B xMgQ== X-Gm-Message-State: AHYfb5jIqrrMSkJXKtJZsewZ3gT9AUUX9/ueli8lCiKjPgbmxNRadzp5 QK6PrVbAExz1tUSHQ2HP5g== X-Received: by 10.176.25.197 with SMTP id r5mr3667717uai.22.1502978652414; Thu, 17 Aug 2017 07:04:12 -0700 (PDT) Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com. [209.85.217.177]) by smtp.gmail.com with ESMTPSA id t2sm691214vke.1.2017.08.17.07.04.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2017 07:04:11 -0700 (PDT) Received: by mail-ua0-f177.google.com with SMTP id r9so15723793uad.0; Thu, 17 Aug 2017 07:04:11 -0700 (PDT) X-Received: by 10.176.26.12 with SMTP id a12mr3578617uai.110.1502978651632; Thu, 17 Aug 2017 07:04:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.56.194 with HTTP; Thu, 17 Aug 2017 07:03:51 -0700 (PDT) In-Reply-To: References: <201708171348.v7HDmkqe045347@repo.freebsd.org> From: Kyle Evans Date: Thu, 17 Aug 2017 09:03:51 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322619 - stable/11/usr.bin/grep To: Steven Hartland Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 14:04:19 -0000 Previous commit had broken the build and the fix had been prepared/tested locally for a while due to other changes On Thu, Aug 17, 2017 at 8:55 AM, Steven Hartland < steven.hartland@multiplay.co.uk> wrote: > This seems a little quick considering it only hit head 8 mins ago. > > > On 17/08/2017 14:48, Kyle Evans wrote: > > Author: kevans > Date: Thu Aug 17 13:48:46 2017 > New Revision: 322619 > URL: https://svnweb.freebsd.org/changeset/base/322619 > > Log: > bsdgrep: fix build when linking against libgnuregex > > MFC r322618: bsdgrep: cast pmatch.rm_so to fix build when linking against > libgnuregex > > Approved by: emaste (mentor) > > Modified: > stable/11/usr.bin/grep/util.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/usr.bin/grep/util.c > ============================================================================== > --- stable/11/usr.bin/grep/util.c Thu Aug 17 13:40:45 2017 (r322618) > +++ stable/11/usr.bin/grep/util.c Thu Aug 17 13:48:46 2017 (r322619) > @@ -450,7 +450,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-all@freebsd.org Thu Aug 17 14:40:50 2017 Return-Path: Delivered-To: svn-src-all@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 10557DE4F8C; Thu, 17 Aug 2017 14:40:50 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C84D6749EE; Thu, 17 Aug 2017 14:40:49 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HEemUE066790; Thu, 17 Aug 2017 14:40:48 GMT (envelope-from matthew@FreeBSD.org) Received: (from matthew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HEemtf066789; Thu, 17 Aug 2017 14:40:48 GMT (envelope-from matthew@FreeBSD.org) Message-Id: <201708171440.v7HEemtf066789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: matthew set sender to matthew@FreeBSD.org using -f From: Matthew Seaman Date: Thu, 17 Aug 2017 14:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322620 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: matthew X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 14:40:50 -0000 Author: matthew (ports committer) Date: Thu Aug 17 14:40:48 2017 New Revision: 322620 URL: https://svnweb.freebsd.org/changeset/base/322620 Log: Take in ache's commit bit. requiescat in pace Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Thu Aug 17 13:48:46 2017 (r322619) +++ svnadmin/conf/access Thu Aug 17 14:40:48 2017 (r322620) @@ -17,7 +17,6 @@ # Changes to email forwards can be made without core's approval. Please # use "Approved by: core (implicit)" to that type of commits. # -ache achim adrian ae From owner-svn-src-all@freebsd.org Thu Aug 17 16:54:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 17:09:29 2017 Return-Path: Delivered-To: svn-src-all@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 E3F0EDCA701; Thu, 17 Aug 2017 17:09:29 +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 BB63F7FF7D; Thu, 17 Aug 2017 17:09:29 +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 v7HH9SQn035583; Thu, 17 Aug 2017 17:09:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HH9SeZ035580; Thu, 17 Aug 2017 17:09:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708171709.v7HH9SeZ035580@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 17:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322622 - stable/11/usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep X-SVN-Commit-Revision: 322622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 17:09:30 -0000 Author: kevans Date: Thu Aug 17 17:09:28 2017 New Revision: 322622 URL: https://svnweb.freebsd.org/changeset/base/322622 Log: MFC r318914: bsdgrep: correct assumptions to prepare for chunking Correct a couple of minor BSD grep assumptions that are valid for line processing but not future chunk-based processing. Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Thu Aug 17 16:54:37 2017 (r322621) +++ stable/11/usr.bin/grep/grep.c Thu Aug 17 17:09:28 2017 (r322622) @@ -79,7 +79,7 @@ const char *errstr[] = { }; /* Flags passed to regcomp() and regexec() */ -int cflags = REG_NOSUB; +int cflags = REG_NOSUB | REG_NEWLINE; int eflags = REG_STARTEND; /* XXX TODO: Get rid of this flag. Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Thu Aug 17 16:54:37 2017 (r322621) +++ stable/11/usr.bin/grep/grep.h Thu Aug 17 17:09:28 2017 (r322622) @@ -82,7 +82,7 @@ extern const char *errstr[]; #define EXCL_PAT 0 #define INCL_PAT 1 -#define MAX_LINE_MATCHES 32 +#define MAX_MATCHES 32 struct file { int fd; Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 16:54:37 2017 (r322621) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 17:09:28 2017 (r322622) @@ -61,7 +61,7 @@ static bool first_match = true; * other useful bits */ struct parsec { - regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ + regmatch_t matches[MAX_MATCHES]; /* Matches made */ struct str ln; /* Current line */ size_t lnstart; /* Position in line */ size_t matchidx; /* Latest match index */ @@ -295,7 +295,7 @@ procfile(const char *fn) /* Print the matching line, but only if not quiet/binary */ if (t == 0 && printmatch) { printline(&pc, ':'); - while (pc.matchidx >= MAX_LINE_MATCHES) { + while (pc.matchidx >= MAX_MATCHES) { /* Reset matchidx and try again */ pc.matchidx = 0; if (procline(&pc) == 0) @@ -401,7 +401,7 @@ procline(struct parsec *pc) lastmatches = 0; startm = matchidx; retry = 0; - if (st > 0) + if (st > 0 && pc->ln.dat[st - 1] != fileeol) leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ for (i = 0; i < patterns; i++) { @@ -483,7 +483,7 @@ procline(struct parsec *pc) } /* avoid excessive matching - skip further patterns */ if ((color == NULL && !oflag) || qflag || lflag || - matchidx >= MAX_LINE_MATCHES) { + matchidx >= MAX_MATCHES) { pc->lnstart = nst; lastmatches = 0; break; From owner-svn-src-all@freebsd.org Thu Aug 17 17:12:01 2017 Return-Path: Delivered-To: svn-src-all@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 04B15DCAA1F; Thu, 17 Aug 2017 17:12:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2E86802FA; Thu, 17 Aug 2017 17:12:00 +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 v7HHBxrX038626; Thu, 17 Aug 2017 17:11:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HHBxc7038625; Thu, 17 Aug 2017 17:11:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708171711.v7HHBxc7038625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 17 Aug 2017 17:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322623 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 322623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 17:12:01 -0000 Author: markj Date: Thu Aug 17 17:11:59 2017 New Revision: 322623 URL: https://svnweb.freebsd.org/changeset/base/322623 Log: MFC r322383: Make vm_page_sunbusy() assert that the page is unlocked. Modified: stable/11/sys/vm/vm_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Thu Aug 17 17:09:28 2017 (r322622) +++ stable/11/sys/vm/vm_page.c Thu Aug 17 17:11:59 2017 (r322623) @@ -745,6 +745,7 @@ vm_page_sunbusy(vm_page_t m) { u_int x; + vm_page_lock_assert(m, MA_NOTOWNED); vm_page_assert_sbusied(m); for (;;) { From owner-svn-src-all@freebsd.org Thu Aug 17 17:13:16 2017 Return-Path: Delivered-To: svn-src-all@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 67DC0DCAC26; Thu, 17 Aug 2017 17:13:16 +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 31965806D7; Thu, 17 Aug 2017 17:13:16 +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 v7HHDF3r039587; Thu, 17 Aug 2017 17:13:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HHDFF4039586; Thu, 17 Aug 2017 17:13:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708171713.v7HHDFF4039586@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 17:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322624 - stable/11/usr.bin/grep/regex X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep/regex X-SVN-Commit-Revision: 322624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 17:13:16 -0000 Author: kevans Date: Thu Aug 17 17:13:15 2017 New Revision: 322624 URL: https://svnweb.freebsd.org/changeset/base/322624 Log: MFC r318916: bsdgrep: use safer sizeof() construct Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- stable/11/usr.bin/grep/regex/tre-fastmatch.c Thu Aug 17 17:11:59 2017 (r322623) +++ stable/11/usr.bin/grep/regex/tre-fastmatch.c Thu Aug 17 17:13:15 2017 (r322624) @@ -351,7 +351,7 @@ static int fastcmp(const fastmatch_t *fg, const void * #define FILL_BMGS \ if (fg->len > 0 && !fg->hasdot) \ { \ - fg->sbmGs = malloc(fg->len * sizeof(int)); \ + fg->sbmGs = malloc(fg->len * sizeof(*fg->sbmGs)); \ if (!fg->sbmGs) \ return REG_ESPACE; \ if (fg->len == 1) \ @@ -367,7 +367,7 @@ static int fastcmp(const fastmatch_t *fg, const void * #define FILL_BMGS_WIDE \ if (fg->wlen > 0 && !fg->hasdot) \ { \ - fg->bmGs = malloc(fg->wlen * sizeof(int)); \ + fg->bmGs = malloc(fg->wlen * sizeof(*fg->bmGs)); \ if (!fg->bmGs) \ return REG_ESPACE; \ if (fg->wlen == 1) \ From owner-svn-src-all@freebsd.org Thu Aug 17 17:17:30 2017 Return-Path: Delivered-To: svn-src-all@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 294A4DCB010; Thu, 17 Aug 2017 17:17:30 +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 0124680A41; Thu, 17 Aug 2017 17:17:29 +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 v7HHHTrv039913; Thu, 17 Aug 2017 17:17:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HHHS66039910; Thu, 17 Aug 2017 17:17:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708171717.v7HHHS66039910@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 17:17:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322625 - in stable/11/usr.bin/grep: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/grep: . tests X-SVN-Commit-Revision: 322625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 17:17:30 -0000 Author: kevans Date: Thu Aug 17 17:17:28 2017 New Revision: 322625 URL: https://svnweb.freebsd.org/changeset/base/322625 Log: bsdgrep: bump version number to 2.6.0 and update copyright information MFC r319132: bsdgrep: bump version number and add Kyle Evans copyright The following changes have been made over the last couple of months: Features: - With bsdgrep -r, the working directory is implied if no directory is specified - bsdgrep will now behave as bsdgrep -r does when it's named rgrep - bsdgrep now understands -z/--null-data to use \0 as EOL - GNU regex compatibility is now indicated with a "GNU compatible" in the version string Fixes: - --mmap no longer hangs when coming across an EOF without an accompanying EOL - -o/--color matching generally improved, now produces earliest / longest matches - Context output now more closely aligns with GNU grep - Zero-length matches no longer exhibit broken behavior - Every output line now honors -b/-H/-n flags Tests have been added for previous regressions as well as other previously untested behaviors. Various other fixes have been commited, and refactoring for further / later improvements has taken place. (The original submission changed the version string to 2.5.2, but I decided to use 2.6.0 to reflect the addition of new features.) MFC r320754: Update copyright e-mail address to @FreeBSD.org address Approved by: emaste (mentor, blanket MFC) Modified: stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/tests/grep_freebsd_test.sh stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Thu Aug 17 17:13:15 2017 (r322624) +++ stable/11/usr.bin/grep/grep.h Thu Aug 17 17:17:28 2017 (r322625) @@ -51,7 +51,7 @@ extern nl_catd catalog; extern const char *errstr[]; -#define VERSION "2.5.1-FreeBSD" +#define VERSION "2.6.0-FreeBSD" #define GREP_FIXED 0 #define GREP_BASIC 1 Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Thu Aug 17 17:13:15 2017 (r322624) +++ stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Thu Aug 17 17:17:28 2017 (r322625) @@ -1,5 +1,5 @@ # -# Copyright (c) 2017 Kyle Evans +# Copyright (c) 2017 Kyle Evans # All rights reserved. # # Redistribution and use in source and binary forms, with or without Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Thu Aug 17 17:13:15 2017 (r322624) +++ stable/11/usr.bin/grep/util.c Thu Aug 17 17:17:28 2017 (r322625) @@ -5,6 +5,7 @@ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav * Copyright (C) 2008-2010 Gabor Kovesdan + * Copyright (C) 2017 Kyle Evans * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Thu Aug 17 17:37:35 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 18:08:46 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 19:16:25 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 19:39:43 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 20:15:22 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 20:20:44 2017 Return-Path: Delivered-To: svn-src-all@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 C3C29DD46EA; Thu, 17 Aug 2017 20:20:44 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) (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 91D8E390B; Thu, 17 Aug 2017 20:20:41 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x236.google.com with SMTP id t3so21738917pgt.0; Thu, 17 Aug 2017 13:20:41 -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=yXfAt/a09G5azaUYlELkyYoc5TlcqhxoUT1mz0Y4GDk=; b=Vhivd2SjoIiM/ZTsnNKHMJXgkOlBBJt83E0kAT/rJOZN2vZWyzECfhzfa6oqachIH0 HteoWjhpRXUmK2LDFPaxHlSC97wmVzDFNkLCOKOAcmzWPOnXp5YhDo/Vldt0c03bw3WI Ny8M7/OqKS3jQ1CjqP9aahDK0vSgLZxUnnO18gr9VqFHb1koJqPdNuqPmO4IlWYM6PVA te1RzIpJS/FnGWNZUW48gUXITx0bAkkz+8KSMTdaibTLm4OYzrq2Hdhzmp3G3Y5rXcci +XIYQYt6U4ToFubv8HmvsCNVJm+cbbRx5Q8c7wLVJFC9yhyHLQLBgzrfyO7b7tr0Fz1a DcHA== 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=yXfAt/a09G5azaUYlELkyYoc5TlcqhxoUT1mz0Y4GDk=; b=Xy+cNR3XHN4x+Hv3D5zSio9b79IxwCsSEUT2cxOi9YfhSSt5WG2BA45z73CUSQEKik J0gKVZmxpcNtnLZdwZXOj3SWgAx4IMJJn7nKvP/3udPoaXPTosip6wGO+LG6/5GM8Go1 z4PJMOjEVeKAupRsiIl2e3jwY+M8GpYUikgr3JF1PrsIbHYlzDXXLqVQAAqwK4+Mqcb5 u1aELEVlLSxVLtOCHZxk4PzLUs38yKPg5KVbyGGicm+uZ/FYYS23cKFcpXcGIhWKaevz OWhnW8dxuovESwiSGVUBHWq5fQECMd7q6dbxBhm/9cBBtsLovpZ3cSASPVWrWhVVw725 DKmg== X-Gm-Message-State: AHYfb5he0e0QLPJ3dJt6u9rhR/Hmel29lxD/RYmCT+mv667XFQZb4uOS vA71Obpux1BvpfqW32E= X-Received: by 10.99.97.207 with SMTP id v198mr2771863pgb.346.1503001240783; Thu, 17 Aug 2017 13:20:40 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id r13sm8160703pfg.14.2017.08.17.13.20.38 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Aug 2017 13:20:39 -0700 (PDT) Subject: Re: svn commit: r322620 - svnadmin/conf Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_425F2A2C-B3DB-4A5C-894E-75EEE1853355"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201708171440.v7HEemtf066789@repo.freebsd.org> Date: Thu, 17 Aug 2017 13:20:36 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Message-Id: <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> References: <201708171440.v7HEemtf066789@repo.freebsd.org> To: Matthew Seaman X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:20:44 -0000 --Apple-Mail=_425F2A2C-B3DB-4A5C-894E-75EEE1853355 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 17, 2017, at 07:40, Matthew Seaman wrote: >=20 > Author: matthew (ports committer) > Date: Thu Aug 17 14:40:48 2017 > New Revision: 322620 > URL: https://svnweb.freebsd.org/changeset/base/322620 >=20 > Log: > Take in ache's commit bit. >=20 > requiescat in pace >=20 > Approved by: core (implicit) Hi Matthew, ache=E2=80=99s death should be commemorated in = usr.bin/calendar/calendars/calendar.freebsd and in docs as well. I would = do it myself but I don=E2=80=99t know where he passed away :=E2=80=99(. Thank you, -Ngie PS RIP Andrey =E2=80=94 you=E2=80=99ll be missed :(. --Apple-Mail=_425F2A2C-B3DB-4A5C-894E-75EEE1853355 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 iQIcBAEBCgAGBQJZlfqUAAoJEPWDqSZpMIYVClYP/2U48OchdhgyH7omv6uz6EMa +JqJuaKVCXdhz+6MqF6aD6r+jaUw0ZOBk9hZJOEdMkFUkdAhcEnh0EM3Gja+IXeR miwiMNjy3dSMRoVsUSzlBGLlbczJb+1mFoDJ+a0ilQjw4BWts0dfOdYX0Ql8navP +A3F+mvqoeGY0lWutqCMwViiPCdQD0N9d3ZlIP+KNlLSme58/4kdIaIySLkzTk1t cXmx8BjrBJl7S44teP9h2pWoloEpzahaAUiCXrRapPWhhXI47TXWZLfJjVO8cBLu /GZAvjeS8FrzOot15PZ17/tE/0zhUPWdePKjo0zjPYX7/6Mx0t5hludZXh7X4Sg+ cBHqPZMC1zf9WobT5fg7Q8vxZ+PaG1eFFvPDKjztdwkQqjbCGBmg5G8A/PlrYqMc zwIqZIpx11pmeEp8HT3TEaBs6Iqf4meI0rkshMZ+I3MqgmrYm/qP3lxX3XfJZkzu EUztH+5v61bKd3Mg5JZssG+heZiiNwoUFc9rFTl3E7D1q2+rtLGfOIblYlVDp6u5 FNzjB66isDKTNnCkG1ge6MUEs+NyJWWgZzJc7yCM2QstqwJDGYDwXomlIod4zZVN dDXAvfjVah1ouTsib8o0uoK4SexFqzACM++9b6vRkp381kcC3AZ2zwZqz/NZGOhr rwaTldrFgR22h1BMzxtY =gNaA -----END PGP SIGNATURE----- --Apple-Mail=_425F2A2C-B3DB-4A5C-894E-75EEE1853355-- From owner-svn-src-all@freebsd.org Thu Aug 17 20:25:52 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 20:37:03 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 20:41:30 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Aug 17 20:57:45 2017 Return-Path: Delivered-To: svn-src-all@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 956B1DD6B0C; Thu, 17 Aug 2017 20:57:45 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [IPv6:2001:8b0:151:1:c4ea:bd49:619b:6cb3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.infracaninophile.co.uk", Issuer "infracaninophile.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 244F0645D7; Thu, 17 Aug 2017 20:57:45 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from liminal.local (unknown [IPv6:2001:8b0:151:1:1c1d:86a1:a200:b700]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: m.seaman@infracaninophile.co.uk) by smtp.infracaninophile.co.uk (Postfix) with ESMTPSA id D35A821A3; Thu, 17 Aug 2017 20:57:41 +0000 (UTC) Authentication-Results: smtp.infracaninophile.co.uk; dmarc=none header.from=FreeBSD.org Authentication-Results: smtp.infracaninophile.co.uk/D35A821A3; dkim=none; dkim-atps=neutral Subject: Re: svn commit: r322620 - svnadmin/conf To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org References: <201708171440.v7HEemtf066789@repo.freebsd.org> <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> From: Matthew Seaman Message-ID: Date: Thu, 17 Aug 2017 21:57:31 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SjlMOujwnu2A8IsTqweODC8GGXofnQMCL" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:57:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SjlMOujwnu2A8IsTqweODC8GGXofnQMCL Content-Type: multipart/mixed; boundary="pW78sxLWdmsmUFBlnBEIG4374rh11FWHa"; protected-headers="v1" From: Matthew Seaman To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Message-ID: Subject: Re: svn commit: r322620 - svnadmin/conf References: <201708171440.v7HEemtf066789@repo.freebsd.org> <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> In-Reply-To: <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> --pW78sxLWdmsmUFBlnBEIG4374rh11FWHa Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 17/08/2017 21:20, Ngie Cooper (yaneurabeya) wrote: >=20 >> On Aug 17, 2017, at 07:40, Matthew Seaman wrote:= >> >> Author: matthew (ports committer) >> Date: Thu Aug 17 14:40:48 2017 >> New Revision: 322620 >> URL: https://svnweb.freebsd.org/changeset/base/322620 >> >> Log: >> Take in ache's commit bit. >> >> requiescat in pace >> >> Approved by: core (implicit) >=20 > Hi Matthew, > ache=E2=80=99s death should be commemorated in usr.bin/calendar/calend= ars/calendar.freebsd and in docs as well. I would do it myself but I don=E2= =80=99t know where he passed away :=E2=80=99(. > Thank you, > -Ngie >=20 > PS RIP Andrey =E2=80=94 you=E2=80=99ll be missed :(. >=20 Absolutely. Unfortunately I don't know any of those details either. If anyone can let me know, it would be appreciated. Cheers, Matthew --pW78sxLWdmsmUFBlnBEIG4374rh11FWHa-- --SjlMOujwnu2A8IsTqweODC8GGXofnQMCL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQJ8BAEBCgBmBQJZlgM8XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkATatUQAKd+CI3PMrB55qv9rqp7IA9A GCJHI8pC8eVmJq7iYT/rYVwJzQxHvO7fdGUMvEa987vv7FdmaZWh6/68ZM6I0Sq2 V0yYVP5FLP4es8hctc5Ykcl44ZDSHFICIRgZ7fRamQ79OKwuZRPI+XsZIARkFaD0 3PR//Te7blgFpdMGVYWSS1eTAKdn7h5un4V110NlQGv5AMhshoD6Y58f9uIkILK9 BOjyQWb7hviPqlu8d6kDHGGnkxYMVeqYeSH5+KlkA/fxWgTTujuW2qqH6CT/Z0eo fU2qdDqQjzRQUEbkrvVJmNr/Xvh2JVsKGCoNn56+JARf9DDKm5M6TRSctR+LyynA za1kGc9pE0B+1I8AcLDw5MUt2DKOro72GGZ3dI1uols/NA6Y8ovADLBJ30PKl5pK MrHH6qIBGVx86koEonfZZFqXpC9+0dUt/ehxkfZhqDYxGReGNyGTZqVYqTZnkM/V cqLB440f/GHf8dklK6n77JtOBrH2Yfr+1TK1R7Z7ywY4Zr4X3TfK4C9Y8pIPTNjn eW2uXfn0HQ7/c4Z9dgO1mheXdqk5GWeC7bXLn2wNJsKI71CpFcdHT5su4yeVywWP 81FfQ+WiqiizVRfmUKEug9Njo9QeiHKzrpDXL2yFwJ47iXyuIOmAaPf97wjlHMU2 YiOSwgJ446ECwESTrwfR =h6sN -----END PGP SIGNATURE----- --SjlMOujwnu2A8IsTqweODC8GGXofnQMCL-- From owner-svn-src-all@freebsd.org Thu Aug 17 21:29:43 2017 Return-Path: Delivered-To: svn-src-all@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 7ACBBDD8783; Thu, 17 Aug 2017 21:29:43 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (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 48401658E7; Thu, 17 Aug 2017 21:29:43 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id u185so11709306pgb.0; Thu, 17 Aug 2017 14:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=rNlC9XHHz4ApeNNAF55lwpXx94P6kpkqYWqCqN5Cyno=; b=ScfxMDFWZJ2+oY9VuI6FhbvlxCDQ3KYJlitGxtUkjjJddh23F3oprw46LYZ09pPl6L 1c7EPmc6H4Ph/f/QKhFIZpH+l/YMaTN3bUXK4VbNFIqWXr/ABPIVGrVQA2tbTJcHm0Qm CEkqhT9uA9z1cDrSL04i/NF/MZWld700L0mZdDV5me5PhZHdeMx8uWSrJbFH4iKccY3E 9H5xNJVuW4//8GkxK3uWnu73F1j/x6BkrTnh8CGooH0JjzhRPIScBP21vZzP+fRRn/YQ WKzxT3RXIrVkIOIvVaRzMl2oP05XuNKVlRsNThNDy1SbO3PdsoGhvA/JwMtco5D7ON9Q JhHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=rNlC9XHHz4ApeNNAF55lwpXx94P6kpkqYWqCqN5Cyno=; b=GivS2XGGRznVWuYqTr3JEIoTyazOvDQquKrMjm4I1twHJ7b+Oq4/7L07ZHu8gG0qUN nRPHdfnWDHb56X7VyfW6V2R+DUw3qiAp7/TTWTZ8BxKJdjNqkJatNjUrH33gWMbV70G1 tBORRPy+D1Zf4HTO45d7vhVdm4SpeJI59eUVj27l4nH2oHedBcIRkIc0mNYAPMGe9Fdb gs8nTyECX3XKxCIj7159JFGhzEZhexoOGMpA2LQuRhe1GdcPte37oELQFdHlK8e6PZuz sAm1S1iVifpBytuyJnAsEk4gniR1OTjG1A8lhEjQsv4QUQnQSsE5akINvbHD9wgeoy6T Gc5w== X-Gm-Message-State: AHYfb5gfL5bue44sJkRTSMml5jqVpsM9dFW19yXPcxj3Z8k0G/nWshrH g+frnY+yDcGMU1XSeZQ= X-Received: by 10.84.209.171 with SMTP id y40mr7425044plh.118.1503005382697; Thu, 17 Aug 2017 14:29:42 -0700 (PDT) Received: from ?IPv6:2607:fb90:836e:3338:f9b7:358f:60de:e797? ([2607:fb90:836e:3338:f9b7:358f:60de:e797]) by smtp.gmail.com with ESMTPSA id q5sm7682265pgn.21.2017.08.17.14.29.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2017 14:29:42 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r322620 - svnadmin/conf From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: Date: Thu, 17 Aug 2017 14:29:41 -0700 Cc: Matthew Seaman , src-committers , svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <031803F7-198B-416C-8E4F-7117741E216F@gmail.com> References: <201708171440.v7HEemtf066789@repo.freebsd.org> <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> To: Maxim Konovalov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 21:29:43 -0000 > On Aug 17, 2017, at 14:14, Maxim Konovalov wro= te: >=20 >> On Thu, 17 Aug 2017, 21:57+0100, Matthew Seaman wrote: >>=20 >>> On 17/08/2017 21:20, Ngie Cooper (yaneurabeya) wrote: >>>=20 >>>> On Aug 17, 2017, at 07:40, Matthew Seaman wrote: >>>>=20 >>>> Author: matthew (ports committer) >>>> Date: Thu Aug 17 14:40:48 2017 >>>> New Revision: 322620 >>>> URL: https://svnweb.freebsd.org/changeset/base/322620 >>>>=20 >>>> Log: >>>> Take in ache's commit bit. >>>>=20 >>>> requiescat in pace >>>>=20 >>>> Approved by: core (implicit) >>>=20 >>> Hi Matthew, >>> ache?s death should be commemorated in usr.bin/calendar/calendars/cal= endar.freebsd and in docs as well. I would do it myself but I don?t know whe= re he passed away :?(. >>> Thank you, >>> -Ngie >>>=20 >>> PS RIP Andrey ? you?ll be missed :(. >>>=20 >>=20 >>=20 >> Absolutely. Unfortunately I don't know any of those details either. If >> anyone can let me know, it would be appreciated. >>=20 > What kind of details you need? He passed away in Moscow, 16th of > August. Those are the details I didn't have. -Ngie= From owner-svn-src-all@freebsd.org Thu Aug 17 21:42:59 2017 Return-Path: Delivered-To: svn-src-all@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 ED7FADD9671; Thu, 17 Aug 2017 21:42:59 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (mp2.macomnet.net [195.128.64.6]) (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 79930662F2; Thu, 17 Aug 2017 21:42:59 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.15.2/8.15.2) with ESMTP id v7HLEGs2007602; Fri, 18 Aug 2017 00:14:16 +0300 (MSK) (envelope-from maxim.konovalov@gmail.com) Date: Fri, 18 Aug 2017 00:14:16 +0300 (MSK) From: Maxim Konovalov To: Matthew Seaman cc: "Ngie Cooper (yaneurabeya)" , src-committers , svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: Re: svn commit: r322620 - svnadmin/conf In-Reply-To: Message-ID: References: <201708171440.v7HEemtf066789@repo.freebsd.org> <2DA87002-9376-48F0-A286-5069B3121F25@gmail.com> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 21:43:00 -0000 On Thu, 17 Aug 2017, 21:57+0100, Matthew Seaman wrote: > On 17/08/2017 21:20, Ngie Cooper (yaneurabeya) wrote: > > > >> On Aug 17, 2017, at 07:40, Matthew Seaman wrote: > >> > >> Author: matthew (ports committer) > >> Date: Thu Aug 17 14:40:48 2017 > >> New Revision: 322620 > >> URL: https://svnweb.freebsd.org/changeset/base/322620 > >> > >> Log: > >> Take in ache's commit bit. > >> > >> requiescat in pace > >> > >> Approved by: core (implicit) > > > > Hi Matthew, > > ache?s death should be commemorated in usr.bin/calendar/calendars/calendar.freebsd and in docs as well. I would do it myself but I don?t know where he passed away :?(. > > Thank you, > > -Ngie > > > > PS RIP Andrey ? you?ll be missed :(. > > > > > Absolutely. Unfortunately I don't know any of those details either. If > anyone can let me know, it would be appreciated. > What kind of details you need? He passed away in Moscow, 16th of August. -- Maxim Konovalov From owner-svn-src-all@freebsd.org Fri Aug 18 00:11:03 2017 Return-Path: Delivered-To: svn-src-all@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 B1484DE0D3A; Fri, 18 Aug 2017 00:11:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7B4C26AAD5; Fri, 18 Aug 2017 00:11:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I0B2CS016500; Fri, 18 Aug 2017 00:11:02 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I0B2HP016499; Fri, 18 Aug 2017 00:11:02 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708180011.v7I0B2HP016499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 18 Aug 2017 00:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322637 - stable/10/sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/conf X-SVN-Commit-Revision: 322637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 00:11:03 -0000 Author: marius Date: Fri Aug 18 00:11:02 2017 New Revision: 322637 URL: https://svnweb.freebsd.org/changeset/base/322637 Log: Update stable/10 to BETA1 in preparation for 10.4-BETA1 builds. Approved by: re (implicit) Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Thu Aug 17 20:41:28 2017 (r322636) +++ stable/10/sys/conf/newvers.sh Fri Aug 18 00:11:02 2017 (r322637) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.4" -BRANCH="PRERELEASE" +BRANCH="BETA1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Aug 18 00:25:29 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 02:06:30 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 03:52:38 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 04:04:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 04:07:27 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 07:00:02 2017 Return-Path: Delivered-To: svn-src-all@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 3B3C8DCE90D; Fri, 18 Aug 2017 07:00:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08A2975FA6; Fri, 18 Aug 2017 07:00:01 +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 v7I701N6080103; Fri, 18 Aug 2017 07:00:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I701WD080102; Fri, 18 Aug 2017 07:00:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708180700.v7I701WD080102@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 07:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322647 - stable/11/sbin/route X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sbin/route X-SVN-Commit-Revision: 322647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 07:00:02 -0000 Author: kib Date: Fri Aug 18 07:00:00 2017 New Revision: 322647 URL: https://svnweb.freebsd.org/changeset/base/322647 Log: MFC r322550: Typo, the '-6' option selects inet6. Modified: stable/11/sbin/route/route.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/route/route.8 ============================================================================== --- stable/11/sbin/route/route.8 Fri Aug 18 04:07:25 2017 (r322646) +++ stable/11/sbin/route/route.8 Fri Aug 18 07:00:00 2017 (r322647) @@ -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-all@freebsd.org Fri Aug 18 07:21:39 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 07:27:17 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 07:34:35 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 08:05:35 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 10:38:51 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 11:22:50 2017 Return-Path: Delivered-To: svn-src-all@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 6BDB0DD9E94; Fri, 18 Aug 2017 11:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38BD381BB9; Fri, 18 Aug 2017 11:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IBMn4Y089423; Fri, 18 Aug 2017 11:22:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IBMnS3089422; Fri, 18 Aug 2017 11:22:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708181122.v7IBMnS3089422@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 11:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322652 - stable/10/sbin/route X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sbin/route X-SVN-Commit-Revision: 322652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 11:22:50 -0000 Author: kib Date: Fri Aug 18 11:22:49 2017 New Revision: 322652 URL: https://svnweb.freebsd.org/changeset/base/322652 Log: MFC r322550: Typo, the '-6' option selects inet6. Approved by: re (delphij) Modified: stable/10/sbin/route/route.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/route/route.8 ============================================================================== --- stable/10/sbin/route/route.8 Fri Aug 18 10:38:49 2017 (r322651) +++ stable/10/sbin/route/route.8 Fri Aug 18 11:22:49 2017 (r322652) @@ -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-all@freebsd.org Fri Aug 18 11:27:11 2017 Return-Path: Delivered-To: svn-src-all@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 6CC89DDA163; Fri, 18 Aug 2017 11:27: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 2388181DB0; Fri, 18 Aug 2017 11:27: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 v7IBRAo4089614; Fri, 18 Aug 2017 11:27:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IBRABA089613; Fri, 18 Aug 2017 11:27:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708181127.v7IBRABA089613@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:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322653 - vendor/zstd/dist/examples X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: vendor/zstd/dist/examples X-SVN-Commit-Revision: 322653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 11:27:11 -0000 Author: bapt Date: Fri Aug 18 11:27:10 2017 New Revision: 322653 URL: https://svnweb.freebsd.org/changeset/base/322653 Log: Remove example from zstandard distribution as it is not supposed to be distributed Deleted: vendor/zstd/dist/examples/ From owner-svn-src-all@freebsd.org Fri Aug 18 11:33:11 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 12:45:01 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 14:04:15 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 14:17:14 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 14:25:09 2017 Return-Path: Delivered-To: svn-src-all@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 A776CDE4BC9; Fri, 18 Aug 2017 14:25:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4C7F1654B4; Fri, 18 Aug 2017 14:25:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IEP8fL063920; Fri, 18 Aug 2017 14:25:08 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IEP7TY063909; Fri, 18 Aug 2017 14:25:07 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708181425.v7IEP7TY063909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 18 Aug 2017 14:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322658 - in stable/11/sys/dev: mpr mps X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11/sys/dev: mpr mps X-SVN-Commit-Revision: 322658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 14:25:09 -0000 Author: ken Date: Fri Aug 18 14:25:07 2017 New Revision: 322658 URL: https://svnweb.freebsd.org/changeset/base/322658 Log: MFC r321502, r321714, r321733, r321737, r321799, r322364: ------------------------------------------------------------------------ r321502 | scottl | 2017-07-25 19:48:13 -0600 (Tue, 25 Jul 2017) | 2 lines Quiet a message that sounds far more dire than it really is. ------------------------------------------------------------------------ r321714 | scottl | 2017-07-30 00:53:58 -0600 (Sun, 30 Jul 2017) | 13 lines Split the interrupt setup code into two parts: allocation and configuration. Do the allocation before requesting the IOCFacts message. This triggers the LSI firmware to recognize the multiqueue should be enabled if available. Multiqueue isn't used by the driver yet, but this also fixes a problem with the cached IOCFacts not matching latter checks, leading to potential problems with error recovery. As a side-effect, fetch the driver tunables as early as possible. Reviewed by: slm Obtained from: Netflix Differential Revision: D9243 ------------------------------------------------------------------------ r321733 | scottl | 2017-07-30 16:34:24 -0600 (Sun, 30 Jul 2017) | 5 lines Change from using underbar function names to normal function names for the informational print functions. Collapse the debug API a bit to be more generic and not require as much code duplication. While here, fix a bug in MPS that was already fixed in MPR. ------------------------------------------------------------------------ r321737 | scottl | 2017-07-30 18:05:49 -0600 (Sun, 30 Jul 2017) | 3 lines Don't re-parse PCI IDs in order to set card-specific flags, use the flags field in the PCIID table. ------------------------------------------------------------------------ r321799 | scottl | 2017-07-31 10:55:56 -0600 (Mon, 31 Jul 2017) | 4 lines Fix a logic bug in the split PCI interrupt code that slipped through Reported by: Harry Schmalzbauer ------------------------------------------------------------------------ r322364 | ken | 2017-08-10 08:59:17 -0600 (Thu, 10 Aug 2017) | 39 lines Changes to make mps(4) and mpr(4) handle reinit with reallocation. When the mps(4) and mpr(4) drivers need to reinitialize the firmware, they sometimes need to reallocate all of the memory allocated by the driver. The reallocation happens whenever the IOC Facts change. That should only happen after a firmware upgrade. If the reinitialization happens as a result of a timed out command sent to the card, the command that timed out and triggered the reinit may have been freed if iocfacts_allocate() reallocated all memory. If the caller attempts to access the command after that, the kernel will panic because the caller will be dereferencing freed memory. The solution is to set a flag in the softc when we reallocate, and avoid dereferencing the command strucure if we've reallocated. The changes are largely the same in both drivers, since mpr(4) is a derivative of mps(4). o In iocfacts_allocate(), if the IOC Facts have changed and we need to reallocate, set the REALLOCATED flag in the softc. o Change wait_command() to take a struct mps_command ** instead of a struct mps_command *. This allows us to NULL out the caller's command pointer if we have to reinit the controller and the data structures get reallocated. (The REALLOCATED flag will be set in the softc if that has happened.) o In every place that calls wait_command(), make sure we handle the case where the command is NULL after the call. o The mpr(4) driver has mpr_request_polled() which can also reinitialize the card. Also check for reallocation there. Reviewed by: scottl, slm Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/sys/dev/mpr/mpr.c stable/11/sys/dev/mpr/mpr_config.c stable/11/sys/dev/mpr/mpr_pci.c stable/11/sys/dev/mpr/mpr_sas.c stable/11/sys/dev/mpr/mpr_sas_lsi.c stable/11/sys/dev/mpr/mpr_table.c stable/11/sys/dev/mpr/mpr_table.h stable/11/sys/dev/mpr/mpr_user.c stable/11/sys/dev/mpr/mprvar.h stable/11/sys/dev/mps/mps.c stable/11/sys/dev/mps/mps_config.c stable/11/sys/dev/mps/mps_pci.c stable/11/sys/dev/mps/mps_sas.c stable/11/sys/dev/mps/mps_sas_lsi.c stable/11/sys/dev/mps/mps_table.c stable/11/sys/dev/mps/mps_table.h stable/11/sys/dev/mps/mps_user.c stable/11/sys/dev/mps/mpsvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpr.c ============================================================================== --- stable/11/sys/dev/mpr/mpr.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr.c Fri Aug 18 14:25:07 2017 (r322658) @@ -381,7 +381,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at } } - mpr_print_iocfacts(sc, sc->facts); + MPR_DPRINT_PAGE(sc, MPR_XINFO, iocfacts, sc->facts); snprintf(sc->fw_version, sizeof(sc->fw_version), "%02d.%02d.%02d.%02d", @@ -436,6 +436,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mpr_flags &= ~MPR_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -458,6 +460,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mpr_flags |= MPR_FLAGS_REALLOCATED; } /* @@ -1482,7 +1487,7 @@ mpr_init_queues(struct mpr_softc *sc) * Next are the global settings, if they exist. Highest are the per-unit * settings, if they exist. */ -static void +void mpr_get_tunables(struct mpr_softc *sc) { char tmpstr[80]; @@ -1658,8 +1663,6 @@ mpr_attach(struct mpr_softc *sc) { int error; - mpr_get_tunables(sc); - MPR_FUNCTRACE(sc); mtx_init(&sc->mpr_mtx, "MPR lock", NULL, MTX_DEF); @@ -1774,7 +1777,7 @@ mpr_log_evt_handler(struct mpr_softc *sc, uintptr_t da { MPI2_EVENT_DATA_LOG_ENTRY_ADDED *entry; - mpr_print_event(sc, event); + MPR_DPRINT_EVENT(sc, generic, event); switch (event->Event) { case MPI2_EVENT_LOG_DATA: @@ -2189,7 +2192,7 @@ mpr_reregister_events_complete(struct mpr_softc *sc, s mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); if (cm->cm_reply) - mpr_print_event(sc, + MPR_DPRINT_EVENT(sc, generic, (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply); mpr_free_command(sc, cm); @@ -2231,8 +2234,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve uint8_t *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; - struct mpr_command *cm; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; + struct mpr_command *cm = NULL; struct mpr_event_handle *eh; int error, i; @@ -2265,18 +2268,20 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_request_polled(sc, cm); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; if (reply) - mpr_print_event(sc, reply); + MPR_DPRINT_EVENT(sc, generic, reply); mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } @@ -3262,11 +3267,12 @@ mpr_map_command(struct mpr_softc *sc, struct mpr_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) return EBUSY; @@ -3321,6 +3327,13 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -3331,10 +3344,11 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm * completion. Its use should be rare. */ int -mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm) +mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cmp) { - int error, timeout = 0, rc; + int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; error = 0; @@ -3342,7 +3356,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co cm->cm_complete = NULL; mpr_map_command(sc, cm); - getmicrotime(&start_time); + getmicrouptime(&start_time); while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3355,9 +3369,9 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co /* * Check for real-time timeout and fail if more than 60 seconds. */ - getmicrotime(&cur_time); - timeout = cur_time.tv_sec - start_time.tv_sec; - if (timeout > 60) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > 60) { mpr_dprint(sc, MPR_FAULT, "polling failed\n"); error = ETIMEDOUT; break; @@ -3369,6 +3383,14 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } } return (error); } @@ -3434,11 +3456,12 @@ mpr_read_config_page(struct mpr_softc *sc, struct mpr_ cm->cm_complete = mpr_config_complete; return (mpr_map_command(sc, cm)); } else { - error = mpr_wait_command(sc, cm, 0, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mpr_dprint(sc, MPR_FAULT, "Error %d reading config page\n", error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } mpr_config_complete(sc, cm); Modified: stable/11/sys/dev/mpr/mpr_config.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_config.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_config.c Fri Aug 18 14:25:07 2017 (r322658) @@ -95,8 +95,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -153,8 +154,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -225,8 +227,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -283,8 +286,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -393,8 +397,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -453,8 +458,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -529,8 +535,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -591,8 +598,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -664,8 +672,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -724,8 +733,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -799,8 +809,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -859,8 +870,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -934,8 +946,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -994,8 +1007,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1066,8 +1080,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1124,8 +1139,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1173,7 +1189,7 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1201,8 +1217,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1258,8 +1275,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1325,8 +1343,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1384,8 +1403,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1459,7 +1479,7 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidPhysDiskPage0_t *page = NULL; int error = 0; @@ -1487,8 +1507,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1544,8 +1565,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ Modified: stable/11/sys/dev/mpr/mpr_pci.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_pci.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_pci.c Fri Aug 18 14:25:07 2017 (r322658) @@ -69,6 +69,7 @@ static int mpr_pci_resume(device_t); static void mpr_pci_free(struct mpr_softc *); static int mpr_alloc_msix(struct mpr_softc *sc, int msgs); static int mpr_alloc_msi(struct mpr_softc *sc, int msgs); +static int mpr_pci_alloc_interrupts(struct mpr_softc *sc); static device_method_t mpr_methods[] = { DEVMETHOD(device_probe, mpr_pci_probe), @@ -124,23 +125,32 @@ struct mpr_ident { { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3324_2, 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3324_2" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3408, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3408" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3408" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3416, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3416" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3416" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3508, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3508" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3508" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3508_1, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3508_1" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3508_1" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3516, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3516" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3516" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3516_1, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3516_1" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3516_1" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3616, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3616" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3616" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3708, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3708" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3708" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3716, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3716" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3716" }, { 0, 0, 0, 0, 0, NULL } }; @@ -191,22 +201,11 @@ mpr_pci_attach(device_t dev) m = mpr_find_ident(dev); sc->mpr_flags = m->flags; + mpr_get_tunables(sc); + /* Twiddle basic PCI config bits for a sanity check */ pci_enable_busmaster(dev); - /* Set flag if this is a Gen3.5 IOC */ - if ((m->device == MPI26_MFGPAGE_DEVID_SAS3508) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3508_1) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3408) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3516) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3516_1) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3416) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3716) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3616) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3708)) { - sc->mpr_flags |= MPR_FLAGS_GEN35_IOC; - } - for (i = 0; i < PCI_MAXMAPS_0; i++) { sc->mpr_regs_rid = PCIR_BAR(i); @@ -240,28 +239,52 @@ mpr_pci_attach(device_t dev) return (ENOMEM); } - if ((error = mpr_attach(sc)) != 0) + if (((error = mpr_pci_alloc_interrupts(sc)) != 0) || + ((error = mpr_attach(sc)) != 0)) mpr_pci_free(sc); return (error); } +/* + * Allocate, but don't assign interrupts early. Doing it before requesting + * the IOCFacts message informs the firmware that we want to do MSI-X + * multiqueue. We might not use all of the available messages, but there's + * no reason to re-alloc if we don't. + */ int -mpr_pci_setup_interrupts(struct mpr_softc *sc) +mpr_pci_alloc_interrupts(struct mpr_softc *sc) { device_t dev; - int i, error, msgs; + int error, msgs; dev = sc->mpr_dev; - error = ENXIO; + error = 0; + msgs = 0; + if ((sc->disable_msix == 0) && ((msgs = pci_msix_count(dev)) >= MPR_MSI_COUNT)) error = mpr_alloc_msix(sc, MPR_MSI_COUNT); if ((error != 0) && (sc->disable_msi == 0) && ((msgs = pci_msi_count(dev)) >= MPR_MSI_COUNT)) error = mpr_alloc_msi(sc, MPR_MSI_COUNT); + if (error != 0) + msgs = 0; - if (error != 0) { + sc->msi_msgs = msgs; + return (error); +} + +int +mpr_pci_setup_interrupts(struct mpr_softc *sc) +{ + device_t dev; + int i, error; + + dev = sc->mpr_dev; + error = ENXIO; + + if (sc->msi_msgs == 0) { sc->mpr_flags |= MPR_FLAGS_INTX; sc->mpr_irq_rid[0] = 0; sc->mpr_irq[0] = bus_alloc_resource_any(dev, SYS_RES_IRQ, Modified: stable/11/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_sas.c Fri Aug 18 14:25:07 2017 (r322658) @@ -1193,13 +1193,8 @@ mprsas_complete_all_commands(struct mpr_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) { + if (cm->cm_sc->io_cmds_active != 0) cm->cm_sc->io_cmds_active--; - } else { - mpr_dprint(cm->cm_sc, MPR_INFO, "Warning: " - "io_cmds_active is out of sync - resynching to " - "0\n"); - } if ((completed == 0) && (cm->cm_state != MPR_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ @@ -2677,7 +2672,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_INFO, "Error sending command, " + mpr_dprint(sc, MPR_XINFO, "Error sending command, " "freezing SIM queue\n"); } } Modified: stable/11/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas_lsi.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_sas_lsi.c Fri Aug 18 14:25:07 2017 (r322658) @@ -139,7 +139,7 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t dat u16 sz; mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); - mpr_print_evt_sas(sc, event); + MPR_DPRINT_EVENT(sc, sas, event); mprsas_record_event(sc, event); fw_event = malloc(sizeof(struct mpr_fw_event_work), M_MPR, @@ -324,7 +324,7 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve { // build RAID Action message Mpi2RaidActionRequest_t *action; - Mpi2RaidActionReply_t *reply; + Mpi2RaidActionReply_t *reply = NULL; struct mpr_command *cm; int error = 0; if ((cm = mpr_alloc_command(sc)) == NULL) { @@ -344,8 +344,10 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve action->PhysDiskNum = element->PhysDiskNum; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; - error = mpr_request_polled(sc, cm); - reply = (Mpi2RaidActionReply_t *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (Mpi2RaidActionReply_t *) + cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1132,12 +1134,14 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han "command\n", __func__); callout_reset(&cm->cm_callout, MPR_ATA_ID_TIMEOUT * hz, mprsas_ata_id_timeout, cm); - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); mpr_dprint(sc, MPR_XINFO, "%s stop timeout counter for SATA ID " "command\n", __func__); + /* XXX KDM need to fix the case where this command is destroyed */ callout_stop(&cm->cm_callout); - reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; + if (cm != NULL) + reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1603,7 +1607,7 @@ mprsas_ir_shutdown(struct mpr_softc *sc) action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; mpr_lock(sc); - mpr_wait_command(sc, cm, 5, CAN_SLEEP); + mpr_wait_command(sc, &cm, 5, CAN_SLEEP); mpr_unlock(sc); /* Modified: stable/11/sys/dev/mpr/mpr_table.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_table.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_table.c Fri Aug 18 14:25:07 2017 (r322658) @@ -219,7 +219,7 @@ mpr_describe_devinfo(uint32_t devinfo, char *string, i } void -_mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) +mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) { MPR_PRINTFIELD_START(sc, "IOCFacts"); MPR_PRINTFIELD(sc, facts, MsgVersion, 0x%x); @@ -259,7 +259,7 @@ _mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FAC } void -_mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) +mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) { MPR_PRINTFIELD_START(sc, "PortFacts"); @@ -269,7 +269,7 @@ _mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_F } void -_mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) +mpr_print_evt_generic(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) { MPR_PRINTFIELD_START(sc, "EventReply"); @@ -281,7 +281,7 @@ _mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTI } void -_mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) +mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS Device Page 0"); MPR_PRINTFIELD(sc, buf, Slot, %d); @@ -310,10 +310,10 @@ _mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_P } void -_mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) +mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) { - _mpr_print_event(sc, event); + mpr_print_evt_generic(sc, event); switch(event->Event) { case MPI2_EVENT_SAS_DISCOVERY: @@ -407,7 +407,7 @@ _mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NO } void -_mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) +mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) { MPR_PRINTFIELD_START(sc, "SAS Expander Page 1 #%d", buf->Phy); MPR_PRINTFIELD(sc, buf, PhysicalPort, %d); @@ -447,7 +447,7 @@ _mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG } void -_mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) +mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS PHY Page 0"); MPR_PRINTFIELD(sc, buf, OwnerDevHandle, 0x%04x); Modified: stable/11/sys/dev/mpr/mpr_table.h ============================================================================== --- stable/11/sys/dev/mpr/mpr_table.h Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_table.h Fri Aug 18 14:25:07 2017 (r322658) @@ -42,63 +42,22 @@ extern struct mpr_table_lookup mpr_phystatus_names[]; extern struct mpr_table_lookup mpr_linkrate_names[]; extern struct mpr_table_lookup mpr_pcie_linkrate_names[]; -void _mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *); -void _mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *); -void _mpr_print_event(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); -void _mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *); -void _mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); -void _mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *); -void _mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *); +void mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *); +void mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *); +void mpr_print_evt_generic(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); +void mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *); +void mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); +void mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *); +void mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *); void mpr_print_sgl(struct mpr_softc *, struct mpr_command *, int); void mpr_print_scsiio_cmd(struct mpr_softc *, struct mpr_command *); -static __inline void -mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_iocfacts(sc, facts); -} +#define MPR_DPRINT_PAGE(sc, level, func, buf) \ +do { \ + if ((sc)->mpr_debug & level) \ + mpr_print_##func((sc), buf); \ +} while (0) -static __inline void -mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_portfacts(sc, facts); -} - -static __inline void -mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) -{ - if (sc->mpr_debug & MPR_EVENT) - _mpr_print_event(sc, event); -} - -static __inline void -mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) -{ - if (sc->mpr_debug & MPR_EVENT) - _mpr_print_evt_sas(sc, event); -} - -static __inline void -mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_sasdev0(sc, buf); -} - -static __inline void -mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_expander1(sc, buf); -} - -static __inline void -mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_sasphy0(sc, buf); -} - +#define MPR_DPRINT_EVENT(sc, func, buf) \ + MPR_DPRINT_PAGE(sc, MPR_EVENT, evt_##func, buf) #endif Modified: stable/11/sys/dev/mpr/mpr_user.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_user.c Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mpr_user.c Fri Aug 18 14:25:07 2017 (r322658) @@ -652,7 +652,7 @@ static int mpr_user_command(struct mpr_softc *sc, struct mpr_usr_command *cmd) { MPI2_REQUEST_HEADER *hdr; - MPI2_DEFAULT_REPLY *rpl; + MPI2_DEFAULT_REPLY *rpl = NULL; void *buf = NULL; struct mpr_command *cm = NULL; int err = 0; @@ -664,7 +664,7 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ if (cm == NULL) { mpr_printf(sc, "%s: no mpr requests\n", __func__); err = ENOMEM; - goto Ret; + goto RetFree; } mpr_unlock(sc); @@ -706,15 +706,16 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ goto RetFreeUnlocked; mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - goto Ret; + goto RetFree; } - rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; + if (cm != NULL) + rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; if (rpl != NULL) sz = rpl->MsgLength * 4; else @@ -734,9 +735,9 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) mpr_free_command(sc, cm); -Ret: mpr_unlock(sc); if (buf != NULL) free(buf, M_MPRUSER); @@ -850,7 +851,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru err = 1; } else { mprsas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); } if (err != 0) { @@ -861,7 +862,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru /* * Copy the reply data and sense data to user space. */ - if (cm->cm_reply != NULL) { + if ((cm != NULL) && (cm->cm_reply != NULL)) { rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; @@ -1054,13 +1055,12 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - mpr_unlock(sc); - goto RetFreeUnlocked; + goto RetFree; } /* @@ -1153,6 +1153,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) { if (cm->cm_data) free(cm->cm_data, M_MPRUSER); @@ -1301,8 +1302,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1333,7 +1334,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, status = MPR_DIAG_SUCCESS; done: - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (status); } @@ -1387,8 +1389,8 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1423,6 +1425,9 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, } done: + if (cm != NULL) + mpr_free_command(sc, cm); + return (status); } Modified: stable/11/sys/dev/mpr/mprvar.h ============================================================================== --- stable/11/sys/dev/mpr/mprvar.h Fri Aug 18 14:17:12 2017 (r322657) +++ stable/11/sys/dev/mpr/mprvar.h Fri Aug 18 14:25:07 2017 (r322658) @@ -275,9 +275,11 @@ struct mpr_softc { #define MPR_FLAGS_DIAGRESET (1 << 4) #define MPR_FLAGS_ATTACH_DONE (1 << 5) #define MPR_FLAGS_GEN35_IOC (1 << 6) +#define MPR_FLAGS_REALLOCATED (1 << 7) u_int mpr_debug; u_int disable_msix; u_int disable_msi; + int msi_msgs; u_int atomic_desc_capable; int tm_cmds_active; int io_cmds_active; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Aug 18 14:30:13 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 14:47:08 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 15:38:10 2017 Return-Path: Delivered-To: svn-src-all@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 DDB3BDE8985; Fri, 18 Aug 2017 15:38:10 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 96F4E688EE; Fri, 18 Aug 2017 15:38:10 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IFc9xY093461; Fri, 18 Aug 2017 15:38:09 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IFc9Tv093450; Fri, 18 Aug 2017 15:38:09 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708181538.v7IFc9Tv093450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 18 Aug 2017 15:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322661 - in stable/10/sys/dev: mpr mps X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/10/sys/dev: mpr mps X-SVN-Commit-Revision: 322661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 15:38:11 -0000 Author: ken Date: Fri Aug 18 15:38:08 2017 New Revision: 322661 URL: https://svnweb.freebsd.org/changeset/base/322661 Log: MFC r321502, r321714, r321733, r321737, r321799, r322364: ------------------------------------------------------------------------ r321502 | scottl | 2017-07-25 19:48:13 -0600 (Tue, 25 Jul 2017) | 2 lines Quiet a message that sounds far more dire than it really is. ------------------------------------------------------------------------ r321714 | scottl | 2017-07-30 00:53:58 -0600 (Sun, 30 Jul 2017) | 13 lines Split the interrupt setup code into two parts: allocation and configuration. Do the allocation before requesting the IOCFacts message. This triggers the LSI firmware to recognize the multiqueue should be enabled if available. Multiqueue isn't used by the driver yet, but this also fixes a problem with the cached IOCFacts not matching latter checks, leading to potential problems with error recovery. As a side-effect, fetch the driver tunables as early as possible. Reviewed by: slm Obtained from: Netflix Differential Revision: D9243 ------------------------------------------------------------------------ r321733 | scottl | 2017-07-30 16:34:24 -0600 (Sun, 30 Jul 2017) | 5 lines Change from using underbar function names to normal function names for the informational print functions. Collapse the debug API a bit to be more generic and not require as much code duplication. While here, fix a bug in MPS that was already fixed in MPR. ------------------------------------------------------------------------ r321737 | scottl | 2017-07-30 18:05:49 -0600 (Sun, 30 Jul 2017) | 3 lines Don't re-parse PCI IDs in order to set card-specific flags, use the flags field in the PCIID table. ------------------------------------------------------------------------ r321799 | scottl | 2017-07-31 10:55:56 -0600 (Mon, 31 Jul 2017) | 4 lines Fix a logic bug in the split PCI interrupt code that slipped through Reported by: Harry Schmalzbauer ------------------------------------------------------------------------ r322364 | ken | 2017-08-10 08:59:17 -0600 (Thu, 10 Aug 2017) | 39 lines Changes to make mps(4) and mpr(4) handle reinit with reallocation. When the mps(4) and mpr(4) drivers need to reinitialize the firmware, they sometimes need to reallocate all of the memory allocated by the driver. The reallocation happens whenever the IOC Facts change. That should only happen after a firmware upgrade. If the reinitialization happens as a result of a timed out command sent to the card, the command that timed out and triggered the reinit may have been freed if iocfacts_allocate() reallocated all memory. If the caller attempts to access the command after that, the kernel will panic because the caller will be dereferencing freed memory. The solution is to set a flag in the softc when we reallocate, and avoid dereferencing the command strucure if we've reallocated. The changes are largely the same in both drivers, since mpr(4) is a derivative of mps(4). o In iocfacts_allocate(), if the IOC Facts have changed and we need to reallocate, set the REALLOCATED flag in the softc. o Change wait_command() to take a struct mps_command ** instead of a struct mps_command *. This allows us to NULL out the caller's command pointer if we have to reinit the controller and the data structures get reallocated. (The REALLOCATED flag will be set in the softc if that has happened.) o In every place that calls wait_command(), make sure we handle the case where the command is NULL after the call. o The mpr(4) driver has mpr_request_polled() which can also reinitialize the card. Also check for reallocation there. Reviewed by: scottl, slm Sponsored by: Spectra Logic ------------------------------------------------------------------------ Approved by: re (marius) Modified: stable/10/sys/dev/mpr/mpr.c stable/10/sys/dev/mpr/mpr_config.c stable/10/sys/dev/mpr/mpr_pci.c stable/10/sys/dev/mpr/mpr_sas.c stable/10/sys/dev/mpr/mpr_sas_lsi.c stable/10/sys/dev/mpr/mpr_table.c stable/10/sys/dev/mpr/mpr_table.h stable/10/sys/dev/mpr/mpr_user.c stable/10/sys/dev/mpr/mprvar.h stable/10/sys/dev/mps/mps.c stable/10/sys/dev/mps/mps_config.c stable/10/sys/dev/mps/mps_pci.c stable/10/sys/dev/mps/mps_sas.c stable/10/sys/dev/mps/mps_sas_lsi.c stable/10/sys/dev/mps/mps_table.c stable/10/sys/dev/mps/mps_table.h stable/10/sys/dev/mps/mps_user.c stable/10/sys/dev/mps/mpsvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr.c ============================================================================== --- stable/10/sys/dev/mpr/mpr.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr.c Fri Aug 18 15:38:08 2017 (r322661) @@ -381,7 +381,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at } } - mpr_print_iocfacts(sc, sc->facts); + MPR_DPRINT_PAGE(sc, MPR_XINFO, iocfacts, sc->facts); snprintf(sc->fw_version, sizeof(sc->fw_version), "%02d.%02d.%02d.%02d", @@ -436,6 +436,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mpr_flags &= ~MPR_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -458,6 +460,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mpr_flags |= MPR_FLAGS_REALLOCATED; } /* @@ -1482,7 +1487,7 @@ mpr_init_queues(struct mpr_softc *sc) * Next are the global settings, if they exist. Highest are the per-unit * settings, if they exist. */ -static void +void mpr_get_tunables(struct mpr_softc *sc) { char tmpstr[80]; @@ -1658,8 +1663,6 @@ mpr_attach(struct mpr_softc *sc) { int error; - mpr_get_tunables(sc); - MPR_FUNCTRACE(sc); mtx_init(&sc->mpr_mtx, "MPR lock", NULL, MTX_DEF); @@ -1774,7 +1777,7 @@ mpr_log_evt_handler(struct mpr_softc *sc, uintptr_t da { MPI2_EVENT_DATA_LOG_ENTRY_ADDED *entry; - mpr_print_event(sc, event); + MPR_DPRINT_EVENT(sc, generic, event); switch (event->Event) { case MPI2_EVENT_LOG_DATA: @@ -2189,7 +2192,7 @@ mpr_reregister_events_complete(struct mpr_softc *sc, s mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); if (cm->cm_reply) - mpr_print_event(sc, + MPR_DPRINT_EVENT(sc, generic, (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply); mpr_free_command(sc, cm); @@ -2231,8 +2234,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve uint8_t *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; - struct mpr_command *cm; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; + struct mpr_command *cm = NULL; struct mpr_event_handle *eh; int error, i; @@ -2265,18 +2268,20 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_request_polled(sc, cm); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; if (reply) - mpr_print_event(sc, reply); + MPR_DPRINT_EVENT(sc, generic, reply); mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } @@ -3262,11 +3267,12 @@ mpr_map_command(struct mpr_softc *sc, struct mpr_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) return EBUSY; @@ -3321,6 +3327,13 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -3331,10 +3344,11 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm * completion. Its use should be rare. */ int -mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm) +mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cmp) { - int error, timeout = 0, rc; + int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; error = 0; @@ -3342,7 +3356,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co cm->cm_complete = NULL; mpr_map_command(sc, cm); - getmicrotime(&start_time); + getmicrouptime(&start_time); while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3355,9 +3369,9 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co /* * Check for real-time timeout and fail if more than 60 seconds. */ - getmicrotime(&cur_time); - timeout = cur_time.tv_sec - start_time.tv_sec; - if (timeout > 60) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > 60) { mpr_dprint(sc, MPR_FAULT, "polling failed\n"); error = ETIMEDOUT; break; @@ -3369,6 +3383,14 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } } return (error); } @@ -3434,11 +3456,12 @@ mpr_read_config_page(struct mpr_softc *sc, struct mpr_ cm->cm_complete = mpr_config_complete; return (mpr_map_command(sc, cm)); } else { - error = mpr_wait_command(sc, cm, 0, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mpr_dprint(sc, MPR_FAULT, "Error %d reading config page\n", error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } mpr_config_complete(sc, cm); Modified: stable/10/sys/dev/mpr/mpr_config.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_config.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_config.c Fri Aug 18 15:38:08 2017 (r322661) @@ -95,8 +95,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -153,8 +154,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -225,8 +227,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -283,8 +286,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -393,8 +397,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -453,8 +458,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -529,8 +535,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -591,8 +598,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -664,8 +672,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -724,8 +733,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -799,8 +809,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -859,8 +870,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -934,8 +946,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -994,8 +1007,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1066,8 +1080,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1124,8 +1139,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1173,7 +1189,7 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1201,8 +1217,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1258,8 +1275,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1325,8 +1343,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1384,8 +1403,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1459,7 +1479,7 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidPhysDiskPage0_t *page = NULL; int error = 0; @@ -1487,8 +1507,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1544,8 +1565,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ Modified: stable/10/sys/dev/mpr/mpr_pci.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_pci.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_pci.c Fri Aug 18 15:38:08 2017 (r322661) @@ -69,6 +69,7 @@ static int mpr_pci_resume(device_t); static void mpr_pci_free(struct mpr_softc *); static int mpr_alloc_msix(struct mpr_softc *sc, int msgs); static int mpr_alloc_msi(struct mpr_softc *sc, int msgs); +static int mpr_pci_alloc_interrupts(struct mpr_softc *sc); static device_method_t mpr_methods[] = { DEVMETHOD(device_probe, mpr_pci_probe), @@ -124,23 +125,32 @@ struct mpr_ident { { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3324_2, 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3324_2" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3408, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3408" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3408" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3416, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3416" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3416" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3508, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3508" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3508" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3508_1, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3508_1" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3508_1" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3516, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3516" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3516" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3516_1, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3516_1" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3516_1" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3616, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3616" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3616" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3708, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3708" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3708" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3716, - 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS3716" }, + 0xffff, 0xffff, MPR_FLAGS_GEN35_IOC, + "Avago Technologies (LSI) SAS3716" }, { 0, 0, 0, 0, 0, NULL } }; @@ -191,22 +201,11 @@ mpr_pci_attach(device_t dev) m = mpr_find_ident(dev); sc->mpr_flags = m->flags; + mpr_get_tunables(sc); + /* Twiddle basic PCI config bits for a sanity check */ pci_enable_busmaster(dev); - /* Set flag if this is a Gen3.5 IOC */ - if ((m->device == MPI26_MFGPAGE_DEVID_SAS3508) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3508_1) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3408) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3516) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3516_1) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3416) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3716) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3616) || - (m->device == MPI26_MFGPAGE_DEVID_SAS3708)) { - sc->mpr_flags |= MPR_FLAGS_GEN35_IOC; - } - for (i = 0; i < PCI_MAXMAPS_0; i++) { sc->mpr_regs_rid = PCIR_BAR(i); @@ -240,28 +239,52 @@ mpr_pci_attach(device_t dev) return (ENOMEM); } - if ((error = mpr_attach(sc)) != 0) + if (((error = mpr_pci_alloc_interrupts(sc)) != 0) || + ((error = mpr_attach(sc)) != 0)) mpr_pci_free(sc); return (error); } +/* + * Allocate, but don't assign interrupts early. Doing it before requesting + * the IOCFacts message informs the firmware that we want to do MSI-X + * multiqueue. We might not use all of the available messages, but there's + * no reason to re-alloc if we don't. + */ int -mpr_pci_setup_interrupts(struct mpr_softc *sc) +mpr_pci_alloc_interrupts(struct mpr_softc *sc) { device_t dev; - int i, error, msgs; + int error, msgs; dev = sc->mpr_dev; - error = ENXIO; + error = 0; + msgs = 0; + if ((sc->disable_msix == 0) && ((msgs = pci_msix_count(dev)) >= MPR_MSI_COUNT)) error = mpr_alloc_msix(sc, MPR_MSI_COUNT); if ((error != 0) && (sc->disable_msi == 0) && ((msgs = pci_msi_count(dev)) >= MPR_MSI_COUNT)) error = mpr_alloc_msi(sc, MPR_MSI_COUNT); + if (error != 0) + msgs = 0; - if (error != 0) { + sc->msi_msgs = msgs; + return (error); +} + +int +mpr_pci_setup_interrupts(struct mpr_softc *sc) +{ + device_t dev; + int i, error; + + dev = sc->mpr_dev; + error = ENXIO; + + if (sc->msi_msgs == 0) { sc->mpr_flags |= MPR_FLAGS_INTX; sc->mpr_irq_rid[0] = 0; sc->mpr_irq[0] = bus_alloc_resource_any(dev, SYS_RES_IRQ, Modified: stable/10/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_sas.c Fri Aug 18 15:38:08 2017 (r322661) @@ -1193,13 +1193,8 @@ mprsas_complete_all_commands(struct mpr_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) { + if (cm->cm_sc->io_cmds_active != 0) cm->cm_sc->io_cmds_active--; - } else { - mpr_dprint(cm->cm_sc, MPR_INFO, "Warning: " - "io_cmds_active is out of sync - resynching to " - "0\n"); - } if ((completed == 0) && (cm->cm_state != MPR_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ @@ -2677,7 +2672,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_INFO, "Error sending command, " + mpr_dprint(sc, MPR_XINFO, "Error sending command, " "freezing SIM queue\n"); } } Modified: stable/10/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas_lsi.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_sas_lsi.c Fri Aug 18 15:38:08 2017 (r322661) @@ -139,7 +139,7 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t dat u16 sz; mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); - mpr_print_evt_sas(sc, event); + MPR_DPRINT_EVENT(sc, sas, event); mprsas_record_event(sc, event); fw_event = malloc(sizeof(struct mpr_fw_event_work), M_MPR, @@ -324,7 +324,7 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve { // build RAID Action message Mpi2RaidActionRequest_t *action; - Mpi2RaidActionReply_t *reply; + Mpi2RaidActionReply_t *reply = NULL; struct mpr_command *cm; int error = 0; if ((cm = mpr_alloc_command(sc)) == NULL) { @@ -344,8 +344,10 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve action->PhysDiskNum = element->PhysDiskNum; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; - error = mpr_request_polled(sc, cm); - reply = (Mpi2RaidActionReply_t *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (Mpi2RaidActionReply_t *) + cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1132,12 +1134,14 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han "command\n", __func__); callout_reset(&cm->cm_callout, MPR_ATA_ID_TIMEOUT * hz, mprsas_ata_id_timeout, cm); - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); mpr_dprint(sc, MPR_XINFO, "%s stop timeout counter for SATA ID " "command\n", __func__); + /* XXX KDM need to fix the case where this command is destroyed */ callout_stop(&cm->cm_callout); - reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; + if (cm != NULL) + reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1603,7 +1607,7 @@ mprsas_ir_shutdown(struct mpr_softc *sc) action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; mpr_lock(sc); - mpr_wait_command(sc, cm, 5, CAN_SLEEP); + mpr_wait_command(sc, &cm, 5, CAN_SLEEP); mpr_unlock(sc); /* Modified: stable/10/sys/dev/mpr/mpr_table.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_table.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_table.c Fri Aug 18 15:38:08 2017 (r322661) @@ -219,7 +219,7 @@ mpr_describe_devinfo(uint32_t devinfo, char *string, i } void -_mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) +mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) { MPR_PRINTFIELD_START(sc, "IOCFacts"); MPR_PRINTFIELD(sc, facts, MsgVersion, 0x%x); @@ -259,7 +259,7 @@ _mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FAC } void -_mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) +mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) { MPR_PRINTFIELD_START(sc, "PortFacts"); @@ -269,7 +269,7 @@ _mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_F } void -_mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) +mpr_print_evt_generic(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) { MPR_PRINTFIELD_START(sc, "EventReply"); @@ -281,7 +281,7 @@ _mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTI } void -_mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) +mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS Device Page 0"); MPR_PRINTFIELD(sc, buf, Slot, %d); @@ -310,10 +310,10 @@ _mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_P } void -_mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) +mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) { - _mpr_print_event(sc, event); + mpr_print_evt_generic(sc, event); switch(event->Event) { case MPI2_EVENT_SAS_DISCOVERY: @@ -407,7 +407,7 @@ _mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NO } void -_mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) +mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) { MPR_PRINTFIELD_START(sc, "SAS Expander Page 1 #%d", buf->Phy); MPR_PRINTFIELD(sc, buf, PhysicalPort, %d); @@ -447,7 +447,7 @@ _mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG } void -_mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) +mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS PHY Page 0"); MPR_PRINTFIELD(sc, buf, OwnerDevHandle, 0x%04x); Modified: stable/10/sys/dev/mpr/mpr_table.h ============================================================================== --- stable/10/sys/dev/mpr/mpr_table.h Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_table.h Fri Aug 18 15:38:08 2017 (r322661) @@ -42,63 +42,22 @@ extern struct mpr_table_lookup mpr_phystatus_names[]; extern struct mpr_table_lookup mpr_linkrate_names[]; extern struct mpr_table_lookup mpr_pcie_linkrate_names[]; -void _mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *); -void _mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *); -void _mpr_print_event(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); -void _mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *); -void _mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); -void _mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *); -void _mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *); +void mpr_print_iocfacts(struct mpr_softc *, MPI2_IOC_FACTS_REPLY *); +void mpr_print_portfacts(struct mpr_softc *, MPI2_PORT_FACTS_REPLY *); +void mpr_print_evt_generic(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); +void mpr_print_sasdev0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_DEV_0 *); +void mpr_print_evt_sas(struct mpr_softc *, MPI2_EVENT_NOTIFICATION_REPLY *); +void mpr_print_expander1(struct mpr_softc *, MPI2_CONFIG_PAGE_EXPANDER_1 *); +void mpr_print_sasphy0(struct mpr_softc *, MPI2_CONFIG_PAGE_SAS_PHY_0 *); void mpr_print_sgl(struct mpr_softc *, struct mpr_command *, int); void mpr_print_scsiio_cmd(struct mpr_softc *, struct mpr_command *); -static __inline void -mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_iocfacts(sc, facts); -} +#define MPR_DPRINT_PAGE(sc, level, func, buf) \ +do { \ + if ((sc)->mpr_debug & level) \ + mpr_print_##func((sc), buf); \ +} while (0) -static __inline void -mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_portfacts(sc, facts); -} - -static __inline void -mpr_print_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) -{ - if (sc->mpr_debug & MPR_EVENT) - _mpr_print_event(sc, event); -} - -static __inline void -mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) -{ - if (sc->mpr_debug & MPR_EVENT) - _mpr_print_evt_sas(sc, event); -} - -static __inline void -mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_sasdev0(sc, buf); -} - -static __inline void -mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_expander1(sc, buf); -} - -static __inline void -mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) -{ - if (sc->mpr_debug & MPR_XINFO) - _mpr_print_sasphy0(sc, buf); -} - +#define MPR_DPRINT_EVENT(sc, func, buf) \ + MPR_DPRINT_PAGE(sc, MPR_EVENT, evt_##func, buf) #endif Modified: stable/10/sys/dev/mpr/mpr_user.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_user.c Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mpr_user.c Fri Aug 18 15:38:08 2017 (r322661) @@ -652,7 +652,7 @@ static int mpr_user_command(struct mpr_softc *sc, struct mpr_usr_command *cmd) { MPI2_REQUEST_HEADER *hdr; - MPI2_DEFAULT_REPLY *rpl; + MPI2_DEFAULT_REPLY *rpl = NULL; void *buf = NULL; struct mpr_command *cm = NULL; int err = 0; @@ -664,7 +664,7 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ if (cm == NULL) { mpr_printf(sc, "%s: no mpr requests\n", __func__); err = ENOMEM; - goto Ret; + goto RetFree; } mpr_unlock(sc); @@ -706,15 +706,16 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ goto RetFreeUnlocked; mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - goto Ret; + goto RetFree; } - rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; + if (cm != NULL) + rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; if (rpl != NULL) sz = rpl->MsgLength * 4; else @@ -734,9 +735,9 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) mpr_free_command(sc, cm); -Ret: mpr_unlock(sc); if (buf != NULL) free(buf, M_MPRUSER); @@ -850,7 +851,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru err = 1; } else { mprsas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); } if (err != 0) { @@ -861,7 +862,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru /* * Copy the reply data and sense data to user space. */ - if (cm->cm_reply != NULL) { + if ((cm != NULL) && (cm->cm_reply != NULL)) { rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; @@ -1054,13 +1055,12 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - mpr_unlock(sc); - goto RetFreeUnlocked; + goto RetFree; } /* @@ -1153,6 +1153,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) { if (cm->cm_data) free(cm->cm_data, M_MPRUSER); @@ -1301,8 +1302,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1333,7 +1334,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, status = MPR_DIAG_SUCCESS; done: - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (status); } @@ -1387,8 +1389,8 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1423,6 +1425,9 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, } done: + if (cm != NULL) + mpr_free_command(sc, cm); + return (status); } Modified: stable/10/sys/dev/mpr/mprvar.h ============================================================================== --- stable/10/sys/dev/mpr/mprvar.h Fri Aug 18 14:47:06 2017 (r322660) +++ stable/10/sys/dev/mpr/mprvar.h Fri Aug 18 15:38:08 2017 (r322661) @@ -275,9 +275,11 @@ struct mpr_softc { #define MPR_FLAGS_DIAGRESET (1 << 4) #define MPR_FLAGS_ATTACH_DONE (1 << 5) #define MPR_FLAGS_GEN35_IOC (1 << 6) +#define MPR_FLAGS_REALLOCATED (1 << 7) u_int mpr_debug; u_int disable_msix; u_int disable_msi; + int msi_msgs; u_int atomic_desc_capable; int tm_cmds_active; int io_cmds_active; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Aug 18 15:40:42 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 16:14:42 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 16:38:34 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 16:43:00 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 16:44:00 2017 Return-Path: Delivered-To: svn-src-all@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 CFBF6DC68A9; Fri, 18 Aug 2017 16:44:00 +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 998BA6C4CB; Fri, 18 Aug 2017 16:44:00 +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 v7IGhxMn023680; Fri, 18 Aug 2017 16:43:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IGhxHN023678; Fri, 18 Aug 2017 16:43:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708181643.v7IGhxHN023678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 18 Aug 2017 16:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322666 - stable/10/release/arm X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/arm X-SVN-Commit-Revision: 322666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 16:44:00 -0000 Author: gjb Date: Fri Aug 18 16:43:59 2017 New Revision: 322666 URL: https://svnweb.freebsd.org/changeset/base/322666 Log: Create hard links to the installed dtb files for the BEAGLEBONE [1] and WANDBOARD [2] images to fix a boot issue. This is a direct commit to stable/10, as the change is not needed for head and stable/11. Approved by: re (marius) Help from: manu [1], ian [2] Tested by: gjb [1], ian [2] Sponsored by: The FreeBSD Foundation Modified: stable/10/release/arm/BEAGLEBONE.conf stable/10/release/arm/WANDBOARD.conf Modified: stable/10/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/10/release/arm/BEAGLEBONE.conf Fri Aug 18 16:42:58 2017 (r322665) +++ stable/10/release/arm/BEAGLEBONE.conf Fri Aug 18 16:43:59 2017 (r322666) @@ -28,6 +28,10 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} ln ${UFSMOUNT}/boot/dtb/beaglebone.dtb \ + ${UFSMOUNT}/boot/dtb/am335x-bone.dtb + chroot ${CHROOTDIR} ln ${UFSMOUNT}/boot/dtb/beaglebone-black.dtb \ + ${UFSMOUNT}/boot/dtb/am335x-boneblack.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: stable/10/release/arm/WANDBOARD.conf ============================================================================== --- stable/10/release/arm/WANDBOARD.conf Fri Aug 18 16:42:58 2017 (r322665) +++ stable/10/release/arm/WANDBOARD.conf Fri Aug 18 16:43:59 2017 (r322666) @@ -31,6 +31,10 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} ln ${UFSMOUNT}/boot/dtb/imx6dl-wandboard.dtb \ + ${UFSMOUNT}/boot/dtb/imx6dl-wandboard-revb1.dtb + chroot ${CHROOTDIR} ln ${UFSMOUNT}/boot/dtb/imx6q-wandboard.dtb + ${UFSMOUNT}/boot/dtb/imx6q-wandboard-revb1.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} From owner-svn-src-all@freebsd.org Fri Aug 18 17:11:16 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 17:32:15 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 18:20:37 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 18:20:52 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 18:26:31 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 18:55:08 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 20:20:50 2017 Return-Path: Delivered-To: svn-src-all@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 DD802DD4582; Fri, 18 Aug 2017 20:20: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 AA22D73B5B; Fri, 18 Aug 2017 20:20: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 v7IKKnbO011467; Fri, 18 Aug 2017 20:20:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IKKnlA011466; Fri, 18 Aug 2017 20:20:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708182020.v7IKKnlA011466@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 20:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322673 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 322673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 20:20:51 -0000 Author: markj Date: Fri Aug 18 20:20:49 2017 New Revision: 322673 URL: https://svnweb.freebsd.org/changeset/base/322673 Log: MFC r322391: Micro-optimize kmem_unback(). Modified: stable/11/sys/vm/vm_kern.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_kern.c ============================================================================== --- stable/11/sys/vm/vm_kern.c Fri Aug 18 18:55:07 2017 (r322672) +++ stable/11/sys/vm/vm_kern.c Fri Aug 18 20:20:49 2017 (r322673) @@ -386,17 +386,19 @@ retry: void kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { - vm_page_t m; - vm_offset_t i, offset; + vm_page_t m, next; + vm_offset_t end, offset; KASSERT(object == kmem_object || object == kernel_object, ("kmem_unback: only supports kernel objects.")); pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; + end = offset + size; VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { - m = vm_page_lookup(object, atop(offset + i)); + for (m = vm_page_lookup(object, atop(offset)); offset < end; + offset += PAGE_SIZE, m = next) { + next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); vm_page_free(m); } From owner-svn-src-all@freebsd.org Fri Aug 18 20:35:36 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Aug 18 21:20:39 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Sat Aug 19 00:19:25 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 00:32:27 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 00:37:34 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 00:45:30 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 00:51:46 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 01:09:16 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 01:12:06 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 01:21:47 2017 Return-Path: Delivered-To: svn-src-all@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 DAC59DE6880; Sat, 19 Aug 2017 01:21: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 919708210A; Sat, 19 Aug 2017 01:21: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 v7J1Lk2K037459; Sat, 19 Aug 2017 01:21:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1Lklt037458; Sat, 19 Aug 2017 01:21:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190121.v7J1Lklt037458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322685 - stable/11/bin/chmod/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/bin/chmod/tests X-SVN-Commit-Revision: 322685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:21:48 -0000 Author: ngie Date: Sat Aug 19 01:21:46 2017 New Revision: 322685 URL: https://svnweb.freebsd.org/changeset/base/322685 Log: MFC r321949,r321950,r322101: r321949: Add expected failures for ZFS - :f_flag fails on ZFS because UF_IMMUTABLE isn't supported [1]. - :v_flag fails on ZFS because the mode for foo is [always] updated unnecessarily. get_filesystem(..) (supporting function that was added to the test script) is based on equivalent logic in usr.bin/extattr/tests/extattr_test.sh . PR: 221189 [1], 221188 [2] r321950: Always use first parameter passed to get_filesystem(..) instead of discarding it and using `.` instead. MFC with: r321949 PR: 221189 [1], 221188 [2] r322101: Don't check result of chflags in f_flag_cleanup() This will prevent false positives from occurring if the test is run on ZFS since ZFS doesn't support fflags throbbing like UFS. PR: 221189 MFC with: r321949 Modified: stable/11/bin/chmod/tests/chmod_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/chmod/tests/chmod_test.sh ============================================================================== --- stable/11/bin/chmod/tests/chmod_test.sh Sat Aug 19 01:12:05 2017 (r322684) +++ stable/11/bin/chmod/tests/chmod_test.sh Sat Aug 19 01:21:46 2017 (r322685) @@ -25,6 +25,13 @@ # # $FreeBSD$ +get_filesystem() +{ + local mountpoint=$1 + + df -T $mountpoint | tail -n 1 | cut -wf 2 +} + atf_test_case RH_flag RH_flag_head() { @@ -94,6 +101,11 @@ f_flag_body() { atf_check truncate -s 0 foo bar atf_check chmod 0750 foo bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS doesn't support UF_IMMUTABLE; returns EPERM - bug 221189" + ;; + esac atf_check chflags uchg foo atf_check -e not-empty -s not-exit:0 chmod 0700 foo bar atf_check -o inline:'100750\n100700\n' stat -f '%p' foo bar @@ -103,7 +115,7 @@ f_flag_body() f_flag_cleanup() { - atf_check chflags 0 foo + chflags 0 foo || : } atf_test_case h_flag @@ -140,6 +152,11 @@ v_flag_body() atf_check truncate -s 0 foo bar atf_check chmod 0600 foo atf_check chmod 0750 bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS updates mode for foo unnecessarily - bug 221188" + ;; + esac atf_check -o 'inline:bar\n' chmod -v 0600 foo bar atf_check chmod -v 0600 foo bar for f in foo bar; do From owner-svn-src-all@freebsd.org Sat Aug 19 01:25:08 2017 Return-Path: Delivered-To: svn-src-all@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 9F98ADE6E1E; Sat, 19 Aug 2017 01:25:08 +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 6E7CF8250F; Sat, 19 Aug 2017 01:25:08 +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 v7J1P7IA038367; Sat, 19 Aug 2017 01:25:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1P7Mp038366; Sat, 19 Aug 2017 01:25:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190125.v7J1P7Mp038366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322686 - stable/11/lib/ncurses/ncurses X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/lib/ncurses/ncurses X-SVN-Commit-Revision: 322686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:25:08 -0000 Author: ngie Date: Sat Aug 19 01:25:07 2017 New Revision: 322686 URL: https://svnweb.freebsd.org/changeset/base/322686 Log: MFC r322445: Hide `sccsid` under #if 0, per example in style(9) This fixes a -Wunused warning with gcc 6.3.0/7.0.0. Modified: stable/11/lib/ncurses/ncurses/termcap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/ncurses/ncurses/termcap.c ============================================================================== --- stable/11/lib/ncurses/ncurses/termcap.c Sat Aug 19 01:21:46 2017 (r322685) +++ stable/11/lib/ncurses/ncurses/termcap.c Sat Aug 19 01:25:07 2017 (r322686) @@ -59,9 +59,11 @@ #include __FBSDID("$FreeBSD$"); +#if 0 #ifndef lint static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ +#endif #include #include From owner-svn-src-all@freebsd.org Sat Aug 19 01:26:27 2017 Return-Path: Delivered-To: svn-src-all@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 C2460DE7041; Sat, 19 Aug 2017 01:26:27 +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 8EDC982675; Sat, 19 Aug 2017 01:26:27 +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 v7J1QQ0k038470; Sat, 19 Aug 2017 01:26:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1QQ43038469; Sat, 19 Aug 2017 01:26:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190126.v7J1QQ43038469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322687 - stable/11/usr.bin/getconf X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/usr.bin/getconf X-SVN-Commit-Revision: 322687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:26:27 -0000 Author: ngie Date: Sat Aug 19 01:26:26 2017 New Revision: 322687 URL: https://svnweb.freebsd.org/changeset/base/322687 Log: MFC r321080: Expose the ILP32/LP64 programming environments based on __ILP32__/__LP64__ instead of by architecture. The list was incomplete (previous commits purged invalid architectures, like __alpha__, but failed to add new ones). It's best to base the symbol presence on whether or not the architecture is ILP32 / LP64 capable, per the compiler. This fixes the ILP32/LP64 program environments on some architectures like arm64, and by proxy fixes the tests on those architectures. Modified: stable/11/usr.bin/getconf/progenv.gperf Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/getconf/progenv.gperf ============================================================================== --- stable/11/usr.bin/getconf/progenv.gperf Sat Aug 19 01:25:07 2017 (r322686) +++ stable/11/usr.bin/getconf/progenv.gperf Sat Aug 19 01:26:26 2017 (r322687) @@ -30,11 +30,11 @@ static const struct map *in_word_set(const char *str); * be updated. (We cheat here and define the supported environments * statically.) */ -#if defined(__sparc64__) || defined(__amd64__) +#ifdef __LP64__ #define have_LP64_OFF64 NULL #endif -#if defined(__i386__) || defined(__powerpc__) +#ifdef __ILP32__ #define have_ILP32_OFFBIG NULL #endif From owner-svn-src-all@freebsd.org Sat Aug 19 01:40:32 2017 Return-Path: Delivered-To: svn-src-all@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 19074DE7D9B; Sat, 19 Aug 2017 01:40:32 +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 D73D283088; Sat, 19 Aug 2017 01:40:31 +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 v7J1eUmB042588; Sat, 19 Aug 2017 01:40:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1eUgQ042587; Sat, 19 Aug 2017 01:40:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190140.v7J1eUgQ042587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:40:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322688 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 322688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:40:32 -0000 Author: ngie Date: Sat Aug 19 01:40:30 2017 New Revision: 322688 URL: https://svnweb.freebsd.org/changeset/base/322688 Log: MFC r321954: Delete comment above "__DEFAULT_DEPENDENT_OPTIONS" related to "meta mode options" src.conf(5) should document which knobs are which and the dependency between each; remove the comment so the variable can apply to non-"meta mode options". Modified: stable/11/share/mk/bsd.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.opts.mk ============================================================================== --- stable/11/share/mk/bsd.opts.mk Sat Aug 19 01:26:26 2017 (r322687) +++ stable/11/share/mk/bsd.opts.mk Sat Aug 19 01:40:30 2017 (r322688) @@ -72,7 +72,6 @@ __DEFAULT_NO_OPTIONS = \ INSTALL_AS_USER \ STALE_STAGED -# meta mode related __DEFAULT_DEPENDENT_OPTIONS = \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ From owner-svn-src-all@freebsd.org Sat Aug 19 01:45:03 2017 Return-Path: Delivered-To: svn-src-all@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 8495BDE8288; Sat, 19 Aug 2017 01:45: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 52E9083527; Sat, 19 Aug 2017 01:45:03 +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 v7J1j2Cu046404; Sat, 19 Aug 2017 01:45:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1j2xM046403; Sat, 19 Aug 2017 01:45:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190145.v7J1j2xM046403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322690 - stable/11/usr.sbin/makefs/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/usr.sbin/makefs/tests X-SVN-Commit-Revision: 322690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:45:03 -0000 Author: ngie Date: Sat Aug 19 01:45:02 2017 New Revision: 322690 URL: https://svnweb.freebsd.org/changeset/base/322690 Log: MFC r321947: Require strings(1) with :o_flag_preparer and :o_flag_publisher strings(1) might not be installed on the system, e.g., if MK_TOOLCHAIN == no Modified: stable/11/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/makefs/tests/makefs_cd9660_tests.sh ============================================================================== --- stable/11/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Sat Aug 19 01:43:02 2017 (r322689) +++ stable/11/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Sat Aug 19 01:45:02 2017 (r322690) @@ -264,6 +264,10 @@ o_flag_isolevel_3_cleanup() } atf_test_case o_flag_preparer +o_flag_preparer_head() +{ + atf_set "require.progs" "strings" +} o_flag_preparer_body() { create_test_dirs @@ -279,6 +283,10 @@ o_flag_preparer_body() } atf_test_case o_flag_publisher +o_flag_publisher_head() +{ + atf_set "require.progs" "strings" +} o_flag_publisher_body() { create_test_dirs From owner-svn-src-all@freebsd.org Sat Aug 19 01:43:03 2017 Return-Path: Delivered-To: svn-src-all@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 F2ACCDE8040; Sat, 19 Aug 2017 01:43: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 C1F9B83408; Sat, 19 Aug 2017 01:43:03 +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 v7J1h2SS046247; Sat, 19 Aug 2017 01:43:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1h2Gm046246; Sat, 19 Aug 2017 01:43:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190143.v7J1h2Gm046246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322689 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 322689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:43:04 -0000 Author: ngie Date: Sat Aug 19 01:43:02 2017 New Revision: 322689 URL: https://svnweb.freebsd.org/changeset/base/322689 Log: MFC r321081: Sort the tests alphabetically before adding them to the Kyuafiles This is being done to aid in debugging test runs, in the event the output shifts due to refactored Makefiles, added tests, etc. Modified: stable/11/share/mk/bsd.test.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.test.mk ============================================================================== --- stable/11/share/mk/bsd.test.mk Sat Aug 19 01:40:30 2017 (r322688) +++ stable/11/share/mk/bsd.test.mk Sat Aug 19 01:43:02 2017 (r322689) @@ -66,6 +66,10 @@ _TESTS= .include .include +# Sort the tests alphabetically, so the results are deterministically formed +# across runs. +_TESTS:= ${_TESTS:O} + # kyua automatically descends directories; only run make check on the # top-level directory .if !make(check) From owner-svn-src-all@freebsd.org Sat Aug 19 01:49:11 2017 Return-Path: Delivered-To: svn-src-all@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 2D445DE87CD; Sat, 19 Aug 2017 01:49:11 +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 F047B8385E; Sat, 19 Aug 2017 01:49:10 +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 v7J1nA9S046602; Sat, 19 Aug 2017 01:49:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1nAqN046601; Sat, 19 Aug 2017 01:49:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708190149.v7J1nAqN046601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 19 Aug 2017 01:49:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322691 - stable/11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/tests/sys/kern X-SVN-Commit-Revision: 322691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:49:11 -0000 Author: ngie Date: Sat Aug 19 01:49:09 2017 New Revision: 322691 URL: https://svnweb.freebsd.org/changeset/base/322691 Log: MFC r321959: Annotate tests that require root privileges appropriately This unbreaks running the tests with unprivileged users. Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Sat Aug 19 01:45:02 2017 (r322690) +++ stable/11/tests/sys/kern/ptrace_test.c Sat Aug 19 01:49:09 2017 (r322691) @@ -1867,7 +1867,12 @@ mask_usr1_thread(void *arg) * Verify that the SIGKILL from PT_KILL takes priority over other signals * and prevents spurious stops due to those other signals. */ -ATF_TC_WITHOUT_HEAD(ptrace__PT_KILL_competing_signal); +ATF_TC(ptrace__PT_KILL_competing_signal); +ATF_TC_HEAD(ptrace__PT_KILL_competing_signal, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} ATF_TC_BODY(ptrace__PT_KILL_competing_signal, tc) { pid_t fpid, wpid; @@ -1961,7 +1966,12 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_signal, tc) * Verify that the SIGKILL from PT_KILL takes priority over other stop events * and prevents spurious stops caused by those events. */ -ATF_TC_WITHOUT_HEAD(ptrace__PT_KILL_competing_stop); +ATF_TC(ptrace__PT_KILL_competing_stop); +ATF_TC_HEAD(ptrace__PT_KILL_competing_stop, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) { pid_t fpid, wpid; @@ -2939,13 +2949,24 @@ terminate_with_pending_sigstop(bool sigstop_from_main_ * to the older thread (the second test). This behavior has changed in the * past, so make no assumption. */ -ATF_TC_WITHOUT_HEAD(ptrace__parent_terminate_with_pending_sigstop1); +ATF_TC(ptrace__parent_terminate_with_pending_sigstop1); +ATF_TC_HEAD(ptrace__parent_terminate_with_pending_sigstop1, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} ATF_TC_BODY(ptrace__parent_terminate_with_pending_sigstop1, tc) { terminate_with_pending_sigstop(true); } -ATF_TC_WITHOUT_HEAD(ptrace__parent_terminate_with_pending_sigstop2); + +ATF_TC(ptrace__parent_terminate_with_pending_sigstop2); +ATF_TC_HEAD(ptrace__parent_terminate_with_pending_sigstop2, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} ATF_TC_BODY(ptrace__parent_terminate_with_pending_sigstop2, tc) { From owner-svn-src-all@freebsd.org Sat Aug 19 09:38:45 2017 Return-Path: Delivered-To: svn-src-all@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 7F91EDDD8D2; Sat, 19 Aug 2017 09:38:45 +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 5B2336D69E; Sat, 19 Aug 2017 09:38:45 +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 v7J9cilP037678; Sat, 19 Aug 2017 09:38:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J9chGd037675; Sat, 19 Aug 2017 09:38:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708190938.v7J9chGd037675@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 09:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322692 - in stable/11/lib/libc: stdlib string tests/string X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/lib/libc: stdlib string tests/string X-SVN-Commit-Revision: 322692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 09:38:45 -0000 Author: kib Date: Sat Aug 19 09:38:43 2017 New Revision: 322692 URL: https://svnweb.freebsd.org/changeset/base/322692 Log: MFC r322427: Improve standard compliance for memset_s() and abort_handler_s(). Modified: stable/11/lib/libc/stdlib/set_constraint_handler_s.c stable/11/lib/libc/string/memset_s.c stable/11/lib/libc/tests/string/memset_s_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/set_constraint_handler_s.c ============================================================================== --- stable/11/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 19 01:49:09 2017 (r322691) +++ stable/11/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 19 09:38:43 2017 (r322692) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "un-namespace.h" #include "libc_private.h" @@ -81,10 +83,14 @@ __throw_constraint_handler_s(const char * restrict msg } void -abort_handler_s(const char * restrict msg __unused, - void * restrict ptr __unused, errno_t error __unused) +abort_handler_s(const char * restrict msg, void * restrict ptr __unused, + errno_t error __unused) { + static const char ahs[] = "abort_handler_s : "; + (void) _write(STDERR_FILENO, ahs, sizeof(ahs) - 1); + (void) _write(STDERR_FILENO, msg, strlen(msg)); + (void) _write(STDERR_FILENO, "\n", 1); abort(); } Modified: stable/11/lib/libc/string/memset_s.c ============================================================================== --- stable/11/lib/libc/string/memset_s.c Sat Aug 19 01:49:09 2017 (r322691) +++ stable/11/lib/libc/string/memset_s.c Sat Aug 19 09:38:43 2017 (r322692) @@ -42,7 +42,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) volatile unsigned char *dst; ret = EINVAL; - lim = smax; + lim = n < smax ? n : smax; v = (unsigned char)c; dst = (unsigned char *)s; if (s == NULL) { @@ -53,11 +53,14 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { - if (n < smax) - lim = n; while (lim > 0) dst[--lim] = v; - ret = 0; + if (n > smax) { + __throw_constraint_handler_s("memset_s : n > smax", + ret); + } else { + ret = 0; + } } return (ret); } Modified: stable/11/lib/libc/tests/string/memset_s_test.c ============================================================================== --- stable/11/lib/libc/tests/string/memset_s_test.c Sat Aug 19 01:49:09 2017 (r322691) +++ stable/11/lib/libc/tests/string/memset_s_test.c Sat Aug 19 09:38:43 2017 (r322692) @@ -109,13 +109,18 @@ ATF_TC_BODY(n_lt_smax, tc) assert(b[2] == 3); } -/* n > smax */ +/* n > smax, handler */ ATF_TC_WITHOUT_HEAD(n_gt_smax); ATF_TC_BODY(n_gt_smax, tc) { char b[3] = {1, 2, 3}; - assert(memset_s(&b[0], 1, 9, 3) == 0); + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b[0], 1, 9, 3) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > smax") == 0); assert(b[0] == 9); assert(b[1] == 2); assert(b[2] == 3); From owner-svn-src-all@freebsd.org Sat Aug 19 12:14:47 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 14:27:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 17:00:12 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 17:00:54 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 17:10:19 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 17:15:42 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 17:18:28 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 19:33:18 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 21:00:04 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 21:17:54 2017 Return-Path: Delivered-To: svn-src-all@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 7403EDE56C1; Sat, 19 Aug 2017 21:17:54 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 43C5B653B9; Sat, 19 Aug 2017 21:17:54 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JLHrHl028517; Sat, 19 Aug 2017 21:17:53 GMT (envelope-from matthew@FreeBSD.org) Received: (from matthew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JLHrHm028516; Sat, 19 Aug 2017 21:17:53 GMT (envelope-from matthew@FreeBSD.org) Message-Id: <201708192117.v7JLHrHm028516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: matthew set sender to matthew@FreeBSD.org using -f From: Matthew Seaman Date: Sat, 19 Aug 2017 21:17:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322707 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: matthew X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 21:17:54 -0000 Author: matthew (ports committer) Date: Sat Aug 19 21:17:53 2017 New Revision: 322707 URL: https://svnweb.freebsd.org/changeset/base/322707 Log: Take in Rui Paulo's comit bit at his own request. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Sat Aug 19 21:00:02 2017 (r322706) +++ svnadmin/conf/access Sat Aug 19 21:17:53 2017 (r322707) @@ -178,7 +178,6 @@ rmacklem roberto rodrigc royger -rpaulo rpokala rrs rstone From owner-svn-src-all@freebsd.org Sat Aug 19 21:40:43 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Aug 19 23:13:35 2017 Return-Path: Delivered-To: svn-src-all@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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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)