From owner-svn-src-all@freebsd.org Sun Aug 25 00:55:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D201D09DE; Sun, 25 Aug 2019 00:55:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GGsB3CvNz4M7R; Sun, 25 Aug 2019 00:55:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50D3CD9F8; Sun, 25 Aug 2019 00:55:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P0tgBp064243; Sun, 25 Aug 2019 00:55:42 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P0tgam064242; Sun, 25 Aug 2019 00:55:42 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908250055.x7P0tgam064242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 25 Aug 2019 00:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351465 - stable/12/release/picobsd/tinyware/simple_httpd X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/release/picobsd/tinyware/simple_httpd X-SVN-Commit-Revision: 351465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 00:55:42 -0000 Author: eugen Date: Sun Aug 25 00:55:41 2019 New Revision: 351465 URL: https://svnweb.freebsd.org/changeset/base/351465 Log: MFC r351179: simple_httpd was not buildable for some time due to multiple missing "static" keywords and -Werror,-Wmissing-variable-declarations This change adds needed "static" so it builds again with WARNS?=6 No functional changes. Modified: stable/12/release/picobsd/tinyware/simple_httpd/simple_httpd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/release/picobsd/tinyware/simple_httpd/simple_httpd.c ============================================================================== --- stable/12/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sat Aug 24 22:07:38 2019 (r351464) +++ stable/12/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sun Aug 25 00:55:41 2019 (r351465) @@ -48,33 +48,33 @@ #include #include -int http_port = 80; -int daemonize = 1; -int verbose = 0; -int http_sock, con_sock; +static int http_port = 80; +static int daemonize = 1; +static int verbose = 0; +static int http_sock, con_sock; -const char *fetch_mode = NULL; -char homedir[100]; -char logfile[80]; -char *adate(void); -void init_servconnection(void); -void http_date(void); -void http_output(const char *html); -void http_request(void); -void log_line(char *req); -void wait_connection(void); +static const char *fetch_mode = NULL; +static char homedir[100]; +static char logfile[80]; +static char *adate(void); +static void init_servconnection(void); +static void http_date(void); +static void http_output(const char *html); +static void http_request(void); +static void log_line(char *req); +static void wait_connection(void); -struct hostent *hst; -struct sockaddr_in source; +static struct hostent *hst; +static struct sockaddr_in source; /* HTTP basics */ static char httpd_server_ident[] = "Server: FreeBSD/PicoBSD simple_httpd 1.1\r"; static char http_200[] = "HTTP/1.0 200 OK\r"; -const char *default_mime_type = "application/octet-stream"; +static const char *default_mime_type = "application/octet-stream"; -const char *mime_type[][2] = { +static const char *mime_type[][2] = { { "txt", "text/plain" }, { "htm", "text/html" }, { "html", "text/html" }, @@ -83,7 +83,7 @@ const char *mime_type[][2] = { { "mp3", "audio/mpeg" } }; -const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; +static const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; /* Two parts, HTTP Header and then HTML */ static const char *http_404[2] = @@ -101,7 +101,7 @@ This server only supports GET and HEAD requests.\n Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77DD5D0AD9; Sun, 25 Aug 2019 00:57:52 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GGvh2cLmz4MG5; Sun, 25 Aug 2019 00:57:52 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CE63D9F9; Sun, 25 Aug 2019 00:57:52 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P0vpx8064376; Sun, 25 Aug 2019 00:57:51 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P0vpCf064375; Sun, 25 Aug 2019 00:57:51 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908250057.x7P0vpCf064375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 25 Aug 2019 00:57: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: r351466 - stable/11/release/picobsd/tinyware/simple_httpd X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/release/picobsd/tinyware/simple_httpd X-SVN-Commit-Revision: 351466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 00:57:52 -0000 Author: eugen Date: Sun Aug 25 00:57:51 2019 New Revision: 351466 URL: https://svnweb.freebsd.org/changeset/base/351466 Log: MFC r351179: simple_httpd was not buildable for some time due to multiple missing "static" keywords and -Werror,-Wmissing-variable-declarations This change adds needed "static" so it builds again with WARNS?=6 No functional changes. Modified: stable/11/release/picobsd/tinyware/simple_httpd/simple_httpd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/release/picobsd/tinyware/simple_httpd/simple_httpd.c ============================================================================== --- stable/11/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sun Aug 25 00:55:41 2019 (r351465) +++ stable/11/release/picobsd/tinyware/simple_httpd/simple_httpd.c Sun Aug 25 00:57:51 2019 (r351466) @@ -48,33 +48,33 @@ #include #include -int http_port = 80; -int daemonize = 1; -int verbose = 0; -int http_sock, con_sock; +static int http_port = 80; +static int daemonize = 1; +static int verbose = 0; +static int http_sock, con_sock; -const char *fetch_mode = NULL; -char homedir[100]; -char logfile[80]; -char *adate(void); -void init_servconnection(void); -void http_date(void); -void http_output(const char *html); -void http_request(void); -void log_line(char *req); -void wait_connection(void); +static const char *fetch_mode = NULL; +static char homedir[100]; +static char logfile[80]; +static char *adate(void); +static void init_servconnection(void); +static void http_date(void); +static void http_output(const char *html); +static void http_request(void); +static void log_line(char *req); +static void wait_connection(void); -struct hostent *hst; -struct sockaddr_in source; +static struct hostent *hst; +static struct sockaddr_in source; /* HTTP basics */ static char httpd_server_ident[] = "Server: FreeBSD/PicoBSD simple_httpd 1.1\r"; static char http_200[] = "HTTP/1.0 200 OK\r"; -const char *default_mime_type = "application/octet-stream"; +static const char *default_mime_type = "application/octet-stream"; -const char *mime_type[][2] = { +static const char *mime_type[][2] = { { "txt", "text/plain" }, { "htm", "text/html" }, { "html", "text/html" }, @@ -83,7 +83,7 @@ const char *mime_type[][2] = { { "mp3", "audio/mpeg" } }; -const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; +static const int mime_type_max = sizeof(mime_type) / sizeof(mime_type[0]) - 1; /* Two parts, HTTP Header and then HTML */ static const char *http_404[2] = @@ -101,7 +101,7 @@ This server only supports GET and HEAD requests.\n Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D59CDD0D2B; Sun, 25 Aug 2019 01:05:01 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GH3x59ztz4MkS; Sun, 25 Aug 2019 01:05:01 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93873DBD7; Sun, 25 Aug 2019 01:05:01 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P151Fe070289; Sun, 25 Aug 2019 01:05:01 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P151V0070288; Sun, 25 Aug 2019 01:05:01 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201908250105.x7P151V0070288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 25 Aug 2019 01:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351467 - head/usr.bin/last X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/usr.bin/last X-SVN-Commit-Revision: 351467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 01:05:01 -0000 Author: eugen Date: Sun Aug 25 01:05:01 2019 New Revision: 351467 URL: https://svnweb.freebsd.org/changeset/base/351467 Log: last(1): fix style after r351459 Reported by: cem MFC after: 2 weeks X-MFC-With: 351459 Modified: head/usr.bin/last/last.c Modified: head/usr.bin/last/last.c ============================================================================== --- head/usr.bin/last/last.c Sun Aug 25 00:57:51 2019 (r351466) +++ head/usr.bin/last/last.c Sun Aug 25 01:05:01 2019 (r351467) @@ -159,7 +159,7 @@ main(int argc, char *argv[]) (void) setlocale(LC_CTYPE, ""); p = nl_langinfo(CODESET); - if (strcmp (p, "UTF-8") == 0 || strcmp (p, "US-ASCII") == 0) + if (strcmp(p, "UTF-8") == 0 || strcmp(p, "US-ASCII") == 0) noctfix = 1; argc = xo_parse_args(argc, argv); From owner-svn-src-all@freebsd.org Sun Aug 25 01:09:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3FC7D0EA9; Sun, 25 Aug 2019 01:09:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GH975lL3z4Mvj; Sun, 25 Aug 2019 01:09:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A836BDBE0; Sun, 25 Aug 2019 01:09:31 +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 x7P19VKZ070514; Sun, 25 Aug 2019 01:09:31 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P19VgS070513; Sun, 25 Aug 2019 01:09:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908250109.x7P19VgS070513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 01:09: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: r351468 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 01:09:32 -0000 Author: cy Date: Sun Aug 25 01:09:31 2019 New Revision: 351468 URL: https://svnweb.freebsd.org/changeset/base/351468 Log: MFC r351380: Specifying array sizes for fully initialized tables at compile time is redundant. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:05:01 2019 (r351467) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:09:31 2019 (r351468) @@ -194,7 +194,7 @@ static int ppsratecheck(struct timeval *, int *, int) * hand side to allow for binary searching of the array and include a trailer * with a 0 for the bitmask for linear searches to easily find the end with. */ -static const struct optlist ipopts[20] = { +static const struct optlist ipopts[] = { { IPOPT_NOP, 0x000001 }, { IPOPT_RR, 0x000002 }, { IPOPT_ZSU, 0x000004 }, @@ -235,7 +235,7 @@ static const struct optlist ip6exthdr[] = { /* * bit values for identifying presence of individual IP security options */ -static const struct optlist secopt[8] = { +static const struct optlist secopt[] = { { IPSO_CLASS_RES4, 0x01 }, { IPSO_CLASS_TOPS, 0x02 }, { IPSO_CLASS_SECR, 0x04 }, From owner-svn-src-all@freebsd.org Sun Aug 25 01:09:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43A21D0EAD; Sun, 25 Aug 2019 01:09:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GH9818fbz4Mvk; Sun, 25 Aug 2019 01:09:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 094E4DBE1; Sun, 25 Aug 2019 01:09:32 +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 x7P19VT6070520; Sun, 25 Aug 2019 01:09:31 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P19VPW070519; Sun, 25 Aug 2019 01:09:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908250109.x7P19VPW070519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 01:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351468 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 01:09:32 -0000 Author: cy Date: Sun Aug 25 01:09:31 2019 New Revision: 351468 URL: https://svnweb.freebsd.org/changeset/base/351468 Log: MFC r351380: Specifying array sizes for fully initialized tables at compile time is redundant. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:05:01 2019 (r351467) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:09:31 2019 (r351468) @@ -194,7 +194,7 @@ static int ppsratecheck(struct timeval *, int *, int) * hand side to allow for binary searching of the array and include a trailer * with a 0 for the bitmask for linear searches to easily find the end with. */ -static const struct optlist ipopts[20] = { +static const struct optlist ipopts[] = { { IPOPT_NOP, 0x000001 }, { IPOPT_RR, 0x000002 }, { IPOPT_ZSU, 0x000004 }, @@ -235,7 +235,7 @@ static const struct optlist ip6exthdr[] = { /* * bit values for identifying presence of individual IP security options */ -static const struct optlist secopt[8] = { +static const struct optlist secopt[] = { { IPSO_CLASS_RES4, 0x01 }, { IPSO_CLASS_TOPS, 0x02 }, { IPSO_CLASS_SECR, 0x04 }, From owner-svn-src-all@freebsd.org Sun Aug 25 01:09:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9920AD0EB5; Sun, 25 Aug 2019 01:09:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GH983bjDz4Mvn; Sun, 25 Aug 2019 01:09:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E4E8DBE2; Sun, 25 Aug 2019 01:09:32 +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 x7P19WKG070526; Sun, 25 Aug 2019 01:09:32 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P19WOB070525; Sun, 25 Aug 2019 01:09:32 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908250109.x7P19WOB070525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 01:09:32 +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: r351468 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 01:09:32 -0000 Author: cy Date: Sun Aug 25 01:09:31 2019 New Revision: 351468 URL: https://svnweb.freebsd.org/changeset/base/351468 Log: MFC r351380: Specifying array sizes for fully initialized tables at compile time is redundant. Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:05:01 2019 (r351467) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 01:09:31 2019 (r351468) @@ -232,7 +232,7 @@ static int ppsratecheck(struct timeval *, int *, int) * hand side to allow for binary searching of the array and include a trailer * with a 0 for the bitmask for linear searches to easily find the end with. */ -static const struct optlist ipopts[20] = { +static const struct optlist ipopts[] = { { IPOPT_NOP, 0x000001 }, { IPOPT_RR, 0x000002 }, { IPOPT_ZSU, 0x000004 }, @@ -273,7 +273,7 @@ static const struct optlist ip6exthdr[] = { /* * bit values for identifying presence of individual IP security options */ -static const struct optlist secopt[8] = { +static const struct optlist secopt[] = { { IPSO_CLASS_RES4, 0x01 }, { IPSO_CLASS_TOPS, 0x02 }, { IPSO_CLASS_SECR, 0x04 }, From owner-svn-src-all@freebsd.org Sun Aug 25 02:38:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 793BCD2D51; Sun, 25 Aug 2019 02:38:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GK862ZpRz4RHk; Sun, 25 Aug 2019 02:38: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A5DBEC4A; Sun, 25 Aug 2019 02:38: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 x7P2ckE8023406; Sun, 25 Aug 2019 02:38:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P2ckxp023405; Sun, 25 Aug 2019 02:38:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908250238.x7P2ckxp023405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 25 Aug 2019 02:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351469 - head/tests/sys/posixshm X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tests/sys/posixshm X-SVN-Commit-Revision: 351469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 02:38:46 -0000 Author: kevans Date: Sun Aug 25 02:38:45 2019 New Revision: 351469 URL: https://svnweb.freebsd.org/changeset/base/351469 Log: tests: shm_open(2): Verify FD_CLOEXEC Motivated by the fact that I'm messing around near the implementation and wanting to ensure this doesn't get messed up in the process. MFC after: 1 week Modified: head/tests/sys/posixshm/posixshm_test.c Modified: head/tests/sys/posixshm/posixshm_test.c ============================================================================== --- head/tests/sys/posixshm/posixshm_test.c Sun Aug 25 01:09:31 2019 (r351468) +++ head/tests/sys/posixshm/posixshm_test.c Sun Aug 25 02:38:45 2019 (r351469) @@ -609,6 +609,27 @@ ATF_TC_BODY(shm_functionality_across_fork, tc) shm_unlink(test_path); } +ATF_TC_WITHOUT_HEAD(cloexec); +ATF_TC_BODY(cloexec, tc) +{ + int fd; + + gen_test_path(); + + /* shm_open(2) is required to set FD_CLOEXEC */ + fd = shm_open(SHM_ANON, O_RDWR, 0777); + ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno); + ATF_REQUIRE((fcntl(fd, F_GETFD) & FD_CLOEXEC) != 0); + close(fd); + + /* Also make sure that named shm is correct */ + fd = shm_open(test_path, O_CREAT | O_RDWR, 0600); + ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno); + ATF_REQUIRE((fcntl(fd, F_GETFD) & FD_CLOEXEC) != 0); + close(fd); +} + + ATF_TP_ADD_TCS(tp) { @@ -630,6 +651,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, unlink_bad_path_pointer); ATF_TP_ADD_TC(tp, unlink_path_too_long); ATF_TP_ADD_TC(tp, object_resize); + ATF_TP_ADD_TC(tp, cloexec); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Sun Aug 25 04:56:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A41F1D5219; Sun, 25 Aug 2019 04:56:34 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GNC63qLkz4X5Y; Sun, 25 Aug 2019 04:56:34 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79DDA1862A; Sun, 25 Aug 2019 04:56:34 +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 x7P4uYpT006479; Sun, 25 Aug 2019 04:56:34 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P4uY6s006477; Sun, 25 Aug 2019 04:56:34 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908250456.x7P4uY6s006477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 04:56: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: r351470 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 04:56:34 -0000 Author: cy Date: Sun Aug 25 04:56:33 2019 New Revision: 351470 URL: https://svnweb.freebsd.org/changeset/base/351470 Log: MFC r350880: r272552 applied the patch from ipfilter upstream fil.c r1.129 to fix broken ipfilter rule matches (upstream bug #554). The upstream patch was incomplete, it resolved all but one rule compare issue. The issue fixed here is when "{to, reply-to, dup-to} interface" are used in conjuncion with "on interface". The match was only made if the on keyword was specified in the same order in each case referencing the same rule. This commit fixes this. The reason for this is that interface name strings and comment keyword comments are stored in a a variable length field starting at fr_names in the frentry struct. These strings are placed into this variable length in the order they are encountered by ipf_y.y and indexed through index pointers in fr_ifnames, fr_comment or one of the frdest struct fd_name fields. (Three frdest structs are within frentry.) Order matters and this patch takes this into account. While in here it was discovered that though ipfilter is designed to pport multiple interface specifiations per rule (up to four), this undocumented (the man page makes no mention of it) feature does not work. A todo is to fix the multiple interfaces feature at a later date. To understand the design decision as to why only four were intended, it is suspected that the decision was made because Sun workstations and PCs rarely if ever exceeded four NICs at the time, this is not true in 2019. PR: 238796 Reported by: WHR Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 02:38:45 2019 (r351469) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 04:56:33 2019 (r351470) @@ -4418,6 +4418,28 @@ ipf_matchicmpqueryreply(v, ic, icmp, rev) } +/* + * IFNAMES are located in the variable length field starting at + * frentry.fr_names. As pointers within the struct cannot be passed + * to the kernel from ipf(8), an offset is used. An offset of -1 means it + * is unused (invalid). If it is used (valid) it is an offset to the + * character string of an interface name or a comment. The following + * macros will assist those who follow to understand the code. + */ +#define IPF_IFNAME_VALID(_a) (_a != -1) +#define IPF_IFNAME_INVALID(_a) (_a == -1) +#define IPF_IFNAMES_DIFFERENT(_a) \ + !((IPF_IFNAME_INVALID(fr1->_a) && \ + IPF_IFNAME_INVALID(fr2->_a)) || \ + (IPF_IFNAME_VALID(fr1->_a) && \ + IPF_IFNAME_VALID(fr2->_a) && \ + !strcmp(FR_NAME(fr1, _a), FR_NAME(fr2, _a)))) +#define IPF_FRDEST_DIFFERENT(_a) \ + (memcmp(&fr1->_a.fd_addr, &fr2->_a.fd_addr, \ + offsetof(frdest_t, fd_name) - offsetof(frdest_t, fd_addr)) || \ + IPF_IFNAMES_DIFFERENT(_a.fd_name)) + + /* ------------------------------------------------------------------------ */ /* Function: ipf_rule_compare */ /* Parameters: fr1(I) - first rule structure to compare */ @@ -4430,22 +4452,50 @@ ipf_matchicmpqueryreply(v, ic, icmp, rev) static int ipf_rule_compare(frentry_t *fr1, frentry_t *fr2) { + int i; + if (fr1->fr_cksum != fr2->fr_cksum) return (1); if (fr1->fr_size != fr2->fr_size) return (2); if (fr1->fr_dsize != fr2->fr_dsize) return (3); - if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ(fr1)) + if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ) != 0) return (4); + /* + * XXX: There is still a bug here as different rules with the + * the same interfaces but in a different order will compare + * differently. But since multiple interfaces in a rule doesn't + * work anyway a simple straightforward compare is performed + * here. Ultimately frentry_t creation will need to be + * revisited in ipf_y.y. While the other issue, recognition + * of only the first interface in a list of interfaces will + * need to be separately addressed along with why only four. + */ + for (i = 0; i < FR_NUM(fr1->fr_ifnames); i++) { + /* + * XXX: It's either the same index or uninitialized. + * We assume this because multiple interfaces + * referenced by the same rule doesn't work anyway. + */ + if (IPF_IFNAMES_DIFFERENT(fr_ifnames[i])) + return(5); + } + + if (IPF_FRDEST_DIFFERENT(fr_tif)) + return (6); + if (IPF_FRDEST_DIFFERENT(fr_rif)) + return (7); + if (IPF_FRDEST_DIFFERENT(fr_dif)) + return (8); if (!fr1->fr_data && !fr2->fr_data) return (0); /* move along, nothing to see here */ if (fr1->fr_data && fr2->fr_data) { if (bcmp(fr1->fr_caddr, fr2->fr_caddr, fr1->fr_dsize) == 0) return (0); /* same */ } - return (5); + return (9); } Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Sun Aug 25 02:38:45 2019 (r351469) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Sun Aug 25 04:56:33 2019 (r351470) @@ -735,12 +735,9 @@ typedef struct frentry { u_char fr_icode; /* return ICMP code */ int fr_group; /* group to which this rule belongs */ int fr_grhead; /* group # which this rule starts */ - int fr_ifnames[4]; int fr_isctag; int fr_rpc; /* XID Filtering */ ipftag_t fr_nattag; - frdest_t fr_tifs[2]; /* "to"/"reply-to" interface */ - frdest_t fr_dif; /* duplicate packet interface */ /* * These are all options related to stateful filtering */ @@ -750,6 +747,12 @@ typedef struct frentry { int fr_icmphead; /* ICMP group for state options */ u_int fr_age[2]; /* non-TCP state timeouts */ /* + * These are compared separately. + */ + int fr_ifnames[4]; + frdest_t fr_tifs[2]; /* "to"/"reply-to" interface */ + frdest_t fr_dif; /* duplicate packet interface */ + /* * How big is the name buffer at the end? */ int fr_namelen; @@ -827,9 +830,10 @@ typedef struct frentry { #define FR_NOLOGTAG 0 -#define FR_CMPSIZ(_f) ((_f)->fr_size - \ - offsetof(struct frentry, fr_func)) +#define FR_CMPSIZ (offsetof(struct frentry, fr_ifnames) - \ + offsetof(struct frentry, fr_func)) #define FR_NAME(_f, _n) (_f)->fr_names + (_f)->_n +#define FR_NUM(_a) (sizeof(_a) / sizeof(*_a)) /* From owner-svn-src-all@freebsd.org Sun Aug 25 04:56:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 444F4D521E; Sun, 25 Aug 2019 04:56:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GNC714vbz4X5Z; Sun, 25 Aug 2019 04:56:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06C5F1862B; Sun, 25 Aug 2019 04:56:35 +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 x7P4uYjp006486; Sun, 25 Aug 2019 04:56:34 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P4uYr1006484; Sun, 25 Aug 2019 04:56:34 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908250456.x7P4uYr1006484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 04:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351470 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 04:56:35 -0000 Author: cy Date: Sun Aug 25 04:56:33 2019 New Revision: 351470 URL: https://svnweb.freebsd.org/changeset/base/351470 Log: MFC r350880: r272552 applied the patch from ipfilter upstream fil.c r1.129 to fix broken ipfilter rule matches (upstream bug #554). The upstream patch was incomplete, it resolved all but one rule compare issue. The issue fixed here is when "{to, reply-to, dup-to} interface" are used in conjuncion with "on interface". The match was only made if the on keyword was specified in the same order in each case referencing the same rule. This commit fixes this. The reason for this is that interface name strings and comment keyword comments are stored in a a variable length field starting at fr_names in the frentry struct. These strings are placed into this variable length in the order they are encountered by ipf_y.y and indexed through index pointers in fr_ifnames, fr_comment or one of the frdest struct fd_name fields. (Three frdest structs are within frentry.) Order matters and this patch takes this into account. While in here it was discovered that though ipfilter is designed to pport multiple interface specifiations per rule (up to four), this undocumented (the man page makes no mention of it) feature does not work. A todo is to fix the multiple interfaces feature at a later date. To understand the design decision as to why only four were intended, it is suspected that the decision was made because Sun workstations and PCs rarely if ever exceeded four NICs at the time, this is not true in 2019. PR: 238796 Reported by: WHR Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 02:38:45 2019 (r351469) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 04:56:33 2019 (r351470) @@ -4418,6 +4418,28 @@ ipf_matchicmpqueryreply(v, ic, icmp, rev) } +/* + * IFNAMES are located in the variable length field starting at + * frentry.fr_names. As pointers within the struct cannot be passed + * to the kernel from ipf(8), an offset is used. An offset of -1 means it + * is unused (invalid). If it is used (valid) it is an offset to the + * character string of an interface name or a comment. The following + * macros will assist those who follow to understand the code. + */ +#define IPF_IFNAME_VALID(_a) (_a != -1) +#define IPF_IFNAME_INVALID(_a) (_a == -1) +#define IPF_IFNAMES_DIFFERENT(_a) \ + !((IPF_IFNAME_INVALID(fr1->_a) && \ + IPF_IFNAME_INVALID(fr2->_a)) || \ + (IPF_IFNAME_VALID(fr1->_a) && \ + IPF_IFNAME_VALID(fr2->_a) && \ + !strcmp(FR_NAME(fr1, _a), FR_NAME(fr2, _a)))) +#define IPF_FRDEST_DIFFERENT(_a) \ + (memcmp(&fr1->_a.fd_addr, &fr2->_a.fd_addr, \ + offsetof(frdest_t, fd_name) - offsetof(frdest_t, fd_addr)) || \ + IPF_IFNAMES_DIFFERENT(_a.fd_name)) + + /* ------------------------------------------------------------------------ */ /* Function: ipf_rule_compare */ /* Parameters: fr1(I) - first rule structure to compare */ @@ -4430,22 +4452,50 @@ ipf_matchicmpqueryreply(v, ic, icmp, rev) static int ipf_rule_compare(frentry_t *fr1, frentry_t *fr2) { + int i; + if (fr1->fr_cksum != fr2->fr_cksum) return (1); if (fr1->fr_size != fr2->fr_size) return (2); if (fr1->fr_dsize != fr2->fr_dsize) return (3); - if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ(fr1)) + if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, FR_CMPSIZ) != 0) return (4); + /* + * XXX: There is still a bug here as different rules with the + * the same interfaces but in a different order will compare + * differently. But since multiple interfaces in a rule doesn't + * work anyway a simple straightforward compare is performed + * here. Ultimately frentry_t creation will need to be + * revisited in ipf_y.y. While the other issue, recognition + * of only the first interface in a list of interfaces will + * need to be separately addressed along with why only four. + */ + for (i = 0; i < FR_NUM(fr1->fr_ifnames); i++) { + /* + * XXX: It's either the same index or uninitialized. + * We assume this because multiple interfaces + * referenced by the same rule doesn't work anyway. + */ + if (IPF_IFNAMES_DIFFERENT(fr_ifnames[i])) + return(5); + } + + if (IPF_FRDEST_DIFFERENT(fr_tif)) + return (6); + if (IPF_FRDEST_DIFFERENT(fr_rif)) + return (7); + if (IPF_FRDEST_DIFFERENT(fr_dif)) + return (8); if (!fr1->fr_data && !fr2->fr_data) return (0); /* move along, nothing to see here */ if (fr1->fr_data && fr2->fr_data) { if (bcmp(fr1->fr_caddr, fr2->fr_caddr, fr1->fr_dsize) == 0) return (0); /* same */ } - return (5); + return (9); } Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Sun Aug 25 02:38:45 2019 (r351469) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Sun Aug 25 04:56:33 2019 (r351470) @@ -735,12 +735,9 @@ typedef struct frentry { u_char fr_icode; /* return ICMP code */ int fr_group; /* group to which this rule belongs */ int fr_grhead; /* group # which this rule starts */ - int fr_ifnames[4]; int fr_isctag; int fr_rpc; /* XID Filtering */ ipftag_t fr_nattag; - frdest_t fr_tifs[2]; /* "to"/"reply-to" interface */ - frdest_t fr_dif; /* duplicate packet interface */ /* * These are all options related to stateful filtering */ @@ -750,6 +747,12 @@ typedef struct frentry { int fr_icmphead; /* ICMP group for state options */ u_int fr_age[2]; /* non-TCP state timeouts */ /* + * These are compared separately. + */ + int fr_ifnames[4]; + frdest_t fr_tifs[2]; /* "to"/"reply-to" interface */ + frdest_t fr_dif; /* duplicate packet interface */ + /* * How big is the name buffer at the end? */ int fr_namelen; @@ -827,9 +830,10 @@ typedef struct frentry { #define FR_NOLOGTAG 0 -#define FR_CMPSIZ(_f) ((_f)->fr_size - \ - offsetof(struct frentry, fr_func)) +#define FR_CMPSIZ (offsetof(struct frentry, fr_ifnames) - \ + offsetof(struct frentry, fr_func)) #define FR_NAME(_f, _n) (_f)->fr_names + (_f)->_n +#define FR_NUM(_a) (sizeof(_a) / sizeof(*_a)) /* From owner-svn-src-all@freebsd.org Sun Aug 25 05:11:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99056D56BB; Sun, 25 Aug 2019 05:11:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GNXc3YZPz4Xwb; Sun, 25 Aug 2019 05:11:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C69D18861; Sun, 25 Aug 2019 05:11:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P5BiPA016075; Sun, 25 Aug 2019 05:11:44 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P5BiPl016074; Sun, 25 Aug 2019 05:11:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908250511.x7P5BiPl016074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 25 Aug 2019 05:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351471 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 351471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 05:11:44 -0000 Author: mjg Date: Sun Aug 25 05:11:43 2019 New Revision: 351471 URL: https://svnweb.freebsd.org/changeset/base/351471 Log: vfs: add vholdnz (for already held vnodes) Reviewed by: kib (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21358 Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Aug 25 04:56:33 2019 (r351470) +++ head/sys/kern/vfs_subr.c Sun Aug 25 05:11:43 2019 (r351471) @@ -3018,6 +3018,19 @@ _vhold(struct vnode *vp, bool locked) VI_UNLOCK(vp); } +void +vholdnz(struct vnode *vp) +{ + + CTR2(KTR_VFS, "%s: vp %p", __func__, vp); +#ifdef INVARIANTS + int old = atomic_fetchadd_int(&vp->v_holdcnt, 1); + VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__)); +#else + atomic_add_int(&vp->v_holdcnt, 1); +#endif +} + /* * Drop the hold count of the vnode. If this is the last reference to * the vnode we place it on the free list unless it has been vgone'd Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Aug 25 04:56:33 2019 (r351470) +++ head/sys/sys/vnode.h Sun Aug 25 05:11:43 2019 (r351471) @@ -657,6 +657,7 @@ void vgone(struct vnode *vp); #define vhold(vp) _vhold((vp), 0) #define vholdl(vp) _vhold((vp), 1) void _vhold(struct vnode *, bool); +void vholdnz(struct vnode *); void vinactive(struct vnode *, struct thread *); int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); int vtruncbuf(struct vnode *vp, off_t length, int blksize); From owner-svn-src-all@freebsd.org Sun Aug 25 05:13:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44524D58B9; Sun, 25 Aug 2019 05:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GNZN11yFz4Y6l; Sun, 25 Aug 2019 05:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0503A189C8; Sun, 25 Aug 2019 05:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P5DFD8017825; Sun, 25 Aug 2019 05:13:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P5DFFx017824; Sun, 25 Aug 2019 05:13:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908250513.x7P5DFFx017824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 25 Aug 2019 05:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351472 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 351472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 05:13:16 -0000 Author: mjg Date: Sun Aug 25 05:13:15 2019 New Revision: 351472 URL: https://svnweb.freebsd.org/changeset/base/351472 Log: nullfs: reduce areas protected by vnode interlock Some places only take the interlock to hold the vnode, which was a requiremnt before they started being manipulated with atomics. Use the newly introduced vholdnz to bump the count. Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21358 Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 2019 (r351471) +++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 2019 (r351472) @@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) * We prevent it from being recycled by holding the vnode * here. */ - vholdl(lvp); + vholdnz(lvp); error = VOP_LOCK(lvp, flags); /* @@ -710,31 +710,16 @@ static int null_unlock(struct vop_unlock_args *ap) { struct vnode *vp = ap->a_vp; - int flags = ap->a_flags; - int mtxlkflag = 0; struct null_node *nn; struct vnode *lvp; int error; - if ((flags & LK_INTERLOCK) != 0) - mtxlkflag = 1; - else if (mtx_owned(VI_MTX(vp)) == 0) { - VI_LOCK(vp); - mtxlkflag = 2; - } nn = VTONULL(vp); if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { - VI_LOCK_FLAGS(lvp, MTX_DUPOK); - flags |= LK_INTERLOCK; - vholdl(lvp); - VI_UNLOCK(vp); - error = VOP_UNLOCK(lvp, flags); + vholdnz(lvp); + error = VOP_UNLOCK(lvp, 0); vdrop(lvp); - if (mtxlkflag == 0) - VI_LOCK(vp); } else { - if (mtxlkflag == 2) - VI_UNLOCK(vp); error = vop_stdunlock(ap); } @@ -845,10 +830,8 @@ null_getwritemount(struct vop_getwritemount_args *ap) VI_LOCK(vp); xp = VTONULL(vp); if (xp && (lowervp = xp->null_lowervp)) { - VI_LOCK_FLAGS(lowervp, MTX_DUPOK); + vholdnz(lowervp); VI_UNLOCK(vp); - vholdl(lowervp); - VI_UNLOCK(lowervp); VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); vdrop(lowervp); } else { From owner-svn-src-all@freebsd.org Sun Aug 25 06:14:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91D37D6637; Sun, 25 Aug 2019 06:14:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GPwT39vZz4b1n; Sun, 25 Aug 2019 06:14:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EFEF194A1; Sun, 25 Aug 2019 06:14: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 x7P6E1dl052896; Sun, 25 Aug 2019 06:14:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P6E0gR052894; Sun, 25 Aug 2019 06:14:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908250614.x7P6E0gR052894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 06:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351473 - in stable/12: share/man/man9 sys/i386/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: share/man/man9 sys/i386/include X-SVN-Commit-Revision: 351473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 06:14:01 -0000 Author: kib Date: Sun Aug 25 06:14:00 2019 New Revision: 351473 URL: https://svnweb.freebsd.org/changeset/base/351473 Log: MFC r351190: i386: Implement atomic_load_64(9) and atomic_store_64(9). Modified: stable/12/share/man/man9/atomic.9 stable/12/sys/i386/include/atomic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/atomic.9 ============================================================================== --- stable/12/share/man/man9/atomic.9 Sun Aug 25 05:13:15 2019 (r351472) +++ stable/12/share/man/man9/atomic.9 Sun Aug 25 06:14:00 2019 (r351473) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 22, 2017 +.Dd August 18, 2019 .Dt ATOMIC 9 .Os .Sh NAME @@ -478,7 +478,7 @@ and do not have any variants with memory barriers at t .Pp The type .Dq Li 64 -is currently not implemented for any of the atomic operations on the +is currently not implemented for some of the atomic operations on the .Tn arm , .Tn i386 , and Modified: stable/12/sys/i386/include/atomic.h ============================================================================== --- stable/12/sys/i386/include/atomic.h Sun Aug 25 05:13:15 2019 (r351472) +++ stable/12/sys/i386/include/atomic.h Sun Aug 25 06:14:00 2019 (r351473) @@ -891,6 +891,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_64 atomic_add_64 #define atomic_subtract_acq_64 atomic_subtract_64 #define atomic_subtract_rel_64 atomic_subtract_64 +#define atomic_load_64 atomic_load_acq_64 +#define atomic_store_64 atomic_store_rel_64 /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ From owner-svn-src-all@freebsd.org Sun Aug 25 06:19:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CE66D670F; Sun, 25 Aug 2019 06:19:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GQ3F06n2z4b97; Sun, 25 Aug 2019 06:19:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3383194A3; Sun, 25 Aug 2019 06:19:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P6JqFf053201; Sun, 25 Aug 2019 06:19:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P6Jq1m053198; Sun, 25 Aug 2019 06:19:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908250619.x7P6Jq1m053198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 06:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351474 - in stable/12/sys: compat/linux kern vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: compat/linux kern vm X-SVN-Commit-Revision: 351474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 06:19:53 -0000 Author: kib Date: Sun Aug 25 06:19:51 2019 New Revision: 351474 URL: https://svnweb.freebsd.org/changeset/base/351474 Log: MFC r351194: Change locking requirements for VOP_UNSET_TEXT(). Modified: stable/12/sys/compat/linux/linux_misc.c stable/12/sys/kern/vnode_if.src stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Sun Aug 25 06:14:00 2019 (r351473) +++ stable/12/sys/compat/linux/linux_misc.c Sun Aug 25 06:19:51 2019 (r351474) @@ -494,8 +494,13 @@ cleanup: locked = false; VOP_CLOSE(vp, FREAD, td->td_ucred, td); } - if (textset) + if (textset) { + if (!locked) { + locked = true; + VOP_LOCK(vp, LK_SHARED | LK_RETRY); + } VOP_UNSET_TEXT_CHECKED(vp); + } if (locked) VOP_UNLOCK(vp, 0); Modified: stable/12/sys/kern/vnode_if.src ============================================================================== --- stable/12/sys/kern/vnode_if.src Sun Aug 25 06:14:00 2019 (r351473) +++ stable/12/sys/kern/vnode_if.src Sun Aug 25 06:19:51 2019 (r351474) @@ -695,7 +695,7 @@ vop_set_text { }; -%% vop_unset_text vp = = = +%% vop_unset_text vp L L L vop_unset_text { IN struct vnode *vp; Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Sun Aug 25 06:14:00 2019 (r351473) +++ stable/12/sys/vm/vm_map.c Sun Aug 25 06:19:51 2019 (r351474) @@ -546,12 +546,20 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool "entry %p, object %p, add %d", entry, object, add)); } if (vp != NULL) { - if (add) + if (add) { VOP_SET_TEXT_CHECKED(vp); - else + VM_OBJECT_RUNLOCK(object); + } else { + vhold(vp); + VM_OBJECT_RUNLOCK(object); + vn_lock(vp, LK_SHARED | LK_RETRY); VOP_UNSET_TEXT_CHECKED(vp); + VOP_UNLOCK(vp, 0); + vdrop(vp); + } + } else { + VM_OBJECT_RUNLOCK(object); } - VM_OBJECT_RUNLOCK(object); } static void From owner-svn-src-all@freebsd.org Sun Aug 25 06:22:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F351D67E4; Sun, 25 Aug 2019 06:22:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GQ5y75Bwz4bV9; Sun, 25 Aug 2019 06:22:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D64AD19663; Sun, 25 Aug 2019 06:22:14 +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 x7P6MEAT058758; Sun, 25 Aug 2019 06:22:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P6ME5w058754; Sun, 25 Aug 2019 06:22:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908250622.x7P6ME5w058754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 06:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351475 - in stable/12/sys: fs/tmpfs kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: fs/tmpfs kern sys X-SVN-Commit-Revision: 351475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 06:22:15 -0000 Author: kib Date: Sun Aug 25 06:22:13 2019 New Revision: 351475 URL: https://svnweb.freebsd.org/changeset/base/351475 Log: MFC r351195: Fix an issue with executing tmpfs binary. Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c stable/12/sys/kern/vfs_default.c stable/12/sys/sys/mount.h stable/12/sys/sys/vnode.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Sun Aug 25 06:19:51 2019 (r351474) +++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Sun Aug 25 06:22:13 2019 (r351475) @@ -504,7 +504,8 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | + MNTK_TEXT_REFS; MNT_IUNLOCK(mp); mp->mnt_data = tmp; Modified: stable/12/sys/kern/vfs_default.c ============================================================================== --- stable/12/sys/kern/vfs_default.c Sun Aug 25 06:19:51 2019 (r351474) +++ stable/12/sys/kern/vfs_default.c Sun Aug 25 06:22:13 2019 (r351475) @@ -1068,6 +1068,7 @@ int vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; + struct mount *mp; int error; vp = ap->a_vp; @@ -1075,6 +1076,17 @@ vop_stdset_text(struct vop_set_text_args *ap) if (vp->v_writecount > 0) { error = ETXTBSY; } else { + /* + * If requested by fs, keep a use reference to the + * vnode until the last text reference is released. + */ + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_TEXT_REFS) != 0 && + vp->v_writecount == 0) { + vp->v_iflag |= VI_TEXT_REF; + vrefl(vp); + } + vp->v_writecount--; error = 0; } @@ -1087,16 +1099,25 @@ vop_stdunset_text(struct vop_unset_text_args *ap) { struct vnode *vp; int error; + bool last; vp = ap->a_vp; + last = false; VI_LOCK(vp); if (vp->v_writecount < 0) { + if ((vp->v_iflag & VI_TEXT_REF) != 0 && + vp->v_writecount == -1) { + last = true; + vp->v_iflag &= ~VI_TEXT_REF; + } vp->v_writecount++; error = 0; } else { error = EINVAL; } VI_UNLOCK(vp); + if (last) + vunref(vp); return (error); } Modified: stable/12/sys/sys/mount.h ============================================================================== --- stable/12/sys/sys/mount.h Sun Aug 25 06:19:51 2019 (r351474) +++ stable/12/sys/sys/mount.h Sun Aug 25 06:22:13 2019 (r351475) @@ -398,6 +398,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_MARKER 0x00001000 #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ +#define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */ #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: stable/12/sys/sys/vnode.h ============================================================================== --- stable/12/sys/sys/vnode.h Sun Aug 25 06:19:51 2019 (r351474) +++ stable/12/sys/sys/vnode.h Sun Aug 25 06:22:13 2019 (r351475) @@ -233,6 +233,7 @@ struct xvnode { * VI_DOOMED is doubly protected by the interlock and vnode lock. Both * are required for writing but the status may be checked with either. */ +#define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ #define VI_MOUNT 0x0020 /* Mount in progress */ #define VI_DOOMED 0x0080 /* This vnode is being recycled */ #define VI_FREE 0x0100 /* This vnode is on the freelist */ From owner-svn-src-all@freebsd.org Sun Aug 25 07:06:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64D1DD7B44; Sun, 25 Aug 2019 07:06:53 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GR5T0NsSz4dKx; Sun, 25 Aug 2019 07:06:53 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4BD919DC5; Sun, 25 Aug 2019 07:06:52 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7P76qb3082322; Sun, 25 Aug 2019 07:06:52 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P76qc1082319; Sun, 25 Aug 2019 07:06:52 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201908250706.x7P76qc1082319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 25 Aug 2019 07:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351476 - in head/sys: security/mac vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in head/sys: security/mac vm X-SVN-Commit-Revision: 351476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 07:06:53 -0000 Author: dougm Date: Sun Aug 25 07:06:51 2019 New Revision: 351476 URL: https://svnweb.freebsd.org/changeset/base/351476 Log: vm_map_simplify_entry considers merging an entry with its two neighbors, and is used in a way so that if entries a and b cannot be merged, we consider them twice, first not-merging a with its successor b, and then not-merging b with its predecessor a. This change replaces vm_map_simplify_entry with vm_map_try_merge_entries, which compares two adjacent entries only, and uses it to avoid duplicated merge-checks. Tested by: pho Reviewed by: alc Approved by: markj (implicit) Differential Revision: https://reviews.freebsd.org/D20814 Modified: head/sys/security/mac/mac_process.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Sun Aug 25 06:22:13 2019 (r351475) +++ head/sys/security/mac/mac_process.c Sun Aug 25 07:06:51 2019 (r351476) @@ -363,7 +363,7 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct u } pmap_protect(map->pmap, vme->start, vme->end, vme->protection & ~revokeperms); - vm_map_simplify_entry(map, vme); + vm_map_try_merge_entries(map, vme->prev, vme); } } vm_map_unlock(map); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Aug 25 06:22:13 2019 (r351475) +++ head/sys/vm/vm_map.c Sun Aug 25 07:06:51 2019 (r351476) @@ -1554,7 +1554,7 @@ charged: map->size += end - prev_entry->end; vm_map_entry_resize(map, prev_entry, end - prev_entry->end); - vm_map_simplify_entry(map, prev_entry); + vm_map_try_merge_entries(map, prev_entry, prev_entry->next); return (KERN_SUCCESS); } @@ -1614,7 +1614,8 @@ charged: * with the previous entry when object is NULL. Here, we handle the * other cases, which are less common. */ - vm_map_simplify_entry(map, new_entry); + vm_map_try_merge_entries(map, prev_entry, new_entry); + vm_map_try_merge_entries(map, new_entry, new_entry->next); if ((cow & (MAP_PREFAULT | MAP_PREFAULT_PARTIAL)) != 0) { vm_map_pmap_enter(map, start, prot, object, OFF_TO_IDX(offset), @@ -2083,34 +2084,24 @@ vm_map_merged_neighbor_dispose(vm_map_t map, vm_map_en } /* - * vm_map_simplify_entry: + * vm_map_try_merge_entries: * - * Simplify the given map entry by merging with either neighbor. This - * routine also has the ability to merge with both neighbors. + * Compare the given map entry to its predecessor, and merge its precessor + * into it if possible. The entry remains valid, and may be extended. + * The predecessor may be deleted. * * The map must be locked. - * - * This routine guarantees that the passed entry remains valid (though - * possibly extended). When merging, this routine may delete one or - * both neighbors. */ void -vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry) +vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev, vm_map_entry_t entry) { - vm_map_entry_t next, prev; - if ((entry->eflags & MAP_ENTRY_NOMERGE_MASK) != 0) - return; - prev = entry->prev; - if (vm_map_mergeable_neighbors(prev, entry)) { + VM_MAP_ASSERT_LOCKED(map); + if ((entry->eflags & MAP_ENTRY_NOMERGE_MASK) == 0 && + vm_map_mergeable_neighbors(prev, entry)) { vm_map_entry_unlink(map, prev, UNLINK_MERGE_NEXT); vm_map_merged_neighbor_dispose(map, prev); } - next = entry->next; - if (vm_map_mergeable_neighbors(entry, next)) { - vm_map_entry_unlink(map, next, UNLINK_MERGE_PREV); - vm_map_merged_neighbor_dispose(map, next); - } } /* @@ -2580,7 +2571,8 @@ again: * [Note that clipping is not necessary the second time.] */ for (current = entry; current->start < end; - vm_map_simplify_entry(map, current), current = current->next) { + vm_map_try_merge_entries(map, current->prev, current), + current = current->next) { if (rv != KERN_SUCCESS || (current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2618,6 +2610,7 @@ again: #undef MASK } } + vm_map_try_merge_entries(map, current->prev, current); vm_map_unlock(map); return (rv); } @@ -2722,8 +2715,9 @@ vm_map_madvise( default: break; } - vm_map_simplify_entry(map, current); + vm_map_try_merge_entries(map, current->prev, current); } + vm_map_try_merge_entries(map, current->prev, current); vm_map_unlock(map); } else { vm_pindex_t pstart, pend; @@ -2837,9 +2831,10 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || new_inheritance != VM_INHERIT_ZERO) entry->inheritance = new_inheritance; - vm_map_simplify_entry(map, entry); + vm_map_try_merge_entries(map, entry->prev, entry); entry = entry->next; } + vm_map_try_merge_entries(map, entry->prev, entry); vm_map_unlock(map); return (KERN_SUCCESS); } @@ -3016,8 +3011,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_simplify_entry(map, entry); + vm_map_try_merge_entries(map, entry->prev, entry); } + vm_map_try_merge_entries(map, entry->prev, entry); vm_map_unlock(map); if (need_wakeup) vm_map_wakeup(map); @@ -3313,8 +3309,9 @@ done: entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_simplify_entry(map, entry); + vm_map_try_merge_entries(map, entry->prev, entry); } + vm_map_try_merge_entries(map, entry->prev, entry); if (need_wakeup) vm_map_wakeup(map); return (rv); @@ -3952,8 +3949,8 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c old_entry->object.vm_object); /* - * As in vm_map_simplify_entry(), the - * vnode lock will not be acquired in + * As in vm_map_merged_neighbor_dispose(), + * the vnode lock will not be acquired in * this call to vm_object_deallocate(). */ vm_object_deallocate(object); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sun Aug 25 06:22:13 2019 (r351475) +++ head/sys/vm/vm_map.h Sun Aug 25 07:06:51 2019 (r351476) @@ -418,7 +418,8 @@ void vm_map_lookup_done (vm_map_t, vm_map_entry_t); boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t); -void vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry); +void vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev, + vm_map_entry_t entry); void vm_map_startup (void); int vm_map_submap (vm_map_t, vm_offset_t, vm_offset_t, vm_map_t); int vm_map_sync(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t); From owner-svn-src-all@freebsd.org Sun Aug 25 07:29:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E681D817E; Sun, 25 Aug 2019 07:29:09 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GRb74b5gz4fHG; Sun, 25 Aug 2019 07:29:07 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id x7P7SoEb088355 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 25 Aug 2019 17:28:56 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id x7P7Sju4005334 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 25 Aug 2019 17:28:45 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id x7P7Sis4005333; Sun, 25 Aug 2019 17:28:44 +1000 (AEST) (envelope-from peter) Date: Sun, 25 Aug 2019 17:28:44 +1000 From: Peter Jeremy To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351187 - head/sys/arm64/rockchip Message-ID: <20190825072844.GA4799@server.rulingia.com> References: <201908180919.x7I9JXGj021325@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline In-Reply-To: <201908180919.x7I9JXGj021325@repo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46GRb74b5gz4fHG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-4.84 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.11)[asn: 20473(-0.50), country: US(-0.05)]; NEURAL_HAM_SHORT(-0.33)[-0.334,0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 07:29:09 -0000 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-Aug-18 09:19:33 +0000, Michal Meloun wrote: > Improve rk_pinctrl driver: Sorry for the late notice but this breaks my Rock64 (RK3328). I'm using: U-Boot 2017.09-rockchip-ayufan-1035-gd646df03ac (Oct 26 2018 - 08:36:01 +00= 00) At r351452, the kernel boot looks like: =2E.. gic0: mem 0xff811000-0xff811fff,0xff8120= 00-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 160 rk_pinctrl0: on ofwbus0 rk_pinctrl0: Cannot attach GPIO subdevice: gpio0@ff210000 rk_pinctrl0: Cannot attach GPIO subdevice: gpio1@ff220000 rk_pinctrl0: Cannot attach GPIO subdevice: gpio2@ff230000 rk_pinctrl0: Cannot attach GPIO subdevice: gpio3@ff240000 panic: acquiring blockable sleep lock with spinlock or critical section hel= d (sleep mutex) pmap @ /usr/src/sys/arm64/arm64/pmap.c:5819 cpuid =3D 0 time =3D 1 KDB: stack backtrace: db_trace_self() at db_trace_self_wrapper+0x28 pc =3D 0xffff00000054c9ac lr =3D 0xffff0000000e2908 sp =3D 0xffff000000010100 fp =3D 0xffff000000010310 db_trace_self_wrapper() at vpanic+0x18c pc =3D 0xffff0000000e2908 lr =3D 0xffff00000027e848 sp =3D 0xffff000000010320 fp =3D 0xffff0000000103c0 vpanic() at panic+0x44 pc =3D 0xffff00000027e848 lr =3D 0xffff00000027e5f8 sp =3D 0xffff0000000103d0 fp =3D 0xffff000000010450 panic() at witness_checkorder+0xa80 pc =3D 0xffff00000027e5f8 lr =3D 0xffff0000002e5348 sp =3D 0xffff000000010460 fp =3D 0xffff0000000104d0 witness_checkorder() at __mtx_lock_flags+0xb0 pc =3D 0xffff0000002e5348 lr =3D 0xffff00000025e574 sp =3D 0xffff0000000104e0 fp =3D 0xffff000000010520 __mtx_lock_flags() at pmap_fault+0x1bc pc =3D 0xffff00000025e574 lr =3D 0xffff000000566c00 sp =3D 0xffff000000010530 fp =3D 0xffff000000010550 pmap_fault() at data_abort+0xc0 pc =3D 0xffff000000566c00 lr =3D 0xffff000000568a68 sp =3D 0xffff000000010560 fp =3D 0xffff000000010610 data_abort() at do_el1h_sync+0x128 pc =3D 0xffff000000568a68 lr =3D 0xffff0000005688a4 sp =3D 0xffff000000010620 fp =3D 0xffff000000010650 do_el1h_sync() at handle_el1h_sync+0x74 pc =3D 0xffff0000005688a4 lr =3D 0xffff00000054f074 sp =3D 0xffff000000010660 fp =3D 0xffff000000010770 handle_el1h_sync() at simple_mfd_syscon_modify_4+0x60 pc =3D 0xffff00000054f074 lr =3D 0xffff0000000fd334 sp =3D 0xffff000000010780 fp =3D 0xffff000000010830 simple_mfd_syscon_modify_4() at rk_pinctrl_configure_pins+0x1b4 pc =3D 0xffff0000000fd334 lr =3D 0xffff0000005795fc sp =3D 0xffff000000010840 fp =3D 0xffff0000000108c0 rk_pinctrl_configure_pins() at pinctrl_configure_children+0x120 pc =3D 0xffff0000005795fc lr =3D 0xffff0000000fc4dc sp =3D 0xffff0000000108d0 fp =3D 0xffff000000010950 pinctrl_configure_children() at fdt_pinctrl_configure_tree+0x20 pc =3D 0xffff0000000fc4dc lr =3D 0xffff0000000fc3a8 sp =3D 0xffff000000010960 fp =3D 0xffff000000010970 fdt_pinctrl_configure_tree() at rk_pinctrl_attach+0x310 pc =3D 0xffff0000000fc3a8 lr =3D 0xffff000000579414 sp =3D 0xffff000000010980 fp =3D 0xffff0000000109e0 rk_pinctrl_attach() at device_attach+0x3f4 pc =3D 0xffff000000579414 lr =3D 0xffff0000002b3f18 sp =3D 0xffff0000000109f0 fp =3D 0xffff000000010a40 device_attach() at bus_generic_new_pass+0x12c pc =3D 0xffff0000002b3f18 lr =3D 0xffff0000002b5ccc sp =3D 0xffff000000010a50 fp =3D 0xffff000000010a80 bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc =3D 0xffff0000002b5ccc lr =3D 0xffff0000002b5c84 sp =3D 0xffff000000010a90 fp =3D 0xffff000000010ac0 bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc =3D 0xffff0000002b5c84 lr =3D 0xffff0000002b5c84 sp =3D 0xffff000000010ad0 fp =3D 0xffff000000010b00 bus_generic_new_pass() at bus_set_pass+0x8c pc =3D 0xffff0000002b5c84 lr =3D 0xffff0000002b1674 sp =3D 0xffff000000010b10 fp =3D 0xffff000000010b40 bus_set_pass() at mi_startup+0x238 pc =3D 0xffff0000002b1674 lr =3D 0xffff000000217b50 sp =3D 0xffff000000010b50 fp =3D 0xffff000000010bb0 mi_startup() at virtdone+0x54 pc =3D 0xffff000000217b50 lr =3D 0xffff000000001084 sp =3D 0xffff000000010bc0 fp =3D 0x0000000000000000 ---- When I revert r351187, I get: =2E.. gic0: mem 0xff811000-0xff811fff,0xff8120= 00-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 160 rk_pinctrl0: on ofwbus0 rk_i2c0: mem 0xff160000-0xff160fff irq 16 on ofwbus0 iicbus0: on rk_i2c0 gpio0: mem 0xff210000-0xff2100ff irq 51 on = rk_pinctrl0 gpiobus0: on gpio0 gpio1: mem 0xff220000-0xff2200ff irq 52 on = rk_pinctrl0 gpiobus1: on gpio1 gpio2: mem 0xff230000-0xff2300ff irq 53 on = rk_pinctrl0 gpiobus2: on gpio2 gpio3: mem 0xff240000-0xff2400ff irq 54 on = rk_pinctrl0 gpiobus3: on gpio3 rk805_pmu0: at addr 0x30 irq 55 on iicbus0 =2E.. I haven't dug into this further yet. --=20 Peter Jeremy --qDbXVdCdHGoSgWSk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl1iOKFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzRllA/+N3jpXxqKYRejpt1aa+uEoOiAxFeC+HnX0GUD9tte7td30wBtrDhM+jEH fLKT9DdXEM9YFYB2NVOS3E5xVYYxBuOS6e7wG2m8aGCVowgKbtuC6s19PxzML0QQ 03PhxTNZQzO5e1hBSj7+JPRunFC0zIzYwSLhhxt9148epttGSumNGAzGrAYBh2JR Ufd3aSqr0KCdtNP/FwK9dNYZvhr5oStTNVHlegUQyk8KIwuy57XwVPaBk9I23/vT cbjd2IbTlSQq5XTPTQ/XYgMy1tj1RIs8wWVcc+MYCHRQyY2B7pwQWJS2ZY7GSrxI M/nAhKcffzCDjpgl0gCYHeVAYB/07PVgDkQeLE6uy0fvRo82OiW4hmF68pkdKzTe N/zgJTc+mPeyUi3H9+Fv98w8cB+NiOgEsUr7+mS2BFGl8dfjlaEMzql1938Yp4Gw DyYGVrXEPRw471GfnqYALgMVHsRlYb3JtBsFexS4aNo4Aptr6z80jI7Cd3DxM/2B 6kqZllF33ZDXv/CymV9WGGP6smzz8AF3fen07f98MxjOs17pgw/LRgXt4V6Y3PHw GGmLLQ5Ga00pQLmG/+ppbvzWHgPx3KBftjD+NKBjoESsR90htqAdpRWTNjI525hM Hcr203t30GbJokuMLPFEKD6p5VIh3c2ENVCYmdJeumeiSUmj8yA= =N+9R -----END PGP SIGNATURE----- --qDbXVdCdHGoSgWSk-- From owner-svn-src-all@freebsd.org Sun Aug 25 07:50:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98A0AD8958; Sun, 25 Aug 2019 07:50:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GS453Tw0z4g6d; Sun, 25 Aug 2019 07:50:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581801A516; Sun, 25 Aug 2019 07:50:45 +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 x7P7ojXS007109; Sun, 25 Aug 2019 07:50:45 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7P7ojPg007108; Sun, 25 Aug 2019 07:50:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908250750.x7P7ojPg007108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 25 Aug 2019 07:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351477 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 07:50:45 -0000 Author: delphij Date: Sun Aug 25 07:50:44 2019 New Revision: 351477 URL: https://svnweb.freebsd.org/changeset/base/351477 Log: GZIO: Update to use zlib 1.2.11. PR: 229763 Submitted by: Yoshihiro Ota Differential Revision: https://reviews.freebsd.org/D21408 Modified: head/sys/kern/subr_compressor.c Modified: head/sys/kern/subr_compressor.c ============================================================================== --- head/sys/kern/subr_compressor.c Sun Aug 25 07:06:51 2019 (r351476) +++ head/sys/kern/subr_compressor.c Sun Aug 25 07:50:44 2019 (r351477) @@ -66,8 +66,7 @@ SET_DECLARE(compressors, struct compressor_methods); #ifdef GZIO -#include -#include +#include struct gz_stream { uint8_t *gz_buffer; /* output buffer */ @@ -141,7 +140,7 @@ gz_reset(void *stream) s = stream; s->gz_off = 0; - s->gz_crc = ~0U; + s->gz_crc = crc32(0L, Z_NULL, 0); (void)deflateReset(&s->gz_stream); s->gz_stream.avail_out = s->gz_bufsz; @@ -173,9 +172,8 @@ gz_write(void *stream, void *data, size_t len, compres if (len > 0) { s->gz_stream.avail_in = len; s->gz_stream.next_in = data; - s->gz_crc = crc32_raw(data, len, s->gz_crc); - } else - s->gz_crc ^= ~0U; + s->gz_crc = crc32(s->gz_crc, data, len); + } error = 0; do { From owner-svn-src-all@freebsd.org Sun Aug 25 13:26:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72608DFC44; Sun, 25 Aug 2019 13:26:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GbW32DrQz3xkB; Sun, 25 Aug 2019 13:26: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E8D51E2C4; Sun, 25 Aug 2019 13:26: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 x7PDQ6HG007921; Sun, 25 Aug 2019 13:26:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PDQ63D007919; Sun, 25 Aug 2019 13:26:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908251326.x7PDQ63D007919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 13:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351478 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 13:26:07 -0000 Author: kib Date: Sun Aug 25 13:26:06 2019 New Revision: 351478 URL: https://svnweb.freebsd.org/changeset/base/351478 Log: Move OBJT_VNODE specific code from vm_object_terminate() to vnode_destroy_vobject(). Reviewed by: alc, jeff (previous version), markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21357 Modified: head/sys/vm/vm_object.c head/sys/vm/vnode_pager.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Aug 25 07:50:44 2019 (r351477) +++ head/sys/vm/vm_object.c Sun Aug 25 13:26:06 2019 (r351478) @@ -653,9 +653,10 @@ doterm: * recursion due to the terminate having to sync data * to disk. */ - if ((object->flags & OBJ_DEAD) == 0) + if ((object->flags & OBJ_DEAD) == 0) { + vm_object_set_flag(object, OBJ_DEAD); vm_object_terminate(object); - else + } else VM_OBJECT_WUNLOCK(object); object = temp; } @@ -746,35 +747,9 @@ vm_object_terminate_pages(vm_object_t object) void vm_object_terminate(vm_object_t object) { - VM_OBJECT_ASSERT_WLOCKED(object); - - /* - * Make sure no one uses us. - */ - vm_object_set_flag(object, OBJ_DEAD); - - /* - * Clean and free the pages, as appropriate. All references to the - * object are gone, so we don't need to lock it. - */ - if (object->type == OBJT_VNODE) { - struct vnode *vp = (struct vnode *)object->handle; - - /* - * Clean pages and flush buffers. - */ - vm_object_page_clean(object, 0, 0, OBJPC_SYNC); - VM_OBJECT_WUNLOCK(object); - - vinvalbuf(vp, V_SAVE, 0, 0); - - BO_LOCK(&vp->v_bufobj); - vp->v_bufobj.bo_flag |= BO_DEAD; - BO_UNLOCK(&vp->v_bufobj); - - VM_OBJECT_WLOCK(object); - } + KASSERT((object->flags & OBJ_DEAD) != 0, + ("terminating non-dead obj %p", object)); /* * wait for the pageout daemon to be done with the object Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sun Aug 25 07:50:44 2019 (r351477) +++ head/sys/vm/vnode_pager.c Sun Aug 25 13:26:06 2019 (r351478) @@ -200,6 +200,21 @@ vnode_destroy_vobject(struct vnode *vp) * don't double-terminate the object */ if ((obj->flags & OBJ_DEAD) == 0) { + vm_object_set_flag(obj, OBJ_DEAD); + + /* + * Clean pages and flush buffers. + */ + vm_object_page_clean(obj, 0, 0, OBJPC_SYNC); + VM_OBJECT_WUNLOCK(obj); + + vinvalbuf(vp, V_SAVE, 0, 0); + + BO_LOCK(&vp->v_bufobj); + vp->v_bufobj.bo_flag |= BO_DEAD; + BO_UNLOCK(&vp->v_bufobj); + + VM_OBJECT_WLOCK(obj); vm_object_terminate(obj); } else { /* From owner-svn-src-all@freebsd.org Sun Aug 25 13:36:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7E7EE012D; Sun, 25 Aug 2019 13:36:21 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gbks4VpYz3yGF; Sun, 25 Aug 2019 13:36:21 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62FF21E48D; Sun, 25 Aug 2019 13:36:21 +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 x7PDaLq7013872; Sun, 25 Aug 2019 13:36:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PDaKjM013870; Sun, 25 Aug 2019 13:36:20 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908251336.x7PDaKjM013870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 13:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351479 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 13:36:21 -0000 Author: cy Date: Sun Aug 25 13:36:20 2019 New Revision: 351479 URL: https://svnweb.freebsd.org/changeset/base/351479 Log: MFC r350881: Calculate the number interface array elements using the new FR_NUM macro instead of the hard-coded value of 4. This is a precursor to increasing the number of interfaces speficied in "on {interface, ..., interface}". Note that though this feature is coded in ipf_y.y, it is partially supported in the ipfilter kld, meaning it does not work yet (and is yet to be documented in ipf.5 too). Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 13:26:06 2019 (r351478) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 13:36:20 2019 (r351479) @@ -4023,7 +4023,7 @@ ipf_synclist(softc, fr, ifp) /* * Lookup all the interface names that are part of the rule. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(fr->fr_ifas); i++) { if ((ifp != NULL) && (fr->fr_ifas[i] != ifp)) continue; if (fr->fr_ifnames[i] == -1) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_state.c Sun Aug 25 13:26:06 2019 (r351478) +++ stable/11/sys/contrib/ipfilter/netinet/ip_state.c Sun Aug 25 13:36:20 2019 (r351479) @@ -975,7 +975,7 @@ ipf_state_putent(softc, softs, data) /* * Look up all the interface names in the rule. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(fr->fr_ifnames); i++) { if (fr->fr_ifnames[i] == -1) { fr->fr_ifas[i] = NULL; continue; @@ -985,7 +985,7 @@ ipf_state_putent(softc, softs, data) fr->fr_family); } - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(isn->is_ifname); i++) { name = isn->is_ifname[i]; isn->is_ifp[i] = ipf_resolvenic(softc, name, isn->is_v); @@ -1076,7 +1076,7 @@ ipf_state_insert(softc, is, rev) /* * Look up all the interface names in the state entry. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(is->is_ifp); i++) { if (is->is_ifp[i] != NULL) continue; is->is_ifp[i] = ipf_resolvenic(softc, is->is_ifname[i], @@ -3574,7 +3574,7 @@ ipf_state_sync(softc, ifp) /* * Look up all the interface names in the state entry. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(is->is_ifp); i++) { if (ifp == NULL || ifp == is->is_ifp[i]) is->is_ifp[i] = ipf_resolvenic(softc, is->is_ifname[i], From owner-svn-src-all@freebsd.org Sun Aug 25 13:36:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E1DCE0131; Sun, 25 Aug 2019 13:36:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gbkt0RCNz3yGG; Sun, 25 Aug 2019 13:36:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4C251E48E; Sun, 25 Aug 2019 13:36:21 +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 x7PDaLwU013881; Sun, 25 Aug 2019 13:36:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PDaLwd013878; Sun, 25 Aug 2019 13:36:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908251336.x7PDaLwd013878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 25 Aug 2019 13:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351479 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 13:36:22 -0000 Author: cy Date: Sun Aug 25 13:36:20 2019 New Revision: 351479 URL: https://svnweb.freebsd.org/changeset/base/351479 Log: MFC r350881: Calculate the number interface array elements using the new FR_NUM macro instead of the hard-coded value of 4. This is a precursor to increasing the number of interfaces speficied in "on {interface, ..., interface}". Note that though this feature is coded in ipf_y.y, it is partially supported in the ipfilter kld, meaning it does not work yet (and is yet to be documented in ipf.5 too). Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 13:26:06 2019 (r351478) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 25 13:36:20 2019 (r351479) @@ -4023,7 +4023,7 @@ ipf_synclist(softc, fr, ifp) /* * Lookup all the interface names that are part of the rule. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(fr->fr_ifas); i++) { if ((ifp != NULL) && (fr->fr_ifas[i] != ifp)) continue; if (fr->fr_ifnames[i] == -1) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_state.c Sun Aug 25 13:26:06 2019 (r351478) +++ stable/12/sys/contrib/ipfilter/netinet/ip_state.c Sun Aug 25 13:36:20 2019 (r351479) @@ -975,7 +975,7 @@ ipf_state_putent(softc, softs, data) /* * Look up all the interface names in the rule. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(fr->fr_ifnames); i++) { if (fr->fr_ifnames[i] == -1) { fr->fr_ifas[i] = NULL; continue; @@ -985,7 +985,7 @@ ipf_state_putent(softc, softs, data) fr->fr_family); } - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(isn->is_ifname); i++) { name = isn->is_ifname[i]; isn->is_ifp[i] = ipf_resolvenic(softc, name, isn->is_v); @@ -1076,7 +1076,7 @@ ipf_state_insert(softc, is, rev) /* * Look up all the interface names in the state entry. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(is->is_ifp); i++) { if (is->is_ifp[i] != NULL) continue; is->is_ifp[i] = ipf_resolvenic(softc, is->is_ifname[i], @@ -3574,7 +3574,7 @@ ipf_state_sync(softc, ifp) /* * Look up all the interface names in the state entry. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < FR_NUM(is->is_ifp); i++) { if (ifp == NULL || ifp == is->is_ifp[i]) is->is_ifp[i] = ipf_resolvenic(softc, is->is_ifname[i], From owner-svn-src-all@freebsd.org Sun Aug 25 17:13:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41891E3DE7; Sun, 25 Aug 2019 17:13:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GhXt11cDz48t5; Sun, 25 Aug 2019 17:13:02 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF91E20C1C; Sun, 25 Aug 2019 17:13:01 +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 x7PHD1h8044463; Sun, 25 Aug 2019 17:13:01 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PHD1sp044459; Sun, 25 Aug 2019 17:13:01 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908251713.x7PHD1sp044459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 25 Aug 2019 17:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351480 - in head: . sys/conf sys/libkern sys/modules/zlib sys/sys X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: . sys/conf sys/libkern sys/modules/zlib sys/sys X-SVN-Commit-Revision: 351480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 17:13:02 -0000 Author: delphij Date: Sun Aug 25 17:13:00 2019 New Revision: 351480 URL: https://svnweb.freebsd.org/changeset/base/351480 Log: Remove zlib 1.0.4 from kernel. PR: 229763 Reviewed by: emaste, Yoshihiro Ota Differential Revision: https://reviews.freebsd.org/D21375 Deleted: head/sys/libkern/zlib.c head/sys/sys/zlib.h head/sys/sys/zutil.h Modified: head/ObsoleteFiles.inc head/sys/conf/files head/sys/modules/zlib/Makefile head/sys/sys/param.h Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Aug 25 13:36:20 2019 (r351479) +++ head/ObsoleteFiles.inc Sun Aug 25 17:13:00 2019 (r351480) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190825: zlib 1.0.4 removed from kernel +OLD_FILES+=/usr/include/sys/zlib.h +OLD_FILES+=/usr/include/sys/zutil.h # 20190817: pft_ping.py and sniffer.py moved to /usr/tests/sys/netpfil/common OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 25 13:36:20 2019 (r351479) +++ head/sys/conf/files Sun Aug 25 17:13:00 2019 (r351480) @@ -3999,8 +3999,6 @@ libkern/strtoul.c standard libkern/strtouq.c standard libkern/strvalid.c standard libkern/timingsafe_bcmp.c standard -libkern/zlib.c optional crypto | geom_uzip | ipsec | \ - ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio contrib/zlib/adler32.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | ddb_ctf | gzio | zfs | zlib contrib/zlib/compress.c optional crypto | geom_uzip | ipsec | \ Modified: head/sys/modules/zlib/Makefile ============================================================================== --- head/sys/modules/zlib/Makefile Sun Aug 25 13:36:20 2019 (r351479) +++ head/sys/modules/zlib/Makefile Sun Aug 25 17:13:00 2019 (r351480) @@ -5,9 +5,6 @@ .PATH: ${SRCTOP}/sys/contrib/zlib KMOD= zlib -# legacy zlib - 1.0.4 -SRCS= zlib.c -# newer zlib - 1.2.11 SRCS+= zcalloc.c SRCS+= zlib_mod.c SRCS+= adler32.c Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Aug 25 13:36:20 2019 (r351479) +++ head/sys/sys/param.h Sun Aug 25 17:13:00 2019 (r351480) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300040 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300041 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Sun Aug 25 17:55:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E3CBE490D; Sun, 25 Aug 2019 17:55:33 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GjTx2Htzz4Bgg; Sun, 25 Aug 2019 17:55:33 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 163D721348; Sun, 25 Aug 2019 17:55:33 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PHtWF3068495; Sun, 25 Aug 2019 17:55:32 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PHtWNF068489; Sun, 25 Aug 2019 17:55:32 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <201908251755.x7PHtWNF068489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Sun, 25 Aug 2019 17:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351481 - in head: etc/mtree usr.sbin/mixer usr.sbin/mixer/tests X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: in head: etc/mtree usr.sbin/mixer usr.sbin/mixer/tests X-SVN-Commit-Revision: 351481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 17:55:33 -0000 Author: 0mp (ports committer) Date: Sun Aug 25 17:55:31 2019 New Revision: 351481 URL: https://svnweb.freebsd.org/changeset/base/351481 Log: mixer(8): Report an error if the passed value is an empty string This patch fixes a bug that made the mixer command enter an infinite loop when instructed to set the value of a device to an empty string (e.g., `mixer vol ""`). Additionally, some tests for mixer(8) are being added. PR: 240039 Reviewed by: hselasky, mav Approved by: src (hselasky, mav) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21409 Added: head/usr.sbin/mixer/tests/ head/usr.sbin/mixer/tests/Makefile (contents, props changed) head/usr.sbin/mixer/tests/mixer_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.sbin/mixer/Makefile head/usr.sbin/mixer/mixer.c Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sun Aug 25 17:13:00 2019 (r351480) +++ head/etc/mtree/BSD.tests.dist Sun Aug 25 17:55:31 2019 (r351481) @@ -821,6 +821,8 @@ .. link .. + mixer + .. mkdir .. mkfifo Modified: head/usr.sbin/mixer/Makefile ============================================================================== --- head/usr.sbin/mixer/Makefile Sun Aug 25 17:13:00 2019 (r351480) +++ head/usr.sbin/mixer/Makefile Sun Aug 25 17:55:31 2019 (r351481) @@ -1,6 +1,11 @@ # $FreeBSD$ +.include + PROG= mixer MAN= mixer.8 + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.sbin/mixer/mixer.c ============================================================================== --- head/usr.sbin/mixer/mixer.c Sun Aug 25 17:13:00 2019 (r351480) +++ head/usr.sbin/mixer/mixer.c Sun Aug 25 17:55:31 2019 (r351481) @@ -241,6 +241,11 @@ main(int argc, char *argv[]) lrel = rrel = 0; if (argc > 1) { m = sscanf(argv[1], "%7[^:]:%7s", lstr, rstr); + if (m == EOF) { + warnx("invalid value: %s", argv[1]); + dusage = 1; + break; + } if (m > 0) { if (*lstr == '+' || *lstr == '-') lrel = rrel = 1; Added: head/usr.sbin/mixer/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mixer/tests/Makefile Sun Aug 25 17:55:31 2019 (r351481) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= mixer_test + +.include Added: head/usr.sbin/mixer/tests/mixer_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mixer/tests/mixer_test.sh Sun Aug 25 17:55:31 2019 (r351481) @@ -0,0 +1,123 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Mateusz Piotrowski <0mp@FreeBSD.org> +# +# 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$ + +mixer_unavailable() +{ + ! { mixer && mixer vol; } >/dev/null 2>&1 +} + +save_mixer_vol() +{ + atf_check -o match:'^[0-9]{1,3}:[0-9]{1,3}$' -o save:saved_vol \ + -x "mixer vol | awk '{print \$7}'" +} + +set_mixer_vol() +{ + atf_check \ + -o match:'^Setting the mixer vol from [0-9]{1,3}:[0-9]{1,3} to 0:0\.$' \ + mixer vol 0 +} + +restore_mixer_vol() +{ + if [ -r "saved_vol" ]; then + mixer vol "$(cat saved_vol)" + fi +} + +atf_test_case s_flag cleanup +s_flag_head() +{ + atf_set "descr" "Verify that the output of the -s flag could be " \ + "reused as command-line arguments to the mixer command" +} +s_flag_body() +{ + if mixer_unavailable; then + atf_skip "This test requires mixer support" + fi + save_mixer_vol + set_mixer_vol + atf_check -o inline:"vol 0:0" -o save:values mixer -s vol + atf_check -o inline:"Setting the mixer vol from 0:0 to 0:0.\n" \ + mixer $(cat values) +} +s_flag_cleanup() +{ + restore_mixer_vol +} + +atf_test_case S_flag cleanup +S_flag_head() +{ + atf_set "descr" "Verify that the output of the -S flag is " \ + "matching the documented behavior" +} +S_flag_body() +{ + if mixer_unavailable; then + atf_skip "This test requires mixer support" + fi + save_mixer_vol + set_mixer_vol + atf_check -o inline:"vol:0:0" mixer -S vol +} +S_flag_cleanup() +{ + restore_mixer_vol +} + +atf_test_case set_empty_value +set_empty_value_head() +{ + atf_set "descr" "Verify that mixer returns when the provided " \ + "value to set is an empty string instead of a number" + atf_set "timeout" "1" +} +set_empty_value_body() +{ + if mixer_unavailable; then + atf_skip "This test requires mixer support" + fi + save_mixer_vol + atf_check -s exit:1 -e inline:"mixer: invalid value: \n" \ + -o match:"^usage:" mixer vol "" +} +set_empty_value_cleanup() +{ + restore_mixer_vol +} + + +atf_init_test_cases() +{ + atf_add_test_case s_flag + atf_add_test_case S_flag + atf_add_test_case set_empty_value +} From owner-svn-src-all@freebsd.org Sun Aug 25 18:46:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45139E666E; Sun, 25 Aug 2019 18:46:11 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GkcM0ft0z4HLW; Sun, 25 Aug 2019 18:46:11 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED18F21C71; Sun, 25 Aug 2019 18:46:10 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PIkA54002315; Sun, 25 Aug 2019 18:46:10 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PIkAUc002314; Sun, 25 Aug 2019 18:46:10 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201908251846.x7PIkAUc002314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 25 Aug 2019 18:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351482 - head/sys/dev/vmware/vmci X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/sys/dev/vmware/vmci X-SVN-Commit-Revision: 351482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 18:46:11 -0000 Author: hrs Date: Sun Aug 25 18:46:10 2019 New Revision: 351482 URL: https://svnweb.freebsd.org/changeset/base/351482 Log: Add MODULE_PNP_INFO() to vmci(4). This allows devd(8) to load the kernel module automatically when FreeBSD is running on VMware. Reviewed by: mp Differential Revision: https://reviews.freebsd.org/D21182 Modified: head/sys/dev/vmware/vmci/vmci.c Modified: head/sys/dev/vmware/vmci/vmci.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci.c Sun Aug 25 17:55:31 2019 (r351481) +++ head/sys/dev/vmware/vmci/vmci.c Sun Aug 25 18:46:10 2019 (r351482) @@ -73,6 +73,16 @@ static driver_t vmci_driver = { static devclass_t vmci_devclass; DRIVER_MODULE(vmci, pci, vmci_driver, vmci_devclass, 0, 0); MODULE_VERSION(vmci, VMCI_VERSION); +const struct { + uint16_t vendor; + uint16_t device; + const char *desc; +} vmci_ids[] = { + { VMCI_VMWARE_VENDOR_ID, VMCI_VMWARE_DEVICE_ID, + "VMware Virtual Machine Communication Interface" }, +}; +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, vmci, vmci_ids, + nitems(vmci_ids)); MODULE_DEPEND(vmci, pci, 1, 1, 1); @@ -112,10 +122,9 @@ static int vmci_probe(device_t dev) { - if (pci_get_vendor(dev) == VMCI_VMWARE_VENDOR_ID && - pci_get_device(dev) == VMCI_VMWARE_DEVICE_ID) { - device_set_desc(dev, - "VMware Virtual Machine Communication Interface"); + if (pci_get_vendor(dev) == vmci_ids[0].vendor && + pci_get_device(dev) == vmci_ids[0].device) { + device_set_desc(dev, vmci_ids[0].desc); return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Sun Aug 25 18:52:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8595E6953; Sun, 25 Aug 2019 18:52:10 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GklG5D4cz4JdS; Sun, 25 Aug 2019 18:52:10 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9440721E42; Sun, 25 Aug 2019 18:52:10 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PIqA3t009797; Sun, 25 Aug 2019 18:52:10 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PIqAnV009796; Sun, 25 Aug 2019 18:52:10 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201908251852.x7PIqAnV009796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 25 Aug 2019 18:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351483 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 351483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 18:52:10 -0000 Author: hrs Date: Sun Aug 25 18:52:10 2019 New Revision: 351483 URL: https://svnweb.freebsd.org/changeset/base/351483 Log: Document soft updates journaling and GEOM-based UFS journaling. Reviewed by: mckusick Modified: head/share/man/man7/ffs.7 Modified: head/share/man/man7/ffs.7 ============================================================================== --- head/share/man/man7/ffs.7 Sun Aug 25 18:46:10 2019 (r351482) +++ head/share/man/man7/ffs.7 Sun Aug 25 18:52:10 2019 (r351483) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 26, 2001 +.Dd August 25, 2019 .Dt FFS 7 .Os .Sh NAME @@ -46,6 +46,7 @@ In the kernel configuration file: .Cd "options UFS_DIRHASH" .Cd "options UFS_EXTATTR" .Cd "options UFS_EXTATTR_AUTOSTART" +.Cd "options UFS_GJOURNAL" .Pp In .Xr fstab 5 : @@ -84,20 +85,65 @@ and enforces metadata update dependencies (e.g., updating free block maps) to ensure that the file system remains consistent. .Pp -To enable soft updates on an -.Em unmounted -file system, use the following command: +To create a new file system with the soft updates +enabled, +use +.Xr newfs 8 +command: .Pp -.D1 Nm tunefs Fl n Cm enable Ar fs +.D1 Nm newfs Fl U Ar fs .Pp .Ar fs can be either a mount point listed in .Xr fstab 5 -(e.g., -.Pa /usr ) , +.Pq e.g. , Pa /usr , or a disk device -(e.g., -.Pa /dev/da0a ) . +.Pq e.g., Pa /dev/da0a . +.Pp +It is possible to enable soft updates on an +.Em unmounted +file system by using +.Xr tunefs 8 +command: +.Pp +.D1 Nm tunefs Fl n Cm enable Ar fs +.Pp +Soft updates can also add journaling that reduces the time spent by +.Xr fsck_ffs 8 +cleaning up a filesystem after a crash from several minutes to a few seconds. +The journal is placed in an inode named +.Pa .sujournal , +and is kept as a circular log of segments containing +records that describe metadata operations. +.Pp +To create a new file system with both the soft updates +and soft updates journaling enabled, +use the following command: +.Pp +.D1 Nm newfs Fl j Ar fs +.Pp +This runs +.Xr tunefs 8 +command after +.Xr newfs 8 +command with +.Fl U +flag enabled. +It is possible to enable soft updates journaling on an +.Em unmounted +file system by using +.Xr tunefs 8 +command: +.Pp +.D1 Nm tunefs Fl j Cm enable Ar fs +.Pp +This flag automatically enables the soft updates feature +when it is not enabled. +Note that this +.Xr tunefs 8 +command will fail if a file +.Pa .sujournal +already exists before enabling the soft updates journaling. .El .Ss File Ownership Inheritance .Bl -tag -width 2n @@ -155,10 +201,9 @@ extattrctl initattr -p / 388 posix1e.acl_default .Ed .Pp On the next mount of the root file system, -the attributes will be automatically started -(if +the attributes will be automatically started if .Dv UFS_EXTATTR_AUTOSTART -is included in the kernel configuration), +is included in the kernel configuration, and ACLs will be enabled. .Ss Directory Hashing .Bl -tag -width 2n @@ -183,7 +228,52 @@ subdirectory of the file system root during the mount If found, extended attribute support will be automatically started for that file system. .El +.Ss GEOM-based Journaling +.Bl -tag -width 2n +.It Cd "options UFS_GJOURNAL" +Implements a block level journaling of a UFS file system, +which is for both data and metadata. +To enable this, +create a +.Xr gjournal 8 +GEOM provider for a block device by using the +following command: .Pp +.D1 Nm gjournal label Ar da0 +.Pp +In this example, +.Pa /dev/da0 +is used as the target block device, +and +.Pa /dev/da0.journal +is created. +Then create a new file system by using +.Xr newfs 8 +with the block level journaling flag and mount it: +.Pp +.D1 Nm newfs Fl J Ar /dev/da0.journal +.D1 Nm mount Fl o Cm async Ar /dev/da0.journal Ar /mnt +.Pp +.Cm async +option is not mandatory but recommended for better performance +because the journaling guarantees the consistency of an +.Cm async +mount. +.Pp +It is also possible to enable the block level journaling +on an existing file system. +To do so, +use +.Xr gjournal 8 +utility to label the underlying block device and +.Xr tunefs 8 +utility to enable the block level journaling flag: +.Pp +.D1 Nm gjournal label Ar da0 +.D1 Nm tunefs Fl J Cm enable Ar /dev/da0.journal +.D1 Nm mount Fl o Cm async Ar /dev/da0.journal Ar /mnt +.El +.Ss Xr sysctl 8 MIBs The following .Xr sysctl 8 MIBs are defined for use with @@ -192,11 +282,11 @@ MIBs are defined for use with .It Va vfs.ffs.doasyncfree Asynchronously write out modified i-node and indirect blocks upon reallocating file system blocks to be contiguous. -(Default: 1.) +.Pq Default: 1 . .It Va vfs.ffs.doreallocblks Enable support for the rearrangement of blocks to be contiguous. -(Default: 1.) +.Pq Default: 1 . .El .Sh SEE ALSO .Xr quota 1 , @@ -204,7 +294,9 @@ to be contiguous. .Xr extattr 3 , .Xr edquota 8 , .Xr extattrctl 8 , -.Xr sysctl 8 +.Xr fsck_ffs 8 , +.Xr sysctl 8 , +.Xr tunefs 8 .Rs .%A M. McKusick .%A W. Joy @@ -223,4 +315,11 @@ to be contiguous. .%T "Soft Updates: A Technique for Eliminating Most Synchronous Writes in the Fast Filesystem" .%J "Proceedings of the Freenix Track at the 1999 Usenix Annual Technical Conference" .%P 71-84 +.Re +.Rs +.%A M. McKusick +.%A J. Roberson +.%D May 2010 +.%T "Journaled Soft-updates" +.%J "BSD Canada Conference 2010 (BSDCan)" .Re From owner-svn-src-all@freebsd.org Sun Aug 25 19:22:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1C02E727A; Sun, 25 Aug 2019 19:22:10 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail.allbsd.org (mx.allbsd.org [IPv6:2001:2f0:104:e001::41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GlPr515hz4Kxj; Sun, 25 Aug 2019 19:22:07 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:4700:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id x7PJLjxC092903 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) (Client CN "/CN=mail-d.allbsd.org", Issuer "/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3"); Mon, 26 Aug 2019 04:21:56 +0900 (JST) (envelope-from hrs@allbsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=allbsd.org; s=20190220; t=1566760925; bh=UqiS9Bk47B4z1rc2OtzTiCrQtHYT7+jPAszJfZUYorY=; h=Date:To:Cc:From:In-Reply-To:References; b=PWKRKG6tMRGjKqg307Dd6syVeKFpoLPzJTcLEFOrqFV0D8cG8iyHTzqI+eC+0hPVS bbXmYFClGx2nB9Bs5/hm5nXmaKR+lMoKDLC4JEGPrxmW8TOZQS+Crk32/2hn0vgS2s RL/pEHy4hGF3bjX8lqHEv6GJu1AyGm4gE8s5IpUc= Received: from alph.d.allbsd.org ([IPv6:2409:11:a740:4700:16:ceff:fe34:2700]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id x7PJLePY068082 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 26 Aug 2019 04:21:40 +0900 (JST) (envelope-from hrs@allbsd.org) Received: from localhost (localhost [[UNIX: localhost]]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id x7PJLemv068078; Mon, 26 Aug 2019 04:21:40 +0900 (JST) (envelope-from hrs@allbsd.org) Date: Mon, 26 Aug 2019 04:20:56 +0900 (JST) Message-Id: <20190826.042056.1329861772202588895.hrs@allbsd.org> To: asomers@FreeBSD.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests From: Hiroki Sato In-Reply-To: <201908231522.x7NFMLuJ068037@repo.freebsd.org> References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Aug_26_04_20_56_2019_001)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:41]); Mon, 26 Aug 2019 04:22:05 +0900 (JST) X-Rspamd-Queue-Id: 46GlPr515hz4Kxj X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=allbsd.org header.s=20190220 header.b=PWKRKG6t; dmarc=none; spf=pass (mx1.freebsd.org: domain of hrs@allbsd.org designates 2001:2f0:104:e001::41 as permitted sender) smtp.mailfrom=hrs@allbsd.org X-Spamd-Result: default: False [-6.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[allbsd.org:s=20190220]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[allbsd.org]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[allbsd.org:+]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; MID_CONTAINS_FROM(1.00)[]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7514, ipnet:2001:2f0::/32, country:JP]; IP_SCORE(-2.03)[ip: (-9.69), ipnet: 2001:2f0::/32(-3.97), asn: 7514(3.52), country: JP(-0.03)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 19:22:10 -0000 ----Security_Multipart(Mon_Aug_26_04_20_56_2019_001)-- Content-Type: Text/Plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable Hi, Alan Somers wrote in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: as> Author: asomers as> Date: Fri Aug 23 15:22:20 2019 as> New Revision: 351423 as> URL: https://svnweb.freebsd.org/changeset/base/351423 as> = as> Log: as> ping6: Rename options for better consistency with ping as> = as> Now equivalent options have the same flags, and nonequivalent opt= ions have as> different flags. This is a prelude to merging the two commands. as> = as> Submitted by: J=E1n Su=E8an as> MFC: Never as> Sponsored by: Google LLC (Google Summer of Code 2019) as> Differential Revision: https://reviews.freebsd.org/D21345 I have an objection on renaming the existing option flags in ping6(8) for compatibility with ping(8). Is it sufficient to add INET6 support to ping(8) with consistent flags and keep CLI of ping6(8) backward compatible? People have used ping6(8) for >15 years, so it is too late to rename the flags. I do not think the renaming is useful if "ping -6 localhost" or "ping ::1" works. -- Hiroki ----Security_Multipart(Mon_Aug_26_04_20_56_2019_001)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAl1i35gACgkQTyzT2CeTzy1D9gCgioFFIo6H4j0qGBdmJ1/ctDpL +zgAn0uVdU9nlHhWMaMtV1y7g72DqkDL =L9AM -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Aug_26_04_20_56_2019_001)---- From owner-svn-src-all@freebsd.org Sun Aug 25 19:27:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 861B1E74BC; Sun, 25 Aug 2019 19:27:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GlWl30vrz4LP3; Sun, 25 Aug 2019 19:27:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DD3F223F1; Sun, 25 Aug 2019 19:27:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PJRFaP028381; Sun, 25 Aug 2019 19:27:15 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PJRFZO028380; Sun, 25 Aug 2019 19:27:15 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201908251927.x7PJRFZO028380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 25 Aug 2019 19:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351484 - head/etc/mtree X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/etc/mtree X-SVN-Commit-Revision: 351484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 19:27:15 -0000 Author: hrs Date: Sun Aug 25 19:27:14 2019 New Revision: 351484 URL: https://svnweb.freebsd.org/changeset/base/351484 Log: Fix build (r351481). Modified: head/etc/mtree/BSD.tests.dist Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sun Aug 25 18:52:10 2019 (r351483) +++ head/etc/mtree/BSD.tests.dist Sun Aug 25 19:27:14 2019 (r351484) @@ -821,8 +821,6 @@ .. link .. - mixer - .. mkdir .. mkfifo @@ -1081,6 +1079,8 @@ fstyp .. makefs + .. + mixer .. newsyslog .. From owner-svn-src-all@freebsd.org Sun Aug 25 19:31:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C262CE7B04; Sun, 25 Aug 2019 19:31:13 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GlcJ4ZDHz4LnZ; Sun, 25 Aug 2019 19:31:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id u13so761245lfm.9; Sun, 25 Aug 2019 12:31:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AlTvoVLrL4Vj6cRRprxXgTNJ69Va6MoTkcIK7bfcIbM=; b=OGL5MHRJjKa31+fX48JZz50JiFgusgrDZI4Efp09UTdOE5jDkEwdNAOTjk+8pU9edH ZrKDq0fOxsPg5ZtfDybjPdZZ0OULy4VTDZJLgaSJgt5fznU3+9Xe8IduLnEgmZVSJHiW vOb8+BZvI/ReIuzoKXhwC19ym8r/HsyZnheR85/Wh0YSu7cYC0nADJn+e3KBPzQjMuiO wFhqg6h28o4KYWojU+OrBU8ZyIA6Yj4YLuUnnhghyKe8gICyuo9+cBJkRXFdkN8umrCk e8uZInLXtIiZ631GfIXItXoVxS6NYILUaGGvTS+DpvlEH1XzUjBRdrnlVdPWwyt2nZrx zCBA== X-Gm-Message-State: APjAAAXjkbYlG7XtTwM83IHJFJh04eDlG+rIMXvenHIvmmPeKaDAgZXg DQzSMRlAFdlY2Tu67nvEo6ZNWhaT2X5stog5kNU= X-Google-Smtp-Source: APXvYqxn4rDHFsOwCNHymkGzcKAmWRGl1CBW0mL899/XhXvsldet2dWMUoQAAh6aPNIJfL4pjeeoT+aQXFOkH6BGYGI= X-Received: by 2002:a19:cbc4:: with SMTP id b187mr8496748lfg.27.1566761470845; Sun, 25 Aug 2019 12:31:10 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> In-Reply-To: <20190826.042056.1329861772202588895.hrs@allbsd.org> From: Alan Somers Date: Sun, 25 Aug 2019 13:30:59 -0600 Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Hiroki Sato , Jan Sucan Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46GlcJ4ZDHz4LnZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-4.25 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.987,0]; RCVD_IN_DNSWL_NONE(0.00)[42.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.26)[ip: (-0.58), ipnet: 209.85.128.0/17(-3.35), asn: 15169(-2.33), country: US(-0.05)]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 19:31:13 -0000 On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: > > Hi, > > Alan Somers wrote > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > > as> Author: asomers > as> Date: Fri Aug 23 15:22:20 2019 > as> New Revision: 351423 > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > as> > as> Log: > as> ping6: Rename options for better consistency with ping > as> > as> Now equivalent options have the same flags, and nonequivalent optio= ns have > as> different flags. This is a prelude to merging the two commands. > as> > as> Submitted by: J=C3=A1n Su=C4=8Dan > as> MFC: Never > as> Sponsored by: Google LLC (Google Summer of Code 2019) > as> Differential Revision: https://reviews.freebsd.org/D21345 > > I have an objection on renaming the existing option flags in ping6(8) > for compatibility with ping(8). > > Is it sufficient to add INET6 support to ping(8) with consistent > flags and keep CLI of ping6(8) backward compatible? People have used > ping6(8) for >15 years, so it is too late to rename the flags. I do > not think the renaming is useful if "ping -6 localhost" or "ping ::1" > works. > > -- Hiroki If ping works with inet6, then why would we want to keep a separate tool around? If it's just for the sake of people who don't want to or can't update scripts, would a version in ports suffice? -Alan From owner-svn-src-all@freebsd.org Sun Aug 25 19:39:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B21DBE7ED9; Sun, 25 Aug 2019 19:39:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Glnz4FT5z4ML2; Sun, 25 Aug 2019 19:39:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73AC3225BA; Sun, 25 Aug 2019 19:39:35 +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 x7PJdZ5m034362; Sun, 25 Aug 2019 19:39:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PJdVq7034344; Sun, 25 Aug 2019 19:39:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908251939.x7PJdVq7034344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 25 Aug 2019 19:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351485 - in head/sys: arm/conf conf powerpc/conf powerpc/conf/dpaa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: arm/conf conf powerpc/conf powerpc/conf/dpaa X-SVN-Commit-Revision: 351485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 19:39:35 -0000 Author: imp Date: Sun Aug 25 19:39:31 2019 New Revision: 351485 URL: https://svnweb.freebsd.org/changeset/base/351485 Log: Fix bogusly declared WERRORs in kernel build Many arm kernel configs bogusly specified WERROR=-Werror. There's no reason for this because the default is that and there's no reason to override. These date from a time when we needed to add additional warning->error suppression. They are obsolete and were cut and paste propagated from file to file. Comment out all the WERROR=.... lines in powerpc. They aren't bogus, but were appropriate for the old defaults for gcc4.2.1. Now that we've made the policy decision to suppress -Werror by default on these platforms, it is appropriate to comment these out. People wishing to fix these errors can still un-comment them out, or say WERROR=-Werror on the command line. Fix two instances (cut and paste propagation) of hard-coded -Werror in x86 code. Replace with ${WERROR} instead. This is a no-op change except for people who build WERROR=-Wno-error :). This should fix tinderbox / CI breakage. Modified: head/sys/arm/conf/ALPINE head/sys/arm/conf/ARMADA38X head/sys/arm/conf/ARMADAXP head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/RT1310 head/sys/arm/conf/SHEEVAPLUG head/sys/arm/conf/SOCFPGA head/sys/arm/conf/TS7800 head/sys/arm/conf/VYBRID head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/MPC85XXSPE head/sys/powerpc/conf/QORIQ64 head/sys/powerpc/conf/dpaa/DPAA Modified: head/sys/arm/conf/ALPINE ============================================================================== --- head/sys/arm/conf/ALPINE Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/ALPINE Sun Aug 25 19:39:31 2019 (r351485) @@ -23,7 +23,6 @@ include "std.armv7" include "../annapurna/alpine/std.alpine" makeoptions MODULES_OVERRIDE="" -makeoptions WERROR="-Werror" options SCHED_4BSD # 4BSD scheduler options SMP # Enable multiple cores Modified: head/sys/arm/conf/ARMADA38X ============================================================================== --- head/sys/arm/conf/ARMADA38X Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/ARMADA38X Sun Aug 25 19:39:31 2019 (r351485) @@ -11,7 +11,6 @@ ident ARMADA38X options SOC_MV_ARMADA38X -makeoptions WERROR="-Werror" makeoptions MODULES_EXTRA="dtb/mv" #options MD_ROOT Modified: head/sys/arm/conf/ARMADAXP ============================================================================== --- head/sys/arm/conf/ARMADAXP Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/ARMADAXP Sun Aug 25 19:39:31 2019 (r351485) @@ -27,8 +27,6 @@ include "../mv/armadaxp/std.mv78x60" options SOC_MV_ARMADAXP -makeoptions WERROR="-Werror" - options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/DB-78XXX Sun Aug 25 19:39:31 2019 (r351485) @@ -10,8 +10,6 @@ include "../mv/discovery/std.db78xxx" options SOC_MV_DISCOVERY -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/DB-88F5XXX Sun Aug 25 19:39:31 2019 (r351485) @@ -10,8 +10,6 @@ include "../mv/orion/std.db88f5xxx" options SOC_MV_ORION -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/DB-88F6XXX Sun Aug 25 19:39:31 2019 (r351485) @@ -10,8 +10,6 @@ include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: head/sys/arm/conf/RT1310 ============================================================================== --- head/sys/arm/conf/RT1310 Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/RT1310 Sun Aug 25 19:39:31 2019 (r351485) @@ -16,7 +16,6 @@ makeoptions FDT_DTS_FILE=wzr2-g300n.dts makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror" options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking Modified: head/sys/arm/conf/SHEEVAPLUG ============================================================================== --- head/sys/arm/conf/SHEEVAPLUG Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/SHEEVAPLUG Sun Aug 25 19:39:31 2019 (r351485) @@ -11,8 +11,6 @@ include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions WERROR="-Werror" - options HZ=1000 options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking Modified: head/sys/arm/conf/SOCFPGA ============================================================================== --- head/sys/arm/conf/SOCFPGA Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/SOCFPGA Sun Aug 25 19:39:31 2019 (r351485) @@ -24,8 +24,6 @@ include "../altera/socfpga/std.socfpga" makeoptions MODULES_OVERRIDE="" -makeoptions WERROR="-Werror" - options SCHED_ULE # ULE scheduler options PLATFORM # Platform based SoC options SMP # Enable multiple cores Modified: head/sys/arm/conf/TS7800 ============================================================================== --- head/sys/arm/conf/TS7800 Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/TS7800 Sun Aug 25 19:39:31 2019 (r351485) @@ -10,8 +10,6 @@ include "../mv/orion/std.ts7800" options SOC_MV_ORION -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: head/sys/arm/conf/VYBRID ============================================================================== --- head/sys/arm/conf/VYBRID Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/arm/conf/VYBRID Sun Aug 25 19:39:31 2019 (r351485) @@ -22,8 +22,6 @@ ident VYBRID include "std.armv7" include "../freescale/vybrid/std.vybrid" -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options PLATFORM # Platform based SoC #options SMP # Enable multiple cores Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/conf/files.amd64 Sun Aug 25 19:39:31 2019 (r351485) @@ -50,7 +50,7 @@ linux32_assym.h optional compat_linux32 \ # linux32_locore.o optional compat_linux32 \ dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.asm" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux32_locore.o" # Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/conf/files.i386 Sun Aug 25 19:39:31 2019 (r351485) @@ -37,7 +37,7 @@ linux_assym.h optional compat_linux \ # linux_locore.o optional compat_linux \ dependency "linux_assym.h $S/i386/linux/linux_locore.asm" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux_locore.o" # Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/powerpc/conf/MPC85XX Sun Aug 25 19:39:31 2019 (r351485) @@ -13,7 +13,6 @@ machine powerpc powerpc include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU Modified: head/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- head/sys/powerpc/conf/MPC85XXSPE Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/powerpc/conf/MPC85XXSPE Sun Aug 25 19:39:31 2019 (r351485) @@ -13,7 +13,6 @@ machine powerpc powerpcspe include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU options MAXCPU=2 Modified: head/sys/powerpc/conf/QORIQ64 ============================================================================== --- head/sys/powerpc/conf/QORIQ64 Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/powerpc/conf/QORIQ64 Sun Aug 25 19:39:31 2019 (r351485) @@ -14,7 +14,7 @@ machine powerpc powerpc64 include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" +#makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU Modified: head/sys/powerpc/conf/dpaa/DPAA ============================================================================== --- head/sys/powerpc/conf/dpaa/DPAA Sun Aug 25 19:27:14 2019 (r351484) +++ head/sys/powerpc/conf/dpaa/DPAA Sun Aug 25 19:39:31 2019 (r351485) @@ -12,7 +12,7 @@ cpu BOOKE_E500 machine powerpc powerpc #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" +#makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" makeoptions NO_MODULES=yes # Platform support From owner-svn-src-all@freebsd.org Sun Aug 25 20:01:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E48DEC07AA for ; Sun, 25 Aug 2019 20:01:56 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmHl6sVfz4NNB for ; Sun, 25 Aug 2019 20:01:55 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb1-xb31.google.com with SMTP id t5so6292099ybt.4 for ; Sun, 25 Aug 2019 13:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=A/ZIZFDxyzPdJcLLyafdizM9dLw89m377HhbdlpOOr8=; b=Lp+j77NFZacX7gYgqc7kv+3zn47+VOco/OqTH3Drq37sAzuM0U4Y+U4LlHJ+czaLxt 3CpM8bEnf/vDmvyoDqvqGRN+gDa+Ul1Ma9r4vGaL1Xmb5jfJIjrOwUJim4zvZeOUbuM+ Cyho5QYh4dT+vfWLHTZfLC2NVRyiQThUrBi1Avh18YgzEwIzDSKrpba6B72QWW5m3c6I 01U0Hp0McD38GHec9zjFd+Y+/IUyioMuuPfPNorC4HTxzXLfIx/ThPSHGJtQHORzHmPZ iI7gi+Ilrxe9APbt5EkckmIoRJu/1zFbrI9RlOi98T+u5ARqZBzps1eU2VCctS7HZ2Vu /xHw== 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=A/ZIZFDxyzPdJcLLyafdizM9dLw89m377HhbdlpOOr8=; b=LkSUFBZ/OgODhW39MG0y0cgjMgh3MDKUPd9Tm6b0Ljyep3bqkDsJEkhzj1aB5iUOFP 0GxffdsOpgVsMswYNHjsvG88DP2eLdIbWYcczcw6N/GRvQR+i5qG8xGApMRYN2x2KtO9 PGxmZLkNIPYH732VToDRhnUrC9RTEz8fJH3+JpuyOl8MaEUKd4XGgfQI3VhBjulHBgxp cdrfMaYADus5zOtnCI6t7p0xkBMvlGsHf5OxJW7mWNvm8rJ2KhB9hzjbaevSCnvh7j9P KiGGW3Hjm9aofferIOCyAfvmCvPGHjczhxBOSkBpsLc0TBdfSTBpcWi2KF5sProk7qcX SDgg== X-Gm-Message-State: APjAAAVlOQojM4h9p8s3nWMQyNbVhnF0rR9VSUC6PtLpDS+knYt77Quh 9SVRNIBEkiJ9gmw+sNhCl0PTfnCBUWEF5ou/Vez1Zg== X-Google-Smtp-Source: APXvYqyBGWeOjr5PXHrCzW6oM+5lRidp/zxihx+K39CJP3TCVv6+fHZv1lIMssGFGvlX6ysgvki2i/cJM5EKk/G8M/4= X-Received: by 2002:a25:42cb:: with SMTP id p194mr9987704yba.334.1566763314795; Sun, 25 Aug 2019 13:01:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:1003:0:0:0:0:0 with HTTP; Sun, 25 Aug 2019 13:01:54 -0700 (PDT) In-Reply-To: <201908250511.x7P5BiPl016074@repo.freebsd.org> References: <201908250511.x7P5BiPl016074@repo.freebsd.org> From: Oliver Pinter Date: Sun, 25 Aug 2019 22:01:54 +0200 Message-ID: Subject: Re: svn commit: r351471 - in head/sys: kern sys To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 46GmHl6sVfz4NNB X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Lp+j77NF; dmarc=none; spf=pass (mx1.freebsd.org: domain of oliver.pinter@hardenedbsd.org designates 2607:f8b0:4864:20::b31 as permitted sender) smtp.mailfrom=oliver.pinter@hardenedbsd.org X-Spamd-Result: default: False [-5.45 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[9]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; RCVD_IN_DNSWL_NONE(0.00)[1.3.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.96)[ip: (-9.53), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.33), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2019 20:01:57 -0000 On Sunday, August 25, 2019, Mateusz Guzik wrote: > Author: mjg > Date: Sun Aug 25 05:11:43 2019 > New Revision: 351471 > URL: https://svnweb.freebsd.org/changeset/base/351471 > > Log: > vfs: add vholdnz (for already held vnodes) Why? (Yes, is can read the real reason in phabricator, but the phabricator didn't considered a persistent information in relation to commit message. Review helper tool just comes and goes as time goes forward, but commit messages survives the repo conversions to other VCS...) And once you have taken the time to write a correct description in phabricator, it would be really really nice and helpful if you would copy them into commit message. > > Reviewed by: kib (previous version) > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21358 > > Modified: > head/sys/kern/vfs_subr.c > head/sys/sys/vnode.h > > Modified: head/sys/kern/vfs_subr.c > ============================================================ > ================== > --- head/sys/kern/vfs_subr.c Sun Aug 25 04:56:33 2019 (r351470) > +++ head/sys/kern/vfs_subr.c Sun Aug 25 05:11:43 2019 (r351471) > @@ -3018,6 +3018,19 @@ _vhold(struct vnode *vp, bool locked) > VI_UNLOCK(vp); > } > > +void > +vholdnz(struct vnode *vp) > +{ > + > + CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > +#ifdef INVARIANTS > + int old = atomic_fetchadd_int(&vp->v_holdcnt, 1); > + VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__)); > +#else > + atomic_add_int(&vp->v_holdcnt, 1); > +#endif > +} > + > /* > * Drop the hold count of the vnode. If this is the last reference to > * the vnode we place it on the free list unless it has been vgone'd > > Modified: head/sys/sys/vnode.h > ============================================================ > ================== > --- head/sys/sys/vnode.h Sun Aug 25 04:56:33 2019 (r351470) > +++ head/sys/sys/vnode.h Sun Aug 25 05:11:43 2019 (r351471) > @@ -657,6 +657,7 @@ void vgone(struct vnode *vp); > #define vhold(vp) _vhold((vp), 0) > #define vholdl(vp) _vhold((vp), 1) > void _vhold(struct vnode *, bool); > +void vholdnz(struct vnode *); > void vinactive(struct vnode *, struct thread *); > int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); > int vtruncbuf(struct vnode *vp, off_t length, int blksize); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Sun Aug 25 20:08:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DF9EC091E; Sun, 25 Aug 2019 20:08:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmRh73zwz4Ng7; Sun, 25 Aug 2019 20:08:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFBAA22B20; Sun, 25 Aug 2019 20:08:48 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PK8mUx052262; Sun, 25 Aug 2019 20:08:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PK8mPt052261; Sun, 25 Aug 2019 20:08:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908252008.x7PK8mPt052261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 25 Aug 2019 20:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351486 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 351486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:08:49 -0000 Author: jhibbits Date: Sun Aug 25 20:08:48 2019 New Revision: 351486 URL: https://svnweb.freebsd.org/changeset/base/351486 Log: powerpc/booke: Use the DMAP if possible in pmap_map() This avoids unnecessary TLB usage for statically mapped regions, such as vm_page_array. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sun Aug 25 19:39:31 2019 (r351485) +++ head/sys/powerpc/booke/pmap.c Sun Aug 25 20:08:48 2019 (r351486) @@ -2546,8 +2546,11 @@ mmu_booke_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t vm_offset_t sva = *virt; vm_offset_t va = sva; - //debugf("mmu_booke_map: s (sva = 0x%08x pa_start = 0x%08x pa_end = 0x%08x)\n", - // sva, pa_start, pa_end); +#ifdef __powerpc64__ + /* XXX: Handle memory not starting at 0x0. */ + if (pa_end < ctob(Maxmem)) + return (PHYS_TO_DMAP(pa_start)); +#endif while (pa_start < pa_end) { mmu_booke_kenter(mmu, va, pa_start); @@ -2556,7 +2559,6 @@ mmu_booke_map(mmu_t mmu, vm_offset_t *virt, vm_paddr_t } *virt = va; - //debugf("mmu_booke_map: e (va = 0x%08x)\n", va); return (sva); } From owner-svn-src-all@freebsd.org Sun Aug 25 20:11:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 983D5C0B4A; Sun, 25 Aug 2019 20:11:18 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail.allbsd.org (mx.allbsd.org [IPv6:2001:2f0:104:e001::41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmVX6MqHz4NxX; Sun, 25 Aug 2019 20:11:16 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:4700:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id x7PKAojq095081 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) (Client CN "/CN=mail-d.allbsd.org", Issuer "/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3"); Mon, 26 Aug 2019 05:11:01 +0900 (JST) (envelope-from hrs@allbsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=allbsd.org; s=20190220; t=1566763870; bh=+acWF/4g1KU26RlnooamDtN8IbTBbDMTABy/2fZEQgw=; h=Date:To:Cc:From:In-Reply-To:References; b=H6BQU4olFW0wpRZBDWBU64Rn0/Dq9wlBxzE/ukgS4oRgi+SQrtMhBG7n4WNoNuecI oRBCFqMSfE4oHsp1oIBQ5V6poGpXSaqEWGCU0NV14XdkfR6teZFUN5qwodCy3W0D49 rk5oT3c+KOgrZZQZpTeEflgZkF0QHcuvTAHWbqa4= Received: from alph.d.allbsd.org ([IPv6:2409:11:a740:4700:16:ceff:fe34:2700]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id x7PKAi5K069014 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 26 Aug 2019 05:10:45 +0900 (JST) (envelope-from hrs@allbsd.org) Received: from localhost (localhost [[UNIX: localhost]]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id x7PKAhWk069011; Mon, 26 Aug 2019 05:10:44 +0900 (JST) (envelope-from hrs@allbsd.org) Date: Mon, 26 Aug 2019 05:09:22 +0900 (JST) Message-Id: <20190826.050922.1810654532466043358.hrs@allbsd.org> To: asomers@freebsd.org Cc: sucanjan@gmail.com, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests From: Hiroki Sato In-Reply-To: References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Aug_26_05_09_22_2019_925)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:41]); Mon, 26 Aug 2019 05:11:10 +0900 (JST) X-Rspamd-Queue-Id: 46GmVX6MqHz4NxX X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=allbsd.org header.s=20190220 header.b=H6BQU4ol; dmarc=none; spf=pass (mx1.freebsd.org: domain of hrs@allbsd.org designates 2001:2f0:104:e001::41 as permitted sender) smtp.mailfrom=hrs@allbsd.org X-Spamd-Result: default: False [-6.12 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[allbsd.org:s=20190220]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MV_CASE(0.50)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[allbsd.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[allbsd.org:+]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; MID_CONTAINS_FROM(1.00)[]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7514, ipnet:2001:2f0::/32, country:JP]; FREEMAIL_CC(0.00)[gmail.com]; IP_SCORE(-2.06)[ip: (-9.71), ipnet: 2001:2f0::/32(-4.06), asn: 7514(3.48), country: JP(-0.03)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:11:18 -0000 ----Security_Multipart(Mon_Aug_26_05_09_22_2019_925)-- Content-Type: Text/Plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable Alan Somers wrote in : as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote:= as> > as> > Hi, as> > as> > Alan Somers wrote as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: as> > as> > as> Author: asomers as> > as> Date: Fri Aug 23 15:22:20 2019 as> > as> New Revision: 351423 as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 as> > as> as> > as> Log: as> > as> ping6: Rename options for better consistency with ping as> > as> as> > as> Now equivalent options have the same flags, and nonequivale= nt options have as> > as> different flags. This is a prelude to merging the two comm= ands. as> > as> as> > as> Submitted by: J=E1n Su=E8an as> > as> MFC: Never as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) as> > as> Differential Revision: https://reviews.freebsd.org/D2134= 5 as> > as> > I have an objection on renaming the existing option flags in pin= g6(8) as> > for compatibility with ping(8). as> > as> > Is it sufficient to add INET6 support to ping(8) with consistent= as> > flags and keep CLI of ping6(8) backward compatible? People have= used as> > ping6(8) for >15 years, so it is too late to rename the flags. = I do as> > not think the renaming is useful if "ping -6 localhost" or "ping= ::1" as> > works. as> > as> > -- Hiroki as> = as> If ping works with inet6, then why would we want to keep a separate= as> tool around? If it's just for the sake of people who don't want to= or as> can't update scripts, would a version in ports suffice? Because removing (or renaming) it causes a POLA violation. Do we really have a strong, unavoidable reason to force people to rewrite their script now? This is still a fairly essential and actively used tool, not like rcp or rlogin. Although deprecating ping6(8) and removing it from the base system in the future release at some point may work, changing the existing interface will simply confuse people who have used IPv6 for a long time. In my understanding, the purpose to integrate ping(8) and ping6(8) into a single utility is to provide a consistent CLI and reduce duplicate code, not to break compatibility. -- Hiroki ----Security_Multipart(Mon_Aug_26_05_09_22_2019_925)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAl1i6vIACgkQTyzT2CeTzy2ClwCfTYqnZFiqnhupVBSSMWJgwBhC IX0An1MVdAFw/iYenhcKqjXJ97XO9tfY =+FC4 -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Aug_26_05_09_22_2019_925)---- From owner-svn-src-all@freebsd.org Sun Aug 25 20:11:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A289C0BC1; Sun, 25 Aug 2019 20:11:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmVw0ZmXz4P5k; Sun, 25 Aug 2019 20:11:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9DAE22C98; Sun, 25 Aug 2019 20:11:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKBZFn056862; Sun, 25 Aug 2019 20:11:35 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKBZXh056861; Sun, 25 Aug 2019 20:11:35 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908252011.x7PKBZXh056861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 25 Aug 2019 20:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351487 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 351487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:11:36 -0000 Author: jhibbits Date: Sun Aug 25 20:11:35 2019 New Revision: 351487 URL: https://svnweb.freebsd.org/changeset/base/351487 Log: powerpc/booke: Clean up pmap a little for 64-bit 64-bit Book-E pmap doesn't need copy and zero bounce pages, nor the mutex. Don't initialize them or reserve space for them. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sun Aug 25 20:08:48 2019 (r351486) +++ head/sys/powerpc/booke/pmap.c Sun Aug 25 20:11:35 2019 (r351487) @@ -161,17 +161,19 @@ static int availmem_regions_sz; static struct mem_region *physmem_regions; static int physmem_regions_sz; +#ifndef __powerpc64__ /* Reserved KVA space and mutex for mmu_booke_zero_page. */ static vm_offset_t zero_page_va; static struct mtx zero_page_mutex; -static struct mtx tlbivax_mutex; - /* Reserved KVA space and mutex for mmu_booke_copy_page. */ static vm_offset_t copy_page_src_va; static vm_offset_t copy_page_dst_va; static struct mtx copy_page_mutex; +#endif +static struct mtx tlbivax_mutex; + /**************************************************************************/ /* PMAP */ /**************************************************************************/ @@ -1646,6 +1648,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o virtual_avail = round_page(data_end); virtual_end = VM_MAX_KERNEL_ADDRESS; +#ifndef __powerpc64__ /* Allocate KVA space for page zero/copy operations. */ zero_page_va = virtual_avail; virtual_avail += PAGE_SIZE; @@ -1661,7 +1664,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o mtx_init(&zero_page_mutex, "mmu_booke_zero_page", NULL, MTX_DEF); mtx_init(©_page_mutex, "mmu_booke_copy_page", NULL, MTX_DEF); -#ifndef __powerpc64__ /* Allocate KVA space for ptbl bufs. */ ptbl_buf_pool_vabase = virtual_avail; virtual_avail += PTBL_BUFS * PTBL_PAGES * PAGE_SIZE; @@ -1820,12 +1822,10 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o /* Initialize (statically allocated) kernel pmap. */ /*******************************************************/ PMAP_LOCK_INIT(kernel_pmap); -#ifndef __powerpc64__ - kptbl_min = VM_MIN_KERNEL_ADDRESS / PDIR_SIZE; -#endif #ifdef __powerpc64__ kernel_pmap->pm_pp2d = (pte_t ***)kernel_ptbl_root; #else + kptbl_min = VM_MIN_KERNEL_ADDRESS / PDIR_SIZE; kernel_pmap->pm_pdir = (pte_t **)kernel_ptbl_root; #endif From owner-svn-src-all@freebsd.org Sun Aug 25 20:16:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22847C0D25; Sun, 25 Aug 2019 20:16:04 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gmc406bpz4PKd; Sun, 25 Aug 2019 20:16:04 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEFFF22D01; Sun, 25 Aug 2019 20:16:03 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKG30j058039; Sun, 25 Aug 2019 20:16:03 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKG3OL058038; Sun, 25 Aug 2019 20:16:03 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201908252016.x7PKG3OL058038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 25 Aug 2019 20:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351488 - in head/sys: conf dev/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: conf dev/netmap X-SVN-Commit-Revision: 351488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:16:04 -0000 Author: vmaffione Date: Sun Aug 25 20:16:03 2019 New Revision: 351488 URL: https://svnweb.freebsd.org/changeset/base/351488 Log: netmap: remove obsolete file The netmap_pt.c module has become obsolete after the refactoring that added netmap_kloop.c. Remove it and unlink it from the build system. MFC after: 1 week Deleted: head/sys/dev/netmap/netmap_pt.c Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 25 20:11:35 2019 (r351487) +++ head/sys/conf/files Sun Aug 25 20:16:03 2019 (r351488) @@ -2470,7 +2470,6 @@ dev/netmap/netmap_monitor.c optional netmap dev/netmap/netmap_null.c optional netmap dev/netmap/netmap_offloadings.c optional netmap dev/netmap/netmap_pipe.c optional netmap -dev/netmap/netmap_pt.c optional netmap dev/netmap/netmap_vale.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci From owner-svn-src-all@freebsd.org Sun Aug 25 20:26:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73D63C1257; Sun, 25 Aug 2019 20:26:44 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmrM12krz4Pth; Sun, 25 Aug 2019 20:26:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-x232.google.com with SMTP id x3so13212736lji.5; Sun, 25 Aug 2019 13:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3yy8EnM/zZwuj7tJGSTuZ+IsF8YcWsrwqUNdoux67sc=; b=lxZU+rROylddv7U/7qKhw8S7cckgKPSVdC85g6r73PIi+Hg4lWxkrSz265TbPiJJFL oll5CScYPzC4tKYsohpDO36mPKvj2iWMgwRbdl0Fzr3MygAaxi3+D5DNJg5CbjvxqUAM ZOf+SWKdUHL1If8uEOlzza35oR0ZSMQ5wG4c/YoRdll1tN1KpGsweLDDznOMirtHcLci qriNWzh07qNVVvstUBjzEV3Rj8qlcCgXLqOzABKbwG/bOh2pPQ9/MEZ/4m135PNKqg1D v15jPopY3cCSJGBRnPAbsioiXkFNjF0/IUmLqew0oa1P1GsC/ravyUPW4VRVyjbr3hTh Pecg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3yy8EnM/zZwuj7tJGSTuZ+IsF8YcWsrwqUNdoux67sc=; b=ERxSv05h6gl3T0IJkwY+UhJYAm+jvRM0Jzstc3FsYui/8KirBozb7bxd4LlGuUQk1N d5I1TGpgk3u+lWYKtbBeistIooCMw49Sgb6zhqLW0wvw14YKI7sPwFIs8EDwgJDMWeLd XegE5Oxaq8+WNkPX8kGD9RX/uNYnSJbZn1yewDRa/6lsYtlwHGn5WI4Yqpq/5FN6IYZM 1AIlSFSgV1nXmTAtBjfsflK50NVsZkI9uLHt+Tp8WagxRiy2hR3SaFJJ8JdcPcPLXdFJ 35c4vqlDb2Pe4KxjNYUfC9LL5hxxtrDSFZg4d4uoqzbk8yFXk6arhxSnSOKqc34CiulC c7VQ== X-Gm-Message-State: APjAAAWYUMMRZPa6ULJtTzoj2g93Rchf6Az3FCFY7iF2PxoZxU+FJAD3 nkg+7qx64W/smyvruLLAu8K+MBK7z1nOjj9jUio= X-Google-Smtp-Source: APXvYqxDE3/edXt0jWjj1QUOFE09RZtQl9I8om2NvmfT2F6XG4uUv3uW7A4J5PlMwJeIlWeXGSCftZ6nZR7m0s8jB9M= X-Received: by 2002:a2e:864c:: with SMTP id i12mr8472014ljj.88.1566764800932; Sun, 25 Aug 2019 13:26:40 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> In-Reply-To: <20190826.050922.1810654532466043358.hrs@allbsd.org> From: alan somers Date: Sun, 25 Aug 2019 14:26:28 -0600 Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Hiroki Sato Cc: Alan Somers , Jan Sucan , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 46GmrM12krz4Pth X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=lxZU+rRO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 2a00:1450:4864:20::232 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-8.98), ipnet: 2a00:1450::/32(-3.00), asn: 15169(-2.33), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2019 20:26:44 -0000 On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > Alan Somers wrote > in : > > as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: > as> > > as> > Hi, > as> > > as> > Alan Somers wrote > as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > as> > > as> > as> Author: asomers > as> > as> Date: Fri Aug 23 15:22:20 2019 > as> > as> New Revision: 351423 > as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > as> > as> > as> > as> Log: > as> > as> ping6: Rename options for better consistency with ping > as> > as> > as> > as> Now equivalent options have the same flags, and nonequivalent > options have > as> > as> different flags. This is a prelude to merging the two > commands. > as> > as> > as> > as> Submitted by: J=C3=A1n Su=C4=8Dan > as> > as> MFC: Never > as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) > as> > as> Differential Revision: https://reviews.freebsd.org/D21345 > as> > > as> > I have an objection on renaming the existing option flags in > ping6(8) > as> > for compatibility with ping(8). > as> > > as> > Is it sufficient to add INET6 support to ping(8) with consistent > as> > flags and keep CLI of ping6(8) backward compatible? People have > used > as> > ping6(8) for >15 years, so it is too late to rename the flags. I = do > as> > not think the renaming is useful if "ping -6 localhost" or "ping > ::1" > as> > works. > as> > > as> > -- Hiroki > as> > as> If ping works with inet6, then why would we want to keep a separate > as> tool around? If it's just for the sake of people who don't want to o= r > as> can't update scripts, would a version in ports suffice? > > Because removing (or renaming) it causes a POLA violation. Do we > really have a strong, unavoidable reason to force people to rewrite > their script now? This is still a fairly essential and actively used > tool, not like rcp or rlogin. Although deprecating ping6(8) and > removing it from the base system in the future release at some point > may work, changing the existing interface will simply confuse people > who have used IPv6 for a long time. > > In my understanding, the purpose to integrate ping(8) and ping6(8) > into a single utility is to provide a consistent CLI and reduce > duplicate code, not to break compatibility. > > -- Hiroki > Those goals are incompatible. We can't provide a consistent CLI without breaking compatibility because ping and ping6 have conflicting options. And we can't keep ping6 around while also removing duplicate code because that would be, well, duplicate code. When would be a better time than a major version bump to make a change like this? The lack of a ping6 command in freebsd 13 should serve as a pretty obvious reminder that scripts will need updating. I think that putting a version of ping6 in ports should be a sufficient crutch for those who need it, don't you? > From owner-svn-src-all@freebsd.org Sun Aug 25 20:29:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEB46C13C1; Sun, 25 Aug 2019 20:29:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gmvz4B9Wz4Q9d; Sun, 25 Aug 2019 20:29:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7150F22EE1; Sun, 25 Aug 2019 20:29:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKTpZF064817; Sun, 25 Aug 2019 20:29:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKTomD064815; Sun, 25 Aug 2019 20:29:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201908252029.x7PKTomD064815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 25 Aug 2019 20:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351489 - in vendor/lldb/dist/utils: . TableGen X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lldb/dist/utils: . TableGen X-SVN-Commit-Revision: 351489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:29:51 -0000 Author: dim Date: Sun Aug 25 20:29:50 2019 New Revision: 351489 URL: https://svnweb.freebsd.org/changeset/base/351489 Log: Import missed sources for lldb-specific TableGen tool. Added: vendor/lldb/dist/utils/ vendor/lldb/dist/utils/TableGen/ vendor/lldb/dist/utils/TableGen/LLDBOptionDefEmitter.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGen.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGenBackends.h Added: vendor/lldb/dist/utils/TableGen/LLDBOptionDefEmitter.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/utils/TableGen/LLDBOptionDefEmitter.cpp Sun Aug 25 20:29:50 2019 (r351489) @@ -0,0 +1,151 @@ +//===- TableGen.cpp - Top-Level TableGen implementation for Clang ---------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// These tablegen backends emits LLDB's OptionDefinition values for different +// LLDB commands. +// +//===----------------------------------------------------------------------===// + +#include "LLDBTableGenBackends.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/TableGen/Record.h" +#include "llvm/TableGen/StringMatcher.h" +#include "llvm/TableGen/TableGenBackend.h" +#include +#include + +using namespace llvm; + +/// Map of command names to their associated records. Also makes sure our +/// commands are sorted in a deterministic way. +typedef std::map> RecordsByCommand; + +/// Groups all records by their command. +static RecordsByCommand getCommandList(std::vector Options) { + RecordsByCommand result; + for (Record *Option : Options) + result[Option->getValueAsString("Command").str()].push_back(Option); + return result; +} + +static void emitOption(Record *Option, raw_ostream &OS) { + OS << " {"; + + // List of option groups this option is in. + std::vector GroupsArg; + + if (Option->getValue("Groups")) { + // The user specified a list of groups. + auto Groups = Option->getValueAsListOfInts("Groups"); + for (int Group : Groups) + GroupsArg.push_back("LLDB_OPT_SET_" + std::to_string(Group)); + } else if (Option->getValue("GroupStart")) { + // The user specified a range of groups (with potentially only one element). + int GroupStart = Option->getValueAsInt("GroupStart"); + int GroupEnd = Option->getValueAsInt("GroupEnd"); + for (int i = GroupStart; i <= GroupEnd; ++i) + GroupsArg.push_back("LLDB_OPT_SET_" + std::to_string(i)); + } + + // If we have any groups, we merge them. Otherwise we move this option into + // the all group. + if (GroupsArg.empty()) + OS << "LLDB_OPT_SET_ALL"; + else + OS << llvm::join(GroupsArg.begin(), GroupsArg.end(), " | "); + + OS << ", "; + + // Check if this option is required. + OS << (Option->getValue("Required") ? "true" : "false"); + + // Add the full and short name for this option. + OS << ", \"" << Option->getValueAsString("FullName") << "\", "; + OS << '\'' << Option->getValueAsString("ShortName") << "'"; + + auto ArgType = Option->getValue("ArgType"); + bool IsOptionalArg = Option->getValue("OptionalArg") != nullptr; + + // Decide if we have either an option, required or no argument for this + // option. + OS << ", OptionParser::"; + if (ArgType) { + if (IsOptionalArg) + OS << "eOptionalArgument"; + else + OS << "eRequiredArgument"; + } else + OS << "eNoArgument"; + OS << ", nullptr, "; + + if (Option->getValue("ArgEnum")) + OS << Option->getValueAsString("ArgEnum"); + else + OS << "{}"; + OS << ", "; + + // Read the tab completions we offer for this option (if there are any) + if (Option->getValue("Completions")) { + auto Completions = Option->getValueAsListOfStrings("Completions"); + std::vector CompletionArgs; + for (llvm::StringRef Completion : Completions) + CompletionArgs.push_back("CommandCompletions::e" + Completion.str() + + "Completion"); + + OS << llvm::join(CompletionArgs.begin(), CompletionArgs.end(), " | "); + } else { + OS << "CommandCompletions::eNoCompletion"; + } + + // Add the argument type. + OS << ", eArgType"; + if (ArgType) { + OS << ArgType->getValue()->getAsUnquotedString(); + } else + OS << "None"; + OS << ", "; + + // Add the description if there is any. + if (auto D = Option->getValue("Description")) + OS << D->getValue()->getAsString(); + else + OS << "\"\""; + OS << "},\n"; +} + +/// Emits all option initializers to the raw_ostream. +static void emitOptions(std::string Command, std::vector Option, + raw_ostream &OS) { + // Generate the macro that the user needs to define before including the + // *.inc file. + std::string NeededMacro = "LLDB_OPTIONS_" + Command; + std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_'); + + // All options are in one file, so we need put them behind macros and ask the + // user to define the macro for the options that are needed. + OS << "// Options for " << Command << "\n"; + OS << "#ifdef " << NeededMacro << "\n"; + for (Record *R : Option) + emitOption(R, OS); + // We undefine the macro for the user like Clang's include files are doing it. + OS << "#undef " << NeededMacro << "\n"; + OS << "#endif // " << Command << " command\n\n"; +} + +void lldb_private::EmitOptionDefs(RecordKeeper &Records, raw_ostream &OS) { + + std::vector Options = Records.getAllDerivedDefinitions("Option"); + + emitSourceFileHeader("Options for LLDB command line commands.", OS); + + RecordsByCommand ByCommand = getCommandList(Options); + + for (auto &CommandRecordPair : ByCommand) { + emitOptions(CommandRecordPair.first, CommandRecordPair.second, OS); + } +} Added: vendor/lldb/dist/utils/TableGen/LLDBTableGen.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/utils/TableGen/LLDBTableGen.cpp Sun Aug 25 20:29:50 2019 (r351489) @@ -0,0 +1,71 @@ +//===- TableGen.cpp - Top-Level TableGen implementation for Clang ---------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the main function for Clang's TableGen. +// +//===----------------------------------------------------------------------===// + +#include "LLDBTableGenBackends.h" // Declares all backends. +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/PrettyStackTrace.h" +#include "llvm/Support/Signals.h" +#include "llvm/TableGen/Error.h" +#include "llvm/TableGen/Main.h" +#include "llvm/TableGen/Record.h" + +using namespace llvm; +using namespace lldb_private; + +enum ActionType { + PrintRecords, + DumpJSON, + GenOptionDefs, +}; + +static cl::opt + Action(cl::desc("Action to perform:"), + cl::values(clEnumValN(PrintRecords, "print-records", + "Print all records to stdout (default)"), + clEnumValN(DumpJSON, "dump-json", + "Dump all records as machine-readable JSON"), + clEnumValN(GenOptionDefs, "gen-lldb-option-defs", + "Generate clang attribute clases"))); + +static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) { + switch (Action) { + case PrintRecords: + OS << Records; // No argument, dump all contents + break; + case DumpJSON: + EmitJSON(Records, OS); + break; + case GenOptionDefs: + EmitOptionDefs(Records, OS); + break; + } + return false; +} + +int main(int argc, char **argv) { + sys::PrintStackTraceOnErrorSignal(argv[0]); + PrettyStackTraceProgram X(argc, argv); + cl::ParseCommandLineOptions(argc, argv); + + llvm_shutdown_obj Y; + + return TableGenMain(argv[0], &LLDBTableGenMain); +} + +#ifdef __has_feature +#if __has_feature(address_sanitizer) +#include +// Disable LeakSanitizer for this binary as it has too many leaks that are not +// very interesting to fix. See compiler-rt/include/sanitizer/lsan_interface.h . +int __lsan_is_turned_off() { return 1; } +#endif // __has_feature(address_sanitizer) +#endif // defined(__has_feature) Added: vendor/lldb/dist/utils/TableGen/LLDBTableGenBackends.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/utils/TableGen/LLDBTableGenBackends.h Sun Aug 25 20:29:50 2019 (r351489) @@ -0,0 +1,34 @@ +//===- TableGen.cpp - Top-Level TableGen implementation for Clang ---------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the declarations for all of the LLDB TableGen +// backends. A "TableGen backend" is just a function. See +// "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H +#define LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H + +#include + +namespace llvm { +class raw_ostream; +class RecordKeeper; +} // namespace llvm + +using llvm::raw_ostream; +using llvm::RecordKeeper; + +namespace lldb_private { + +void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS); + +} // namespace lldb_private + +#endif From owner-svn-src-all@freebsd.org Sun Aug 25 20:32:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 227C9C1E80; Sun, 25 Aug 2019 20:32:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GmzP02qFz4Qlb; Sun, 25 Aug 2019 20:32:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDAEC2309B; Sun, 25 Aug 2019 20:32:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKWmPJ070181; Sun, 25 Aug 2019 20:32:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKWmja070180; Sun, 25 Aug 2019 20:32:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201908252032.x7PKWmja070180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 25 Aug 2019 20:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351490 - vendor/lldb/lldb-trunk-r366426 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-trunk-r366426 X-SVN-Commit-Revision: 351490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:32:49 -0000 Author: dim Date: Sun Aug 25 20:32:48 2019 New Revision: 351490 URL: https://svnweb.freebsd.org/changeset/base/351490 Log: Remove tag for lldb trunk r366426, for re-tagging. Deleted: vendor/lldb/lldb-trunk-r366426/ From owner-svn-src-all@freebsd.org Sun Aug 25 20:33:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80A54C1F17; Sun, 25 Aug 2019 20:33:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gn0j2lZyz4QsW; Sun, 25 Aug 2019 20:33:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2600B2309C; Sun, 25 Aug 2019 20:33:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKXvQX070311; Sun, 25 Aug 2019 20:33:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKXvbl070310; Sun, 25 Aug 2019 20:33:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201908252033.x7PKXvbl070310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 25 Aug 2019 20:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351491 - vendor/lldb/lldb-trunk-r366426 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-trunk-r366426 X-SVN-Commit-Revision: 351491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:33:57 -0000 Author: dim Date: Sun Aug 25 20:33:56 2019 New Revision: 351491 URL: https://svnweb.freebsd.org/changeset/base/351491 Log: Re-tag stripped llvm trunk r366426 (just before the release_90 branch point). Added: vendor/lldb/lldb-trunk-r366426/ - copied from r351490, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Sun Aug 25 20:57:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D778EC39C9; Sun, 25 Aug 2019 20:57:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GnX35LwPz4SY2; Sun, 25 Aug 2019 20:57:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9576C23454; Sun, 25 Aug 2019 20:57:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PKvdmE082417; Sun, 25 Aug 2019 20:57:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PKvdtU082416; Sun, 25 Aug 2019 20:57:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908252057.x7PKvdtU082416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 20:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351494 - 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: 351494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 20:57:39 -0000 Author: kib Date: Sun Aug 25 20:57:39 2019 New Revision: 351494 URL: https://svnweb.freebsd.org/changeset/base/351494 Log: amd64: If domain-local page for pcpu cannot be allocated, keep use existing one. Allocation failure is possible for instance when cpu domain has no memory. Reported and tested by: bcran Reviewed by: markj Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Aug 25 20:36:52 2019 (r351493) +++ head/sys/amd64/amd64/mp_machdep.c Sun Aug 25 20:57:39 2019 (r351494) @@ -402,6 +402,8 @@ mp_realloc_pcpu(int cpuid, int domain) return; m = vm_page_alloc_domain(NULL, 0, domain, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + if (m == NULL) + return; na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); pagecopy((void *)oa, (void *)na); pmap_qenter((vm_offset_t)&__pcpu[cpuid], &m, 1); From owner-svn-src-all@freebsd.org Sun Aug 25 21:01:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12FDDC4571; Sun, 25 Aug 2019 21:01:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gnch6mZhz4TsT; Sun, 25 Aug 2019 21:01:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9B7A236FF; Sun, 25 Aug 2019 21:01: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 x7PL1edH087637; Sun, 25 Aug 2019 21:01:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PL1eu1087636; Sun, 25 Aug 2019 21:01:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908252101.x7PL1eu1087636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 25 Aug 2019 21:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351495 - 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: 351495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 21:01:41 -0000 Author: kib Date: Sun Aug 25 21:01:40 2019 New Revision: 351495 URL: https://svnweb.freebsd.org/changeset/base/351495 Log: amd64: loose constraints on the APs dpcpu and nmi/dbg stack allocations. Use DOMAINSET_PREF() instead of DOMAINSET_FIXED(), to gracefully fallback in case of memory-less domain. Reported and tested by: bcran Reviewed by: markj Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Aug 25 20:57:39 2019 (r351494) +++ head/sys/amd64/amd64/mp_machdep.c Sun Aug 25 21:01:40 2019 (r351495) @@ -483,10 +483,10 @@ native_start_all_aps(void) M_ZERO); mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); nmi_stack = (char *)kmem_malloc_domainset( - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc_domainset( - DOMAINSET_FIXED(domain), PAGE_SIZE, M_WAITOK | M_ZERO); - dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_FIXED(domain), + DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), DPCPU_SIZE, M_WAITOK | M_ZERO); bootSTK = (char *)bootstacks[cpu] + From owner-svn-src-all@freebsd.org Sun Aug 25 21:14:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3916C5360; Sun, 25 Aug 2019 21:14:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gnvq4mrVz4VX1; Sun, 25 Aug 2019 21:14:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 852252390D; Sun, 25 Aug 2019 21:14:47 +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 x7PLElMM094386; Sun, 25 Aug 2019 21:14:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PLEkfV094383; Sun, 25 Aug 2019 21:14:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908252114.x7PLEkfV094383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 25 Aug 2019 21:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351496 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 21:14:47 -0000 Author: markj Date: Sun Aug 25 21:14:46 2019 New Revision: 351496 URL: https://svnweb.freebsd.org/changeset/base/351496 Log: Handle UMA_ANYDOMAIN in kstack_import(). The kernel thread stack zone performs first-touch allocations by default, and must handle the case where the local memory domain is empty. For most UMA zones this is handled in the keg layer, but cache zones currently must implement a policy for this case. Simply use a round-robin policy if UMA_ANYDOMAIN is passed. Reported and tested by: bcran Reviewed by: kib Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/vm_glue.c Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/uma.h Sun Aug 25 21:14:46 2019 (r351496) @@ -294,6 +294,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma #define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ #define UMA_ALIGNOF(type) (_Alignof(type) - 1) /* Alignment fit for 'type' */ +#define UMA_ANYDOMAIN -1 /* Special value for domain search. */ + /* * Destroys an empty uma zone. If the zone is not empty uma complains loudly. * Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/uma_core.c Sun Aug 25 21:14:46 2019 (r351496) @@ -234,8 +234,6 @@ enum zfreeskip { SKIP_FINI = 0x00020000, }; -#define UMA_ANYDOMAIN -1 /* Special value for domain search. */ - /* Prototypes.. */ int uma_startup_count(int); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Aug 25 21:01:40 2019 (r351495) +++ head/sys/vm/vm_glue.c Sun Aug 25 21:14:46 2019 (r351496) @@ -454,12 +454,18 @@ vm_thread_dispose(struct thread *td) static int kstack_import(void *arg, void **store, int cnt, int domain, int flags) { + struct domainset *ds; vm_object_t ksobj; int i; + if (domain == UMA_ANYDOMAIN) + ds = DOMAINSET_RR(); + else + ds = DOMAINSET_PREF(domain); + for (i = 0; i < cnt; i++) { - store[i] = (void *)vm_thread_stack_create( - DOMAINSET_PREF(domain), &ksobj, kstack_pages); + store[i] = (void *)vm_thread_stack_create(ds, &ksobj, + kstack_pages); if (store[i] == NULL) break; } From owner-svn-src-all@freebsd.org Sun Aug 25 22:06:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4530AC6BB0; Sun, 25 Aug 2019 22:06:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gq3G15s8z4Xv8; Sun, 25 Aug 2019 22:06:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 039A224227; Sun, 25 Aug 2019 22:06:18 +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 x7PM6HOW024111; Sun, 25 Aug 2019 22:06:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PM6HBn024110; Sun, 25 Aug 2019 22:06:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908252206.x7PM6HBn024110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 25 Aug 2019 22:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351497 - in head/sys/modules: linux linux64 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/modules: linux linux64 X-SVN-Commit-Revision: 351497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 22:06:18 -0000 Author: imp Date: Sun Aug 25 22:06:17 2019 New Revision: 351497 URL: https://svnweb.freebsd.org/changeset/base/351497 Log: Replace -Werror with ${WERROR} in module builds Modified: head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Sun Aug 25 21:14:46 2019 (r351496) +++ head/sys/modules/linux/Makefile Sun Aug 25 22:06:17 2019 (r351497) @@ -55,7 +55,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s \ - -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib \ + -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -nostdinc -nostdlib \ -fno-omit-frame-pointer -fPIC \ -Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}/${VDSO}.lds.s \ -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common \ Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Sun Aug 25 21:14:46 2019 (r351496) +++ head/sys/modules/linux64/Makefile Sun Aug 25 22:06:17 2019 (r351497) @@ -31,7 +31,7 @@ linux_assym.h: linux_genassym.o linux_locore.o: linux_locore.asm linux_assym.h ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ - -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc \ + -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -fPIC -nostdinc \ -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ -Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib \ ${.IMPSRC} -o ${.TARGET} From owner-svn-src-all@freebsd.org Sun Aug 25 22:06:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 673B8C6BF8; Sun, 25 Aug 2019 22:06:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gq3R28R2z4Y29; Sun, 25 Aug 2019 22:06:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D1BB24228; Sun, 25 Aug 2019 22:06:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PM6RvR024165; Sun, 25 Aug 2019 22:06:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PM6Rab024164; Sun, 25 Aug 2019 22:06:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908252206.x7PM6Rab024164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 25 Aug 2019 22:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351498 - head/usr.sbin/pmcstudy X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/pmcstudy X-SVN-Commit-Revision: 351498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 22:06:27 -0000 Author: imp Date: Sun Aug 25 22:06:26 2019 New Revision: 351498 URL: https://svnweb.freebsd.org/changeset/base/351498 Log: Replace -Werror with ${WERROR} in pmcstudy Modified: head/usr.sbin/pmcstudy/Makefile Modified: head/usr.sbin/pmcstudy/Makefile ============================================================================== --- head/usr.sbin/pmcstudy/Makefile Sun Aug 25 22:06:17 2019 (r351497) +++ head/usr.sbin/pmcstudy/Makefile Sun Aug 25 22:06:26 2019 (r351498) @@ -4,7 +4,7 @@ PROG= pmcstudy MAN= pmcstudy.8 SRCS= pmcstudy.c eval_expr.c -CFLAGS+= -Wall -Werror +CFLAGS+= -Wall ${WERROR} BINDIR= /usr/bin From owner-svn-src-all@freebsd.org Sun Aug 25 22:30:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F2BCC74A7; Sun, 25 Aug 2019 22:30:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GqZz01Z0z4Z8P; Sun, 25 Aug 2019 22:30:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D302E245CD; Sun, 25 Aug 2019 22:30:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7PMUIwC036138; Sun, 25 Aug 2019 22:30:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PMUIgd036137; Sun, 25 Aug 2019 22:30:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908252230.x7PMUIgd036137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 25 Aug 2019 22:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351499 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 351499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 22:30:19 -0000 Author: mjg Date: Sun Aug 25 22:30:18 2019 New Revision: 351499 URL: https://svnweb.freebsd.org/changeset/base/351499 Log: vfs: swap vop_unlock_post and vop_unlock_pre definitions to the logical order The change is no-op. Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Aug 25 22:06:26 2019 (r351498) +++ head/sys/sys/vnode.h Sun Aug 25 22:30:18 2019 (r351499) @@ -811,14 +811,14 @@ int vop_sigdefer(struct vop_vector *vop, struct vop_ge void vop_strategy_pre(void *a); void vop_lock_pre(void *a); void vop_lock_post(void *a, int rc); -void vop_unlock_post(void *a, int rc); void vop_unlock_pre(void *a); +void vop_unlock_post(void *a, int rc); #else #define vop_strategy_pre(x) do { } while (0) #define vop_lock_pre(x) do { } while (0) #define vop_lock_post(x, y) do { } while (0) -#define vop_unlock_post(x, y) do { } while (0) #define vop_unlock_pre(x) do { } while (0) +#define vop_unlock_post(x, y) do { } while (0) #endif void vop_rename_fail(struct vop_rename_args *ap); From owner-svn-src-all@freebsd.org Sun Aug 25 23:51:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E79B6C90D7; Sun, 25 Aug 2019 23:51:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GsNB6MnLz4d6L; Sun, 25 Aug 2019 23:51:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f66.google.com with SMTP id x4so32844371iog.13; Sun, 25 Aug 2019 16:51:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=IAhWOLebHxyIsnMYARiHbaA7Y1egdQStURsvuArycSE=; b=Pk1WBNnBNGldtSqQgpgzAigUHEnTQm1asHFHpa4KXzpWTXvUL9azszCeuJHz9x8JHW ydXtg1o0mGJT1MfRKU4deksq62TkBx4/EWHJJ9O7RptJ8tJL2Q06cH5irTX5VLJboIID JkFHt86fFw/7AgEy452SqhB/FN/0ukC2J0459LFhukrvua4+nEIWGXsotilTCTtJi2PV Uj98jMl5a35TMcuRAwxe3qtpj/hGuQO3eIreCAAoWaBose7WPI5c1wtxT2M0fzoVJUYX wW9Td1g7yZsbaV+aH5q5uflbTp+187MZJ6OSn1vlPUHpBcbIX0VE4QiihWOG3HofGegp 8SMg== X-Gm-Message-State: APjAAAUo7X9O35kD7xOMMZgZR/FOPmaNsS2NSOXTy31GNpzwc3boskfK TGsv07KxYVTCkJqLrShXMd6U8qGh X-Google-Smtp-Source: APXvYqwriJaOggPhvluTqwPCUBuLSPcdYnD7W/6JVO8odxeWgahj0A0bF6BGDSSq06aCuDvSszsOCg== X-Received: by 2002:a02:4881:: with SMTP id p123mr15626140jaa.69.1566777065395; Sun, 25 Aug 2019 16:51:05 -0700 (PDT) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com. [209.85.166.48]) by smtp.gmail.com with ESMTPSA id j18sm3113019ioo.14.2019.08.25.16.51.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Aug 2019 16:51:04 -0700 (PDT) Received: by mail-io1-f48.google.com with SMTP id j4so24634291iog.11; Sun, 25 Aug 2019 16:51:04 -0700 (PDT) X-Received: by 2002:a02:6d24:: with SMTP id m36mr1746226jac.87.1566777064136; Sun, 25 Aug 2019 16:51:04 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sun, 25 Aug 2019 16:50:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: alan somers Cc: Hiroki Sato , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46GsNB6MnLz4d6L X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.66 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-4.23 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[66.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.25)[ip: (-0.53), ipnet: 209.85.128.0/17(-3.35), asn: 15169(-2.33), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 23:51:08 -0000 Hi Alan, Hiroki, It would be pretty easy to install a `ping6` link to the `ping(8)` binary with different option parsing (conditional on argv[0]). That removes most of the issues of code and space duplication, I think? And the goal would be for the 'ping6' name to retain option compatibility with historical ping6. It's not an uncommon pattern; for example, 'id', 'groups', and 'whoami' are all a single binary with multiple linked names. Another example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', 'clang++' and 'cpp' links to the same inode =E2=80=94 and those have very different behavior depending on argv[0]. It's less work than forcing the ping6 compatibility crowd to create a port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable middle ground? Best, Conrad On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: > > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: >> >> Alan Somers wrote >> in : >> >> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: >> as> > >> as> > Hi, >> as> > >> as> > Alan Somers wrote >> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: >> as> > >> as> > as> Author: asomers >> as> > as> Date: Fri Aug 23 15:22:20 2019 >> as> > as> New Revision: 351423 >> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 >> as> > as> >> as> > as> Log: >> as> > as> ping6: Rename options for better consistency with ping >> as> > as> >> as> > as> Now equivalent options have the same flags, and nonequivalen= t options have >> as> > as> different flags. This is a prelude to merging the two comma= nds. >> as> > as> >> as> > as> Submitted by: J=C3=A1n Su=C4=8Dan >> as> > as> MFC: Never >> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) >> as> > as> Differential Revision: https://reviews.freebsd.org/D21345 >> as> > >> as> > I have an objection on renaming the existing option flags in ping= 6(8) >> as> > for compatibility with ping(8). >> as> > >> as> > Is it sufficient to add INET6 support to ping(8) with consistent >> as> > flags and keep CLI of ping6(8) backward compatible? People have = used >> as> > ping6(8) for >15 years, so it is too late to rename the flags. I= do >> as> > not think the renaming is useful if "ping -6 localhost" or "ping = ::1" >> as> > works. >> as> > >> as> > -- Hiroki >> as> >> as> If ping works with inet6, then why would we want to keep a separate >> as> tool around? If it's just for the sake of people who don't want to = or >> as> can't update scripts, would a version in ports suffice? >> >> Because removing (or renaming) it causes a POLA violation. Do we >> really have a strong, unavoidable reason to force people to rewrite >> their script now? This is still a fairly essential and actively used >> tool, not like rcp or rlogin. Although deprecating ping6(8) and >> removing it from the base system in the future release at some point >> may work, changing the existing interface will simply confuse people >> who have used IPv6 for a long time. >> >> In my understanding, the purpose to integrate ping(8) and ping6(8) >> into a single utility is to provide a consistent CLI and reduce >> duplicate code, not to break compatibility. >> >> -- Hiroki > > > Those goals are incompatible. We can't provide a consistent CLI without b= reaking compatibility because ping and ping6 have conflicting options. And= we can't keep ping6 around while also removing duplicate code because that= would be, well, duplicate code. > > When would be a better time than a major version bump to make a change li= ke this? > > The lack of a ping6 command in freebsd 13 should serve as a pretty obviou= s reminder that scripts will need updating. I think that putting a version= of ping6 in ports should be a sufficient crutch for those who need it, don= 't you? From owner-svn-src-all@freebsd.org Sun Aug 25 23:51:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48388C914B; Sun, 25 Aug 2019 23:51:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GsNx1Cd4z4dNV; Sun, 25 Aug 2019 23:51:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B9232548D; Sun, 25 Aug 2019 23:51:45 +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 x7PNpiKD087265; Sun, 25 Aug 2019 23:51:44 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7PNpimK087264; Sun, 25 Aug 2019 23:51:44 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908252351.x7PNpimK087264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 25 Aug 2019 23:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351500 - vendor/zlib/dist X-SVN-Group: vendor X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: vendor/zlib/dist X-SVN-Commit-Revision: 351500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 23:51:45 -0000 Author: delphij Date: Sun Aug 25 23:51:44 2019 New Revision: 351500 URL: https://svnweb.freebsd.org/changeset/base/351500 Log: Import vendor commit 38e8ce32afbaa82f67d992b9f3056f281fe69259: Author: Mark Adler Date: Sun Jan 22 23:38:52 2017 -0800 Fix CLEAR_HASH macro to be usable as a single statement. As it is used in deflateParams(). Modified: vendor/zlib/dist/deflate.c Modified: vendor/zlib/dist/deflate.c ============================================================================== --- vendor/zlib/dist/deflate.c Sun Aug 25 22:30:18 2019 (r351499) +++ vendor/zlib/dist/deflate.c Sun Aug 25 23:51:44 2019 (r351500) @@ -190,8 +190,11 @@ local const config configuration_table[10] = { * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + do { \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, \ + (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ + } while (0) /* =========================================================================== * Slide the hash table when sliding the window down (could be avoided with 32 From owner-svn-src-all@freebsd.org Sun Aug 25 23:58:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BC58C9677; Sun, 25 Aug 2019 23:58:51 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GsY66sJlz4ddf; Sun, 25 Aug 2019 23:58:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f196.google.com with SMTP id z17so13451414ljz.0; Sun, 25 Aug 2019 16:58:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6BmYDSqs/dXRXvkMWiM4xPxNtftCpzZ4ksrp9M3VeEw=; b=RUWA9AvOsKHztUYGP8K3Jj9xYuywI9aCh/R2xMlaQG//m1k/gP5zhpXpuknOtWTR3v pNkAAlLJ6OIV54oLfR5M9gdzW1ece9Qen5Ipup2uD8Srv91p9n23+u0r26t5vWeemyza wDUndcZTYH/ZlA4+VAy/y1q3QrgSy2aKQN+M8adCLuMM/qXHZFykMwltAVr6lbvL2jRh U9c0vNmHyHSHn0cn0MqZOsxLxopKbnb8UITL+LWVy3gWqAqRIWzb86on1qbvKFioStot znL3InLyPYOtbA+1aVlV+SQ6nEpTEKb6teF6stHalur7ahSpe0IieebELtHs0FuA4q8O 6jpQ== X-Gm-Message-State: APjAAAWPhrUwHgrnnpCO0I2m64IzcaBvKKzYPKVyb7bM79SvN0bf8i8I jj2hm4Gzn+ond+p7vIcYf0jvg/xZxbwN4YgEWFPi68Kt X-Google-Smtp-Source: APXvYqxoBVeT4Qf2ippp4EnCrmitH3ojYrKgXr5qNbp5S2F3wjNZBh41RIw6AkryAxTjHH9BkQmq5KN7L+764oLmbpQ= X-Received: by 2002:a2e:a0c3:: with SMTP id f3mr8998688ljm.123.1566777528702; Sun, 25 Aug 2019 16:58:48 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> In-Reply-To: From: Alan Somers Date: Sun, 25 Aug 2019 17:58:37 -0600 Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: "Conrad E. Meyer" , Jan Sucan Cc: Hiroki Sato , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46GsY66sJlz4ddf X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.982,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 25 Aug 2019 23:58:51 -0000 Jan (please keep him CCed on replies) has been musing about the same thing. That might satisfy everyone. Jan, would it be straightforward to implement? -Alan On Sun, Aug 25, 2019 at 5:51 PM Conrad Meyer wrote: > > Hi Alan, Hiroki, > > It would be pretty easy to install a `ping6` link to the `ping(8)` > binary with different option parsing (conditional on argv[0]). That > removes most of the issues of code and space duplication, I think? > And the goal would be for the 'ping6' name to retain option > compatibility with historical ping6. > > It's not an uncommon pattern; for example, 'id', 'groups', and > 'whoami' are all a single binary with multiple linked names. Another > example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', > 'clang++' and 'cpp' links to the same inode =E2=80=94 and those have very > different behavior depending on argv[0]. > > It's less work than forcing the ping6 compatibility crowd to create a > port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable > middle ground? > > Best, > Conrad > > On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: > > > > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > >> > >> Alan Somers wrote > >> in : > >> > >> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote= : > >> as> > > >> as> > Hi, > >> as> > > >> as> > Alan Somers wrote > >> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > >> as> > > >> as> > as> Author: asomers > >> as> > as> Date: Fri Aug 23 15:22:20 2019 > >> as> > as> New Revision: 351423 > >> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > >> as> > as> > >> as> > as> Log: > >> as> > as> ping6: Rename options for better consistency with ping > >> as> > as> > >> as> > as> Now equivalent options have the same flags, and nonequival= ent options have > >> as> > as> different flags. This is a prelude to merging the two com= mands. > >> as> > as> > >> as> > as> Submitted by: J=C3=A1n Su=C4=8Dan > >> as> > as> MFC: Never > >> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) > >> as> > as> Differential Revision: https://reviews.freebsd.org/D213= 45 > >> as> > > >> as> > I have an objection on renaming the existing option flags in pi= ng6(8) > >> as> > for compatibility with ping(8). > >> as> > > >> as> > Is it sufficient to add INET6 support to ping(8) with consisten= t > >> as> > flags and keep CLI of ping6(8) backward compatible? People hav= e used > >> as> > ping6(8) for >15 years, so it is too late to rename the flags. = I do > >> as> > not think the renaming is useful if "ping -6 localhost" or "pin= g ::1" > >> as> > works. > >> as> > > >> as> > -- Hiroki > >> as> > >> as> If ping works with inet6, then why would we want to keep a separat= e > >> as> tool around? If it's just for the sake of people who don't want t= o or > >> as> can't update scripts, would a version in ports suffice? > >> > >> Because removing (or renaming) it causes a POLA violation. Do we > >> really have a strong, unavoidable reason to force people to rewrite > >> their script now? This is still a fairly essential and actively used > >> tool, not like rcp or rlogin. Although deprecating ping6(8) and > >> removing it from the base system in the future release at some point > >> may work, changing the existing interface will simply confuse people > >> who have used IPv6 for a long time. > >> > >> In my understanding, the purpose to integrate ping(8) and ping6(8) > >> into a single utility is to provide a consistent CLI and reduce > >> duplicate code, not to break compatibility. > >> > >> -- Hiroki > > > > > > Those goals are incompatible. We can't provide a consistent CLI without= breaking compatibility because ping and ping6 have conflicting options. A= nd we can't keep ping6 around while also removing duplicate code because th= at would be, well, duplicate code. > > > > When would be a better time than a major version bump to make a change = like this? > > > > The lack of a ping6 command in freebsd 13 should serve as a pretty obvi= ous reminder that scripts will need updating. I think that putting a versi= on of ping6 in ports should be a sufficient crutch for those who need it, d= on't you? From owner-svn-src-all@freebsd.org Mon Aug 26 00:19:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 752D0C9DD6; Mon, 26 Aug 2019 00:19:02 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail.allbsd.org (mx.allbsd.org [IPv6:2001:2f0:104:e001::41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gt0N04T5z4fQG; Mon, 26 Aug 2019 00:18:59 +0000 (UTC) (envelope-from hrs@allbsd.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:4700:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id x7Q0IYmc004217 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) (Client CN "/CN=mail-d.allbsd.org", Issuer "/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3"); Mon, 26 Aug 2019 09:18:45 +0900 (JST) (envelope-from hrs@allbsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=allbsd.org; s=20190220; t=1566778733; bh=RqAfa7pnwsCKHT2AkNxsFiyEWp7x6u8wxwJZduVoidQ=; h=Date:To:Cc:From:In-Reply-To:References; b=RauG2cR98GVR4v9i3Uvy3sncqmiUaZCrpqhrtQQvWXb+xhTF6qdxw+0coZh0s7mmM +qjtE/4MmxT9yH187Zz35F9oz66Q1HGa8Eog+aYyfs97JehswZcYpW3GVYzEFn6aor rGDkR8+NTyHO5VfriWV0vomHVq0PxMjK+6x2Iod8= Received: from alph.d.allbsd.org ([IPv6:2409:11:a740:4700:16:ceff:fe34:2700]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id x7Q0ITDU071636 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 26 Aug 2019 09:18:29 +0900 (JST) (envelope-from hrs@allbsd.org) Received: from localhost (localhost [[UNIX: localhost]]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id x7Q0IRIa071632; Mon, 26 Aug 2019 09:18:29 +0900 (JST) (envelope-from hrs@allbsd.org) Date: Mon, 26 Aug 2019 09:18:17 +0900 (JST) Message-Id: <20190826.091817.1030128007560633472.hrs@allbsd.org> To: asomers@freebsd.org Cc: cem@freebsd.org, sucanjan@gmail.com, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests From: Hiroki Sato In-Reply-To: References: X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Aug_26_09_18_17_2019_471)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:41]); Mon, 26 Aug 2019 09:18:53 +0900 (JST) X-Rspamd-Queue-Id: 46Gt0N04T5z4fQG X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=allbsd.org header.s=20190220 header.b=RauG2cR9; dmarc=none; spf=pass (mx1.freebsd.org: domain of hrs@allbsd.org designates 2001:2f0:104:e001::41 as permitted sender) smtp.mailfrom=hrs@allbsd.org X-Spamd-Result: default: False [-6.05 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[allbsd.org:s=20190220]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MV_CASE(0.50)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[allbsd.org]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[allbsd.org:+]; MIME_BASE64_TEXT(0.10)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7514, ipnet:2001:2f0::/32, country:JP]; IP_SCORE(-2.09)[ip: (-9.72), ipnet: 2001:2f0::/32(-4.13), asn: 7514(3.45), country: JP(-0.03)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 00:19:02 -0000 ----Security_Multipart(Mon_Aug_26_09_18_17_2019_471)-- Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: base64 SGkgQWxhbiBhbmQgQ29ucmFkLA0KDQogSSBhZ3JlZSB3aXRoIHRoZSBpZGVhIGhhdmluZyBwaW5n Nig4KSBhcyBhIGhhcmRsaW5rIHRvIHBpbmcoOCkgdG8NCiBwcm92aWRlIHRoZSBoaXN0b3JpY2Fs IHBpbmc2KDgpIGJlaGF2aW9yLg0KDQpBbGFuIFNvbWVycyA8YXNvbWVyc0BmcmVlYnNkLm9yZz4g d3JvdGUNCiAgaW4gPENBT3RNWDJoamFZcSs4X1MweVhlQUp1dEYyZ055M3dnaXZtdk9kPU9WLWlU QnlVZFlLQUBtYWlsLmdtYWlsLmNvbT46DQoNCmFzPiBKYW4gKHBsZWFzZSBrZWVwIGhpbSBDQ2Vk IG9uIHJlcGxpZXMpIGhhcyBiZWVuIG11c2luZyBhYm91dCB0aGUgc2FtZQ0KYXM+IHRoaW5nLiAg VGhhdCBtaWdodCBzYXRpc2Z5IGV2ZXJ5b25lLiAgSmFuLCB3b3VsZCBpdCBiZSBzdHJhaWdodGZv cndhcmQNCmFzPiB0byBpbXBsZW1lbnQ/DQphcz4gLUFsYW4NCmFzPiANCmFzPiBPbiBTdW4sIEF1 ZyAyNSwgMjAxOSBhdCA1OjUxIFBNIENvbnJhZCBNZXllciA8Y2VtQGZyZWVic2Qub3JnPiB3cm90 ZToNCmFzPiA+DQphcz4gPiBIaSBBbGFuLCBIaXJva2ksDQphcz4gPg0KYXM+ID4gSXQgd291bGQg YmUgcHJldHR5IGVhc3kgdG8gaW5zdGFsbCBhIGBwaW5nNmAgbGluayB0byB0aGUgYHBpbmcoOClg DQphcz4gPiBiaW5hcnkgd2l0aCBkaWZmZXJlbnQgb3B0aW9uIHBhcnNpbmcgKGNvbmRpdGlvbmFs IG9uIGFyZ3ZbMF0pLiAgVGhhdA0KYXM+ID4gcmVtb3ZlcyBtb3N0IG9mIHRoZSBpc3N1ZXMgb2Yg Y29kZSBhbmQgc3BhY2UgZHVwbGljYXRpb24sIEkgdGhpbms/DQphcz4gPiBBbmQgdGhlIGdvYWwg d291bGQgYmUgZm9yIHRoZSAncGluZzYnIG5hbWUgdG8gcmV0YWluIG9wdGlvbg0KYXM+ID4gY29t cGF0aWJpbGl0eSB3aXRoIGhpc3RvcmljYWwgcGluZzYuDQphcz4gPg0KYXM+ID4gSXQncyBub3Qg YW4gdW5jb21tb24gcGF0dGVybjsgZm9yIGV4YW1wbGUsICdpZCcsICdncm91cHMnLCBhbmQNCmFz PiA+ICd3aG9hbWknIGFyZSBhbGwgYSBzaW5nbGUgYmluYXJ5IHdpdGggbXVsdGlwbGUgbGlua2Vk IG5hbWVzLiAgQW5vdGhlcg0KYXM+ID4gZXhhbXBsZSBpcyBDbGFuZywgd2hpY2ggcHJvdmlkZXMg J2NjJywgJ2MrKycsICdjbGFuZycsICdjbGFuZy1jcHAnLA0KYXM+ID4gJ2NsYW5nKysnIGFuZCAn Y3BwJyBsaW5rcyB0byB0aGUgc2FtZSBpbm9kZSDigJQgYW5kIHRob3NlIGhhdmUgdmVyeQ0KYXM+ ID4gZGlmZmVyZW50IGJlaGF2aW9yIGRlcGVuZGluZyBvbiBhcmd2WzBdLg0KYXM+ID4NCmFzPiA+ IEl0J3MgbGVzcyB3b3JrIHRoYW4gZm9yY2luZyB0aGUgcGluZzYgY29tcGF0aWJpbGl0eSBjcm93 ZCB0byBjcmVhdGUgYQ0KYXM+ID4gcG9ydCBhbmQgZG9lc24ndCBodXJ0IHBpbmcoOCkgbXVjaCwg QUZBSUNULiAgSXMgaXQgYW4gYWNjZXB0YWJsZQ0KYXM+ID4gbWlkZGxlIGdyb3VuZD8NCmFzPiA+ DQphcz4gPiBCZXN0LA0KYXM+ID4gQ29ucmFkDQphcz4gPg0KYXM+ID4gT24gU3VuLCBBdWcgMjUs IDIwMTkgYXQgMToyNiBQTSBhbGFuIHNvbWVycyA8YXNvbWVyc0BnbWFpbC5jb20+IHdyb3RlOg0K YXM+ID4gPg0KYXM+ID4gPiBPbiBTdW4sIEF1ZyAyNSwgMjAxOSwgMjoxMSBQTSBIaXJva2kgU2F0 byA8aHJzQGFsbGJzZC5vcmc+IHdyb3RlOg0KYXM+ID4gPj4NCmFzPiA+ID4+IEFsYW4gU29tZXJz IDxhc29tZXJzQGZyZWVic2Qub3JnPiB3cm90ZQ0KYXM+ID4gPj4gICBpbiA8Q0FPdE1YMmhMeHg9 U0t2aDFab2lNQWNhZ1FKalBhUlN2a01MOUorQmdwUXN6NXVOTmJ3QG1haWwuZ21haWwuY29tPjoN CmFzPiA+ID4+DQphcz4gPiA+PiBhcz4gT24gU3VuLCBBdWcgMjUsIDIwMTkgYXQgMToyMiBQTSBI aXJva2kgU2F0byA8aHJzQGFsbGJzZC5vcmc+IHdyb3RlOg0KYXM+ID4gPj4gYXM+ID4NCmFzPiA+ ID4+IGFzPiA+IEhpLA0KYXM+ID4gPj4gYXM+ID4NCmFzPiA+ID4+IGFzPiA+IEFsYW4gU29tZXJz IDxhc29tZXJzQEZyZWVCU0Qub3JnPiB3cm90ZQ0KYXM+ID4gPj4gYXM+ID4gICBpbiA8MjAxOTA4 MjMxNTIyLng3TkZNTHVKMDY4MDM3QHJlcG8uZnJlZWJzZC5vcmc+Og0KYXM+ID4gPj4gYXM+ID4N CmFzPiA+ID4+IGFzPiA+IGFzPiBBdXRob3I6IGFzb21lcnMNCmFzPiA+ID4+IGFzPiA+IGFzPiBE YXRlOiBGcmkgQXVnIDIzIDE1OjIyOjIwIDIwMTkNCmFzPiA+ID4+IGFzPiA+IGFzPiBOZXcgUmV2 aXNpb246IDM1MTQyMw0KYXM+ID4gPj4gYXM+ID4gYXM+IFVSTDogaHR0cHM6Ly9zdm53ZWIuZnJl ZWJzZC5vcmcvY2hhbmdlc2V0L2Jhc2UvMzUxNDIzDQphcz4gPiA+PiBhcz4gPiBhcz4NCmFzPiA+ ID4+IGFzPiA+IGFzPiBMb2c6DQphcz4gPiA+PiBhcz4gPiBhcz4gICBwaW5nNjogUmVuYW1lIG9w dGlvbnMgZm9yIGJldHRlciBjb25zaXN0ZW5jeSB3aXRoIHBpbmcNCmFzPiA+ID4+IGFzPiA+IGFz Pg0KYXM+ID4gPj4gYXM+ID4gYXM+ICAgTm93IGVxdWl2YWxlbnQgb3B0aW9ucyBoYXZlIHRoZSBz YW1lIGZsYWdzLCBhbmQgbm9uZXF1aXZhbGVudCBvcHRpb25zIGhhdmUNCmFzPiA+ID4+IGFzPiA+ IGFzPiAgIGRpZmZlcmVudCBmbGFncy4gIFRoaXMgaXMgYSBwcmVsdWRlIHRvIG1lcmdpbmcgdGhl IHR3byBjb21tYW5kcy4NCmFzPiA+ID4+IGFzPiA+IGFzPg0KYXM+ID4gPj4gYXM+ID4gYXM+ICAg U3VibWl0dGVkIGJ5OiAgICAgSsOhbiBTdcSNYW4gPHN1Y2FuamFuQGdtYWlsLmNvbT4NCmFzPiA+ ID4+IGFzPiA+IGFzPiAgIE1GQzogICAgICAgICAgICAgIE5ldmVyDQphcz4gPiA+PiBhcz4gPiBh cz4gICBTcG9uc29yZWQgYnk6ICAgICBHb29nbGUgTExDIChHb29nbGUgU3VtbWVyIG9mIENvZGUg MjAxOSkNCmFzPiA+ID4+IGFzPiA+IGFzPiAgIERpZmZlcmVudGlhbCBSZXZpc2lvbjogICAgaHR0 cHM6Ly9yZXZpZXdzLmZyZWVic2Qub3JnL0QyMTM0NQ0KYXM+ID4gPj4gYXM+ID4NCmFzPiA+ID4+ IGFzPiA+ICBJIGhhdmUgYW4gb2JqZWN0aW9uIG9uIHJlbmFtaW5nIHRoZSBleGlzdGluZyBvcHRp b24gZmxhZ3MgaW4gcGluZzYoOCkNCmFzPiA+ID4+IGFzPiA+ICBmb3IgY29tcGF0aWJpbGl0eSB3 aXRoIHBpbmcoOCkuDQphcz4gPiA+PiBhcz4gPg0KYXM+ID4gPj4gYXM+ID4gIElzIGl0IHN1ZmZp Y2llbnQgdG8gYWRkIElORVQ2IHN1cHBvcnQgdG8gcGluZyg4KSB3aXRoIGNvbnNpc3RlbnQNCmFz PiA+ID4+IGFzPiA+ICBmbGFncyBhbmQga2VlcCBDTEkgb2YgcGluZzYoOCkgYmFja3dhcmQgY29t cGF0aWJsZT8gIFBlb3BsZSBoYXZlIHVzZWQNCmFzPiA+ID4+IGFzPiA+ICBwaW5nNig4KSBmb3Ig PjE1IHllYXJzLCBzbyBpdCBpcyB0b28gbGF0ZSB0byByZW5hbWUgdGhlIGZsYWdzLiAgSSBkbw0K YXM+ID4gPj4gYXM+ID4gIG5vdCB0aGluayB0aGUgcmVuYW1pbmcgaXMgdXNlZnVsIGlmICJwaW5n IC02IGxvY2FsaG9zdCIgb3IgInBpbmcgOjoxIg0KYXM+ID4gPj4gYXM+ID4gIHdvcmtzLg0KYXM+ ID4gPj4gYXM+ID4NCmFzPiA+ID4+IGFzPiA+IC0tIEhpcm9raQ0KYXM+ID4gPj4gYXM+DQphcz4g PiA+PiBhcz4gSWYgcGluZyB3b3JrcyB3aXRoIGluZXQ2LCB0aGVuIHdoeSB3b3VsZCB3ZSB3YW50 IHRvIGtlZXAgYSBzZXBhcmF0ZQ0KYXM+ID4gPj4gYXM+IHRvb2wgYXJvdW5kPyAgSWYgaXQncyBq dXN0IGZvciB0aGUgc2FrZSBvZiBwZW9wbGUgd2hvIGRvbid0IHdhbnQgdG8gb3INCmFzPiA+ID4+ IGFzPiBjYW4ndCB1cGRhdGUgc2NyaXB0cywgd291bGQgYSB2ZXJzaW9uIGluIHBvcnRzIHN1ZmZp Y2U/DQphcz4gPiA+Pg0KYXM+ID4gPj4gIEJlY2F1c2UgcmVtb3ZpbmcgKG9yIHJlbmFtaW5nKSBp dCBjYXVzZXMgYSBQT0xBIHZpb2xhdGlvbi4gIERvIHdlDQphcz4gPiA+PiAgcmVhbGx5IGhhdmUg YSBzdHJvbmcsIHVuYXZvaWRhYmxlIHJlYXNvbiB0byBmb3JjZSBwZW9wbGUgdG8gcmV3cml0ZQ0K YXM+ID4gPj4gIHRoZWlyIHNjcmlwdCBub3c/ICBUaGlzIGlzIHN0aWxsIGEgZmFpcmx5IGVzc2Vu dGlhbCBhbmQgYWN0aXZlbHkgdXNlZA0KYXM+ID4gPj4gIHRvb2wsIG5vdCBsaWtlIHJjcCBvciBy bG9naW4uICBBbHRob3VnaCBkZXByZWNhdGluZyBwaW5nNig4KSBhbmQNCmFzPiA+ID4+ICByZW1v dmluZyBpdCBmcm9tIHRoZSBiYXNlIHN5c3RlbSBpbiB0aGUgZnV0dXJlIHJlbGVhc2UgYXQgc29t ZSBwb2ludA0KYXM+ID4gPj4gIG1heSB3b3JrLCBjaGFuZ2luZyB0aGUgZXhpc3RpbmcgaW50ZXJm YWNlIHdpbGwgc2ltcGx5IGNvbmZ1c2UgcGVvcGxlDQphcz4gPiA+PiAgd2hvIGhhdmUgdXNlZCBJ UHY2IGZvciBhIGxvbmcgdGltZS4NCmFzPiA+ID4+DQphcz4gPiA+PiAgSW4gbXkgdW5kZXJzdGFu ZGluZywgdGhlIHB1cnBvc2UgdG8gaW50ZWdyYXRlIHBpbmcoOCkgYW5kIHBpbmc2KDgpDQphcz4g PiA+PiAgaW50byBhIHNpbmdsZSB1dGlsaXR5IGlzIHRvIHByb3ZpZGUgYSBjb25zaXN0ZW50IENM SSBhbmQgcmVkdWNlDQphcz4gPiA+PiAgZHVwbGljYXRlIGNvZGUsIG5vdCB0byBicmVhayBjb21w YXRpYmlsaXR5Lg0KYXM+ID4gPj4NCmFzPiA+ID4+IC0tIEhpcm9raQ0KYXM+ID4gPg0KYXM+ID4g Pg0KYXM+ID4gPiBUaG9zZSBnb2FscyBhcmUgaW5jb21wYXRpYmxlLiBXZSBjYW4ndCBwcm92aWRl IGEgY29uc2lzdGVudCBDTEkgd2l0aG91dCBicmVha2luZyBjb21wYXRpYmlsaXR5IGJlY2F1c2Ug cGluZyBhbmQgcGluZzYgaGF2ZSBjb25mbGljdGluZyBvcHRpb25zLiAgQW5kIHdlIGNhbid0IGtl ZXAgcGluZzYgYXJvdW5kIHdoaWxlIGFsc28gcmVtb3ZpbmcgZHVwbGljYXRlIGNvZGUgYmVjYXVz ZSB0aGF0IHdvdWxkIGJlLCB3ZWxsLCBkdXBsaWNhdGUgY29kZS4NCmFzPiA+ID4NCmFzPiA+ID4g V2hlbiB3b3VsZCBiZSBhIGJldHRlciB0aW1lIHRoYW4gYSBtYWpvciB2ZXJzaW9uIGJ1bXAgdG8g bWFrZSBhIGNoYW5nZSBsaWtlIHRoaXM/DQphcz4gPiA+DQphcz4gPiA+IFRoZSBsYWNrIG9mIGEg cGluZzYgY29tbWFuZCBpbiBmcmVlYnNkIDEzIHNob3VsZCBzZXJ2ZSBhcyBhIHByZXR0eSBvYnZp b3VzIHJlbWluZGVyIHRoYXQgc2NyaXB0cyB3aWxsIG5lZWQgdXBkYXRpbmcuICBJIHRoaW5rIHRo YXQgcHV0dGluZyBhIHZlcnNpb24gb2YgcGluZzYgaW4gcG9ydHMgc2hvdWxkIGJlIGEgc3VmZmlj aWVudCBjcnV0Y2ggZm9yIHRob3NlIHdobyBuZWVkIGl0LCBkb24ndCB5b3U/DQphcz4gDQphcz4g DQoNCi0tIEhpcm9raQ0K ----Security_Multipart(Mon_Aug_26_09_18_17_2019_471)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAl1jJUkACgkQTyzT2CeTzy3SmQCeOgJHNCS5Uv0z78W/tFaXfseE lOQAoNT/RpxbCo/wCUxIXpNth3O30p0x =qvmJ -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Aug_26_09_18_17_2019_471)---- From owner-svn-src-all@freebsd.org Mon Aug 26 00:46:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7016ECA8BA; Mon, 26 Aug 2019 00:46:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GtcJ2MPYz3C1P; Mon, 26 Aug 2019 00:46:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E64B25ED5; Mon, 26 Aug 2019 00:46:40 +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 x7Q0keG7020728; Mon, 26 Aug 2019 00:46:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q0keZM020727; Mon, 26 Aug 2019 00:46:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908260046.x7Q0keZM020727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Aug 2019 00:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351501 - head/sys/contrib/zlib X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/contrib/zlib X-SVN-Commit-Revision: 351501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 00:46:40 -0000 Author: delphij Date: Mon Aug 26 00:46:39 2019 New Revision: 351501 URL: https://svnweb.freebsd.org/changeset/base/351501 Log: MFV r351500: Fix CLEAR_HASH macro to be usable as a single statement. MFC after: 2 weeks Modified: head/sys/contrib/zlib/deflate.c Directory Properties: head/sys/contrib/zlib/ (props changed) Modified: head/sys/contrib/zlib/deflate.c ============================================================================== --- head/sys/contrib/zlib/deflate.c Sun Aug 25 23:51:44 2019 (r351500) +++ head/sys/contrib/zlib/deflate.c Mon Aug 26 00:46:39 2019 (r351501) @@ -189,9 +189,11 @@ local const config configuration_table[10] = { * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ -#define CLEAR_HASH(s) do { \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ +#define CLEAR_HASH(s) \ + do { \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, \ + (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ } while (0) /* =========================================================================== From owner-svn-src-all@freebsd.org Mon Aug 26 01:47:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85CE2CB7E7 for ; Mon, 26 Aug 2019 01:47:30 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GvyT3nwVz3F3V for ; Mon, 26 Aug 2019 01:47:29 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x743.google.com with SMTP id d23so12951306qko.3 for ; Sun, 25 Aug 2019 18:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=paLFNFTL1CmTpZmLB+ClrikDf1/GDNOE0G8FbJVY6mw=; b=bQ+jwFX+39bTqg4daSD+bXXA1ZzJTfpv8Imoe3nhyHmxfBKNekpZNYhhyQ63UUeVnD WEL+Dd3qPLJt1zTKby4UYKh7B5EPkuqaegWaVNnHYBX1yfUrse7OKnn5M6I4LnH7FLUX bUD5iFDAqmYrPIcyFX1SN9ighoiLqSjCArZzInV9lh5+5gvbeXazRcStS5HDEPJC676M 9L7TNcrOR57vM1OdCAE2ovyQjosHrns5YggzT8IqSnm0ra+9tuperZC8tfiH0CgFUr1W stEqxa2WpiSNEQ1ra2PUYqZXCxKAw4mviMgETj0Ght9slPM9iC8RuzwSOLp+/zSvxchc P8Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=paLFNFTL1CmTpZmLB+ClrikDf1/GDNOE0G8FbJVY6mw=; b=bc5XKZggYIN2MCcU4c0TZnqqVx2MSUQzv496vic+bIZWzAZ2C3Mra4CzRKND8RvPjM nrJOaS+UX8yQWs1Jglw0jfLXmi7lswpFSAr3MbZ6JSt7PHdC0d2NmaXqORbXCY5EEmiI qac9S/zgL0k6rXpUDZoVPZiZys06koMI3RzE1wT8PISkSvmD/LhDDp67T2cKQMzJhLn8 0fvuprVLfWURI/ZzXeLM8TjpM14YXgCNfM5ZucWnVofWboeYAEsCQyTSR/RnMYzyPEuC dx/3xNneSl2tAe4apAa8lX4e5ngYQheIf/tM38PfjOaEqyrVA7vDQ5WNEVb6V1IVcn7m QzaQ== X-Gm-Message-State: APjAAAWclWYKfeTDlkXmvU0Vp62gG1rcHV4ul3c9WIsLI4CwjtQ1NzaR zCCizQ/jjO3KWJoOaTtlyRtegQ== X-Google-Smtp-Source: APXvYqxtgJuNY3Aw1y3fMx39K6lYUBPh/dbxqRvYftJ+j89+n9f7e9hxmlUE3I9vcFrMUXkC9SmKGQ== X-Received: by 2002:a05:620a:4c8:: with SMTP id 8mr13402975qks.366.1566784048170; Sun, 25 Aug 2019 18:47:28 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id q73sm5633433qke.90.2019.08.25.18.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 18:47:27 -0700 (PDT) Date: Sun, 25 Aug 2019 21:47:26 -0400 From: Shawn Webb To: Hiroki Sato Cc: asomers@FreeBSD.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests Message-ID: <20190826014726.mwddt4uwqoulewhh@mutt-hbsd> References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="63e6t6wtjncgu5iy" Content-Disposition: inline In-Reply-To: <20190826.042056.1329861772202588895.hrs@allbsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 46GvyT3nwVz3F3V X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=bQ+jwFX+; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::743 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-5.54 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; RCVD_IN_DNSWL_NONE(0.00)[3.4.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.47)[ip: (2.91), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.33), country: US(-0.05)]; RECEIVED_SPAMHAUS_PBL(0.00)[239.118.196.151.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 01:47:30 -0000 --63e6t6wtjncgu5iy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2019 at 04:20:56AM +0900, Hiroki Sato wrote: > Hi, >=20 > Alan Somers wrote > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: >=20 > as> Author: asomers > as> Date: Fri Aug 23 15:22:20 2019 > as> New Revision: 351423 > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > as>=20 > as> Log: > as> ping6: Rename options for better consistency with ping > as> =20 > as> Now equivalent options have the same flags, and nonequivalent optio= ns have > as> different flags. This is a prelude to merging the two commands. > as> =20 > as> Submitted by: J?n Su?an > as> MFC: Never > as> Sponsored by: Google LLC (Google Summer of Code 2019) > as> Differential Revision: https://reviews.freebsd.org/D21345 >=20 > I have an objection on renaming the existing option flags in ping6(8) > for compatibility with ping(8). >=20 > Is it sufficient to add INET6 support to ping(8) with consistent > flags and keep CLI of ping6(8) backward compatible? People have used > ping6(8) for >15 years, so it is too late to rename the flags. I do > not think the renaming is useful if "ping -6 localhost" or "ping ::1" > works. I wonder if something like this could be done: Somewhere in ping(8): bool ping6_compat; if (strcmp(argv[0], "ping6")) { ping6_compat =3D true; } =2E.. if (ping6_compat) { do_this(); } else {} do_that(); } And sbin/ping/Makefile: LINKS+=3Dsbin/ping sbin/ping6 (Note that I didn't check if sbin/ping/Makefile already set LINKS. If it doesn't, it'd be "LINKS=3D", of course.) Then, ping(8) and ping6(8) still are the same binary and backwards compat is maintained, at least until spray paints the neon pink bike shed. (Note: I am in no way saying this discussion is a bike shed. I'm _only_ making a joke as a nod to the idiomatic expression.) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --63e6t6wtjncgu5iy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl1jOigACgkQ/y5nonf4 4frgYw/9ELxk7ab6jWJaadj3jql60yKBQMcPEiLCzd1UZYe3528CKs1TIKPnbN7x mTAhEusRs/GJabiQaB9rbhKgWgKv293wsGXV1t/NW/AwQS6o0DWrFXrCaTI3wIkU Oj+EFw4amq0bHlxRnk/fDGRC+JIcL0WljGAd0WUzzFzPkd/3KHNjXS8He4shk3kc ld2YWPyNzjH4NqMItouqeJlJZw9HvTIxdsW1jle33QJKI3087ZBK76IJmIhA14um xU5WW0yJmjpryalnX3s38jsOPOUeer1CbyE06QKwB+13S5T+eBo1YAgu3sQ0dhRQ jf30hcN/AwtwVihh4a22c/yztW4avL2C1EXGmJrQjnfSN5O0a1afEM/TUoD/6ChR XwO6aAC8djEP9VZsVKV9IVwKpCUcOMlE252JKLCigMpKNf+0SvUQi+SJzOBPA+pB +X2eRO9oHMO2fssAP6wqlNqhI+0lveTVPORFSjmCqIBKezDMeLJLDd23CbyC32d+ mtpU3NOCafiYGMXT26KcI5/a8aRtK8BgwCFoyLxDr82ro/Kly5TXTrULET5w0iqJ wrQ6l5qc7qZIHHX0DWq+BdX84KM4s8CkRqKQY01Vi8qqkVxbpCGU7DSNQcdA0q2t 2jfGNpqEPe0mBCHMX3cd0Gc1s1OaD/udTRR8sMC6Qh6lBaB0Fl4= =6BTW -----END PGP SIGNATURE----- --63e6t6wtjncgu5iy-- From owner-svn-src-all@freebsd.org Mon Aug 26 02:29:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70042CC2F3; Mon, 26 Aug 2019 02:29:35 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gwv21dPCz3GXD; Mon, 26 Aug 2019 02:29:33 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x7Q2TMlC074267; Sun, 25 Aug 2019 19:29:22 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x7Q2TMSM074266; Sun, 25 Aug 2019 19:29:22 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201908260229.x7Q2TMSM074266@gndrsh.dnsmgr.net> Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests In-Reply-To: To: alan somers Date: Sun, 25 Aug 2019 19:29:22 -0700 (PDT) CC: Hiroki Sato , Alan Somers , Jan Sucan , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 46Gwv21dPCz3GXD X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [1.28 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.38)[0.385,0]; NEURAL_HAM_LONG(-0.72)[-0.724,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_MEDIUM(0.67)[0.670,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.15), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.05), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 02:29:35 -0000 [ Charset UTF-8 unsupported, converting... ] > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > > > Alan Somers wrote > > in : > > > > as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: > > as> > > > as> > Hi, > > as> > > > as> > Alan Somers wrote > > as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > > as> > > > as> > as> Author: asomers > > as> > as> Date: Fri Aug 23 15:22:20 2019 > > as> > as> New Revision: 351423 > > as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > > as> > as> > > as> > as> Log: > > as> > as> ping6: Rename options for better consistency with ping > > as> > as> > > as> > as> Now equivalent options have the same flags, and nonequivalent > > options have > > as> > as> different flags. This is a prelude to merging the two > > commands. > > as> > as> > > as> > as> Submitted by: J?n Su?an > > as> > as> MFC: Never > > as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) > > as> > as> Differential Revision: https://reviews.freebsd.org/D21345 > > as> > > > as> > I have an objection on renaming the existing option flags in > > ping6(8) > > as> > for compatibility with ping(8). > > as> > > > as> > Is it sufficient to add INET6 support to ping(8) with consistent > > as> > flags and keep CLI of ping6(8) backward compatible? People have > > used > > as> > ping6(8) for >15 years, so it is too late to rename the flags. I do > > as> > not think the renaming is useful if "ping -6 localhost" or "ping > > ::1" > > as> > works. > > as> > > > as> > -- Hiroki > > as> > > as> If ping works with inet6, then why would we want to keep a separate > > as> tool around? If it's just for the sake of people who don't want to or > > as> can't update scripts, would a version in ports suffice? > > > > Because removing (or renaming) it causes a POLA violation. Do we > > really have a strong, unavoidable reason to force people to rewrite > > their script now? This is still a fairly essential and actively used > > tool, not like rcp or rlogin. Although deprecating ping6(8) and > > removing it from the base system in the future release at some point > > may work, changing the existing interface will simply confuse people > > who have used IPv6 for a long time. > > > > In my understanding, the purpose to integrate ping(8) and ping6(8) > > into a single utility is to provide a consistent CLI and reduce > > duplicate code, not to break compatibility. > > > > -- Hiroki > > > > Those goals are incompatible. We can't provide a consistent CLI without > breaking compatibility because ping and ping6 have conflicting options. > And we can't keep ping6 around while also removing duplicate code because > that would be, well, duplicate code. Only incompatible in mind. $0 can easily be used to determine which set of getopt() to process in a single binary that then has unduplicated code to implement the set of final options. A bit more to code but should achive the single binary linked by 2 names processing 2 different option sets executing 1 set of common code. I am firmyly in the camp these changes are being made to well estabilish and probably heavily used utility by both humans and shell scripts. I was not happy with the changes to -n, but sat silient on that issue, with other things being done I need to chime in and say I think that this is poorly tought out with respect to downstream impact. > > When would be a better time than a major version bump to make a change like > this? > > The lack of a ping6 command in freebsd 13 should serve as a pretty obvious > reminder that scripts will need updating. I think that putting a version > of ping6 in ports should be a sufficient crutch for those who need it, > don't you? How does a copy in ports of the old ping6 code "remove duplicate code", that just changes the location of the duplication out of base where it shall certainly rot as unmaintained causing numerious consumers heart ache over time. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Mon Aug 26 03:50:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A03C2CE014; Mon, 26 Aug 2019 03:50:25 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GyhJ3ZwMz3Kyx; Mon, 26 Aug 2019 03:50:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f48.google.com with SMTP id l7so34007240ioj.6; Sun, 25 Aug 2019 20:50:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=6wbovqpq62M6hEcAoDTjKDkb+6dkjLMekazh+A1N9pk=; b=cNfrK25w22FMkf6wsjkCCU1WMLpRRh5HmmovNkUSOZdHHFKrGGc5dB8HKqjQTX6dob I4e1IcszghfqwWizRCydbBtKDm54vSrc14yJIn1gTOlFz0Anm+n/mh0qJSO7FgBMES/Z dX/nv6V+8g3B4lmmGwH5KbXHowQGbyP7SUvl0JQlpLUVtqmEJc7ODbv7thWgxmHQazL0 N3jDQDPv4xlbsYMXLfxeOYwxmoQYQOIHllArXJ+0r6m1ZBq9AdfglgGxbE6wjfUtZGNp KnOvuncUYffSQ70v4OAKb43UhPJEkxJ01oYNk2P0V9kCV3HVWFFqDWL0n3KUoVfdTj14 kXmg== X-Gm-Message-State: APjAAAWFSfFXZyf5PLUUY5Rf5++Bgj1Ulcwm0HIuFI8VZtmGGT8JXD5u mHeEGAOP1Mn1AnrV0rvOHSAu3coj X-Google-Smtp-Source: APXvYqz9iWgT25l0H1gTKCrXSWvMId9CmUF4V4kBL8GTbyYNzryolV24cPS7ti8QdgLl3VyqfI5GtA== X-Received: by 2002:a5d:8599:: with SMTP id f25mr21690204ioj.265.1566791422748; Sun, 25 Aug 2019 20:50:22 -0700 (PDT) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com. [209.85.166.42]) by smtp.gmail.com with ESMTPSA id k3sm12619476ioq.18.2019.08.25.20.50.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Aug 2019 20:50:22 -0700 (PDT) Received: by mail-io1-f42.google.com with SMTP id t3so33875151ioj.12; Sun, 25 Aug 2019 20:50:22 -0700 (PDT) X-Received: by 2002:a02:b604:: with SMTP id h4mr15214116jam.78.1566791422272; Sun, 25 Aug 2019 20:50:22 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826014726.mwddt4uwqoulewhh@mutt-hbsd> In-Reply-To: <20190826014726.mwddt4uwqoulewhh@mutt-hbsd> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sun, 25 Aug 2019 20:50:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Shawn Webb Cc: svn-src-head , svn-src-all , src-committers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46GyhJ3ZwMz3Kyx X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.48 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-5.64 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[48.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.65)[ip: (-7.52), ipnet: 209.85.128.0/17(-3.35), asn: 15169(-2.33), country: US(-0.05)]; RWL_MAILSPIKE_POSSIBLE(0.00)[48.166.85.209.rep.mailspike.net : 127.0.0.17]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 03:50:25 -0000 On Sun, Aug 25, 2019 at 6:47 PM Shawn Webb wrote: > I wonder if something like this could be done: Something like it could be; I suggested so two hours ago. > Somewhere in ping(8): > bool ping6_compat; > if (strcmp(argv[0], "ping6")) { > ping6_compat = true; You've gotten the sense of the basic C89 function strcmp() backwards. Maybe it's a security feature that way? You can add HardenedStrcmp to your Easy Feature Comparison page. Conrad From owner-svn-src-all@freebsd.org Mon Aug 26 04:35:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E7F9CEEE3; Mon, 26 Aug 2019 04:35:23 +0000 (UTC) (envelope-from sucanjan@gmail.com) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Gzh95VMDz3Mmw; Mon, 26 Aug 2019 04:35:21 +0000 (UTC) (envelope-from sucanjan@gmail.com) Received: by mail-wr1-x442.google.com with SMTP id s18so13932560wrn.1; Sun, 25 Aug 2019 21:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=cMmXbT221xByOLlnT27es9s58Q8Y01sWT+2f20LVC1s=; b=QBLiVDf0tMIsL7IFMJ6qV0wxXiPkJnPgDImztokP4n5LnmXZGLeWNbyHK7uF1QtQoi i/KLUDyDT+Rx18Rw2jTcd3kzlXdFKEIvq9VOSI5f/FDbz1JzlrUS6VGMlX9qzXZ7ICRp EUb9Xc+V2DVhxEubCeINJmomRxMRtDGGPNNwJqpCmGYa1jLWvEHZko1tzHroDOGK7JUc 2U9eLhqgwzI4lOTG9oSSZKpuVruDbpiUBGwM8RajtCSTu+ZT/kMZ8ZRjXrulCfjJoB+J yi7XoDCjDXQpovgDIwzwO8Aw02xSGZd0I+QQGkwObpwAonyWwxAUjLbdETfBJk65RvtH 1TuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=cMmXbT221xByOLlnT27es9s58Q8Y01sWT+2f20LVC1s=; b=kJuvTC8X890zJ3PDyTPWmvwLzCqx26/JftzzuaGE12+WM+jaBomKg111UarMv8ay6m 2tzRwZmQcUZygkfRypMeY3YFqU05rlKbbYi24UyOfRj0BYC5xUE99g8njZa0Kzqs7vlr Ek09ESZzCLeWvvkugfAArBbM8kh7iH5TW7oZlnfWs7UCOaD1VVEBmg6x81vb8QAtfgaF h0YqtvhqsUCAA22bTGrEum36XPkGb2G5DjlCAfWCW3sA4g6cGaC2bcChTRoD2i9zk2dJ 70DrJkYHTYDdGDAzKzmTWVJH8L8f0eBvjljshgcz9M8kLWnqzWWvJvu57ChGy/wsFVyj JVCA== X-Gm-Message-State: APjAAAXeHvwKr9paLIk2zeIeMgt1W18HdBqHvLvcxg3e/ElcJogdeY3o ED3brG82nX7+FIkRjpf7CbT60zSgrtXF+Q== X-Google-Smtp-Source: APXvYqwRTAKqU0i1WS5jMp+qy1m0cjO/GR1e5hEzs/kQzNjsrWR/mjRDUnX4zOryliteEby+b6GK3w== X-Received: by 2002:adf:afe7:: with SMTP id y39mr18932468wrd.350.1566793743802; Sun, 25 Aug 2019 21:29:03 -0700 (PDT) Received: from [192.168.1.102] (120.215.broadband18.iol.cz. [109.81.215.120]) by smtp.gmail.com with ESMTPSA id i93sm23865408wri.57.2019.08.25.21.29.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Aug 2019 21:29:03 -0700 (PDT) Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Alan Somers , "Conrad E. Meyer" Cc: Hiroki Sato , src-committers , svn-src-all , svn-src-head References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> From: Jan Sucan Message-ID: <379c3378-f9dd-4d6b-35ca-fa1ac7e6386b@gmail.com> Date: Mon, 26 Aug 2019 06:28:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 46Gzh95VMDz3Mmw X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=QBLiVDf0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of sucanjan@gmail.com designates 2a00:1450:4864:20::442 as permitted sender) smtp.mailfrom=sucanjan@gmail.com X-Spamd-Result: default: False [3.19 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(0.00)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(0.00)[gmail.com,none]; NEURAL_HAM_SHORT(-0.76)[-0.758,0]; RECEIVED_SPAMHAUS_PBL(0.00)[120.215.81.109.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_XBL(5.00)[120.215.81.109.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.4]; R_DKIM_ALLOW(0.00)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-0.07)[-0.065,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.986,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.67), ipnet: 2a00:1450::/32(-3.00), asn: 15169(-2.33), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; BAD_REP_POLICIES(0.10)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[]; GREYLIST(0.00)[pass,body] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 04:35:23 -0000 Hello, I can implement it. I suppose that ping6's manual page should be kept it this case. I was also thinking about printing a warning for each option renamed to lead a willing user to use the new unified option set of ping. It could be either only with -v, or by default and suppressed with -q. Or should the option translation be completely transparent? -Jan On 26. 8. 2019 1:58, Alan Somers wrote: > Jan (please keep him CCed on replies) has been musing about the same > thing. That might satisfy everyone. Jan, would it be straightforward > to implement? > -Alan > > On Sun, Aug 25, 2019 at 5:51 PM Conrad Meyer wrote: >> Hi Alan, Hiroki, >> >> It would be pretty easy to install a `ping6` link to the `ping(8)` >> binary with different option parsing (conditional on argv[0]). That >> removes most of the issues of code and space duplication, I think? >> And the goal would be for the 'ping6' name to retain option >> compatibility with historical ping6. >> >> It's not an uncommon pattern; for example, 'id', 'groups', and >> 'whoami' are all a single binary with multiple linked names. Another >> example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', >> 'clang++' and 'cpp' links to the same inode — and those have very >> different behavior depending on argv[0]. >> >> It's less work than forcing the ping6 compatibility crowd to create a >> port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable >> middle ground? >> >> Best, >> Conrad >> >> On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: >>> On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: >>>> Alan Somers wrote >>>> in : >>>> >>>> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: >>>> as> > >>>> as> > Hi, >>>> as> > >>>> as> > Alan Somers wrote >>>> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: >>>> as> > >>>> as> > as> Author: asomers >>>> as> > as> Date: Fri Aug 23 15:22:20 2019 >>>> as> > as> New Revision: 351423 >>>> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 >>>> as> > as> >>>> as> > as> Log: >>>> as> > as> ping6: Rename options for better consistency with ping >>>> as> > as> >>>> as> > as> Now equivalent options have the same flags, and nonequivalent options have >>>> as> > as> different flags. This is a prelude to merging the two commands. >>>> as> > as> >>>> as> > as> Submitted by: Ján Sučan >>>> as> > as> MFC: Never >>>> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) >>>> as> > as> Differential Revision: https://reviews.freebsd.org/D21345 >>>> as> > >>>> as> > I have an objection on renaming the existing option flags in ping6(8) >>>> as> > for compatibility with ping(8). >>>> as> > >>>> as> > Is it sufficient to add INET6 support to ping(8) with consistent >>>> as> > flags and keep CLI of ping6(8) backward compatible? People have used >>>> as> > ping6(8) for >15 years, so it is too late to rename the flags. I do >>>> as> > not think the renaming is useful if "ping -6 localhost" or "ping ::1" >>>> as> > works. >>>> as> > >>>> as> > -- Hiroki >>>> as> >>>> as> If ping works with inet6, then why would we want to keep a separate >>>> as> tool around? If it's just for the sake of people who don't want to or >>>> as> can't update scripts, would a version in ports suffice? >>>> >>>> Because removing (or renaming) it causes a POLA violation. Do we >>>> really have a strong, unavoidable reason to force people to rewrite >>>> their script now? This is still a fairly essential and actively used >>>> tool, not like rcp or rlogin. Although deprecating ping6(8) and >>>> removing it from the base system in the future release at some point >>>> may work, changing the existing interface will simply confuse people >>>> who have used IPv6 for a long time. >>>> >>>> In my understanding, the purpose to integrate ping(8) and ping6(8) >>>> into a single utility is to provide a consistent CLI and reduce >>>> duplicate code, not to break compatibility. >>>> >>>> -- Hiroki >>> >>> Those goals are incompatible. We can't provide a consistent CLI without breaking compatibility because ping and ping6 have conflicting options. And we can't keep ping6 around while also removing duplicate code because that would be, well, duplicate code. >>> >>> When would be a better time than a major version bump to make a change like this? >>> >>> The lack of a ping6 command in freebsd 13 should serve as a pretty obvious reminder that scripts will need updating. I think that putting a version of ping6 in ports should be a sufficient crutch for those who need it, don't you? From owner-svn-src-all@freebsd.org Mon Aug 26 04:40:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A999CEFD5 for ; Mon, 26 Aug 2019 04:40:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GzpJ4wW2z3MxS for ; Mon, 26 Aug 2019 04:40:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x842.google.com with SMTP id y26so16763234qto.4 for ; Sun, 25 Aug 2019 21:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fB79W3XA56WQpyZIzrce2Y7iAmv9V6dJXuK7zltBSV8=; b=rT4v0ZswWrY6OZ94caBrN6/7BQEp57q6+1vymCzuflykMxK568Fi/vDsEF9XfaguBO vywPOcXI2KFtlIdKxGzs5SZzsUmgGNUeZVdeUgImpqVeWBqxUxm2Vr0DGkTL2rvh/JeU 6R+skQh4bKJUotR9geaji1bhJZEuHYjSj8/3jcUeZoGIP4fE+O68jXCB77RDO7dUot0z 1hsiIU/wEewQnz1MIjvvDVAbyH51apQiwZdxzhBxZSqz1cGXmSSHe9OaLSzvT7m/B8TR F/xocbmCEpkuXMLpcr5IgTe/ojXV8cKd3INi4aEFYqNAhIZxQD1Tj4ZmBLuspRDTq58O eGBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fB79W3XA56WQpyZIzrce2Y7iAmv9V6dJXuK7zltBSV8=; b=YmCWhCgbnxEuM40+PduCDLm5Ha4UeIDu2gP3WszWC+/0Uk/dMZBwwcNrimS+PxY91N Z+Ac5WBtLbZ+ZcEoe/NCtUCVfLR8kkh6ewOA4cEHeO1zP9uk8N0QSX1KbD9E3pjiET45 Py06xHV5v76Wg/OdlLBc5WuoJtMFv7wa/KaGDigbQ2SvmILrJaGJPGkeoXa3y7YsS5t6 iffsqxax4hQV8kRcoGPgCvgni6fBeReYw+iD3LEeHvQNBpDTkyHE4mHy8G1EZ9L+W2a9 BIREr1i3mSV7usHMLTCOrHZe2yAGQGZ2xSJN41x8ikvZmcO0rGr+10WQxcVkpiarkukX IpEA== X-Gm-Message-State: APjAAAVtYPGaxeAJJpWFmdxFUCdyZecaSRfzIamDvkp/82SIonkXNy2E 5fJ1/VhG9FtGfUig4SpQR2TevJ2hNrjbyZqmnFydSQ== X-Google-Smtp-Source: APXvYqyacxT0XCsDJapjok8mNpQtJFtQMuYmj3JEZw01zs/Vm0sZDqiyxc/Hi94QqbKslLIFjOo1Cw+nzsrDRvXdMzA= X-Received: by 2002:ac8:4602:: with SMTP id p2mr15860269qtn.291.1566794439418; Sun, 25 Aug 2019 21:40:39 -0700 (PDT) MIME-Version: 1.0 References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> <379c3378-f9dd-4d6b-35ca-fa1ac7e6386b@gmail.com> In-Reply-To: <379c3378-f9dd-4d6b-35ca-fa1ac7e6386b@gmail.com> From: Warner Losh Date: Sun, 25 Aug 2019 22:40:27 -0600 Message-ID: Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Jan Sucan Cc: Alan Somers , "Conrad E. Meyer" , Hiroki Sato , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46GzpJ4wW2z3MxS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=rT4v0Zsw; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::842) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.59 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; RCVD_IN_DNSWL_NONE(0.00)[2.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.61)[ip: (2.22), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.33), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Aug 2019 04:40:41 -0000 On Sun, Aug 25, 2019, 10:35 PM Jan Sucan wrote: > Hello, > > I can implement it. I suppose that ping6's manual page should be kept it > this case. > The differences are small enough you may be able to combine man pages. I was also thinking about printing a warning for each option renamed to > lead a willing user to use the new unified option set of ping. It could > be either only with -v, or by default and suppressed with -q. Or should > the option translation be completely transparent? > This I'm unsure about., so I'll leave it to others to opine. Warner -Jan > > On 26. 8. 2019 1:58, Alan Somers wrote: > > Jan (please keep him CCed on replies) has been musing about the same > > thing. That might satisfy everyone. Jan, would it be straightforward > > to implement? > > -Alan > > > > On Sun, Aug 25, 2019 at 5:51 PM Conrad Meyer wrote: > >> Hi Alan, Hiroki, > >> > >> It would be pretty easy to install a `ping6` link to the `ping(8)` > >> binary with different option parsing (conditional on argv[0]). That > >> removes most of the issues of code and space duplication, I think? > >> And the goal would be for the 'ping6' name to retain option > >> compatibility with historical ping6. > >> > >> It's not an uncommon pattern; for example, 'id', 'groups', and > >> 'whoami' are all a single binary with multiple linked names. Another > >> example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', > >> 'clang++' and 'cpp' links to the same inode =E2=80=94 and those have v= ery > >> different behavior depending on argv[0]. > >> > >> It's less work than forcing the ping6 compatibility crowd to create a > >> port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable > >> middle ground? > >> > >> Best, > >> Conrad > >> > >> On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: > >>> On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > >>>> Alan Somers wrote > >>>> in SKvh1ZoiMAcagQJjPaRSvkML9J+BgpQsz5uNNbw@mail.gmail.com>: > >>>> > >>>> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato > wrote: > >>>> as> > > >>>> as> > Hi, > >>>> as> > > >>>> as> > Alan Somers wrote > >>>> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > >>>> as> > > >>>> as> > as> Author: asomers > >>>> as> > as> Date: Fri Aug 23 15:22:20 2019 > >>>> as> > as> New Revision: 351423 > >>>> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > >>>> as> > as> > >>>> as> > as> Log: > >>>> as> > as> ping6: Rename options for better consistency with ping > >>>> as> > as> > >>>> as> > as> Now equivalent options have the same flags, and > nonequivalent options have > >>>> as> > as> different flags. This is a prelude to merging the two > commands. > >>>> as> > as> > >>>> as> > as> Submitted by: J=C3=A1n Su=C4=8Dan > >>>> as> > as> MFC: Never > >>>> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019= ) > >>>> as> > as> Differential Revision: > https://reviews.freebsd.org/D21345 > >>>> as> > > >>>> as> > I have an objection on renaming the existing option flags in > ping6(8) > >>>> as> > for compatibility with ping(8). > >>>> as> > > >>>> as> > Is it sufficient to add INET6 support to ping(8) with > consistent > >>>> as> > flags and keep CLI of ping6(8) backward compatible? People > have used > >>>> as> > ping6(8) for >15 years, so it is too late to rename the > flags. I do > >>>> as> > not think the renaming is useful if "ping -6 localhost" or > "ping ::1" > >>>> as> > works. > >>>> as> > > >>>> as> > -- Hiroki > >>>> as> > >>>> as> If ping works with inet6, then why would we want to keep a > separate > >>>> as> tool around? If it's just for the sake of people who don't want > to or > >>>> as> can't update scripts, would a version in ports suffice? > >>>> > >>>> Because removing (or renaming) it causes a POLA violation. Do we > >>>> really have a strong, unavoidable reason to force people to rewrit= e > >>>> their script now? This is still a fairly essential and actively > used > >>>> tool, not like rcp or rlogin. Although deprecating ping6(8) and > >>>> removing it from the base system in the future release at some poi= nt > >>>> may work, changing the existing interface will simply confuse peop= le > >>>> who have used IPv6 for a long time. > >>>> > >>>> In my understanding, the purpose to integrate ping(8) and ping6(8) > >>>> into a single utility is to provide a consistent CLI and reduce > >>>> duplicate code, not to break compatibility. > >>>> > >>>> -- Hiroki > >>> > >>> Those goals are incompatible. We can't provide a consistent CLI > without breaking compatibility because ping and ping6 have conflicting > options. And we can't keep ping6 around while also removing duplicate co= de > because that would be, well, duplicate code. > >>> > >>> When would be a better time than a major version bump to make a chang= e > like this? > >>> > >>> The lack of a ping6 command in freebsd 13 should serve as a pretty > obvious reminder that scripts will need updating. I think that putting a > version of ping6 in ports should be a sufficient crutch for those who nee= d > it, don't you? > > > From owner-svn-src-all@freebsd.org Mon Aug 26 05:25:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5556CD03C0; Mon, 26 Aug 2019 05:25:04 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H0nW0xmBz3Q12; Mon, 26 Aug 2019 05:25:02 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 27UviVRdNUIS227UwinelM; Sun, 25 Aug 2019 23:25:01 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=iKhvJSA4AAAA:8 a=Wi8YH2NmAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=RVYa22C5S4XIXbcRN4UA:9 a=CjuIK1q_8ugA:10 a=odh9cflL3HIXMm4fY7Wr:22 a=dHv3ApjLk2iqpRL9FmoU:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 2E1A33C15; Sun, 25 Aug 2019 22:24:56 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7Q5OtMH055918; Sun, 25 Aug 2019 22:24:55 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7Q5Osnv055867; Sun, 25 Aug 2019 22:24:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908260524.x7Q5Osnv055867@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: rgrimes@freebsd.org cc: alan somers , Hiroki Sato , Alan Somers , Jan Sucan , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests In-reply-to: <201908260229.x7Q2TMSM074266@gndrsh.dnsmgr.net> References: <201908260229.x7Q2TMSM074266@gndrsh.dnsmgr.net> Comments: In-reply-to "Rodney W. Grimes" message dated "Sun, 25 Aug 2019 19:29:22 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 25 Aug 2019 22:24:54 -0700 X-CMAE-Envelope: MS4wfCZRke9oKm27/6pSw+1/3cu5WwLhZ9CUjVuJr+G5d8hZLEKeUvOIXyunGzPokASOSpbLYgWARMqM846PYeFjyJdCJWkKg5tzGwtvHvEGCX0xpDZMVB4w hIin+BkGoodh8NyM+DK+v0S0c/UI7gSMv5pvixI7H9hStiOXFWZhzzrnrWLZ4ZTO/FGqxOZfNBy5dscPM55ciwBif67kydjvbyn7yMZqTztxpTg6pE9OYn0n MsSdNNvVMwKX9VcFDZZTnzbXPcq2u4SAz569lTjJxJHWK48luvxM+nEcrj9YW4qtXkebanM13KFpHrXNd9DjaLEjS5MMR7yNVdjJJiuyktFDAabvcogVlJXz fBJDCEhS X-Rspamd-Queue-Id: 46H0nW0xmBz3Q12 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.9) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.97 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; IP_SCORE(-2.41)[ip: (-6.38), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_NONE(0.00)[9.134.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 05:25:04 -0000 In message <201908260229.x7Q2TMSM074266@gndrsh.dnsmgr.net>, "Rodney W. Grimes" writes: > [ Charset UTF-8 unsupported, converting... ] > > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > > > > > Alan Somers wrote > > > in > : > > > > > > as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: > > > as> > > > > as> > Hi, > > > as> > > > > as> > Alan Somers wrote > > > as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: > > > as> > > > > as> > as> Author: asomers > > > as> > as> Date: Fri Aug 23 15:22:20 2019 > > > as> > as> New Revision: 351423 > > > as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 > > > as> > as> > > > as> > as> Log: > > > as> > as> ping6: Rename options for better consistency with ping > > > as> > as> > > > as> > as> Now equivalent options have the same flags, and nonequivalent > > > options have > > > as> > as> different flags. This is a prelude to merging the two > > > commands. > > > as> > as> > > > as> > as> Submitted by: J?n Su?an > > > as> > as> MFC: Never > > > as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) > > > as> > as> Differential Revision: https://reviews.freebsd.org/D21345 > > > as> > > > > as> > I have an objection on renaming the existing option flags in > > > ping6(8) > > > as> > for compatibility with ping(8). > > > as> > > > > as> > Is it sufficient to add INET6 support to ping(8) with consistent > > > as> > flags and keep CLI of ping6(8) backward compatible? People have > > > used > > > as> > ping6(8) for >15 years, so it is too late to rename the flags. I > do > > > as> > not think the renaming is useful if "ping -6 localhost" or "ping > > > ::1" > > > as> > works. > > > as> > > > > as> > -- Hiroki > > > as> > > > as> If ping works with inet6, then why would we want to keep a separate > > > as> tool around? If it's just for the sake of people who don't want to o > r > > > as> can't update scripts, would a version in ports suffice? > > > > > > Because removing (or renaming) it causes a POLA violation. Do we > > > really have a strong, unavoidable reason to force people to rewrite > > > their script now? This is still a fairly essential and actively used > > > tool, not like rcp or rlogin. Although deprecating ping6(8) and > > > removing it from the base system in the future release at some point > > > may work, changing the existing interface will simply confuse people > > > who have used IPv6 for a long time. > > > > > > In my understanding, the purpose to integrate ping(8) and ping6(8) > > > into a single utility is to provide a consistent CLI and reduce > > > duplicate code, not to break compatibility. > > > > > > -- Hiroki > > > > > > > Those goals are incompatible. We can't provide a consistent CLI without > > breaking compatibility because ping and ping6 have conflicting options. > > And we can't keep ping6 around while also removing duplicate code because > > that would be, well, duplicate code. > > Only incompatible in mind. $0 can easily be used to determine which > set of getopt() to process in a single binary that then has unduplicated > code to implement the set of final options. A bit more to code but > should achive the single binary linked by 2 names processing 2 different > option sets executing 1 set of common code. > > I am firmyly in the camp these changes are being made to well estabilish > and probably heavily used utility by both humans and shell scripts. > > I was not happy with the changes to -n, but sat silient on that issue, > with other things being done I need to chime in and say I think that > this is poorly tought out with respect to downstream impact. > > > > > When would be a better time than a major version bump to make a change like > > this? > > > > The lack of a ping6 command in freebsd 13 should serve as a pretty obvious > > reminder that scripts will need updating. I think that putting a version > > of ping6 in ports should be a sufficient crutch for those who need it, > > don't you? > > How does a copy in ports of the old ping6 code "remove duplicate code", > that just changes the location of the duplication out of base where it > shall certainly rot as unmaintained causing numerious consumers heart > ache over time. Ports is a big issue, especially considering we're supporting previous versions of FreeBSD (stable/11 & stable/12) with an inconsistent ping6. Also agreed regarding checking *argv[0] to determine which getopt() to use. While we're at giving ping options some love and attention, shouldn't we also use getopt_long()? It is 2019 for that matter, and almost 2020 in a few months. > > -- > Rod Grimes rgrimes@freebsd.or > g > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Mon Aug 26 06:41:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D1E9D1958; Mon, 26 Aug 2019 06:41:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H2TT74xXz3y7J; Mon, 26 Aug 2019 06:41:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D608E1EEA; Mon, 26 Aug 2019 06:41:17 +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 x7Q6fH7g031136; Mon, 26 Aug 2019 06:41:17 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q6fHsb031135; Mon, 26 Aug 2019 06:41:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908260641.x7Q6fHsb031135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 26 Aug 2019 06:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351502 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 351502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 06:41:18 -0000 Author: delphij Date: Mon Aug 26 06:41:17 2019 New Revision: 351502 URL: https://svnweb.freebsd.org/changeset/base/351502 Log: Comment boot block checks and perform additional sanity checks: The following checks are now being enforced: - bpbBytesPerSec: only accept 512, 1024, 2048 and 4096. - bpbSecPerClust: only accept 1, 2, 4, 8, 16, 32, 64 and 128. - bpbResSectors: require non-zero. - bpbFATs: require non-zero. - bpbSectors: require zero for FAT32. - bpbFATsmall: require zero for FAT32. - bpbHugeSectors: require non-zero for FAT32. Bail out if the BPB contained values that do not meet these requirements. We also require FATsecs * FATsecs to not overflow 32-bit unsigned integer. Check for backup boot block was removed because the checker does not take corrective action, and msdosfs driver ignores it too. Modified: head/sbin/fsck_msdosfs/boot.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Mon Aug 26 00:46:39 2019 (r351501) +++ head/sbin/fsck_msdosfs/boot.c Mon Aug 26 06:41:17 2019 (r351502) @@ -33,6 +33,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include + +#include #include #include #include @@ -46,9 +49,7 @@ readboot(int dosfs, struct bootblock *boot) { u_char block[DOSBOOTBLOCKSIZE]; u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; - u_char backup[DOSBOOTBLOCKSIZE]; int ret = FSOK; - int i; if ((size_t)read(dosfs, block, sizeof block) != sizeof block) { perr("could not read boot block"); @@ -64,61 +65,133 @@ readboot(int dosfs, struct bootblock *boot) memset(boot, 0, sizeof *boot); boot->ValidFat = -1; - /* decode bios parameter block */ + /* Decode BIOS Parameter Block */ + + /* Bytes per sector: can only be 512, 1024, 2048 and 4096. */ boot->bpbBytesPerSec = block[11] + (block[12] << 8); + if (boot->bpbBytesPerSec < DOSBOOTBLOCKSIZE_REAL || + boot->bpbBytesPerSec > DOSBOOTBLOCKSIZE || + !powerof2(boot->bpbBytesPerSec)) { + pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); + return FSFATAL; + } + + /* Sectors per cluster: can only be: 1, 2, 4, 8, 16, 32, 64, 128. */ boot->bpbSecPerClust = block[13]; + if (boot->bpbSecPerClust == 0 || !powerof2(boot->bpbSecPerClust)) { + pfatal("Invalid cluster size: %u", boot->bpbSecPerClust); + return FSFATAL; + } + + /* Reserved sectors: must be non-zero */ boot->bpbResSectors = block[14] + (block[15] << 8); + if (boot->bpbResSectors < 1) { + pfatal("Invalid reserved sectors: %u", + boot->bpbResSectors); + return FSFATAL; + } + + /* Number of FATs */ boot->bpbFATs = block[16]; + if (boot->bpbFATs == 0) { + pfatal("Invalid number of FATs: %u", boot->bpbFATs); + return FSFATAL; + } + + /* Root directory entries for FAT12 and FAT16 */ boot->bpbRootDirEnts = block[17] + (block[18] << 8); + if (!boot->bpbRootDirEnts) { + /* bpbRootDirEnts = 0 suggests that we are FAT32 */ + boot->flags |= FAT32; + } + + /* Total sectors (16 bits) */ boot->bpbSectors = block[19] + (block[20] << 8); + if (boot->bpbSectors != 0 && (boot->flags & FAT32)) { + pfatal("Invalid 16-bit total sector count on FAT32: %u", + boot->bpbSectors); + return FSFATAL; + } + + /* Media type: ignored */ boot->bpbMedia = block[21]; + + /* FAT12/FAT16: 16-bit count of sectors per FAT */ boot->bpbFATsmall = block[22] + (block[23] << 8); + if (boot->bpbFATsmall != 0 && (boot->flags & FAT32)) { + pfatal("Invalid 16-bit FAT sector count on FAT32: %u", + boot->bpbFATsmall); + return FSFATAL; + } + + /* Legacy CHS geometry numbers: ignored */ boot->SecPerTrack = block[24] + (block[25] << 8); boot->bpbHeads = block[26] + (block[27] << 8); + + /* Hidden sectors: ignored */ boot->bpbHiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24); + + /* Total sectors (32 bits) */ boot->bpbHugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24); + if (boot->bpbHugeSectors == 0) { + if (boot->flags & FAT32) { + pfatal("FAT32 with sector count of zero"); + return FSFATAL; + } else if (boot->bpbSectors == 0) { + pfatal("FAT with sector count of zero"); + return FSFATAL; + } + boot->NumSectors = boot->bpbSectors; + } else { + if (boot->bpbSectors != 0) { + pfatal("Invalid FAT sector count"); + return FSFATAL; + } + boot->NumSectors = boot->bpbHugeSectors; + } - boot->FATsecs = boot->bpbFATsmall; - if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0 || - boot->bpbBytesPerSec / DOSBOOTBLOCKSIZE_REAL == 0) { - pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); - return FSFATAL; - } - if (boot->bpbFATs == 0) { - pfatal("Invalid number of FATs: %u", boot->bpbFATs); - return FSFATAL; - } - if (!boot->bpbRootDirEnts) - boot->flags |= FAT32; + + if (boot->flags & FAT32) { + /* If the OEM Name field is EXFAT, it's not FAT32, so bail */ + if (!memcmp(&block[3], "EXFAT ", 8)) { + pfatal("exFAT filesystem is not supported."); + return FSFATAL; + } + + /* 32-bit count of sectors per FAT */ boot->FATsecs = block[36] + (block[37] << 8) + (block[38] << 16) + (block[39] << 24); + if (block[40] & 0x80) boot->ValidFat = block[40] & 0x0f; - /* check version number: */ + /* FAT32 version, bail out if not 0.0 */ if (block[42] || block[43]) { - /* Correct? XXX */ pfatal("Unknown file system version: %x.%x", block[43], block[42]); return FSFATAL; } + + /* + * Cluster number of the first cluster of root directory. + * + * Should be 2 but do not require it. + */ boot->bpbRootClust = block[44] + (block[45] << 8) + (block[46] << 16) + (block[47] << 24); + + /* Sector number of the FSInfo structure, usually 1 */ boot->bpbFSInfo = block[48] + (block[49] << 8); + + /* Sector number of the backup boot block, ignored */ boot->bpbBackup = block[50] + (block[51] << 8); - /* If the OEM Name field is EXFAT, it's not FAT32, so bail */ - if (!memcmp(&block[3], "EXFAT ", 8)) { - pfatal("exFAT filesystem is not supported."); - return FSFATAL; - } - - /* check basic parameters */ - if ((boot->bpbFSInfo == 0) || (boot->bpbSecPerClust == 0)) { + /* Check basic parameters */ + if (boot->bpbFSInfo == 0) { /* * Either the BIOS Parameter Block has been corrupted, * or this is not a FAT32 filesystem, most likely an @@ -127,6 +200,8 @@ readboot(int dosfs, struct bootblock *boot) pfatal("Invalid FAT32 Extended BIOS Parameter Block"); return FSFATAL; } + + /* Read in and verify the FSInfo block */ if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET) != boot->bpbFSInfo * boot->bpbBytesPerSec || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) { @@ -164,8 +239,8 @@ readboot(int dosfs, struct bootblock *boot) ret = FSBOOTMOD; } else boot->bpbFSInfo = 0; - } - if (boot->bpbFSInfo) { + } else { + /* We appear to have a valid FSInfo block, decode */ boot->FSFree = fsinfo[0x1e8] + (fsinfo[0x1e9] << 8) + (fsinfo[0x1ea] << 16) + (fsinfo[0x1eb] << 24); @@ -173,45 +248,17 @@ readboot(int dosfs, struct bootblock *boot) + (fsinfo[0x1ee] << 16) + (fsinfo[0x1ef] << 24); } - - if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec, - SEEK_SET) - != boot->bpbBackup * boot->bpbBytesPerSec - || read(dosfs, backup, sizeof backup) != sizeof backup) { - perr("could not read backup bootblock"); - return FSFATAL; - } - backup[65] = block[65]; /* XXX */ - if (memcmp(block + 11, backup + 11, 79)) { - /* - * XXX We require a reference that explains - * that these bytes need to match, or should - * drop the check. gdt@NetBSD has observed - * filesystems that work fine under Windows XP - * and NetBSD that do not match, so the - * requirement is suspect. For now, just - * print out useful information and continue. - */ - pwarn("backup (block %d) mismatch with primary bootblock:\n", - boot->bpbBackup); - for (i = 11; i < 11 + 90; i++) { - if (block[i] != backup[i]) - pwarn("\ti=%d\tprimary 0x%02x\tbackup 0x%02x\n", - i, block[i], backup[i]); - } - } - /* Check backup bpbFSInfo? XXX */ + } else { + /* !FAT32: FAT12/FAT16 */ + boot->FATsecs = boot->bpbFATsmall; } - if (boot->bpbSecPerClust == 0) { - pfatal("Invalid cluster size: %u", boot->bpbSecPerClust); + if (boot->FATsecs > UINT32_MAX / boot->bpbFATs) { + pfatal("Invalid FATs(%u) with FATsecs(%zu)", + boot->bpbFATs, (size_t)boot->FATsecs); return FSFATAL; } - if (boot->bpbSectors) { - boot->bpbHugeSectors = 0; - boot->NumSectors = boot->bpbSectors; - } else - boot->NumSectors = boot->bpbHugeSectors; + boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec + boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - From owner-svn-src-all@freebsd.org Mon Aug 26 08:06:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A79CD3FD4; Mon, 26 Aug 2019 08:06:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H4Mb3dbZz447J; Mon, 26 Aug 2019 08:06:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E33C2ED2; Mon, 26 Aug 2019 08:06:19 +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 x7Q86JMa083526; Mon, 26 Aug 2019 08:06:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q86Jcg083525; Mon, 26 Aug 2019 08:06:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908260806.x7Q86Jcg083525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Aug 2019 08:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351503 - stable/12/tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/tests/sys/kern X-SVN-Commit-Revision: 351503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 08:06:19 -0000 Author: kib Date: Mon Aug 26 08:06:18 2019 New Revision: 351503 URL: https://svnweb.freebsd.org/changeset/base/351503 Log: MFC r351210: sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach PR: 237657 Modified: stable/12/tests/sys/kern/pdeathsig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/kern/pdeathsig.c ============================================================================== --- stable/12/tests/sys/kern/pdeathsig.c Mon Aug 26 06:41:17 2019 (r351502) +++ stable/12/tests/sys/kern/pdeathsig.c Mon Aug 26 08:06:18 2019 (r351503) @@ -305,7 +305,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) WSTOPSIG(status)); assert(rc == 0); - ptrace(PT_DETACH, c_pid, 0, 0); + waitpid(c_pid, &status, 0); + if (!WIFEXITED(status)) + ptrace(PT_DETACH, c_pid, 0, 0); _exit(0); } From owner-svn-src-all@freebsd.org Mon Aug 26 08:07:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9B5DD405A; Mon, 26 Aug 2019 08:07:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H4NZ5pgWz44Fm; Mon, 26 Aug 2019 08:07: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8F9B2EDB; Mon, 26 Aug 2019 08:07: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 x7Q87A5M083644; Mon, 26 Aug 2019 08:07:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q87AUW083643; Mon, 26 Aug 2019 08:07:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908260807.x7Q87AUW083643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Aug 2019 08:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351504 - stable/12/tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/tests/sys/kern X-SVN-Commit-Revision: 351504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 08:07:11 -0000 Author: kib Date: Mon Aug 26 08:07:10 2019 New Revision: 351504 URL: https://svnweb.freebsd.org/changeset/base/351504 Log: MFC r351211: sys.kern.pdeathsig.signal_delivered_ptrace: fix startup. PR: 237657 Modified: stable/12/tests/sys/kern/pdeathsig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/kern/pdeathsig.c ============================================================================== --- stable/12/tests/sys/kern/pdeathsig.c Mon Aug 26 08:06:18 2019 (r351503) +++ stable/12/tests/sys/kern/pdeathsig.c Mon Aug 26 08:07:10 2019 (r351504) @@ -229,6 +229,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) int rc; int pipe_ca[2]; int pipe_db[2]; + int pipe_cd[2]; char buffer; int status; @@ -236,6 +237,8 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) ATF_REQUIRE(rc == 0); rc = pipe(pipe_db); ATF_REQUIRE(rc == 0); + rc = pipe(pipe_cd); + assert(rc == 0); rc = fork(); ATF_REQUIRE(rc != -1); @@ -263,6 +266,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum); assert(rc == 0); + rc = write(pipe_cd[1], "x", 1); + assert(rc == 1); + /* wait for B to die and signal us... */ signum = 0xdeadbeef; rc = sigwait(&sigset, &signum); @@ -292,6 +298,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0); assert(rc == 0); + + rc = read(pipe_cd[0], &buffer, 1); + assert(rc == 1); /* tell B that we're ready for it to exit now */ rc = write(pipe_db[1], ".", 1); From owner-svn-src-all@freebsd.org Mon Aug 26 08:07:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4D18D40CC; Mon, 26 Aug 2019 08:07:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H4PH4N5Jz44ND; Mon, 26 Aug 2019 08:07:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7824E2EE4; Mon, 26 Aug 2019 08:07:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7Q87lJH083745; Mon, 26 Aug 2019 08:07:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q87lVP083744; Mon, 26 Aug 2019 08:07:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908260807.x7Q87lVP083744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Aug 2019 08:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351505 - stable/11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/tests/sys/kern X-SVN-Commit-Revision: 351505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 08:07:47 -0000 Author: kib Date: Mon Aug 26 08:07:47 2019 New Revision: 351505 URL: https://svnweb.freebsd.org/changeset/base/351505 Log: MFC r351210: sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach PR: 237657 Modified: stable/11/tests/sys/kern/pdeathsig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/pdeathsig.c ============================================================================== --- stable/11/tests/sys/kern/pdeathsig.c Mon Aug 26 08:07:10 2019 (r351504) +++ stable/11/tests/sys/kern/pdeathsig.c Mon Aug 26 08:07:47 2019 (r351505) @@ -305,7 +305,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) WSTOPSIG(status)); assert(rc == 0); - ptrace(PT_DETACH, c_pid, 0, 0); + waitpid(c_pid, &status, 0); + if (!WIFEXITED(status)) + ptrace(PT_DETACH, c_pid, 0, 0); _exit(0); } From owner-svn-src-all@freebsd.org Mon Aug 26 08:08:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 479CDD412A; Mon, 26 Aug 2019 08:08:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H4Pr1CFlz44V9; Mon, 26 Aug 2019 08:08: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B2D22EE6; Mon, 26 Aug 2019 08:08: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 x7Q88FeJ083841; Mon, 26 Aug 2019 08:08:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q88F3B083840; Mon, 26 Aug 2019 08:08:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908260808.x7Q88F3B083840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 26 Aug 2019 08:08: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: r351506 - stable/11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/tests/sys/kern X-SVN-Commit-Revision: 351506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 08:08:16 -0000 Author: kib Date: Mon Aug 26 08:08:15 2019 New Revision: 351506 URL: https://svnweb.freebsd.org/changeset/base/351506 Log: MFC r351211: sys.kern.pdeathsig.signal_delivered_ptrace: fix startup. PR: 237657 Modified: stable/11/tests/sys/kern/pdeathsig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/pdeathsig.c ============================================================================== --- stable/11/tests/sys/kern/pdeathsig.c Mon Aug 26 08:07:47 2019 (r351505) +++ stable/11/tests/sys/kern/pdeathsig.c Mon Aug 26 08:08:15 2019 (r351506) @@ -229,6 +229,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) int rc; int pipe_ca[2]; int pipe_db[2]; + int pipe_cd[2]; char buffer; int status; @@ -236,6 +237,8 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) ATF_REQUIRE(rc == 0); rc = pipe(pipe_db); ATF_REQUIRE(rc == 0); + rc = pipe(pipe_cd); + assert(rc == 0); rc = fork(); ATF_REQUIRE(rc != -1); @@ -263,6 +266,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum); assert(rc == 0); + rc = write(pipe_cd[1], "x", 1); + assert(rc == 1); + /* wait for B to die and signal us... */ signum = 0xdeadbeef; rc = sigwait(&sigset, &signum); @@ -292,6 +298,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc) rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0); assert(rc == 0); + + rc = read(pipe_cd[0], &buffer, 1); + assert(rc == 1); /* tell B that we're ready for it to exit now */ rc = write(pipe_db[1], ".", 1); From owner-svn-src-all@freebsd.org Mon Aug 26 09:10:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA872D5628; Mon, 26 Aug 2019 09:10:23 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H5nV5BbWz47Px; Mon, 26 Aug 2019 09:10:21 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id EBC278D4A13E; Mon, 26 Aug 2019 08:59:51 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id D97D4E7088C; Mon, 26 Aug 2019 08:59:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id VkL5k9jmMkFk; Mon, 26 Aug 2019 08:59:47 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:6cf4:379e:a51d:13c3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id CCDC6E70824; Mon, 26 Aug 2019 08:59:46 +0000 (UTC) From: "Bjoern A. Zeeb" To: "alan somers" Cc: "Hiroki Sato" , "Alan Somers" , "Jan Sucan" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests Date: Mon, 26 Aug 2019 08:59:45 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: <4D99F70B-5BFD-447A-B833-D4F73CEECFF2@lists.zabbadoz.net> In-Reply-To: References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46H5nV5BbWz47Px X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 195.201.62.131 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-4.35 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.201.62.131]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[zabbadoz.net]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; RCPT_COUNT_SEVEN(0.00)[7]; IP_SCORE(-1.11)[ipnet: 195.201.0.0/16(-3.75), asn: 24940(-1.79), country: DE(-0.01)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:195.201.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 09:10:23 -0000 On 25 Aug 2019, at 20:26, alan somers wrote: > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: > >> Alan Somers wrote >> in >> : >> >> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato >> wrote: >> as> > >> as> > Hi, >> as> > >> as> > Alan Somers wrote >> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: >> as> > >> as> > as> Author: asomers >> as> > as> Date: Fri Aug 23 15:22:20 2019 >> as> > as> New Revision: 351423 >> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 >> as> > as> >> as> > as> Log: >> as> > as> ping6: Rename options for better consistency with ping >> as> > as> >> as> > as> Now equivalent options have the same flags, and >> nonequivalent >> options have >> as> > as> different flags. This is a prelude to merging the two >> commands. >> as> > as> >> as> > as> Submitted by: Ján Sučan >> as> > as> MFC: Never >> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) >> as> > as> Differential Revision: >> https://reviews.freebsd.org/D21345 >> as> > >> as> > I have an objection on renaming the existing option flags in >> ping6(8) >> as> > for compatibility with ping(8). >> as> > >> as> > Is it sufficient to add INET6 support to ping(8) with >> consistent >> as> > flags and keep CLI of ping6(8) backward compatible? People >> have >> used >> as> > ping6(8) for >15 years, so it is too late to rename the flags. >> I do >> as> > not think the renaming is useful if "ping -6 localhost" or >> "ping >> ::1" >> as> > works. >> as> > >> as> > -- Hiroki >> as> >> as> If ping works with inet6, then why would we want to keep a >> separate >> as> tool around? If it's just for the sake of people who don't want >> to or >> as> can't update scripts, would a version in ports suffice? >> >> Because removing (or renaming) it causes a POLA violation. Do we >> really have a strong, unavoidable reason to force people to rewrite >> their script now? This is still a fairly essential and actively >> used >> tool, not like rcp or rlogin. Although deprecating ping6(8) and >> removing it from the base system in the future release at some point >> may work, changing the existing interface will simply confuse people >> who have used IPv6 for a long time. >> >> In my understanding, the purpose to integrate ping(8) and ping6(8) >> into a single utility is to provide a consistent CLI and reduce >> duplicate code, not to break compatibility. >> >> -- Hiroki >> > > Those goals are incompatible. We can't provide a consistent CLI > without > breaking compatibility because ping and ping6 have conflicting > options. > And we can't keep ping6 around while also removing duplicate code > because > that would be, well, duplicate code. > > When would be a better time than a major version bump to make a change > like > this? > > The lack of a ping6 command in freebsd 13 should serve as a pretty > obvious > reminder that scripts will need updating. I think that putting a > version > of ping6 in ports should be a sufficient crutch for those who need it, > don't you? No. I have systems without ping as I have systems without any INET support. We do use ping(though not ping6 yet imho) in startup scripts so we consider it essential to the base system. If you migrate ping6 into ping the first thing I’ll want to be able is to compile one or the other address family out and that’ll basically give me the same we have today + a name change I have to deal with unless argv[0] tricks and a hardlink are done. (Hint: if you make the compile out happen, deal with the fact that ping and ping6 can be there without the hardlink to the other — a bit of Makefile glue — and migrate it all in based on argv[0], I think I can be happy). In other notes (and I keep saying that), I can see a world when ping doesn’t exist anymore as IPv4 doesn’t exist anymore (I partially already live in that world). The fact that people still do not prepare themselves for this time is a bit strange to me as by the time FreeBSD 14 is still in support this IPv6-only world might very well happen for a majority of people. And FreeBSD 14-CURRENT really is only a year away now. So breaking what’s been good for almost 20 years now for a few more years doesn’t really seem to be worth to me. Just my 2cts, Bjoern From owner-svn-src-all@freebsd.org Mon Aug 26 09:29:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9291AD5AE1; Mon, 26 Aug 2019 09:29:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H6CH3B0Pz48Jm; Mon, 26 Aug 2019 09:29:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A69F3FA0; Mon, 26 Aug 2019 09:29:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7Q9TFio031703; Mon, 26 Aug 2019 09:29:15 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7Q9TF12031702; Mon, 26 Aug 2019 09:29:15 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201908260929.x7Q9TF12031702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 26 Aug 2019 09:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351507 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 351507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 09:29:15 -0000 Author: ae Date: Mon Aug 26 09:29:14 2019 New Revision: 351507 URL: https://svnweb.freebsd.org/changeset/base/351507 Log: MFC r351214: Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose(). PR: 239893 Modified: stable/12/sys/kern/uipc_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Mon Aug 26 08:08:15 2019 (r351506) +++ stable/12/sys/kern/uipc_socket.c Mon Aug 26 09:29:14 2019 (r351507) @@ -1131,9 +1131,9 @@ drop: so->so_state |= SS_NOFDREF; sorele(so); if (listening) { - struct socket *sp; + struct socket *sp, *tsp; - TAILQ_FOREACH(sp, &lqueue, so_list) { + TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { SOCK_LOCK(sp); if (sp->so_count == 0) { SOCK_UNLOCK(sp); From owner-svn-src-all@freebsd.org Mon Aug 26 10:16:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46004D6C9F; Mon, 26 Aug 2019 10:16:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H7G70tY8z4Bp5; Mon, 26 Aug 2019 10:16:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFDAF48ED; Mon, 26 Aug 2019 10:16:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7QAGkYv061465; Mon, 26 Aug 2019 10:16:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QAGkU4061464; Mon, 26 Aug 2019 10:16:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908261016.x7QAGkU4061464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 26 Aug 2019 10:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351508 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 351508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 10:16:47 -0000 Author: trasz Date: Mon Aug 26 10:16:46 2019 New Revision: 351508 URL: https://svnweb.freebsd.org/changeset/base/351508 Log: .Xr ports(7) and development(7). MFC after: 2 weeks Modified: head/share/man/man7/development.7 head/share/man/man7/ports.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Mon Aug 26 09:29:14 2019 (r351507) +++ head/share/man/man7/development.7 Mon Aug 26 10:16:46 2019 (r351508) @@ -163,6 +163,7 @@ make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Xr witness 4 , .Xr build 7 , .Xr hier 7 , +.Xr ports 7 , .Xr release 7 , .Xr locking 9 , .Xr style 9 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Mon Aug 26 09:29:14 2019 (r351507) +++ head/share/man/man7/ports.7 Mon Aug 26 10:16:46 2019 (r351508) @@ -617,6 +617,7 @@ is going to be built with Python 3.7 support.) .Sh SEE ALSO .Xr make 1 , .Xr make.conf 5 , +.Xr development 7 , .Xr pkg 7 , .Xr portsnap 8 .Pp From owner-svn-src-all@freebsd.org Mon Aug 26 10:18:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28BADD6D37; Mon, 26 Aug 2019 10:18:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H7Hw08MQz4Bxl; Mon, 26 Aug 2019 10:18:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAAFC48EE; Mon, 26 Aug 2019 10:18:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7QAIJho061579; Mon, 26 Aug 2019 10:18:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QAIJi1061578; Mon, 26 Aug 2019 10:18:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908261018.x7QAIJi1061578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 26 Aug 2019 10:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351509 - head/usr.bin/ktrace X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/ktrace X-SVN-Commit-Revision: 351509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 10:18:20 -0000 Author: trasz Date: Mon Aug 26 10:18:19 2019 New Revision: 351509 URL: https://svnweb.freebsd.org/changeset/base/351509 Log: Make it clear what the userland traces are in the ktrace(1) man page. MFC after: 2 weeks Modified: head/usr.bin/ktrace/ktrace.1 Modified: head/usr.bin/ktrace/ktrace.1 ============================================================================== --- head/usr.bin/ktrace/ktrace.1 Mon Aug 26 10:16:46 2019 (r351508) +++ head/usr.bin/ktrace/ktrace.1 Mon Aug 26 10:18:19 2019 (r351509) @@ -28,7 +28,7 @@ .\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 24, 2017 +.Dd August 26, 2019 .Dt KTRACE 1 .Os .Sh NAME @@ -130,7 +130,8 @@ trace signal processing .It Cm t trace various structures .It Cm u -userland traces +userland traces generated by +.Xr utrace 2 .It Cm w context switches .It Cm y @@ -184,7 +185,8 @@ Disable tracing of all user-owned processes: .Xr dtrace 1 , .Xr kdump 1 , .Xr truss 1 , -.Xr ktrace 2 +.Xr ktrace 2 , +.Xr utrace 2 .Sh HISTORY The .Nm From owner-svn-src-all@freebsd.org Mon Aug 26 10:47:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 297B0D76AE for ; Mon, 26 Aug 2019 10:47:50 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46H7xw0kLDz4DXw for ; Mon, 26 Aug 2019 10:47:47 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x730.google.com with SMTP id w18so13650552qki.0 for ; Mon, 26 Aug 2019 03:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mx9nf31lrxEqn3Juf4X7wXJzCmO/IHQZjEJRDOmvchA=; b=a6ijpnV82B4dS8R3rRoqG4wYmFTWmY3IkVubkNar2u5lBMxnac57mASX+K+jMYyXkD FhOX9WGY0ehLebp9iNU3hU6CqQuNBYnMU6UnbToN1NNXIvBRYN234TuZSCgtEJc04vmF w7Oznl5Nf4qiJeH/AtTvvTN0OJHBjmIYYUx6OMqiGPocuc9hLg2bLJbJDBs+NEWadqXy QSup3aQxjexIjKvdQvOlTIecbT4O7hY16rroJHW15uBXd7otgzqhRscfelkQgglbCPp/ HNph6yW2dymJRwG/cnuPKNj42c7HwFfkWc/87xBmC+470VdvXdlYIbJgs8GnU48W9k40 K8bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mx9nf31lrxEqn3Juf4X7wXJzCmO/IHQZjEJRDOmvchA=; b=e9T9zP3bSanOMgxQnDn1PpeuVAmKisCr9RNQFVyFWaU1OQ7T3Ojo2Sm1fQaSj1orz9 57XFKtdI/iSxnatYiWGVm1WMJ9JG7L78IXoOPXCUfGlgUcyHKgtQq1h1RPuAusDXRb6a d98eBGdXdnpw3cguqhWKRCX4YjGvKFKCjfOCd/8GGlp9+R81fn1l7GWTQzFEYd/bT6rh vDbYL+ANJCtGLkiXUJPpjF9Bs5i7sEjnintsRgLgrGG2Bzi6qwNksWSpHNbPtFZiZt2I 3N7aLaCzc96G9SFipvqUq+e12u6cajUYRfjVz3p4sRkdEV38X+2B0cCHuNSAXWmY2/z0 4Z2Q== X-Gm-Message-State: APjAAAW02Je4HpriMHHjwEAHtMb3VGO2hEk8wvCQCH9l8VUCulPS4nUQ rdT9QqhNYQkzssZEWDH2XlhJ5Q== X-Google-Smtp-Source: APXvYqyP7LJt15A22HQSEgx0nEjB4dcHW2C6zqR78W+CeQkpjdv+j/12YDo9I3757thMplBE4vOMiw== X-Received: by 2002:ae9:e916:: with SMTP id x22mr15751087qkf.296.1566816466648; Mon, 26 Aug 2019 03:47:46 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id a135sm5858699qkg.72.2019.08.26.03.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 03:47:45 -0700 (PDT) Date: Mon, 26 Aug 2019 06:47:45 -0400 From: Shawn Webb To: Conrad Meyer Cc: svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests Message-ID: <20190826104745.yykfnboikehj6yxn@mutt-hbsd> References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826014726.mwddt4uwqoulewhh@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x3loc3dl7k4nv76w" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 46H7xw0kLDz4DXw X-Spamd-Bar: -------- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=a6ijpnV8; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::730 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-8.03 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.99)[-0.995,0]; RCVD_IN_DNSWL_NONE(0.00)[0.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.93)[ip: (-9.41), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.33), country: US(-0.05)]; RECEIVED_SPAMHAUS_PBL(0.00)[239.118.196.151.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 10:47:50 -0000 --x3loc3dl7k4nv76w Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 25, 2019 at 08:50:11PM -0700, Conrad Meyer wrote: > On Sun, Aug 25, 2019 at 6:47 PM Shawn Webb w= rote: > > I wonder if something like this could be done: >=20 > Something like it could be; I suggested so two hours ago. >=20 > > Somewhere in ping(8): > > bool ping6_compat; > > if (strcmp(argv[0], "ping6")) { > > ping6_compat =3D true; >=20 > You've gotten the sense of the basic C89 function strcmp() backwards. > Maybe it's a security feature that way? You can add HardenedStrcmp to > your Easy Feature Comparison page. I'll keep that in mind should FreeBSD implement it, enabling us to adopt it. :) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --x3loc3dl7k4nv76w Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl1juMsACgkQ/y5nonf4 4fqsNQ/+KMEhgzIhHK+khIhIoMAiLCArrjt9PUr8u+fFPM+LZ9XaaledMnpaa+0J kEqWVLUyXM/h35gU5bgKcMHLTntpjITdBoq9E/KpnjNVfRRx6QmHIae3a/hvSDDH UOlKgo/2qi713sTysQ+Jb5w8UVMNdyP6b3omTkBRx6tK13q0dJNfNPHRclOHRC9d WovgNOiwwAZP7MibWGFeN8367JjDuWsD3vLj9O17Sf5crK2FDDJ3xrb1qHttvcmB k1cTdwSwBn2qx3umwv7DHuAcVAswQQ+71Sh7Ldhk/zIaP1a9qNyO51wEnY1+sEGU 6k4k2gaA0gGOn3P68Z+s1tZt7qsJm1+OIs/J5rRzbga5yE9pFFekgHnbEMHEsGaX Ie3CYyobDg/6gzkGfl2OmQa+IjqJRwFKsIqxz7tA3cxCQvqGQs3pjTUuV89ySmRT qQCjCCtuKoxWuIU5PEDGe6yKFaRFG4RY1hiUJorLb1OILpaU1bLB74sdai2SJNow 3TtByvYqZBT2tmJwBw3oZ/8fviTajuVWNr2W7kGHHQFSzojovJz8pJgvgVz0F/si Ww7QAfzwJ4LaX+F7LT7a332Sg+O3hhBlw3fPnpqBHrtMjxe62XaNOGiZtkcrTT+f K7kMaMSF3Qwif/rVO5o5EIefg/E1PZ1xipFqejZZkenlNsZIHtA= =FVCC -----END PGP SIGNATURE----- --x3loc3dl7k4nv76w-- From owner-svn-src-all@freebsd.org Mon Aug 26 13:18:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3E3CDBAAC; Mon, 26 Aug 2019 13:18:28 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HCHl6jWbz4Qhc; Mon, 26 Aug 2019 13:18:27 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2Et5iXohaUIS22Et7ioCkU; Mon, 26 Aug 2019 07:18:25 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=xqWC_Br6kY4A:10 a=FmdZ9Uzk2mMA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=1jjyFtX1wCNYCS2Dt-UA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from [IPv6:2605:8d80:405:4266:152f:7238:2e01:55c7] (unknown [72.143.220.104]) by spqr.komquats.com (Postfix) with ESMTPSA id EAABB152; Mon, 26 Aug 2019 06:18:22 -0700 (PDT) Date: Mon, 26 Aug 2019 06:17:57 -0700 In-Reply-To: <201908250513.x7P5DFFx017824@repo.freebsd.org> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Cy Schubert Message-ID: <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> X-CMAE-Envelope: MS4wfGPaZVSnU2Fglh/jm5hdyR2pMJju+aclvWYEHb0sSIzB+0obTyD0U3BMctTLTuAMYSSZLbdPoFg4Ztf5OB4YAdkbb1/jpkIgkmWF8LI23A8jmaU6JhvL xLrWcrMFsa4w6/eFzZuPFSf1wWFi0Lnhn2IIIIFfOtoi1EYJYWr5cHoSAUnxof6O+gxQXAq/P27T6FMyzczkdR+pCQOB1gRD9EqvXSzRTaPWRrFCMIYbFZKP InYglfP82NXugUwzEmRf/01Gv1D8thAdiyzVQof2lMWmxLRogHd5uJfeD42ZQJPN X-Rspamd-Queue-Id: 46HCHl6jWbz4Qhc X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-5.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.45)[ip: (-6.57), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; RCVD_IN_DNSWL_NONE(0.00)[12.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 13:18:29 -0000 On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik wrote= : >Author: mjg >Date: Sun Aug 25 05:13:15 2019 >New Revision: 351472 >URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/351472 > >Log: > nullfs: reduce areas protected by vnode interlock > =20 >Some places only take the interlock to hold the vnode, which was a >requiremnt >before they started being manipulated with atomics=2E Use the newly >introduced > vholdnz to bump the count=2E > =20 > Reviewed by: kib > Tested by: pho > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews=2Efreebsd=2Eorg/D21358 > >Modified: > head/sys/fs/nullfs/null_vnops=2Ec > >Modified: head/sys/fs/nullfs/null_vnops=2Ec >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >--- head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:11:43 2019 (r351471) >+++ head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:13:15 2019 (r351472) >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > * We prevent it from being recycled by holding the vnode > * here=2E > */ >- vholdl(lvp); >+ vholdnz(lvp); > error =3D VOP_LOCK(lvp, flags); >=20 > /* >@@ -710,31 +710,16 @@ static int > null_unlock(struct vop_unlock_args *ap) > { > struct vnode *vp =3D ap->a_vp; >- int flags =3D ap->a_flags; >- int mtxlkflag =3D 0; > struct null_node *nn; > struct vnode *lvp; > int error; >=20 >- if ((flags & LK_INTERLOCK) !=3D 0) >- mtxlkflag =3D 1; >- else if (mtx_owned(VI_MTX(vp)) =3D=3D 0) { >- VI_LOCK(vp); >- mtxlkflag =3D 2; >- } > nn =3D VTONULL(vp); > if (nn !=3D NULL && (lvp =3D NULLVPTOLOWERVP(vp)) !=3D NULL) { >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); >- flags |=3D LK_INTERLOCK; >- vholdl(lvp); >- VI_UNLOCK(vp); >- error =3D VOP_UNLOCK(lvp, flags); >+ vholdnz(lvp); >+ error =3D VOP_UNLOCK(lvp, 0); > vdrop(lvp); >- if (mtxlkflag =3D=3D 0) >- VI_LOCK(vp); > } else { >- if (mtxlkflag =3D=3D 2) >- VI_UNLOCK(vp); > error =3D vop_stdunlock(ap); > } >=20 >@@ -845,10 +830,8 @@ null_getwritemount(struct vop_getwritemount_args >*ap) > VI_LOCK(vp); > xp =3D VTONULL(vp); > if (xp && (lowervp =3D xp->null_lowervp)) { >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); >+ vholdnz(lowervp); > VI_UNLOCK(vp); >- vholdl(lowervp); >- VI_UNLOCK(lowervp); > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > vdrop(lowervp); > } else { Hi mjg@, This causes trap 12 a few seconds after mountlate during boot=2E Reverting= this commit allowed it to boot=2E Sorry for no backtrace=2E I managed to=20 revert and test just prior to rushing out to catch the bus, with no time = to craft a proper email=2E I'll post the backtrace when I arrive at work=2E --=20 Pardon the typos and autocorrect, small keyboard in use=2E Cheers, Cy Schubert FreeBSD UNIX: Web: http://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E From owner-svn-src-all@freebsd.org Mon Aug 26 14:11:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00D55DCDC5; Mon, 26 Aug 2019 14:11:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HDSw58Zqz4TWD; Mon, 26 Aug 2019 14:11:28 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2FiNil8tzSrVc2FiOilMVg; Mon, 26 Aug 2019 08:11:26 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=7QqoLyUhOw1ptgkwiHYA:9 a=xijKLwi-kJkXrt_u:21 a=0210p9udBa2dCv46:21 a=bB0jzgBmlxtydUqe:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 3F53F1EB; Mon, 26 Aug 2019 07:11:23 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7QEBMCg075357; Mon, 26 Aug 2019 07:11:22 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7QEBMWi075354; Mon, 26 Aug 2019 07:11:22 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908261411.x7QEBMWi075354@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Cy.Schubert@cschubert.com Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> Comments: In-reply-to Cy Schubert message dated "Mon, 26 Aug 2019 06:17:57 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 07:11:22 -0700 X-CMAE-Envelope: MS4wfCk0FJ9/AhnkKurZKtxFe5VdCiNOOXUaTCM7f1x7Cn6KQ48J5WSkLWc51joeDCL1vOxaElKMmJhLqNmpTNBC1T0Ahx8aplU4nIWG9pTBwyLwRfxyobjD OcMIZZl06eSUhB9ctGhLs2FFii+RGzaSBTREJY2B8kB7PkZPEkdE7tmB4n5l/0A+1z0KQEYi+AzAZkBi3BeXRV2us9Xz8QerlBxemRXQM6ctUDJmmHMwK6sa 7HnfTSKXSw4CJqcmJX2o9CVu/a3Jo504a1FI5+bIXz28psdZ6H60zhMn5B9PhCed X-Rspamd-Queue-Id: 46HDSw58Zqz4TWD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.90 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; RCVD_IN_DNSWL_NONE(0.00)[137.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.33)[ip: (-5.97), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 14:11:30 -0000 In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy Schubert wr ites: > On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik wrote: > >Author: mjg > >Date: Sun Aug 25 05:13:15 2019 > >New Revision: 351472 > >URL: https://svnweb.freebsd.org/changeset/base/351472 > > > >Log: > > nullfs: reduce areas protected by vnode interlock > > > >Some places only take the interlock to hold the vnode, which was a > >requiremnt > >before they started being manipulated with atomics. Use the newly > >introduced > > vholdnz to bump the count. > > > > Reviewed by: kib > > Tested by: pho > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D21358 > > > >Modified: > > head/sys/fs/nullfs/null_vnops.c > > > >Modified: head/sys/fs/nullfs/null_vnops.c > >============================================================================ > == > >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 2019 (r35147 > 1) > >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 2019 (r35147 > 2) > >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > > * We prevent it from being recycled by holding the vnode > > * here. > > */ > >- vholdl(lvp); > >+ vholdnz(lvp); > > error = VOP_LOCK(lvp, flags); > > > > /* > >@@ -710,31 +710,16 @@ static int > > null_unlock(struct vop_unlock_args *ap) > > { > > struct vnode *vp = ap->a_vp; > >- int flags = ap->a_flags; > >- int mtxlkflag = 0; > > struct null_node *nn; > > struct vnode *lvp; > > int error; > > > >- if ((flags & LK_INTERLOCK) != 0) > >- mtxlkflag = 1; > >- else if (mtx_owned(VI_MTX(vp)) == 0) { > >- VI_LOCK(vp); > >- mtxlkflag = 2; > >- } > > nn = VTONULL(vp); > > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { > >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); > >- flags |= LK_INTERLOCK; > >- vholdl(lvp); > >- VI_UNLOCK(vp); > >- error = VOP_UNLOCK(lvp, flags); > >+ vholdnz(lvp); > >+ error = VOP_UNLOCK(lvp, 0); > > vdrop(lvp); > >- if (mtxlkflag == 0) > >- VI_LOCK(vp); > > } else { > >- if (mtxlkflag == 2) > >- VI_UNLOCK(vp); > > error = vop_stdunlock(ap); > > } > > > >@@ -845,10 +830,8 @@ null_getwritemount(struct vop_getwritemount_args > >*ap) > > VI_LOCK(vp); > > xp = VTONULL(vp); > > if (xp && (lowervp = xp->null_lowervp)) { > >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); > >+ vholdnz(lowervp); > > VI_UNLOCK(vp); > >- vholdl(lowervp); > >- VI_UNLOCK(lowervp); > > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > > vdrop(lowervp); > > } else { > > Hi mjg@, > > This causes trap 12 a few seconds after mountlate during boot. Reverting this > commit allowed it to boot. > > Sorry for no backtrace. I managed to > revert and test just prior to rushing out to catch the bus, with no time to > craft a proper email. I'll post the backtrace when I arrive at work. Hi mjg@, The gory details below. Don't be fooled by the panic when yppasswd is started. I was able to reproduce this panic in single user by simply mounting and using a nullfs. kernel trap 12 with interrupts disabled Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0xc fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff806f0633 stack pointer = 0x28:0xfffffe004b3fa7c0 frame pointer = 0x28:0xfffffe004b3fa7e0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = resume, IOPL = 0 current process = 26 (syncer) trap number = 12 panic: page fault cpuid = 0 time = 1566821203 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004b3fa470 vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 panic() at panic+0x43/frame 0xfffffe004b3fa520 trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 --- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp = 0xfffffe004b3fa7e0 --- propagate_priority() at propagate_priority+0x153/frame 0xfffffe004b3fa7e0 turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 __mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame 0xfffffe004b3fa920 vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Uptime: 3m25s Dumping 921 out of 7974 MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% __curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (OFFSETOF_CURTHREAD)); (kgdb) #0 __curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 #1 doadump (textdump=1) at /opt/src/svn-current/sys/kern/kern_shutdown.c:392 #2 0xffffffff8068aead in kern_reboot (howto=260) at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 #3 0xffffffff8068b369 in vpanic (fmt=, ap=) at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 #4 0xffffffff8068b163 in panic (fmt=) at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 #5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, eva=12) at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 #6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, usermode=0) at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 #7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 #8 #9 propagate_priority (td=0xfffff8003e43b000) at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 #10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, owner=, queue=-512) at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 #11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, v=) at /opt/src/svn-current/sys/kern/kern_mutex.c:654 #12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( mvp=0xfffff80002449800, mp=0xfffff80132d1e000, vp=0xfffff80132e4eb40) at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 #13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 #14 0xffffffff80766206 in __mnt_vnode_next_active (mvp=0xfffff80002449800, mp=) at /opt/src/svn-current/sys/kern/vfs_subr.c:5682 #15 vfs_msync (mp=0xfffff80132d1e000, flags=2) at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 #16 0xffffffff8076b4a6 in sync_fsync (ap=) at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 #17 0xffffffff80a7be46 in VOP_FSYNC_APV ( vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) at vnode_if.c:1312 #18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, td=0xfffff800061dc5a0) at ./vnode_if.h:549 #19 sync_vnode (bo=, td=0xfffff800061dc5a0, slp=) at /opt/src/svn-current/sys/kern/vfs_subr.c:2316 #20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 #21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 , arg=0x0, frame=0xfffffe004b3faac0) at /opt/src/svn-current/sys/kern/kern_fork.c:1045 #22 dmesg output: Updating motd:. Mounting late filesystems:. Starting nscd. Security policy loaded: MAC/ntpd (mac_ntpd) Starting ntpd. Starting yppasswdd. kernel trap 12 with interrupts disabled Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0xc fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff806f0633 stack pointer = 0x28:0xfffffe004b7fa7c0 frame pointer = 0x28:0xfffffe004b7fa7e0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = resume, IOPL = 0 current process = 26 (syncer) trap number = 12 panic: page fault cpuid = 0 time = 1566820700 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004b7fa470 vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 panic() at panic+0x43/frame 0xfffffe004b7fa520 trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 --- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp = 0xfffffe004b7fa7e0 --- propagate_priority() at propagate_priority+0x153/frame 0xfffffe004b7fa7e0 turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 __mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame 0xfffffe004b7fa920 vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Uptime: 1m38s Dumping 810 out of 7974 MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Mon Aug 26 15:21:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A972DE209; Mon, 26 Aug 2019 15:21:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HG1k0HDyz4Y5L; Mon, 26 Aug 2019 15:21:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF0968088; Mon, 26 Aug 2019 15:21:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7QFLTv3047526; Mon, 26 Aug 2019 15:21:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QFLTcG047525; Mon, 26 Aug 2019 15:21:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908261521.x7QFLTcG047525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 26 Aug 2019 15:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351510 - stable/12/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Commit-Revision: 351510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 15:21:30 -0000 Author: markj Date: Mon Aug 26 15:21:29 2019 New Revision: 351510 URL: https://svnweb.freebsd.org/changeset/base/351510 Log: MFC r351359: Fix inverted predicates for sx lock hold events in lockstat(1). Modified: stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Mon Aug 26 10:18:19 2019 (r351509) +++ stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Mon Aug 26 15:21:29 2019 (r351510) @@ -206,10 +206,10 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { "lockstat:::rw-release", "arg1 == 1", "lockstat:::rw-acquire" }, { 'H', "Lock", "SX shared hold", "nsec", - "lockstat:::sx-release", "arg1 == 0", + "lockstat:::sx-release", "arg1 == 1", "lockstat:::sx-acquire" }, { 'H', "Lock", "SX exclusive hold", "nsec", - "lockstat:::sx-release", "arg1 == 1", + "lockstat:::sx-release", "arg1 == 0", "lockstat:::sx-acquire" }, { 'H', "Lock", "Unknown event (type 38)", "units" }, { 'H', "Lock", "Unknown event (type 39)", "units" }, From owner-svn-src-all@freebsd.org Mon Aug 26 15:41:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48DAEDE7ED; Mon, 26 Aug 2019 15:41:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HGSb5zDzz4YyT; Mon, 26 Aug 2019 15:41:19 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2H7LimLlZSrVc2H7MileVg; Mon, 26 Aug 2019 09:41:17 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=XMxNKzTx4BUYNsliDvEA:9 a=fvwWC_t7I1q_Dfr2:21 a=zAa2iZ8Va_Uz8Il7:21 a=8HBsMUk44bn0z0wV:21 a=QEXdDO2ut3YA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from 5CG5030TVK-N.esitwifi.local (S0106788a207e2972.gv.shawcable.net [70.66.154.233]) by spqr.komquats.com (Postfix) with ESMTPSA id 459ED190; Mon, 26 Aug 2019 08:41:14 -0700 (PDT) Date: Mon, 26 Aug 2019 08:40:50 -0700 In-Reply-To: <201908261411.x7QEBMWi075354@slippy.cwsent.com> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Mateusz Guzik CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfLiAzcR+5nM2MQHtiPUltKYdtAOo5ZOFiilxjJyi2c73dnJzJASGdhfdOEWMdnuoEO4N9WuG8rAkx4x+Bj10yAFgd2WDFEDQRy+20+KicAlfExXXiIxP LffHbh8FwvHWX3XwCD0AADc2XJVlQxywcQl47+RdifUrT0tfckdPWj6mRwNRdguZe+GapZcmPfSjQFMo02Fp7hivEgWj3gAv3xV5GVK8cBdaa9tBdQRfbIjN WHllncU4o4F6fU+X0ZE2bD9SDTAggraUWLkIgAXDkfize23gyiyfA7+t9zeYapK5 X-Rspamd-Queue-Id: 46HGSb5zDzz4YyT X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-5.38 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.33)[ip: (-5.97), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; RCVD_IN_DNSWL_NONE(0.00)[137.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11, 233.154.66.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 15:41:21 -0000 On August 26, 2019 7:11:22 AM PDT, Cy Schubert wrote: >In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert=2Ecom>, Cy >Schubert wr >ites: >> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik >wrote: >> >Author: mjg >> >Date: Sun Aug 25 05:13:15 2019 >> >New Revision: 351472 >> >URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/351472 >> > >> >Log: >> > nullfs: reduce areas protected by vnode interlock >> > =20 >> >Some places only take the interlock to hold the vnode, which was a >> >requiremnt >> >before they started being manipulated with atomics=2E Use the newly >> >introduced >> > vholdnz to bump the count=2E >> > =20 >> > Reviewed by: kib >> > Tested by: pho >> > Sponsored by: The FreeBSD Foundation >> > Differential Revision: https://reviews=2Efreebsd=2Eorg/D21358 >> > >> >Modified: >> > head/sys/fs/nullfs/null_vnops=2Ec >> > >> >Modified: head/sys/fs/nullfs/null_vnops=2Ec >> >>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D >> =3D=3D >> >--- head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:11:43 2019 (r35147 >> 1) >> >+++ head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:13:15 2019 (r35147 >> 2) >> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) >> > * We prevent it from being recycled by holding the vnode >> > * here=2E >> > */ >> >- vholdl(lvp); >> >+ vholdnz(lvp); >> > error =3D VOP_LOCK(lvp, flags); >> >=20 >> > /* >> >@@ -710,31 +710,16 @@ static int >> > null_unlock(struct vop_unlock_args *ap) >> > { >> > struct vnode *vp =3D ap->a_vp; >> >- int flags =3D ap->a_flags; >> >- int mtxlkflag =3D 0; >> > struct null_node *nn; >> > struct vnode *lvp; >> > int error; >> >=20 >> >- if ((flags & LK_INTERLOCK) !=3D 0) >> >- mtxlkflag =3D 1; >> >- else if (mtx_owned(VI_MTX(vp)) =3D=3D 0) { >> >- VI_LOCK(vp); >> >- mtxlkflag =3D 2; >> >- } >> > nn =3D VTONULL(vp); >> > if (nn !=3D NULL && (lvp =3D NULLVPTOLOWERVP(vp)) !=3D NULL) { >> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); >> >- flags |=3D LK_INTERLOCK; >> >- vholdl(lvp); >> >- VI_UNLOCK(vp); >> >- error =3D VOP_UNLOCK(lvp, flags); >> >+ vholdnz(lvp); >> >+ error =3D VOP_UNLOCK(lvp, 0); >> > vdrop(lvp); >> >- if (mtxlkflag =3D=3D 0) >> >- VI_LOCK(vp); >> > } else { >> >- if (mtxlkflag =3D=3D 2) >> >- VI_UNLOCK(vp); >> > error =3D vop_stdunlock(ap); >> > } >> >=20 >> >@@ -845,10 +830,8 @@ null_getwritemount(struct >vop_getwritemount_args >> >*ap) >> > VI_LOCK(vp); >> > xp =3D VTONULL(vp); >> > if (xp && (lowervp =3D xp->null_lowervp)) { >> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); >> >+ vholdnz(lowervp); >> > VI_UNLOCK(vp); >> >- vholdl(lowervp); >> >- VI_UNLOCK(lowervp); >> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); >> > vdrop(lowervp); >> > } else { >> >> Hi mjg@, >> >> This causes trap 12 a few seconds after mountlate during boot=2E >Reverting this >> commit allowed it to boot=2E >> >> Sorry for no backtrace=2E I managed to=20 >> revert and test just prior to rushing out to catch the bus, with no >time to=20 >> craft a proper email=2E I'll post the backtrace when I arrive at work= =2E > >Hi mjg@, > >The gory details below=2E Don't be fooled by the panic when yppasswd is >started=2E I was able to reproduce this panic in single user by simply >mounting and using a nullfs=2E > >kernel trap 12 with interrupts disabled > > >Fatal trap 12: page fault while in kernel mode >cpuid =3D 0; apic id =3D 00 >fault virtual address =3D 0xc >fault code =3D supervisor read data, page not present >instruction pointer =3D 0x20:0xffffffff806f0633 >stack pointer =3D 0x28:0xfffffe004b3fa7c0 >frame pointer =3D 0x28:0xfffffe004b3fa7e0 >code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 >processor eflags =3D resume, IOPL =3D 0 >current process =3D 26 (syncer) >trap number =3D 12 >panic: page fault >cpuid =3D 0 >time =3D 1566821203 >KDB: stack backtrace: >db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >0xfffffe004b3fa470 >vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 >panic() at panic+0x43/frame 0xfffffe004b3fa520 >trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 >trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 >trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 >calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 >--- trap 0xc, rip =3D 0xffffffff806f0633, rsp =3D 0xfffffe004b3fa7c0, rbp= =3D >0xfffffe004b3fa7e0 --- >propagate_priority() at propagate_priority+0x153/frame >0xfffffe004b3fa7e0 >turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 >__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 >mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >0xfffffe004b3fa920 >vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 >sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 >VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 >sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 >fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 >fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 >--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- >Uptime: 3m25s >Dumping 921 out of 7974 >MB:=2E=2E2%=2E=2E11%=2E=2E21%=2E=2E32%=2E=2E42%=2E=2E51%=2E=2E61%=2E=2E72= %=2E=2E82%=2E=2E91% > >__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu=2Eh:246 >246 __asm("movq %%gs:%P1,%0" : "=3Dr" (td) : "n" >(OFFSETOF_CURTHREAD)); >(kgdb) #0 __curthread () at >/opt/src/svn-current/sys/amd64/include/pcpu=2Eh:246 >#1 doadump (textdump=3D1) at >/opt/src/svn-current/sys/kern/kern_shutdown=2Ec:392 >#2 0xffffffff8068aead in kern_reboot (howto=3D260) > at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:479 >#3 0xffffffff8068b369 in vpanic (fmt=3D, ap=3Dout>) > at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:905 >#4 0xffffffff8068b163 in panic (fmt=3D) > at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:832 >#5 0xffffffff80a11c2c in trap_fatal (frame=3D0xfffffe004b3fa700, eva=3D1= 2) > at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:943 >#6 0xffffffff80a11c79 in trap_pfault (frame=3D0xfffffe004b3fa700, >usermode=3D0) > at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:767 >#7 0xffffffff80a1126d in trap (frame=3D0xfffffe004b3fa700) > at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:443 >#8 >#9 propagate_priority (td=3D0xfffff8003e43b000) > at /opt/src/svn-current/sys/kern/subr_turnstile=2Ec:279 >#10 0xffffffff806f13db in turnstile_wait (ts=3D0xfffff8000258a780,=20 > owner=3D, queue=3D-512) > at /opt/src/svn-current/sys/kern/subr_turnstile=2Ec:785 >#11 0xffffffff80669271 in __mtx_lock_sleep (c=3D0xfffff80132e4ebf0,=20 > v=3D) at /opt/src/svn-current/sys/kern/kern_mutex=2Ec:6= 54 >#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( > mvp=3D0xfffff80002449800, mp=3D0xfffff80132d1e000, vp=3D0xfffff80132e4e= b40) > at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:5590 >#13 mnt_vnode_next_active (mvp=3D, mp=3D0xfffff80132d1e000= ) > at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:5649 >#14 0xffffffff80766206 in __mnt_vnode_next_active >(mvp=3D0xfffff80002449800,=20 > mp=3D) at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:56= 82 >#15 vfs_msync (mp=3D0xfffff80132d1e000, flags=3D2) > at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:4238 >#16 0xffffffff8076b4a6 in sync_fsync (ap=3D) > at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:4468 >#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( > vop=3D0xffffffff80cb4120 , a=3D0xfffffe004b3faa08) > at vnode_if=2Ec:1312 >#18 0xffffffff80769319 in VOP_FSYNC (vp=3D, waitfor=3D3,= =20 > td=3D0xfffff800061dc5a0) at =2E/vnode_if=2Eh:549 >#19 sync_vnode (bo=3D, td=3D0xfffff800061dc5a0,=20 > slp=3D) at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:23= 16 >#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:2418 >#21 0xffffffff80647e33 in fork_exit (callout=3D0xffffffff80768fa0 >,=20 > arg=3D0x0, frame=3D0xfffffe004b3faac0) > at /opt/src/svn-current/sys/kern/kern_fork=2Ec:1045 >#22 > > >dmesg output: > >Updating motd:=2E >Mounting late filesystems:=2E >Starting nscd=2E >Security policy loaded: MAC/ntpd (mac_ntpd) >Starting ntpd=2E >Starting yppasswdd=2E >kernel trap 12 with interrupts disabled > > >Fatal trap 12: page fault while in kernel mode >cpuid =3D 0; apic id =3D 00 >fault virtual address =3D 0xc >fault code =3D supervisor read data, page not present >instruction pointer =3D 0x20:0xffffffff806f0633 >stack pointer =3D 0x28:0xfffffe004b7fa7c0 >frame pointer =3D 0x28:0xfffffe004b7fa7e0 >code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 >processor eflags =3D resume, IOPL =3D 0 >current process =3D 26 (syncer) >trap number =3D 12 >panic: page fault >cpuid =3D 0 >time =3D 1566820700 >KDB: stack backtrace: >db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >0xfffffe004b7fa470 >vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 >panic() at panic+0x43/frame 0xfffffe004b7fa520 >trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 >trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 >trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 >calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 >--- trap 0xc, rip =3D 0xffffffff806f0633, rsp =3D 0xfffffe004b7fa7c0, rbp= =3D >0xfffffe004b7fa7e0 --- >propagate_priority() at propagate_priority+0x153/frame >0xfffffe004b7fa7e0 >turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 >__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 >mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >0xfffffe004b7fa920 >vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 >sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 >--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- >Uptime: 1m38s >Dumping 810 out of 7974 >MB:=2E=2E2%=2E=2E12%=2E=2E22%=2E=2E32%=2E=2E42%=2E=2E52%=2E=2E62%=2E=2E72= %=2E=2E81%=2E=2E91%---<>--- This may be a simple case of increasing the kernel stack=2E I'll try this = at noon=2E --=20 Pardon the typos and autocorrect, small keyboard in use=2E Cheers, Cy Schubert FreeBSD UNIX: Web: http://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E From owner-svn-src-all@freebsd.org Mon Aug 26 16:12:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F52BDF271; Mon, 26 Aug 2019 16:12:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HH8H2nMsz4bVZ; Mon, 26 Aug 2019 16:12:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42BFA89F1; Mon, 26 Aug 2019 16:12:15 +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 x7QGCFDk079251; Mon, 26 Aug 2019 16:12:15 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QGCEOR079250; Mon, 26 Aug 2019 16:12:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908261612.x7QGCEOR079250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 26 Aug 2019 16:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351511 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 351511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 16:12:15 -0000 Author: tuexen Date: Mon Aug 26 16:12:14 2019 New Revision: 351511 URL: https://svnweb.freebsd.org/changeset/base/351511 Log: Identify eMAG CPU used in Ampere Computing systems. Reviewed by: emaste@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21314 Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/cpu.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Mon Aug 26 15:21:29 2019 (r351510) +++ head/sys/arm64/arm64/identcpu.c Mon Aug 26 16:12:14 2019 (r351511) @@ -168,6 +168,12 @@ static const struct cpu_parts cpu_parts_cavium[] = { CPU_PART_NONE, }; +/* APM / Ampere */ +static const struct cpu_parts cpu_parts_apm[] = { + { CPU_PART_EMAG8180, "eMAG 8180" }, + CPU_PART_NONE, +}; + /* Unknown */ static const struct cpu_parts cpu_parts_none[] = { CPU_PART_NONE, @@ -184,7 +190,7 @@ const struct cpu_implementers cpu_implementers[] = { { CPU_IMPL_INFINEON, "IFX", cpu_parts_none }, { CPU_IMPL_FREESCALE, "Freescale", cpu_parts_none }, { CPU_IMPL_NVIDIA, "NVIDIA", cpu_parts_none }, - { CPU_IMPL_APM, "APM", cpu_parts_none }, + { CPU_IMPL_APM, "APM", cpu_parts_apm }, { CPU_IMPL_QUALCOMM, "Qualcomm", cpu_parts_none }, { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none }, { CPU_IMPL_INTEL, "Intel", cpu_parts_none }, Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Mon Aug 26 15:21:29 2019 (r351510) +++ head/sys/arm64/include/cpu.h Mon Aug 26 16:12:14 2019 (r351511) @@ -100,6 +100,9 @@ #define CPU_REV_THUNDERX2_0 0x00 +/* APM / Ampere Part Number */ +#define CPU_PART_EMAG8180 0x000 + #define CPU_IMPL(midr) (((midr) >> 24) & 0xff) #define CPU_PART(midr) (((midr) >> 4) & 0xfff) #define CPU_VAR(midr) (((midr) >> 20) & 0xf) From owner-svn-src-all@freebsd.org Mon Aug 26 16:23:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89130DF659; Mon, 26 Aug 2019 16:23:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HHPc3B87z4cBF; Mon, 26 Aug 2019 16:23:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BDE88C10; Mon, 26 Aug 2019 16:23:48 +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 x7QGNm8P085384; Mon, 26 Aug 2019 16:23:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QGNmcv085383; Mon, 26 Aug 2019 16:23:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908261623.x7QGNmcv085383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 26 Aug 2019 16:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351512 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 351512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 16:23:48 -0000 Author: tuexen Date: Mon Aug 26 16:23:47 2019 New Revision: 351512 URL: https://svnweb.freebsd.org/changeset/base/351512 Log: Don't hold the rs_mtx lock while calling malloc(). Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D21416 Modified: head/sys/netinet/tcp_ratelimit.c Modified: head/sys/netinet/tcp_ratelimit.c ============================================================================== --- head/sys/netinet/tcp_ratelimit.c Mon Aug 26 16:12:14 2019 (r351511) +++ head/sys/netinet/tcp_ratelimit.c Mon Aug 26 16:23:47 2019 (r351512) @@ -390,12 +390,10 @@ rt_setup_new_rs(struct ifnet *ifp, int *error) rs->rs_ifp->if_xname, CTLFLAG_RW, 0, ""); - CK_LIST_INSERT_HEAD(&int_rs, rs, next); - /* Unlock to allow the sysctl stuff to allocate */ - mtx_unlock(&rs_mtx); rl_add_syctl_entries(rl_sysctl_root, rs); - /* re-lock for our caller */ mtx_lock(&rs_mtx); + CK_LIST_INSERT_HEAD(&int_rs, rs, next); + mtx_unlock(&rs_mtx); return (rs); } else if ((rl.flags & RT_IS_INDIRECT) == RT_IS_INDIRECT) { memset(rs, 0, sizeof(struct tcp_rate_set)); @@ -410,12 +408,10 @@ rt_setup_new_rs(struct ifnet *ifp, int *error) rs->rs_ifp->if_xname, CTLFLAG_RW, 0, ""); - CK_LIST_INSERT_HEAD(&int_rs, rs, next); - /* Unlock to allow the sysctl stuff to allocate */ - mtx_unlock(&rs_mtx); rl_add_syctl_entries(rl_sysctl_root, rs); - /* re-lock for our caller */ mtx_lock(&rs_mtx); + CK_LIST_INSERT_HEAD(&int_rs, rs, next); + mtx_unlock(&rs_mtx); return (rs); } else if ((rl.flags & RT_IS_FIXED_TABLE) == RT_IS_FIXED_TABLE) { /* Mellanox most likely */ @@ -560,7 +556,6 @@ bail: goto bail; } rs_number_alive++; - CK_LIST_INSERT_HEAD(&int_rs, rs, next); sysctl_ctx_init(&rs->sysctl_ctx); rl_sysctl_root = SYSCTL_ADD_NODE(&rs->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_net_inet_tcp_rl), @@ -568,11 +563,10 @@ bail: rs->rs_ifp->if_xname, CTLFLAG_RW, 0, ""); - /* Unlock to allow the sysctl stuff to allocate */ - mtx_unlock(&rs_mtx); rl_add_syctl_entries(rl_sysctl_root, rs); - /* re-lock for our caller */ mtx_lock(&rs_mtx); + CK_LIST_INSERT_HEAD(&int_rs, rs, next); + mtx_unlock(&rs_mtx); return (rs); } @@ -978,8 +972,8 @@ tcp_rl_ifnet_link(void *arg __unused, struct ifnet *if return; } } - rt_setup_new_rs(ifp, &error); mtx_unlock(&rs_mtx); + rt_setup_new_rs(ifp, &error); } static void From owner-svn-src-all@freebsd.org Mon Aug 26 16:25:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8013FDF712; Mon, 26 Aug 2019 16:25:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HHRD2pFtz4cLW; Mon, 26 Aug 2019 16:25:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id AF3CC1BF91; Mon, 26 Aug 2019 16:25:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 To: Konstantin Belousov , Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head References: <201908241528.x7OFSemm026182@repo.freebsd.org> <20190824161503.GA71821@kib.kiev.ua> <20190824204353.GH71821@kib.kiev.ua> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <1a09a4ef-45aa-1bb2-5b16-1bde24df0f3d@FreeBSD.org> Date: Mon, 26 Aug 2019 09:25:11 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190824204353.GH71821@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 16:25:12 -0000 On 8/24/19 1:43 PM, Konstantin Belousov wrote: > On Sat, Aug 24, 2019 at 11:47:52AM -0700, Conrad Meyer wrote: >> On Sat, Aug 24, 2019 at 9:15 AM Konstantin Belousov wrote: >>> >>> On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: >>>> Hi Konstantin, >>>> >>>> What is the motivation for this change? The commit message doesn't >>>> really describe why it was done. >>> >>> Really it does. There is no point to request allocations for e.g. >>> doublefault stack to be at the local domain, because this stack is only >>> used once. Doublefault is definitely a machine halt situation, it does >>> not matter if it generates inter-socket traffic to handle. >>> >>> Same for boot stacks, and for mce. >>> >>> The change avoids unnecessary constraints. >> >> Sure, but what is the harm of the unnecessary constraints? Does this >> change fix an actual bug, or is it just a stylistic preference to >> avoid domain-specific allocations for infrequently used objects? > I am not sure about this being a stylistic preference. We usually > write code to express the required actions. I removed constraints > which did not added anything neither to code correctness nor to the > performance. Judging by the thread on current though, this fixes boot panics on machines with NUMA but CPUs that don't have local memory, correct? I think that's the thing Conrad is asking. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Aug 26 16:31:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0AE9DF8F8; Mon, 26 Aug 2019 16:31:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HHZZ5BBRz4cmS; Mon, 26 Aug 2019 16:31:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 9D5BB1C0B6; Mon, 26 Aug 2019 16:31:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: "Bjoern A. Zeeb" , alan somers Cc: Hiroki Sato , Alan Somers , Jan Sucan , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> <4D99F70B-5BFD-447A-B833-D4F73CEECFF2@lists.zabbadoz.net> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Mon, 26 Aug 2019 09:31:33 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4D99F70B-5BFD-447A-B833-D4F73CEECFF2@lists.zabbadoz.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 16:31:34 -0000 On 8/26/19 1:59 AM, Bjoern A. Zeeb wrote: > In other notes (and I keep saying that), I can see a world when ping > doesn’t exist anymore as IPv4 doesn’t exist anymore (I partially > already live in that world). The fact that people still do not prepare > themselves for this time is a bit strange to me as by the time FreeBSD > 14 is still in support this IPv6-only world might very well happen for a > majority of people. And FreeBSD 14-CURRENT really is only a year away > now. So breaking what’s been good for almost 20 years now for a few > more years doesn’t really seem to be worth to me. Eh, I think having 'ping' around on even IPv6 systems is sensible. ping is not inherently version-specific in name, only ping6 is. Having ping not include ipv4 bits for WITHOUT_INET=yes is fine, but I think not having ping as a command is just nonsense. The fact that we have ping6 instead of ping -6 (compared to say, traceroute, ssh, etc. which all have unified commands) is just a user-interface bug we are stuck maintaining compatibility for, not a goal to shoot for. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Aug 26 16:34:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD36BDFB02; Mon, 26 Aug 2019 16:34:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46HHfH3LKXz4d1F; Mon, 26 Aug 2019 16:34:46 +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 x7QGYdG8008503 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 26 Aug 2019 19:34:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x7QGYdG8008503 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x7QGYdjf008502; Mon, 26 Aug 2019 19:34:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 26 Aug 2019 19:34:39 +0300 From: Konstantin Belousov To: John Baldwin Cc: Conrad Meyer , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 Message-ID: <20190826163439.GS71821@kib.kiev.ua> References: <201908241528.x7OFSemm026182@repo.freebsd.org> <20190824161503.GA71821@kib.kiev.ua> <20190824204353.GH71821@kib.kiev.ua> <1a09a4ef-45aa-1bb2-5b16-1bde24df0f3d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1a09a4ef-45aa-1bb2-5b16-1bde24df0f3d@FreeBSD.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46HHfH3LKXz4d1F X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.90)[-0.897,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 16:34:47 -0000 On Mon, Aug 26, 2019 at 09:25:11AM -0700, John Baldwin wrote: > On 8/24/19 1:43 PM, Konstantin Belousov wrote: > > On Sat, Aug 24, 2019 at 11:47:52AM -0700, Conrad Meyer wrote: > >> On Sat, Aug 24, 2019 at 9:15 AM Konstantin Belousov wrote: > >>> > >>> On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: > >>>> Hi Konstantin, > >>>> > >>>> What is the motivation for this change? The commit message doesn't > >>>> really describe why it was done. > >>> > >>> Really it does. There is no point to request allocations for e.g. > >>> doublefault stack to be at the local domain, because this stack is only > >>> used once. Doublefault is definitely a machine halt situation, it does > >>> not matter if it generates inter-socket traffic to handle. > >>> > >>> Same for boot stacks, and for mce. > >>> > >>> The change avoids unnecessary constraints. > >> > >> Sure, but what is the harm of the unnecessary constraints? Does this > >> change fix an actual bug, or is it just a stylistic preference to > >> avoid domain-specific allocations for infrequently used objects? > > I am not sure about this being a stylistic preference. We usually > > write code to express the required actions. I removed constraints > > which did not added anything neither to code correctness nor to the > > performance. > > Judging by the thread on current though, this fixes boot panics on > machines with NUMA but CPUs that don't have local memory, correct? > I think that's the thing Conrad is asking. > This was discovered later. From owner-svn-src-all@freebsd.org Mon Aug 26 17:25:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65AD6E1008; Mon, 26 Aug 2019 17:25:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HJmP23wPz3CXd; Mon, 26 Aug 2019 17:25:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28A81977A; Mon, 26 Aug 2019 17:25:09 +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 x7QHP9NR020777; Mon, 26 Aug 2019 17:25:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QHP79q020769; Mon, 26 Aug 2019 17:25:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908261725.x7QHP79q020769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 26 Aug 2019 17:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351513 - in head/sys: crypto/des kgssapi/krb5 netsmb opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto/des kgssapi/krb5 netsmb opencrypto X-SVN-Commit-Revision: 351513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:25:09 -0000 Author: jhb Date: Mon Aug 26 17:25:07 2019 New Revision: 351513 URL: https://svnweb.freebsd.org/changeset/base/351513 Log: Stop using des_cblock * for arguments to DES functions. This amounts to a char ** since it is a char[8] *. Evil casts mostly resolved the fact that what was actually passed in were plain char *. Instead, change the DES functions to use 'unsigned char *' for keys and for input and output buffers. Reviewed by: cem, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21389 Modified: head/sys/crypto/des/des.h head/sys/crypto/des/des_ecb.c head/sys/crypto/des/des_setkey.c head/sys/kgssapi/krb5/kcrypto_des.c head/sys/kgssapi/krb5/kcrypto_des3.c head/sys/netsmb/smb_crypt.c head/sys/opencrypto/xform_des1.c head/sys/opencrypto/xform_des3.c Modified: head/sys/crypto/des/des.h ============================================================================== --- head/sys/crypto/des/des.h Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/crypto/des/des.h Mon Aug 26 17:25:07 2019 (r351513) @@ -82,7 +82,7 @@ typedef struct des_ks_struct extern int des_check_key; /* defaults to false */ char *des_options(void); -void des_ecb_encrypt(des_cblock *, des_cblock *, des_key_schedule, int); +void des_ecb_encrypt(unsigned char *, unsigned char *, des_key_schedule, int); void des_encrypt1(DES_LONG *, des_key_schedule, int); void des_encrypt2(DES_LONG *, des_key_schedule, int); @@ -91,24 +91,17 @@ void des_encrypt3(DES_LONG *, des_key_schedule, des_ke void des_decrypt3(DES_LONG *, des_key_schedule, des_key_schedule, des_key_schedule); -void des_ecb3_encrypt(des_cblock *, des_cblock *, des_key_schedule, +void des_ecb3_encrypt(unsigned char *, unsigned char *, des_key_schedule, des_key_schedule, des_key_schedule, int); -void des_ncbc_encrypt(const unsigned char *, unsigned char *, long, - des_key_schedule, des_cblock *, int); - -void des_ede3_cbc_encrypt(const unsigned char *, unsigned char *, long, - des_key_schedule, des_key_schedule, - des_key_schedule, des_cblock *, int); - -void des_set_odd_parity(des_cblock *); -void des_fixup_key_parity(des_cblock *); -int des_is_weak_key(const des_cblock *); -int des_set_key(const des_cblock *, des_key_schedule); -int des_key_sched(const des_cblock *, des_key_schedule); -int des_set_key_checked(const des_cblock *, des_key_schedule); -void des_set_key_unchecked(const des_cblock *, des_key_schedule); -int des_check_key_parity(const des_cblock *); +void des_set_odd_parity(unsigned char *); +void des_fixup_key_parity(unsigned char *); +int des_is_weak_key(const unsigned char *); +int des_set_key(const unsigned char *, des_key_schedule); +int des_key_sched(const unsigned char *, des_key_schedule); +int des_set_key_checked(const unsigned char *, des_key_schedule); +void des_set_key_unchecked(const unsigned char *, des_key_schedule); +int des_check_key_parity(const unsigned char *); #ifdef __cplusplus } Modified: head/sys/crypto/des/des_ecb.c ============================================================================== --- head/sys/crypto/des/des_ecb.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/crypto/des/des_ecb.c Mon Aug 26 17:25:07 2019 (r351513) @@ -97,13 +97,13 @@ char *des_options(void) } return(buf); } -void des_ecb_encrypt(des_cblock *input, des_cblock *output, +void des_ecb_encrypt(unsigned char *input, unsigned char *output, des_key_schedule ks, int enc) { register DES_LONG l; DES_LONG ll[2]; - const unsigned char *in=&(*input)[0]; - unsigned char *out = &(*output)[0]; + const unsigned char *in = input; + unsigned char *out = output; c2l(in,l); ll[0]=l; c2l(in,l); ll[1]=l; @@ -113,14 +113,14 @@ void des_ecb_encrypt(des_cblock *input, des_cblock *ou l=ll[0]=ll[1]=0; } -void des_ecb3_encrypt(des_cblock *input, des_cblock *output, +void des_ecb3_encrypt(unsigned char *input, unsigned char *output, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, int enc) { register DES_LONG l0,l1; DES_LONG ll[2]; - const unsigned char *in = &(*input)[0]; - unsigned char *out = &(*output)[0]; + const unsigned char *in = input; + unsigned char *out = output; c2l(in,l0); c2l(in,l1); Modified: head/sys/crypto/des/des_setkey.c ============================================================================== --- head/sys/crypto/des/des_setkey.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/crypto/des/des_setkey.c Mon Aug 26 17:25:07 2019 (r351513) @@ -67,21 +67,21 @@ __FBSDID("$FreeBSD$"); int des_check_key=0; -void des_set_odd_parity(des_cblock *key) +void des_set_odd_parity(unsigned char *key) { int i; for (i=0; i>(16-(n)))) -int des_set_key(const des_cblock *key, des_key_schedule schedule) +int des_set_key(const unsigned char *key, des_key_schedule schedule) { if (des_check_key) { @@ -159,7 +159,7 @@ int des_set_key(const des_cblock *key, des_key_schedul * return -1 if key parity error, * return -2 if illegal weak key. */ -int des_set_key_checked(const des_cblock *key, des_key_schedule schedule) +int des_set_key_checked(const unsigned char *key, des_key_schedule schedule) { if (!des_check_key_parity(key)) return(-1); @@ -169,7 +169,7 @@ int des_set_key_checked(const des_cblock *key, des_key return 0; } -void des_set_key_unchecked(const des_cblock *key, des_key_schedule schedule) +void des_set_key_unchecked(const unsigned char *key, des_key_schedule schedule) { static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; DES_LONG c,d,t,s,t2; @@ -178,7 +178,7 @@ void des_set_key_unchecked(const des_cblock *key, des_ int i; k = &schedule->ks.deslong[0]; - in = &(*key)[0]; + in = key; c2l(in,c); c2l(in,d); @@ -225,12 +225,12 @@ void des_set_key_unchecked(const des_cblock *key, des_ } } -int des_key_sched(const des_cblock *key, des_key_schedule schedule) +int des_key_sched(const unsigned char *key, des_key_schedule schedule) { return(des_set_key(key,schedule)); } -void des_fixup_key_parity(des_cblock *key) +void des_fixup_key_parity(unsigned char *key) { des_set_odd_parity(key); } Modified: head/sys/kgssapi/krb5/kcrypto_des.c ============================================================================== --- head/sys/kgssapi/krb5/kcrypto_des.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/kgssapi/krb5/kcrypto_des.c Mon Aug 26 17:25:07 2019 (r351513) @@ -135,8 +135,8 @@ des1_random_to_key(struct krb5_key_state *ks, const vo | ((inkey[4] & 1) << 5) | ((inkey[5] & 1) << 6) | ((inkey[6] & 1) << 7)); - des_set_odd_parity((des_cblock *) outkey); - if (des_is_weak_key((des_cblock *) outkey)) + des_set_odd_parity(outkey); + if (des_is_weak_key(outkey)) outkey[7] ^= 0xf0; des1_set_key(ks, ks->ks_key); Modified: head/sys/kgssapi/krb5/kcrypto_des3.c ============================================================================== --- head/sys/kgssapi/krb5/kcrypto_des3.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/kgssapi/krb5/kcrypto_des3.c Mon Aug 26 17:25:07 2019 (r351513) @@ -144,8 +144,8 @@ des3_random_to_key(struct krb5_key_state *ks, const vo | ((inkey[4] & 1) << 5) | ((inkey[5] & 1) << 6) | ((inkey[6] & 1) << 7)); - des_set_odd_parity((des_cblock *) outkey); - if (des_is_weak_key((des_cblock *) outkey)) + des_set_odd_parity(outkey); + if (des_is_weak_key(outkey)) outkey[7] ^= 0xf0; } Modified: head/sys/netsmb/smb_crypt.c ============================================================================== --- head/sys/netsmb/smb_crypt.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/netsmb/smb_crypt.c Mon Aug 26 17:25:07 2019 (r351513) @@ -83,8 +83,8 @@ smb_E(const u_char *key, u_char *data, u_char *dest) kk[6] = key[5] << 2 | (key[6] >> 6 & 0xfe); kk[7] = key[6] << 1; ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK); - des_set_key((des_cblock *)kk, *ksp); - des_ecb_encrypt((des_cblock *)data, (des_cblock *)dest, *ksp, 1); + des_set_key(kk, *ksp); + des_ecb_encrypt(data, dest, *ksp, 1); free(ksp, M_SMBTEMP); } Modified: head/sys/opencrypto/xform_des1.c ============================================================================== --- head/sys/opencrypto/xform_des1.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/opencrypto/xform_des1.c Mon Aug 26 17:25:07 2019 (r351513) @@ -75,19 +75,17 @@ struct enc_xform enc_xform_des = { static void des1_encrypt(caddr_t key, u_int8_t *blk) { - des_cblock *cb = (des_cblock *) blk; des_key_schedule *p = (des_key_schedule *) key; - des_ecb_encrypt(cb, cb, p[0], DES_ENCRYPT); + des_ecb_encrypt(blk, blk, p[0], DES_ENCRYPT); } static void des1_decrypt(caddr_t key, u_int8_t *blk) { - des_cblock *cb = (des_cblock *) blk; des_key_schedule *p = (des_key_schedule *) key; - des_ecb_encrypt(cb, cb, p[0], DES_DECRYPT); + des_ecb_encrypt(blk, blk, p[0], DES_DECRYPT); } static int @@ -99,7 +97,7 @@ des1_setkey(u_int8_t **sched, const u_int8_t *key, int p = KMALLOC(sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((const des_cblock *) key, p[0]); + des_set_key(key, p[0]); err = 0; } else err = ENOMEM; Modified: head/sys/opencrypto/xform_des3.c ============================================================================== --- head/sys/opencrypto/xform_des3.c Mon Aug 26 16:23:47 2019 (r351512) +++ head/sys/opencrypto/xform_des3.c Mon Aug 26 17:25:07 2019 (r351513) @@ -76,19 +76,17 @@ struct enc_xform enc_xform_3des = { static void des3_encrypt(caddr_t key, u_int8_t *blk) { - des_cblock *cb = (des_cblock *) blk; des_key_schedule *p = (des_key_schedule *) key; - des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_ENCRYPT); + des_ecb3_encrypt(blk, blk, p[0], p[1], p[2], DES_ENCRYPT); } static void des3_decrypt(caddr_t key, u_int8_t *blk) { - des_cblock *cb = (des_cblock *) blk; des_key_schedule *p = (des_key_schedule *) key; - des_ecb3_encrypt(cb, cb, p[0], p[1], p[2], DES_DECRYPT); + des_ecb3_encrypt(blk, blk, p[0], p[1], p[2], DES_DECRYPT); } static int @@ -100,9 +98,9 @@ des3_setkey(u_int8_t **sched, const u_int8_t *key, int p = KMALLOC(3*sizeof (des_key_schedule), M_CRYPTO_DATA, M_NOWAIT|M_ZERO); if (p != NULL) { - des_set_key((const des_cblock *)(key + 0), p[0]); - des_set_key((const des_cblock *)(key + 8), p[1]); - des_set_key((const des_cblock *)(key + 16), p[2]); + des_set_key(key + 0, p[0]); + des_set_key(key + 8, p[1]); + des_set_key(key + 16, p[2]); err = 0; } else err = ENOMEM; From owner-svn-src-all@freebsd.org Mon Aug 26 17:25:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7487AE108B; Mon, 26 Aug 2019 17:25:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HJnH2HJsz3Cgv; Mon, 26 Aug 2019 17:25:54 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f45.google.com with SMTP id 18so39129413ioe.10; Mon, 26 Aug 2019 10:25:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=0kZl83pA3Hq31XlGvGPzmDs7uT+aEXK/JLr0t4jKFj4=; b=RlbC+MFQzJw8fjAemvjLqBVZpTWXdNC4J3oAYHnKc+JPIe2Elu5+hOLiEyd8xeHG9t DJmB+GOHFAsxUCEkYPE0N89mRcUk7x8roT+SaO6vLgGgPER1I2ustJbnaKuGIo69MCgD A5Oyyf11TYs20fHOf73RtIEofVQRwN+saDYIwRcsKzrcqyUHngspX/Kn3u/0iipjqTcR rnX+Z3+UPEqE24EOsTMLl2SYm1rb6kASIiePTOrd77T5i9D6URBCssXck1M5qGBJVNv5 rpeJ00vEXVCerjY1OcV4AumC45vFKB1smau+r917B7DWfzU+/TQXOTaP7L6crZQn+n5D PW9g== X-Gm-Message-State: APjAAAUtgfQdaLA+kkiuGf3shHseUgToI3D5JQefrynsj82NS8+TpvjY q3/gE+9MZcVP4GJqSTCCphIu/pfW X-Google-Smtp-Source: APXvYqxdnLAKKmpSAOBIB/Jpnd3AU0wtNXGpHDMwQ480PaBysmC5hJ6pqYvw/cC8Ja/qAK3R+w2jfw== X-Received: by 2002:a6b:3784:: with SMTP id e126mr21075691ioa.8.1566840353148; Mon, 26 Aug 2019 10:25:53 -0700 (PDT) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com. [209.85.166.43]) by smtp.gmail.com with ESMTPSA id y17sm10088442ioa.52.2019.08.26.10.25.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2019 10:25:52 -0700 (PDT) Received: by mail-io1-f43.google.com with SMTP id j4so30833363iog.11; Mon, 26 Aug 2019 10:25:52 -0700 (PDT) X-Received: by 2002:a6b:e013:: with SMTP id z19mr660569iog.141.1566840352555; Mon, 26 Aug 2019 10:25:52 -0700 (PDT) MIME-Version: 1.0 References: <201908241528.x7OFSemm026182@repo.freebsd.org> <20190824161503.GA71821@kib.kiev.ua> <20190824204353.GH71821@kib.kiev.ua> <1a09a4ef-45aa-1bb2-5b16-1bde24df0f3d@FreeBSD.org> In-Reply-To: <1a09a4ef-45aa-1bb2-5b16-1bde24df0f3d@FreeBSD.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 26 Aug 2019 10:25:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351456 - head/sys/amd64/amd64 To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HJnH2HJsz3Cgv X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:25:55 -0000 r351456 only loosened restrictions on some of the less common thread types; it was accidentally necessary, but not sufficient. 351494, 351495, and 351496 (at least) are also necessary, once the issue was identified. Best, Conrad On Mon, Aug 26, 2019 at 9:25 AM John Baldwin wrote: > > On 8/24/19 1:43 PM, Konstantin Belousov wrote: > > On Sat, Aug 24, 2019 at 11:47:52AM -0700, Conrad Meyer wrote: > >> On Sat, Aug 24, 2019 at 9:15 AM Konstantin Belousov wrote: > >>> > >>> On Sat, Aug 24, 2019 at 08:49:42AM -0700, Conrad Meyer wrote: > >>>> Hi Konstantin, > >>>> > >>>> What is the motivation for this change? The commit message doesn't > >>>> really describe why it was done. > >>> > >>> Really it does. There is no point to request allocations for e.g. > >>> doublefault stack to be at the local domain, because this stack is only > >>> used once. Doublefault is definitely a machine halt situation, it does > >>> not matter if it generates inter-socket traffic to handle. > >>> > >>> Same for boot stacks, and for mce. > >>> > >>> The change avoids unnecessary constraints. > >> > >> Sure, but what is the harm of the unnecessary constraints? Does this > >> change fix an actual bug, or is it just a stylistic preference to > >> avoid domain-specific allocations for infrequently used objects? > > I am not sure about this being a stylistic preference. We usually > > write code to express the required actions. I removed constraints > > which did not added anything neither to code correctness nor to the > > performance. > > Judging by the thread on current though, this fixes boot panics on > machines with NUMA but CPUs that don't have local memory, correct? > I think that's the thing Conrad is asking. > > -- > John Baldwin From owner-svn-src-all@freebsd.org Mon Aug 26 17:27:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9060BE1106; Mon, 26 Aug 2019 17:27:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HJqF398Gz3CrR; Mon, 26 Aug 2019 17:27:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62BFC9780; Mon, 26 Aug 2019 17:27:37 +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 x7QHRbI2020979; Mon, 26 Aug 2019 17:27:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QHRbsc020978; Mon, 26 Aug 2019 17:27:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908261727.x7QHRbsc020978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 26 Aug 2019 17:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351514 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 351514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:27:37 -0000 Author: mav Date: Mon Aug 26 17:27:36 2019 New Revision: 351514 URL: https://svnweb.freebsd.org/changeset/base/351514 Log: Don't consider PCIe hot-plug command timeout fatal. According to my tests and errata to several generations of Intel CPUs, PCIe hot-plug command completion reporting is not very reliable thing. At least on my Supermicro X11DPi-NT board I never saw it reported. Before this change timeout code detached devices and tried to disable the slot, that in my case resulted in hot-plugged device being detached just a second after it was successfully detected and attached. This change removes that, so in case of timeout it just prints the error and continue operation. Linux does the same. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Mon Aug 26 17:25:07 2019 (r351513) +++ head/sys/dev/pci/pci_pci.c Mon Aug 26 17:27:36 2019 (r351514) @@ -1272,11 +1272,8 @@ pcib_pcie_cc_timeout(void *arg) mtx_assert(&Giant, MA_OWNED); sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); if (!(sta & PCIEM_SLOT_STA_CC)) { - device_printf(dev, - "HotPlug Command Timed Out - forcing detach\n"); - sc->flags &= ~(PCIB_HOTPLUG_CMD_PENDING | PCIB_DETACH_PENDING); - sc->flags |= PCIB_DETACHING; - pcib_pcie_hotplug_update(sc, 0, 0, true); + device_printf(dev, "HotPlug Command Timed Out\n"); + sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; } else { device_printf(dev, "Missed HotPlug interrupt waiting for Command Completion\n"); From owner-svn-src-all@freebsd.org Mon Aug 26 17:34:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD1D5E1331; Mon, 26 Aug 2019 17:34:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HJym5116z3DPT; Mon, 26 Aug 2019 17:34:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D9659941; Mon, 26 Aug 2019 17:34:08 +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 x7QHY89K027002; Mon, 26 Aug 2019 17:34:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QHY8Xv027000; Mon, 26 Aug 2019 17:34:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908261734.x7QHY8Xv027000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 26 Aug 2019 17:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351515 - in stable: 11/stand 11/stand/i386/boot2 11/stand/libsa 12/stand 12/stand/i386/boot2 12/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand 11/stand/i386/boot2 11/stand/libsa 12/stand 12/stand/i386/boot2 12/stand/libsa X-SVN-Commit-Revision: 351515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:34:08 -0000 Author: kevans Date: Mon Aug 26 17:34:07 2019 New Revision: 351515 URL: https://svnweb.freebsd.org/changeset/base/351515 Log: MFC r351119, r351135-r351136, r351412: stand xtoolchain-llvm90 fixes r351119: stand: push LIBC_SRC up into defs.mk Other parts of stand/ that don't use libsa will need to grab bits from libc shortly. Push LIBC_SRC up to defs.mk in advance of this so that they can use it, and rename it to LIBCSRC to match the convention of the rest of the *SRC variables in this file. r351135: stand: boot2: fix build with xtoolchain-llvm90 ufsread.c grows a dependency on __ashldi3 with llvm90. Grab ashldi3.c out of compiler-rt rather than trying to link against libsa (for now). -Wno-missing-prototypes is necessary to compile ashldi3.c standalone. r351136: stand: gptboot: fix build with xtoolchain-llvm90 ufsread.c grows a dependency on __ashldi3 with llvm90. For gptboot, just start pulling in ashldi3.c ashrdi3.c lshrdi3.c into libsa for all archs as the number of archs requiring one or more of them keeps growing. qdivrem.c and quad.h can be trivially kicked out of libsa if we start pulling these from compiler-rt as qdivrem was only used to implement umoddi3, divdi3, moddi3 (also in qdivrem.c). r351412: stand: boot2: fix amd64-xtoolchain-gcc build -Wno-missing-declarations is the GCC equivalent of -Wno-missing-prototypes... this was overlooked in r351135. Deleted: stable/11/stand/libsa/qdivrem.c stable/11/stand/libsa/quad.h Modified: stable/11/stand/defs.mk stable/11/stand/i386/boot2/Makefile stable/11/stand/libsa/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Deleted: stable/12/stand/libsa/qdivrem.c stable/12/stand/libsa/quad.h Modified: stable/12/stand/defs.mk stable/12/stand/i386/boot2/Makefile stable/12/stand/libsa/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Mon Aug 26 17:27:36 2019 (r351514) +++ stable/11/stand/defs.mk Mon Aug 26 17:34:07 2019 (r351515) @@ -33,6 +33,7 @@ SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot ZFSSRC= ${SASRC}/zfs +LIBCSRC= ${SRCTOP}/lib/libc BOOTOBJ= ${OBJTOP}/stand Modified: stable/11/stand/i386/boot2/Makefile ============================================================================== --- stable/11/stand/i386/boot2/Makefile Mon Aug 26 17:27:36 2019 (r351514) +++ stable/11/stand/i386/boot2/Makefile Mon Aug 26 17:34:07 2019 (r351515) @@ -78,7 +78,12 @@ boot2.ldr: boot2.bin: boot2.out ${OBJCOPY} -S -O binary boot2.out ${.TARGET} -boot2.out: ${BTXCRT} boot2.o sio.o +# For __ashldi3 +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins +CFLAGS.ashldi3.c= -Wno-missing-prototypes -Wno-missing-declarations +CLEANFILES+= ashldi3.o + +boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} SRCS= boot2.c boot2.h Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Mon Aug 26 17:27:36 2019 (r351514) +++ stable/11/stand/libsa/Makefile Mon Aug 26 17:34:07 2019 (r351515) @@ -9,7 +9,6 @@ .include LIBSA_CPUARCH?=${MACHINE_CPUARCH} -LIBC_SRC= ${SRCTOP}/lib/libc LIB?= sa @@ -21,20 +20,20 @@ SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd. # private (pruned) versions of libc string functions SRCS+= strcasecmp.c -.PATH: ${LIBC_SRC}/net +.PATH: ${LIBCSRC}/net SRCS+= ntoh.c # string functions from libc -.PATH: ${LIBC_SRC}/string +.PATH: ${LIBCSRC}/string SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \ - qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ + strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c # stdlib functions from libc -.PATH: ${LIBC_SRC}/stdlib +.PATH: ${LIBCSRC}/stdlib SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c # common boot code @@ -42,7 +41,7 @@ SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c SRCS+= subr_boot.c .if ${MACHINE_CPUARCH} == "arm" -.PATH: ${LIBC_SRC}/arm/gen +.PATH: ${LIBCSRC}/arm/gen # Do not generate movt/movw, because the relocation fixup for them does not # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). @@ -54,36 +53,30 @@ CFLAGS.clang+= -mno-movt .endif CFLAGS.clang+= -mfpu=none -# Compiler support functions -.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/ -# __clzsi2 and ctzsi2 for various builtin functions -SRCS+= clzsi2.c ctzsi2.c -# Divide and modulus functions called by the compiler -SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c -SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c - .PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/arm/ SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" -.PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen +.PATH: ${LIBCSRC}/${MACHINE_CPUARCH}/gen .endif -.if ${MACHINE_CPUARCH} == "powerpc" -.PATH: ${LIBC_SRC}/quad +# Compiler support functions +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/ +# __clzsi2 and ctzsi2 for various builtin functions +SRCS+= clzsi2.c ctzsi2.c +# Divide and modulus functions called by the compiler +SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c +SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c SRCS+= ashldi3.c ashrdi3.c lshrdi3.c + +.if ${MACHINE_CPUARCH} == "powerpc" SRCS+= syncicache.c .endif -.if ${MACHINE_CPUARCH} == "mips" -.PATH: ${LIBC_SRC}/quad -SRCS+= ashldi3.c ashrdi3.c lshrdi3.c -.endif - # uuid functions from libc -.PATH: ${LIBC_SRC}/uuid +.PATH: ${LIBCSRC}/uuid SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c # _setjmp/_longjmp From owner-svn-src-all@freebsd.org Mon Aug 26 17:34:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE460E1337; Mon, 26 Aug 2019 17:34:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HJyn48dCz3DPV; Mon, 26 Aug 2019 17:34:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 705129942; Mon, 26 Aug 2019 17:34:09 +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 x7QHY9sd027010; Mon, 26 Aug 2019 17:34:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QHY85Z027008; Mon, 26 Aug 2019 17:34:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201908261734.x7QHY85Z027008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 26 Aug 2019 17:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351515 - in stable: 11/stand 11/stand/i386/boot2 11/stand/libsa 12/stand 12/stand/i386/boot2 12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand 11/stand/i386/boot2 11/stand/libsa 12/stand 12/stand/i386/boot2 12/stand/libsa X-SVN-Commit-Revision: 351515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:34:09 -0000 Author: kevans Date: Mon Aug 26 17:34:07 2019 New Revision: 351515 URL: https://svnweb.freebsd.org/changeset/base/351515 Log: MFC r351119, r351135-r351136, r351412: stand xtoolchain-llvm90 fixes r351119: stand: push LIBC_SRC up into defs.mk Other parts of stand/ that don't use libsa will need to grab bits from libc shortly. Push LIBC_SRC up to defs.mk in advance of this so that they can use it, and rename it to LIBCSRC to match the convention of the rest of the *SRC variables in this file. r351135: stand: boot2: fix build with xtoolchain-llvm90 ufsread.c grows a dependency on __ashldi3 with llvm90. Grab ashldi3.c out of compiler-rt rather than trying to link against libsa (for now). -Wno-missing-prototypes is necessary to compile ashldi3.c standalone. r351136: stand: gptboot: fix build with xtoolchain-llvm90 ufsread.c grows a dependency on __ashldi3 with llvm90. For gptboot, just start pulling in ashldi3.c ashrdi3.c lshrdi3.c into libsa for all archs as the number of archs requiring one or more of them keeps growing. qdivrem.c and quad.h can be trivially kicked out of libsa if we start pulling these from compiler-rt as qdivrem was only used to implement umoddi3, divdi3, moddi3 (also in qdivrem.c). r351412: stand: boot2: fix amd64-xtoolchain-gcc build -Wno-missing-declarations is the GCC equivalent of -Wno-missing-prototypes... this was overlooked in r351135. Deleted: stable/12/stand/libsa/qdivrem.c stable/12/stand/libsa/quad.h Modified: stable/12/stand/defs.mk stable/12/stand/i386/boot2/Makefile stable/12/stand/libsa/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Deleted: stable/11/stand/libsa/qdivrem.c stable/11/stand/libsa/quad.h Modified: stable/11/stand/defs.mk stable/11/stand/i386/boot2/Makefile stable/11/stand/libsa/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/defs.mk ============================================================================== --- stable/12/stand/defs.mk Mon Aug 26 17:27:36 2019 (r351514) +++ stable/12/stand/defs.mk Mon Aug 26 17:34:07 2019 (r351515) @@ -29,6 +29,7 @@ SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot ZFSSRC= ${SASRC}/zfs +LIBCSRC= ${SRCTOP}/lib/libc BOOTOBJ= ${OBJTOP}/stand Modified: stable/12/stand/i386/boot2/Makefile ============================================================================== --- stable/12/stand/i386/boot2/Makefile Mon Aug 26 17:27:36 2019 (r351514) +++ stable/12/stand/i386/boot2/Makefile Mon Aug 26 17:34:07 2019 (r351515) @@ -78,7 +78,12 @@ boot2.ldr: boot2.bin: boot2.out ${OBJCOPY} -S -O binary boot2.out ${.TARGET} -boot2.out: ${BTXCRT} boot2.o sio.o +# For __ashldi3 +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins +CFLAGS.ashldi3.c= -Wno-missing-prototypes -Wno-missing-declarations +CLEANFILES+= ashldi3.o + +boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} SRCS= boot2.c boot2.h Modified: stable/12/stand/libsa/Makefile ============================================================================== --- stable/12/stand/libsa/Makefile Mon Aug 26 17:27:36 2019 (r351514) +++ stable/12/stand/libsa/Makefile Mon Aug 26 17:34:07 2019 (r351515) @@ -9,7 +9,6 @@ .include LIBSA_CPUARCH?=${MACHINE_CPUARCH} -LIBC_SRC= ${SRCTOP}/lib/libc LIB?= sa @@ -21,20 +20,20 @@ SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd. # private (pruned) versions of libc string functions SRCS+= strcasecmp.c -.PATH: ${LIBC_SRC}/net +.PATH: ${LIBCSRC}/net SRCS+= ntoh.c # string functions from libc -.PATH: ${LIBC_SRC}/string +.PATH: ${LIBCSRC}/string SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \ - qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ + strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c # stdlib functions from libc -.PATH: ${LIBC_SRC}/stdlib +.PATH: ${LIBCSRC}/stdlib SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c # common boot code @@ -42,7 +41,7 @@ SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c SRCS+= subr_boot.c .if ${MACHINE_CPUARCH} == "arm" -.PATH: ${LIBC_SRC}/arm/gen +.PATH: ${LIBCSRC}/arm/gen # Do not generate movt/movw, because the relocation fixup for them does not # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). @@ -54,36 +53,30 @@ CFLAGS.clang+= -mno-movt .endif CFLAGS.clang+= -mfpu=none -# Compiler support functions -.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/ -# __clzsi2 and ctzsi2 for various builtin functions -SRCS+= clzsi2.c ctzsi2.c -# Divide and modulus functions called by the compiler -SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c -SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c - .PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/arm/ SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" -.PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen +.PATH: ${LIBCSRC}/${MACHINE_CPUARCH}/gen .endif -.if ${MACHINE_CPUARCH} == "powerpc" -.PATH: ${LIBC_SRC}/quad +# Compiler support functions +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/ +# __clzsi2 and ctzsi2 for various builtin functions +SRCS+= clzsi2.c ctzsi2.c +# Divide and modulus functions called by the compiler +SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c +SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c SRCS+= ashldi3.c ashrdi3.c lshrdi3.c + +.if ${MACHINE_CPUARCH} == "powerpc" SRCS+= syncicache.c .endif -.if ${MACHINE_CPUARCH} == "mips" -.PATH: ${LIBC_SRC}/quad -SRCS+= ashldi3.c ashrdi3.c lshrdi3.c -.endif - # uuid functions from libc -.PATH: ${LIBC_SRC}/uuid +.PATH: ${LIBCSRC}/uuid SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c # _setjmp/_longjmp From owner-svn-src-all@freebsd.org Mon Aug 26 17:54:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EC02E1B23; Mon, 26 Aug 2019 17:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HKQ43Cbkz3FjW; Mon, 26 Aug 2019 17:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AC7D9D0B; Mon, 26 Aug 2019 17:54:20 +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 x7QHsKkr038856; Mon, 26 Aug 2019 17:54:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QHsKtL038855; Mon, 26 Aug 2019 17:54:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908261754.x7QHsKtL038855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 26 Aug 2019 17:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351516 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 351516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 17:54:20 -0000 Author: mav Date: Mon Aug 26 17:54:19 2019 New Revision: 351516 URL: https://svnweb.freebsd.org/changeset/base/351516 Log: Announce PCI Segment Groups supported to PCI host _OSC. According to ACPI 6.3 specification: The OS sets this bit to 1 if it supports PCI Segment Groups as defined by the _SEG object, and access to the configuration space of devices in PCI Segment Groups as described by this specification. Otherwise, the OS sets this bit to 0. As far as I see we support both of those as PCI domains for quite a while. MFC after: 2 months Modified: head/sys/dev/acpica/acpi_pcib_acpi.c Modified: head/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- head/sys/dev/acpica/acpi_pcib_acpi.c Mon Aug 26 17:34:07 2019 (r351515) +++ head/sys/dev/acpica/acpi_pcib_acpi.c Mon Aug 26 17:54:19 2019 (r351516) @@ -323,9 +323,9 @@ acpi_pcib_osc(struct acpi_hpcib_softc *sc, uint32_t os if (osc_ctl != 0 && (sc->ap_osc_ctl & osc_ctl) == osc_ctl) return (0); - /* Support Field: Extended PCI Config Space, MSI */ + /* Support Field: Extended PCI Config Space, PCI Segment Groups, MSI */ cap_set[PCI_OSC_SUPPORT] = PCIM_OSC_SUPPORT_EXT_PCI_CONF | - PCIM_OSC_SUPPORT_MSI; + PCIM_OSC_SUPPORT_SEG_GROUP | PCIM_OSC_SUPPORT_MSI; /* Control Field */ cap_set[PCI_OSC_CTL] = sc->ap_osc_ctl | osc_ctl; From owner-svn-src-all@freebsd.org Mon Aug 26 18:37:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3558DE263E; Mon, 26 Aug 2019 18:37:20 +0000 (UTC) (envelope-from sucanjan@gmail.com) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HLMg1BJmz3HhB; Mon, 26 Aug 2019 18:37:18 +0000 (UTC) (envelope-from sucanjan@gmail.com) Received: by mail-wr1-x443.google.com with SMTP id y8so16264423wrn.10; Mon, 26 Aug 2019 11:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=RNXkOeV3VkCJxwlq7AgAfVBjBWH5dL+gIwc8h2J3Y5w=; b=IhLbl1nUCxb7qsexGD9i5aB8fi/FqiNMm6kX+YLSVwJpICIGvrv97Wl8lNfjEhA+tq UupSM/YGZcprO/pB1AD7HtMD8zunYIEnXojJ4IUyPM4hid10baNXsVcCtGh72UUs6wOx CerEL90u/m/ZHd/cnMh8C5LaGo54OHfDXG7rD//GefnGZvQ7zZ/2LRLGkOe6BdGyTjGR ulJu12d8qr98IwKlPc0T/JAdKtA9082dMAyp6ADjrfkSWUYc5mU9cJxtCu1KgBTqwsFs AOPF9/jU+bb5otmC6g0n86KeDcPmZFn+vA//xdwM4Sk3O1/0m2+FpLkZZ/ajb3XjrXmz hEfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=RNXkOeV3VkCJxwlq7AgAfVBjBWH5dL+gIwc8h2J3Y5w=; b=OQugWpQ1n4nzNZ1vO8mWTQK499d2yWOtKs6IcFunKaKpBt5JZkBYAdYZdRWbX0dLF8 n4NEkEuWexYEr6uZaYn9wyqPW+yRtpjndcolDd9J+M2f4vNLD0PwMhLbj6BBt+6p7F9S ftacR1KptAq0Lk7F01Bjmsa5qrJtkWabkYO+S9m3P/i/j3YFb7mD/ZazOJoqvzLNbDBf dkwjMTx0TpkrOeaqizE2SQ62dRdSEwNbXl11Eby7Q52NygYV02i0TWcsWNrS2Dnbmzfm PljzP5NQ0IYOu748MxUHKKH2nHL62aHXmlLDo+aSd5YiRGa9lutp93SGiPq0eMzYzAbb xV0A== X-Gm-Message-State: APjAAAUvO3a9C4ru4dCHvSA5cABlCdpQobcrOeBou3mKA5Fk61Tvtk50 aIhdscj1TJaEmjrZ0cneEL5DUHMhxRcRRQ== X-Google-Smtp-Source: APXvYqxXt84afNROsx9T2xH4PeS5jIkS308uT4gFTqWRKiI0XaQ9zb5u0e7oUYXwqJavUtlIqBuIWg== X-Received: by 2002:a5d:698f:: with SMTP id g15mr25304890wru.310.1566844637384; Mon, 26 Aug 2019 11:37:17 -0700 (PDT) Received: from [192.168.1.102] (9.215.broadband18.iol.cz. [109.81.215.9]) by smtp.gmail.com with ESMTPSA id s192sm213920wme.17.2019.08.26.11.37.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2019 11:37:16 -0700 (PDT) Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests To: Alan Somers , "Conrad E. Meyer" Cc: Hiroki Sato , src-committers , svn-src-all , svn-src-head References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> From: Jan Sucan Message-ID: Date: Mon, 26 Aug 2019 20:37:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 46HLMg1BJmz3HhB X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=IhLbl1nU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of sucanjan@gmail.com designates 2a00:1450:4864:20::443 as permitted sender) smtp.mailfrom=sucanjan@gmail.com X-Spamd-Result: default: False [-3.95 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; RECEIVED_SPAMHAUS_PBL(0.00)[9.215.81.109.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.55), ipnet: 2a00:1450::/32(-3.00), asn: 15169(-2.33), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 18:37:20 -0000 On 26. 8. 2019 1:58, Alan Somers wrote: > Jan (please keep him CCed on replies) has been musing about the same > thing. That might satisfy everyone. Jan, would it be straightforward > to implement? > -Alan I forgot to answer the question whether it would be straightforward. It depends on how fast it should be solved. Simple and quick solution would be to completely duplicate the getopt loop including parsing of arguments of the options. With some more time I would implement it in two commits. The first commit for separating parsing of command line tokens from parsing of the option arguments, the second commit for translation of the options. I'm going to do it the second way. If the time is important, let me know. -Jan > On Sun, Aug 25, 2019 at 5:51 PM Conrad Meyer wrote: >> Hi Alan, Hiroki, >> >> It would be pretty easy to install a `ping6` link to the `ping(8)` >> binary with different option parsing (conditional on argv[0]). That >> removes most of the issues of code and space duplication, I think? >> And the goal would be for the 'ping6' name to retain option >> compatibility with historical ping6. >> >> It's not an uncommon pattern; for example, 'id', 'groups', and >> 'whoami' are all a single binary with multiple linked names. Another >> example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', >> 'clang++' and 'cpp' links to the same inode — and those have very >> different behavior depending on argv[0]. >> >> It's less work than forcing the ping6 compatibility crowd to create a >> port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable >> middle ground? >> >> Best, >> Conrad >> >> On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: >>> On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: >>>> Alan Somers wrote >>>> in : >>>> >>>> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: >>>> as> > >>>> as> > Hi, >>>> as> > >>>> as> > Alan Somers wrote >>>> as> > in <201908231522.x7NFMLuJ068037@repo.freebsd.org>: >>>> as> > >>>> as> > as> Author: asomers >>>> as> > as> Date: Fri Aug 23 15:22:20 2019 >>>> as> > as> New Revision: 351423 >>>> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 >>>> as> > as> >>>> as> > as> Log: >>>> as> > as> ping6: Rename options for better consistency with ping >>>> as> > as> >>>> as> > as> Now equivalent options have the same flags, and nonequivalent options have >>>> as> > as> different flags. This is a prelude to merging the two commands. >>>> as> > as> >>>> as> > as> Submitted by: Ján Sučan >>>> as> > as> MFC: Never >>>> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) >>>> as> > as> Differential Revision: https://reviews.freebsd.org/D21345 >>>> as> > >>>> as> > I have an objection on renaming the existing option flags in ping6(8) >>>> as> > for compatibility with ping(8). >>>> as> > >>>> as> > Is it sufficient to add INET6 support to ping(8) with consistent >>>> as> > flags and keep CLI of ping6(8) backward compatible? People have used >>>> as> > ping6(8) for >15 years, so it is too late to rename the flags. I do >>>> as> > not think the renaming is useful if "ping -6 localhost" or "ping ::1" >>>> as> > works. >>>> as> > >>>> as> > -- Hiroki >>>> as> >>>> as> If ping works with inet6, then why would we want to keep a separate >>>> as> tool around? If it's just for the sake of people who don't want to or >>>> as> can't update scripts, would a version in ports suffice? >>>> >>>> Because removing (or renaming) it causes a POLA violation. Do we >>>> really have a strong, unavoidable reason to force people to rewrite >>>> their script now? This is still a fairly essential and actively used >>>> tool, not like rcp or rlogin. Although deprecating ping6(8) and >>>> removing it from the base system in the future release at some point >>>> may work, changing the existing interface will simply confuse people >>>> who have used IPv6 for a long time. >>>> >>>> In my understanding, the purpose to integrate ping(8) and ping6(8) >>>> into a single utility is to provide a consistent CLI and reduce >>>> duplicate code, not to break compatibility. >>>> >>>> -- Hiroki >>> >>> Those goals are incompatible. We can't provide a consistent CLI without breaking compatibility because ping and ping6 have conflicting options. And we can't keep ping6 around while also removing duplicate code because that would be, well, duplicate code. >>> >>> When would be a better time than a major version bump to make a change like this? >>> >>> The lack of a ping6 command in freebsd 13 should serve as a pretty obvious reminder that scripts will need updating. I think that putting a version of ping6 in ports should be a sufficient crutch for those who need it, don't you? From owner-svn-src-all@freebsd.org Mon Aug 26 18:57:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7133E2BAA; Mon, 26 Aug 2019 18:57:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HLpc0P5Lz3JV8; Mon, 26 Aug 2019 18:57:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2KAtib6SpUIS22KAvipi99; Mon, 26 Aug 2019 12:57:10 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=ZEoSrfTuiJO42y7gCn8A:9 a=6fx59qz95PZ1v0d2:21 a=3I2Xy-IaEZeS5o1S:21 a=8HBsMUk44bn0z0wV:21 a=QEXdDO2ut3YA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from [10.250.34.60] (S01060c8ddb626965.gv.shawcable.net [70.67.252.119]) by spqr.komquats.com (Postfix) with ESMTPSA id 286E6345; Mon, 26 Aug 2019 11:57:06 -0700 (PDT) Date: Mon, 26 Aug 2019 11:56:43 -0700 In-Reply-To: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Mateusz Guzik CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfNirnWGFzeMM/s7qvPO+uU9N5jjAlNn64u+rwoje7fZxUhaHGnhHcaJMy/eojC69GbZcmWdPkYcP6c5UBxnRjL4n2/cPrBESa4hB8X9JkHmPH6DmiTwb D2HaXnp/CYhlWn+Cuqkx3FeJ6bDyxxDSHyH0hx52TunbNO0TArT9W8FPU0oA0c9CJHcOXZy0f+c3ay35V0fd7FT1tEVKWUa5+caF8x3XPA1XRScei62idJMn ZTEETTCk/lzsBHRLRzGVKb+dUc0kdCc9VmX2090xLeRmNfFPCdD/DIKa4nHfbP58 X-Rspamd-Queue-Id: 46HLpc0P5Lz3JV8 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-5.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.45)[ip: (-6.57), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; RCVD_IN_DNSWL_NONE(0.00)[12.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11, 119.252.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 18:57:14 -0000 On August 26, 2019 8:40:50 AM PDT, Cy Schubert wrote: >On August 26, 2019 7:11:22 AM PDT, Cy Schubert > wrote: >>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert=2Ecom>, Cy >>Schubert wr >>ites: >>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik >>wrote: >>> >Author: mjg >>> >Date: Sun Aug 25 05:13:15 2019 >>> >New Revision: 351472 >>> >URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/351472 >>> > >>> >Log: >>> > nullfs: reduce areas protected by vnode interlock >>> > =20 >>> >Some places only take the interlock to hold the vnode, which was a >>> >requiremnt >>> >before they started being manipulated with atomics=2E Use the newly >>> >introduced >>> > vholdnz to bump the count=2E >>> > =20 >>> > Reviewed by: kib >>> > Tested by: pho >>> > Sponsored by: The FreeBSD Foundation >>> > Differential Revision: https://reviews=2Efreebsd=2Eorg/D21358 >>> > >>> >Modified: >>> > head/sys/fs/nullfs/null_vnops=2Ec >>> > >>> >Modified: head/sys/fs/nullfs/null_vnops=2Ec >>> >>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> =3D=3D >>> >--- head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:11:43 >2019 (r35147 >>> 1) >>> >+++ head/sys/fs/nullfs/null_vnops=2Ec Sun Aug 25 05:13:15 >2019 (r35147 >>> 2) >>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) >>> > * We prevent it from being recycled by holding the vnode >>> > * here=2E >>> > */ >>> >- vholdl(lvp); >>> >+ vholdnz(lvp); >>> > error =3D VOP_LOCK(lvp, flags); >>> >=20 >>> > /* >>> >@@ -710,31 +710,16 @@ static int >>> > null_unlock(struct vop_unlock_args *ap) >>> > { >>> > struct vnode *vp =3D ap->a_vp; >>> >- int flags =3D ap->a_flags; >>> >- int mtxlkflag =3D 0; >>> > struct null_node *nn; >>> > struct vnode *lvp; >>> > int error; >>> >=20 >>> >- if ((flags & LK_INTERLOCK) !=3D 0) >>> >- mtxlkflag =3D 1; >>> >- else if (mtx_owned(VI_MTX(vp)) =3D=3D 0) { >>> >- VI_LOCK(vp); >>> >- mtxlkflag =3D 2; >>> >- } >>> > nn =3D VTONULL(vp); >>> > if (nn !=3D NULL && (lvp =3D NULLVPTOLOWERVP(vp)) !=3D NULL) { >>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); >>> >- flags |=3D LK_INTERLOCK; >>> >- vholdl(lvp); >>> >- VI_UNLOCK(vp); >>> >- error =3D VOP_UNLOCK(lvp, flags); >>> >+ vholdnz(lvp); >>> >+ error =3D VOP_UNLOCK(lvp, 0); >>> > vdrop(lvp); >>> >- if (mtxlkflag =3D=3D 0) >>> >- VI_LOCK(vp); >>> > } else { >>> >- if (mtxlkflag =3D=3D 2) >>> >- VI_UNLOCK(vp); >>> > error =3D vop_stdunlock(ap); >>> > } >>> >=20 >>> >@@ -845,10 +830,8 @@ null_getwritemount(struct >>vop_getwritemount_args >>> >*ap) >>> > VI_LOCK(vp); >>> > xp =3D VTONULL(vp); >>> > if (xp && (lowervp =3D xp->null_lowervp)) { >>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); >>> >+ vholdnz(lowervp); >>> > VI_UNLOCK(vp); >>> >- vholdl(lowervp); >>> >- VI_UNLOCK(lowervp); >>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); >>> > vdrop(lowervp); >>> > } else { >>> >>> Hi mjg@, >>> >>> This causes trap 12 a few seconds after mountlate during boot=2E >>Reverting this >>> commit allowed it to boot=2E >>> >>> Sorry for no backtrace=2E I managed to=20 >>> revert and test just prior to rushing out to catch the bus, with no >>time to=20 >>> craft a proper email=2E I'll post the backtrace when I arrive at work= =2E >> >>Hi mjg@, >> >>The gory details below=2E Don't be fooled by the panic when yppasswd is >>started=2E I was able to reproduce this panic in single user by simply >>mounting and using a nullfs=2E >> >>kernel trap 12 with interrupts disabled >> >> >>Fatal trap 12: page fault while in kernel mode >>cpuid =3D 0; apic id =3D 00 >>fault virtual address =3D 0xc >>fault code =3D supervisor read data, page not present >>instruction pointer =3D 0x20:0xffffffff806f0633 >>stack pointer =3D 0x28:0xfffffe004b3fa7c0 >>frame pointer =3D 0x28:0xfffffe004b3fa7e0 >>code segment =3D base 0x0, limit 0xfffff, type 0x1b >> =3D DPL 0, pres 1, long 1, def32 0, gran 1 >>processor eflags =3D resume, IOPL =3D 0 >>current process =3D 26 (syncer) >>trap number =3D 12 >>panic: page fault >>cpuid =3D 0 >>time =3D 1566821203 >>KDB: stack backtrace: >>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >>0xfffffe004b3fa470 >>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 >>panic() at panic+0x43/frame 0xfffffe004b3fa520 >>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 >>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 >>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 >>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 >>--- trap 0xc, rip =3D 0xffffffff806f0633, rsp =3D 0xfffffe004b3fa7c0, rb= p >=3D >>0xfffffe004b3fa7e0 --- >>propagate_priority() at propagate_priority+0x153/frame >>0xfffffe004b3fa7e0 >>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 >>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 >>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >>0xfffffe004b3fa920 >>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 >>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 >>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 >>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 >>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 >>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 >>--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- >>Uptime: 3m25s >>Dumping 921 out of 7974 >>MB:=2E=2E2%=2E=2E11%=2E=2E21%=2E=2E32%=2E=2E42%=2E=2E51%=2E=2E61%=2E=2E7= 2%=2E=2E82%=2E=2E91% >> >>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu=2Eh:246 >>246 __asm("movq %%gs:%P1,%0" : "=3Dr" (td) : "n" >>(OFFSETOF_CURTHREAD)); >>(kgdb) #0 __curthread () at >>/opt/src/svn-current/sys/amd64/include/pcpu=2Eh:246 >>#1 doadump (textdump=3D1) at >>/opt/src/svn-current/sys/kern/kern_shutdown=2Ec:392 >>#2 0xffffffff8068aead in kern_reboot (howto=3D260) >> at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:479 >>#3 0xffffffff8068b369 in vpanic (fmt=3D, ap=3D>out>) >> at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:905 >>#4 0xffffffff8068b163 in panic (fmt=3D) >> at /opt/src/svn-current/sys/kern/kern_shutdown=2Ec:832 >>#5 0xffffffff80a11c2c in trap_fatal (frame=3D0xfffffe004b3fa700, >eva=3D12) >> at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:943 >>#6 0xffffffff80a11c79 in trap_pfault (frame=3D0xfffffe004b3fa700, >>usermode=3D0) >> at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:767 >>#7 0xffffffff80a1126d in trap (frame=3D0xfffffe004b3fa700) >> at /opt/src/svn-current/sys/amd64/amd64/trap=2Ec:443 >>#8 >>#9 propagate_priority (td=3D0xfffff8003e43b000) >> at /opt/src/svn-current/sys/kern/subr_turnstile=2Ec:279 >>#10 0xffffffff806f13db in turnstile_wait (ts=3D0xfffff8000258a780,=20 >> owner=3D, queue=3D-512) >> at /opt/src/svn-current/sys/kern/subr_turnstile=2Ec:785 >>#11 0xffffffff80669271 in __mtx_lock_sleep (c=3D0xfffff80132e4ebf0,=20 >> v=3D) at >/opt/src/svn-current/sys/kern/kern_mutex=2Ec:654 >>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( >> mvp=3D0xfffff80002449800, mp=3D0xfffff80132d1e000, >vp=3D0xfffff80132e4eb40) >> at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:5590 >>#13 mnt_vnode_next_active (mvp=3D, mp=3D0xfffff80132d1e00= 0) >> at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:5649 >>#14 0xffffffff80766206 in __mnt_vnode_next_active >>(mvp=3D0xfffff80002449800,=20 >> mp=3D) at >/opt/src/svn-current/sys/kern/vfs_subr=2Ec:5682 >>#15 vfs_msync (mp=3D0xfffff80132d1e000, flags=3D2) >> at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:4238 >>#16 0xffffffff8076b4a6 in sync_fsync (ap=3D) >> at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:4468 >>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( >> vop=3D0xffffffff80cb4120 , a=3D0xfffffe004b3faa08) >> at vnode_if=2Ec:1312 >>#18 0xffffffff80769319 in VOP_FSYNC (vp=3D, waitfor=3D3,= =20 >> td=3D0xfffff800061dc5a0) at =2E/vnode_if=2Eh:549 >>#19 sync_vnode (bo=3D, td=3D0xfffff800061dc5a0,=20 >> slp=3D) at >/opt/src/svn-current/sys/kern/vfs_subr=2Ec:2316 >>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr=2Ec:2418 >>#21 0xffffffff80647e33 in fork_exit (callout=3D0xffffffff80768fa0 >>,=20 >> arg=3D0x0, frame=3D0xfffffe004b3faac0) >> at /opt/src/svn-current/sys/kern/kern_fork=2Ec:1045 >>#22 >> >> >>dmesg output: >> >>Updating motd:=2E >>Mounting late filesystems:=2E >>Starting nscd=2E >>Security policy loaded: MAC/ntpd (mac_ntpd) >>Starting ntpd=2E >>Starting yppasswdd=2E >>kernel trap 12 with interrupts disabled >> >> >>Fatal trap 12: page fault while in kernel mode >>cpuid =3D 0; apic id =3D 00 >>fault virtual address =3D 0xc >>fault code =3D supervisor read data, page not present >>instruction pointer =3D 0x20:0xffffffff806f0633 >>stack pointer =3D 0x28:0xfffffe004b7fa7c0 >>frame pointer =3D 0x28:0xfffffe004b7fa7e0 >>code segment =3D base 0x0, limit 0xfffff, type 0x1b >> =3D DPL 0, pres 1, long 1, def32 0, gran 1 >>processor eflags =3D resume, IOPL =3D 0 >>current process =3D 26 (syncer) >>trap number =3D 12 >>panic: page fault >>cpuid =3D 0 >>time =3D 1566820700 >>KDB: stack backtrace: >>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >>0xfffffe004b7fa470 >>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 >>panic() at panic+0x43/frame 0xfffffe004b7fa520 >>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 >>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 >>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 >>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 >>--- trap 0xc, rip =3D 0xffffffff806f0633, rsp =3D 0xfffffe004b7fa7c0, rb= p >=3D >>0xfffffe004b7fa7e0 --- >>propagate_priority() at propagate_priority+0x153/frame >>0xfffffe004b7fa7e0 >>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 >>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 >>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >>0xfffffe004b7fa920 >>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 >>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 >>--- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- >>Uptime: 1m38s >>Dumping 810 out of 7974 >>MB:=2E=2E2%=2E=2E12%=2E=2E22%=2E=2E32%=2E=2E42%=2E=2E52%=2E=2E62%=2E=2E7= 2%=2E=2E81%=2E=2E91%---<>--- > >This may be a simple case of increasing the kernel stack=2E I'll try this >at noon=2E Increasing kernel stack pages from 8 to 20 still results in the panic=2E --=20 Pardon the typos and autocorrect, small keyboard in use=2E Cheers, Cy Schubert FreeBSD UNIX: Web: http://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E From owner-svn-src-all@freebsd.org Mon Aug 26 18:57:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21669E2C04; Mon, 26 Aug 2019 18:57:30 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HLpy05Gvz3JdR; Mon, 26 Aug 2019 18:57:30 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9EABA895; Mon, 26 Aug 2019 18:57:29 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7QIvTEr074221; Mon, 26 Aug 2019 18:57:29 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QIvTL4074220; Mon, 26 Aug 2019 18:57:29 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201908261857.x7QIvTL4074220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 26 Aug 2019 18:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351517 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 351517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 18:57:30 -0000 Author: vmaffione Date: Mon Aug 26 18:57:29 2019 New Revision: 351517 URL: https://svnweb.freebsd.org/changeset/base/351517 Log: MFC r351221 link ptnet(4) man page to the build system Reported by: kevans Reviewed by: kevans, bcr Differential Revision: https://reviews.freebsd.org/D21312 Modified: stable/12/share/man/man4/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Mon Aug 26 17:54:19 2019 (r351516) +++ stable/12/share/man/man4/Makefile Mon Aug 26 18:57:29 2019 (r351517) @@ -425,6 +425,7 @@ MAN= aac.4 \ psm.4 \ pst.4 \ pt.4 \ + ptnet.4 \ pts.4 \ pty.4 \ puc.4 \ @@ -706,6 +707,7 @@ MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 MLINKS+=pms.4 pmspcv.4 +MLINKS+=ptnet.4 if_ptnet.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 From owner-svn-src-all@freebsd.org Mon Aug 26 20:14:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FA51E3FF6; Mon, 26 Aug 2019 20:14:17 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HNWX4Z1xz3Ms4; Mon, 26 Aug 2019 20:14:16 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 51DC58D4A13E; Mon, 26 Aug 2019 20:14:14 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3F853E7088C; Mon, 26 Aug 2019 20:14:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id qyE8TIkOAvwQ; Mon, 26 Aug 2019 20:14:11 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:28c9:afdb:7f06:b59d]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id BE28DE70824; Mon, 26 Aug 2019 20:14:10 +0000 (UTC) From: "Bjoern A. Zeeb" To: "John Baldwin" Cc: "alan somers" , "Hiroki Sato" , "Alan Somers" , "Jan Sucan" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests Date: Mon, 26 Aug 2019 20:14:10 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: In-Reply-To: References: <201908231522.x7NFMLuJ068037@repo.freebsd.org> <20190826.042056.1329861772202588895.hrs@allbsd.org> <20190826.050922.1810654532466043358.hrs@allbsd.org> <4D99F70B-5BFD-447A-B833-D4F73CEECFF2@lists.zabbadoz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46HNWX4Z1xz3Ms4 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 2a01:4f8:13b:39f::9f:25 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-5.67 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f8:13b:39f::9f:25]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[zabbadoz.net]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; RCPT_COUNT_SEVEN(0.00)[8]; IP_SCORE(-2.40)[ip: (-8.26), ipnet: 2a01:4f8::/29(-1.96), asn: 24940(-1.79), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; FREEMAIL_CC(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 20:14:17 -0000 On 26 Aug 2019, at 16:31, John Baldwin wrote: > On 8/26/19 1:59 AM, Bjoern A. Zeeb wrote: >> In other notes (and I keep saying that), I can see a world when ping >> doesn’t exist anymore as IPv4 doesn’t exist anymore (I partially >> already live in that world). The fact that people still do not >> prepare >> themselves for this time is a bit strange to me as by the time >> FreeBSD >> 14 is still in support this IPv6-only world might very well happen >> for a >> majority of people. And FreeBSD 14-CURRENT really is only a year >> away >> now. So breaking what’s been good for almost 20 years now for a >> few >> more years doesn’t really seem to be worth to me. > > Eh, I think having 'ping' around on even IPv6 systems is sensible. > ping is not inherently version-specific in name, only ping6 is. > Having > ping not include ipv4 bits for WITHOUT_INET=yes is fine, but I think > not > having ping as a command is just nonsense. The fact that we have > ping6 > instead of ping -6 (compared to say, traceroute, ssh, etc. which all > have unified commands) is just a user-interface bug we are stuck > maintaining compatibility for, not a goal to shoot for. Yes, I think we agreed with that and the wording we are using for the current (and future) FreeBSD situation just differed. To rephrase: I think it is a good idea (especially given the startup script use it) to have a command to send ICMP echo requests for a supported protocol family. I also think it would be a good idea to preserve the legacy of ping6(8) which behaves exactly the same as the current ping6(8) even if the code is shared with ping(8) and installed as a hardlink or similar. /bz From owner-svn-src-all@freebsd.org Mon Aug 26 20:15:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58AA0E4083; Mon, 26 Aug 2019 20:15:04 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HNXR2Xy5z3N1g; Mon, 26 Aug 2019 20:15:03 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x244.google.com with SMTP id o6so13123896oic.9; Mon, 26 Aug 2019 13:15:03 -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=xLrvTGGkh8LJKdFDiPtsUXoyMxMZH/8wD2h3a+v4288=; b=dwuBFAgxRFObnu/efRyE0iX0Y05KIFeGnoFwWen65ZZ47GbmmA2RSHQtfjgYbRPtxD /8IyaRn54VLNoz+K0CLP1jA7rS7rbr+tEvdLWhgwQG2cVK96X6RTl91w7ihOQb7ifBJU fyvGBDmPMxZglBa8SR+RSV4kGqFModBpTa0x5+Rre8TVe6KoQ3/xiq9tRU6H2jzw+cjt RBM7OWDU62OMUXNaKF4TnMkp3JY6dbQcQWXpcxxDR28qvZIQKivQjFqkk5e4prR617kK m7TUkqiN7tahuenAay3BeblmcNN8vKRxDROzEOJBe7k/iSy1a1nsp7Rkhzu/Wt5A4kbd ZOkA== 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=xLrvTGGkh8LJKdFDiPtsUXoyMxMZH/8wD2h3a+v4288=; b=kUpeyfIo+4gITpbnT2s/kwL4mLF6ougR9n7QEeZne5qXm9tNYCRDm6EL6PAED3HFa0 BGNmhZQtNMHfN4TzUN2vb6peF6MU1xKenabxp+ayjU8MeC6y5XPAnuE2off50JUf5uUp OARypAWkU0zpoltzx5ggaX1tU/ePKMIFg0xbbPVU0X6X14VscPmcY99zxed9E+kvCUq1 FcTOpORrWnr4bpoG7M1DbAwEzRtaWsi9xFXHudsxMsOK7+CNmpWdlgWO3JQgGzVcw3+b 7iu8epEukoQKObvN/Xyv7azEwg3Ph/rFmMbH3NY6bVxhzmLtlLFYQnIGG616KSIAdJAx KY/Q== X-Gm-Message-State: APjAAAWTVhII2jlvBoU9f8TihTeSpBU+cPvbkui6P7VaUf8OeuAk5YCx j2ESQTSH1ErchoPaEj/efT5Nil48wbcIwLNtgLdzBw== X-Google-Smtp-Source: APXvYqxcQ8ovJeG69zwV9t6wxYe2BL44uEqxp69tbpb23gEszgPC4bQddomb0D4TPD2D/DGwOJpLK1/LDA9zyZfm/H4= X-Received: by 2002:aca:ea82:: with SMTP id i124mr13367816oih.153.1566850502044; Mon, 26 Aug 2019 13:15:02 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Mon, 26 Aug 2019 13:15:01 -0700 (PDT) In-Reply-To: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> From: Mateusz Guzik Date: Mon, 26 Aug 2019 22:15:01 +0200 Message-ID: Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HNXR2Xy5z3N1g X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=dwuBFAgx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::244 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.38), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[4.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 20:15:04 -0000 Does this do the trick for you? https://people.freebsd.org/~mjg/vop_unlock-interlock.diff On 8/26/19, Cy Schubert wrote: > On August 26, 2019 8:40:50 AM PDT, Cy Schubert > wrote: >>On August 26, 2019 7:11:22 AM PDT, Cy Schubert >> wrote: >>>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy >>>Schubert wr >>>ites: >>>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik >>>wrote: >>>> >Author: mjg >>>> >Date: Sun Aug 25 05:13:15 2019 >>>> >New Revision: 351472 >>>> >URL: https://svnweb.freebsd.org/changeset/base/351472 >>>> > >>>> >Log: >>>> > nullfs: reduce areas protected by vnode interlock >>>> > >>>> >Some places only take the interlock to hold the vnode, which was a >>>> >requiremnt >>>> >before they started being manipulated with atomics. Use the newly >>>> >introduced >>>> > vholdnz to bump the count. >>>> > >>>> > Reviewed by: kib >>>> > Tested by: pho >>>> > Sponsored by: The FreeBSD Foundation >>>> > Differential Revision: https://reviews.freebsd.org/D21358 >>>> > >>>> >Modified: >>>> > head/sys/fs/nullfs/null_vnops.c >>>> > >>>> >Modified: head/sys/fs/nullfs/null_vnops.c >>>> >>>>============================================================================ >>>> == >>>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 >>2019 (r35147 >>>> 1) >>>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 >>2019 (r35147 >>>> 2) >>>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) >>>> > * We prevent it from being recycled by holding the vnode >>>> > * here. >>>> > */ >>>> >- vholdl(lvp); >>>> >+ vholdnz(lvp); >>>> > error = VOP_LOCK(lvp, flags); >>>> > >>>> > /* >>>> >@@ -710,31 +710,16 @@ static int >>>> > null_unlock(struct vop_unlock_args *ap) >>>> > { >>>> > struct vnode *vp = ap->a_vp; >>>> >- int flags = ap->a_flags; >>>> >- int mtxlkflag = 0; >>>> > struct null_node *nn; >>>> > struct vnode *lvp; >>>> > int error; >>>> > >>>> >- if ((flags & LK_INTERLOCK) != 0) >>>> >- mtxlkflag = 1; >>>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { >>>> >- VI_LOCK(vp); >>>> >- mtxlkflag = 2; >>>> >- } >>>> > nn = VTONULL(vp); >>>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { >>>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); >>>> >- flags |= LK_INTERLOCK; >>>> >- vholdl(lvp); >>>> >- VI_UNLOCK(vp); >>>> >- error = VOP_UNLOCK(lvp, flags); >>>> >+ vholdnz(lvp); >>>> >+ error = VOP_UNLOCK(lvp, 0); >>>> > vdrop(lvp); >>>> >- if (mtxlkflag == 0) >>>> >- VI_LOCK(vp); >>>> > } else { >>>> >- if (mtxlkflag == 2) >>>> >- VI_UNLOCK(vp); >>>> > error = vop_stdunlock(ap); >>>> > } >>>> > >>>> >@@ -845,10 +830,8 @@ null_getwritemount(struct >>>vop_getwritemount_args >>>> >*ap) >>>> > VI_LOCK(vp); >>>> > xp = VTONULL(vp); >>>> > if (xp && (lowervp = xp->null_lowervp)) { >>>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); >>>> >+ vholdnz(lowervp); >>>> > VI_UNLOCK(vp); >>>> >- vholdl(lowervp); >>>> >- VI_UNLOCK(lowervp); >>>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); >>>> > vdrop(lowervp); >>>> > } else { >>>> >>>> Hi mjg@, >>>> >>>> This causes trap 12 a few seconds after mountlate during boot. >>>Reverting this >>>> commit allowed it to boot. >>>> >>>> Sorry for no backtrace. I managed to >>>> revert and test just prior to rushing out to catch the bus, with no >>>time to >>>> craft a proper email. I'll post the backtrace when I arrive at work. >>> >>>Hi mjg@, >>> >>>The gory details below. Don't be fooled by the panic when yppasswd is >>>started. I was able to reproduce this panic in single user by simply >>>mounting and using a nullfs. >>> >>>kernel trap 12 with interrupts disabled >>> >>> >>>Fatal trap 12: page fault while in kernel mode >>>cpuid = 0; apic id = 00 >>>fault virtual address = 0xc >>>fault code = supervisor read data, page not present >>>instruction pointer = 0x20:0xffffffff806f0633 >>>stack pointer = 0x28:0xfffffe004b3fa7c0 >>>frame pointer = 0x28:0xfffffe004b3fa7e0 >>>code segment = base 0x0, limit 0xfffff, type 0x1b >>> = DPL 0, pres 1, long 1, def32 0, gran 1 >>>processor eflags = resume, IOPL = 0 >>>current process = 26 (syncer) >>>trap number = 12 >>>panic: page fault >>>cpuid = 0 >>>time = 1566821203 >>>KDB: stack backtrace: >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >>>0xfffffe004b3fa470 >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 >>>panic() at panic+0x43/frame 0xfffffe004b3fa520 >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 >>>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 >>>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp >>= >>>0xfffffe004b3fa7e0 --- >>>propagate_priority() at propagate_priority+0x153/frame >>>0xfffffe004b3fa7e0 >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >>>0xfffffe004b3fa920 >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 >>>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 >>>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 >>>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 >>>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- >>>Uptime: 3m25s >>>Dumping 921 out of 7974 >>>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% >>> >>>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 >>>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" >>>(OFFSETOF_CURTHREAD)); >>>(kgdb) #0 __curthread () at >>>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 >>>#1 doadump (textdump=1) at >>>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 >>>#2 0xffffffff8068aead in kern_reboot (howto=260) >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 >>>#3 0xffffffff8068b369 in vpanic (fmt=, ap=>>out>) >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 >>>#4 0xffffffff8068b163 in panic (fmt=) >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 >>>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, >>eva=12) >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 >>>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, >>>usermode=0) >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 >>>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 >>>#8 >>>#9 propagate_priority (td=0xfffff8003e43b000) >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 >>>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, >>> owner=, queue=-512) >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 >>>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, >>> v=) at >>/opt/src/svn-current/sys/kern/kern_mutex.c:654 >>>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( >>> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, >>vp=0xfffff80132e4eb40) >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 >>>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 >>>#14 0xffffffff80766206 in __mnt_vnode_next_active >>>(mvp=0xfffff80002449800, >>> mp=) at >>/opt/src/svn-current/sys/kern/vfs_subr.c:5682 >>>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 >>>#16 0xffffffff8076b4a6 in sync_fsync (ap=) >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 >>>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( >>> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) >>> at vnode_if.c:1312 >>>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, >>> td=0xfffff800061dc5a0) at ./vnode_if.h:549 >>>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, >>> slp=) at >>/opt/src/svn-current/sys/kern/vfs_subr.c:2316 >>>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 >>>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 >>>, >>> arg=0x0, frame=0xfffffe004b3faac0) >>> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 >>>#22 >>> >>> >>>dmesg output: >>> >>>Updating motd:. >>>Mounting late filesystems:. >>>Starting nscd. >>>Security policy loaded: MAC/ntpd (mac_ntpd) >>>Starting ntpd. >>>Starting yppasswdd. >>>kernel trap 12 with interrupts disabled >>> >>> >>>Fatal trap 12: page fault while in kernel mode >>>cpuid = 0; apic id = 00 >>>fault virtual address = 0xc >>>fault code = supervisor read data, page not present >>>instruction pointer = 0x20:0xffffffff806f0633 >>>stack pointer = 0x28:0xfffffe004b7fa7c0 >>>frame pointer = 0x28:0xfffffe004b7fa7e0 >>>code segment = base 0x0, limit 0xfffff, type 0x1b >>> = DPL 0, pres 1, long 1, def32 0, gran 1 >>>processor eflags = resume, IOPL = 0 >>>current process = 26 (syncer) >>>trap number = 12 >>>panic: page fault >>>cpuid = 0 >>>time = 1566820700 >>>KDB: stack backtrace: >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >>>0xfffffe004b7fa470 >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 >>>panic() at panic+0x43/frame 0xfffffe004b7fa520 >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 >>>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 >>>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp >>= >>>0xfffffe004b7fa7e0 --- >>>propagate_priority() at propagate_priority+0x153/frame >>>0xfffffe004b7fa7e0 >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >>>0xfffffe004b7fa920 >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- >>>Uptime: 1m38s >>>Dumping 810 out of 7974 >>>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- >> >>This may be a simple case of increasing the kernel stack. I'll try this >>at noon. > > Increasing kernel stack pages from 8 to 20 still results in the panic. > > > -- > Pardon the typos and autocorrect, small keyboard in use. > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Mon Aug 26 20:15:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9ECEFE40BF; Mon, 26 Aug 2019 20:15:12 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HNXb2wGtz3N7q; Mon, 26 Aug 2019 20:15:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2LOMiqX2fSrVc2LONimzLk; Mon, 26 Aug 2019 14:15:08 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=u4J8QU_s_-lIpTMvNuEA:9 a=7rGe7H_wMalzTzRd:21 a=rQ4BupQ3IxZE0W-Y:21 a=P72zRhDHRApVOsr8:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id E0FBF3FB; Mon, 26 Aug 2019 13:15:05 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7QKF5WV050008; Mon, 26 Aug 2019 13:15:05 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7QKF5Q1049991; Mon, 26 Aug 2019 13:15:05 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908262015.x7QKF5Q1049991@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Mon, 26 Aug 2019 11:56:43 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 13:15:05 -0700 X-CMAE-Envelope: MS4wfD9c+PFg6rxoqmm9IKr3DJ0+D6RN4Yf4F3QPn7Z8s8yCOX2iYMXPyBoWjMEOETSrCUi90CB7fUg/D+y8i9fs9Av6VGMY7Jx8jEo981MQQIN4PauMGqcq eDTy8lt49fiJJVyyHwKUAXCnxGm1xLCkMNqjvqpJ+5U2QZLC9Z3yDku7LSIoL3KqMhN+/AR0heJqIr85El128R9HGFV1/UMLJdOKOCLYTiRdLQqkT7HMF/pO mhD0TBqxjyGgyB4S5ZqZOcCtzXQ7T/kAtG64yD6fHORbp7nm6NztzrCGkOtuXLew X-Rspamd-Queue-Id: 46HNXb2wGtz3N7q X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.89 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; RCVD_IN_DNSWL_NONE(0.00)[137.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.33)[ip: (-5.95), ipnet: 64.59.128.0/20(-3.15), asn: 6327(-2.45), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 20:15:12 -0000 In message , Cy Schubert wr ites: > On August 26, 2019 8:40:50 AM PDT, Cy Schubert wr > ote: > >On August 26, 2019 7:11:22 AM PDT, Cy Schubert > > wrote: > >>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy > >>Schubert wr > >>ites: > >>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik > >>wrote: > >>> >Author: mjg > >>> >Date: Sun Aug 25 05:13:15 2019 > >>> >New Revision: 351472 > >>> >URL: https://svnweb.freebsd.org/changeset/base/351472 > >>> > > >>> >Log: > >>> > nullfs: reduce areas protected by vnode interlock > >>> > > >>> >Some places only take the interlock to hold the vnode, which was a > >>> >requiremnt > >>> >before they started being manipulated with atomics. Use the newly > >>> >introduced > >>> > vholdnz to bump the count. > >>> > > >>> > Reviewed by: kib > >>> > Tested by: pho > >>> > Sponsored by: The FreeBSD Foundation > >>> > Differential Revision: https://reviews.freebsd.org/D21358 > >>> > > >>> >Modified: > >>> > head/sys/fs/nullfs/null_vnops.c > >>> > > >>> >Modified: head/sys/fs/nullfs/null_vnops.c > >>> > >>>========================================================================== > == > >>> == > >>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 > >2019 (r35147 > >>> 1) > >>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 > >2019 (r35147 > >>> 2) > >>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > >>> > * We prevent it from being recycled by holding the vno > de > >>> > * here. > >>> > */ > >>> >- vholdl(lvp); > >>> >+ vholdnz(lvp); > >>> > error = VOP_LOCK(lvp, flags); > >>> > > >>> > /* > >>> >@@ -710,31 +710,16 @@ static int > >>> > null_unlock(struct vop_unlock_args *ap) > >>> > { > >>> > struct vnode *vp = ap->a_vp; > >>> >- int flags = ap->a_flags; > >>> >- int mtxlkflag = 0; > >>> > struct null_node *nn; > >>> > struct vnode *lvp; > >>> > int error; > >>> > > >>> >- if ((flags & LK_INTERLOCK) != 0) > >>> >- mtxlkflag = 1; > >>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { > >>> >- VI_LOCK(vp); > >>> >- mtxlkflag = 2; > >>> >- } > >>> > nn = VTONULL(vp); > >>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { > >>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); > >>> >- flags |= LK_INTERLOCK; > >>> >- vholdl(lvp); > >>> >- VI_UNLOCK(vp); > >>> >- error = VOP_UNLOCK(lvp, flags); > >>> >+ vholdnz(lvp); > >>> >+ error = VOP_UNLOCK(lvp, 0); > >>> > vdrop(lvp); > >>> >- if (mtxlkflag == 0) > >>> >- VI_LOCK(vp); > >>> > } else { > >>> >- if (mtxlkflag == 2) > >>> >- VI_UNLOCK(vp); > >>> > error = vop_stdunlock(ap); > >>> > } > >>> > > >>> >@@ -845,10 +830,8 @@ null_getwritemount(struct > >>vop_getwritemount_args > >>> >*ap) > >>> > VI_LOCK(vp); > >>> > xp = VTONULL(vp); > >>> > if (xp && (lowervp = xp->null_lowervp)) { > >>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); > >>> >+ vholdnz(lowervp); > >>> > VI_UNLOCK(vp); > >>> >- vholdl(lowervp); > >>> >- VI_UNLOCK(lowervp); > >>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > >>> > vdrop(lowervp); > >>> > } else { > >>> > >>> Hi mjg@, > >>> > >>> This causes trap 12 a few seconds after mountlate during boot. > >>Reverting this > >>> commit allowed it to boot. > >>> > >>> Sorry for no backtrace. I managed to > >>> revert and test just prior to rushing out to catch the bus, with no > >>time to > >>> craft a proper email. I'll post the backtrace when I arrive at work. > >> > >>Hi mjg@, > >> > >>The gory details below. Don't be fooled by the panic when yppasswd is > >>started. I was able to reproduce this panic in single user by simply > >>mounting and using a nullfs. > >> > >>kernel trap 12 with interrupts disabled > >> > >> > >>Fatal trap 12: page fault while in kernel mode > >>cpuid = 0; apic id = 00 > >>fault virtual address = 0xc > >>fault code = supervisor read data, page not present > >>instruction pointer = 0x20:0xffffffff806f0633 > >>stack pointer = 0x28:0xfffffe004b3fa7c0 > >>frame pointer = 0x28:0xfffffe004b3fa7e0 > >>code segment = base 0x0, limit 0xfffff, type 0x1b > >> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>processor eflags = resume, IOPL = 0 > >>current process = 26 (syncer) > >>trap number = 12 > >>panic: page fault > >>cpuid = 0 > >>time = 1566821203 > >>KDB: stack backtrace: > >>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>0xfffffe004b3fa470 > >>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 > >>panic() at panic+0x43/frame 0xfffffe004b3fa520 > >>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 > >>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 > >>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 > >>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 > >>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp > >= > >>0xfffffe004b3fa7e0 --- > >>propagate_priority() at propagate_priority+0x153/frame > >>0xfffffe004b3fa7e0 > >>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 > >>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 > >>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>0xfffffe004b3fa920 > >>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 > >>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 > >>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 > >>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 > >>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 > >>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 > >>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>Uptime: 3m25s > >>Dumping 921 out of 7974 > >>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% > >> > >>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" > >>(OFFSETOF_CURTHREAD)); > >>(kgdb) #0 __curthread () at > >>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>#1 doadump (textdump=1) at > >>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 > >>#2 0xffffffff8068aead in kern_reboot (howto=260) > >> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 > >>#3 0xffffffff8068b369 in vpanic (fmt=, ap= >>out>) > >> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 > >>#4 0xffffffff8068b163 in panic (fmt=) > >> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 > >>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, > >eva=12) > >> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 > >>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, > >>usermode=0) > >> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 > >>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) > >> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 > >>#8 > >>#9 propagate_priority (td=0xfffff8003e43b000) > >> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 > >>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, > >> owner=, queue=-512) > >> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 > >>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, > >> v=) at > >/opt/src/svn-current/sys/kern/kern_mutex.c:654 > >>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( > >> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, > >vp=0xfffff80132e4eb40) > >> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 > >>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) > >> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 > >>#14 0xffffffff80766206 in __mnt_vnode_next_active > >>(mvp=0xfffff80002449800, > >> mp=) at > >/opt/src/svn-current/sys/kern/vfs_subr.c:5682 > >>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) > >> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 > >>#16 0xffffffff8076b4a6 in sync_fsync (ap=) > >> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 > >>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( > >> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) > >> at vnode_if.c:1312 > >>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, > >> td=0xfffff800061dc5a0) at ./vnode_if.h:549 > >>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, > >> slp=) at > >/opt/src/svn-current/sys/kern/vfs_subr.c:2316 > >>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 > >>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 > >>, > >> arg=0x0, frame=0xfffffe004b3faac0) > >> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 > >>#22 > >> > >> > >>dmesg output: > >> > >>Updating motd:. > >>Mounting late filesystems:. > >>Starting nscd. > >>Security policy loaded: MAC/ntpd (mac_ntpd) > >>Starting ntpd. > >>Starting yppasswdd. > >>kernel trap 12 with interrupts disabled > >> > >> > >>Fatal trap 12: page fault while in kernel mode > >>cpuid = 0; apic id = 00 > >>fault virtual address = 0xc > >>fault code = supervisor read data, page not present > >>instruction pointer = 0x20:0xffffffff806f0633 > >>stack pointer = 0x28:0xfffffe004b7fa7c0 > >>frame pointer = 0x28:0xfffffe004b7fa7e0 > >>code segment = base 0x0, limit 0xfffff, type 0x1b > >> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>processor eflags = resume, IOPL = 0 > >>current process = 26 (syncer) > >>trap number = 12 > >>panic: page fault > >>cpuid = 0 > >>time = 1566820700 > >>KDB: stack backtrace: > >>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>0xfffffe004b7fa470 > >>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 > >>panic() at panic+0x43/frame 0xfffffe004b7fa520 > >>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 > >>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 > >>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 > >>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 > >>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp > >= > >>0xfffffe004b7fa7e0 --- > >>propagate_priority() at propagate_priority+0x153/frame > >>0xfffffe004b7fa7e0 > >>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 > >>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 > >>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>0xfffffe004b7fa920 > >>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 > >>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 > >>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>Uptime: 1m38s > >>Dumping 810 out of 7974 > >>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- > > > >This may be a simple case of increasing the kernel stack. I'll try this > >at noon. > > Increasing kernel stack pages from 8 to 20 still results in the panic. Pfft. Obviously. td->td_blocked is NULL. I've run out of noon hour but I'll put this out there even if this is half baked and not fully analyzed (got to get back to $JOB) but td->td_turnstile is NULL at frame 11. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Mon Aug 26 20:17:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9D2FE41F8; Mon, 26 Aug 2019 20:17:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HNbc3VkWz3NKj; Mon, 26 Aug 2019 20:17:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2LQuiqZ9jSrVc2LQvin03k; Mon, 26 Aug 2019 14:17:46 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=BrtT2lZyVd4BvNs1i8sA:9 a=082q3YohYhMu5kk3:21 a=dPDYV4cP5bbATGA8:21 a=8HBsMUk44bn0z0wV:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id EB01A40E; Mon, 26 Aug 2019 13:17:43 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7QKHhCV050140; Mon, 26 Aug 2019 13:17:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7QKHhOu050137; Mon, 26 Aug 2019 13:17:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908262017.x7QKHhOu050137@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> Comments: In-reply-to Mateusz Guzik message dated "Mon, 26 Aug 2019 22:15:01 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 13:17:43 -0700 X-CMAE-Envelope: MS4wfFsWrUUBPo/AqYvh+ANBXj7kpoHJa8hXII97Aw/WOIWDqCNK/cDsU7kQmyUhPKEum5zUFfPrZwWjNcMK7efud8tWp7yHCni6e8JF+okbjhVrse/QnuqI gtwPSQnfhCvLxlDKTVWd1+S6d/M+EgNDnEP+xzAYzPrxuMwtQLSrAxUfm74JvpPSisnmcFcJU8I5Ego5LiUgtH/u7IaEEj2XQud9Va9ZLNChwLPHVt1CvGr+ xMAd+KwSUuB75fPEE4UI7ppNDf+MeGrxldCnUSmKbf4= X-Rspamd-Queue-Id: 46HNbc3VkWz3NKj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.85 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.28)[ip: (-5.71), ipnet: 64.59.128.0/20(-3.14), asn: 6327(-2.45), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 20:17:49 -0000 Thanks. My lunch hour is over. I'll try this after I get home from $JOB. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. In message , Mateusz Guzik writes: > Does this do the trick for you? > > https://people.freebsd.org/~mjg/vop_unlock-interlock.diff > > On 8/26/19, Cy Schubert wrote: > > On August 26, 2019 8:40:50 AM PDT, Cy Schubert > > wrote: > >>On August 26, 2019 7:11:22 AM PDT, Cy Schubert > >> wrote: > >>>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy > >>>Schubert wr > >>>ites: > >>>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik > >>>wrote: > >>>> >Author: mjg > >>>> >Date: Sun Aug 25 05:13:15 2019 > >>>> >New Revision: 351472 > >>>> >URL: https://svnweb.freebsd.org/changeset/base/351472 > >>>> > > >>>> >Log: > >>>> > nullfs: reduce areas protected by vnode interlock > >>>> > > >>>> >Some places only take the interlock to hold the vnode, which was a > >>>> >requiremnt > >>>> >before they started being manipulated with atomics. Use the newly > >>>> >introduced > >>>> > vholdnz to bump the count. > >>>> > > >>>> > Reviewed by: kib > >>>> > Tested by: pho > >>>> > Sponsored by: The FreeBSD Foundation > >>>> > Differential Revision: https://reviews.freebsd.org/D21358 > >>>> > > >>>> >Modified: > >>>> > head/sys/fs/nullfs/null_vnops.c > >>>> > > >>>> >Modified: head/sys/fs/nullfs/null_vnops.c > >>>> > >>>>========================================================================= > === > >>>> == > >>>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 > >>2019 (r35147 > >>>> 1) > >>>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 > >>2019 (r35147 > >>>> 2) > >>>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > >>>> > * We prevent it from being recycled by holding the vno > de > >>>> > * here. > >>>> > */ > >>>> >- vholdl(lvp); > >>>> >+ vholdnz(lvp); > >>>> > error = VOP_LOCK(lvp, flags); > >>>> > > >>>> > /* > >>>> >@@ -710,31 +710,16 @@ static int > >>>> > null_unlock(struct vop_unlock_args *ap) > >>>> > { > >>>> > struct vnode *vp = ap->a_vp; > >>>> >- int flags = ap->a_flags; > >>>> >- int mtxlkflag = 0; > >>>> > struct null_node *nn; > >>>> > struct vnode *lvp; > >>>> > int error; > >>>> > > >>>> >- if ((flags & LK_INTERLOCK) != 0) > >>>> >- mtxlkflag = 1; > >>>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { > >>>> >- VI_LOCK(vp); > >>>> >- mtxlkflag = 2; > >>>> >- } > >>>> > nn = VTONULL(vp); > >>>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { > >>>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); > >>>> >- flags |= LK_INTERLOCK; > >>>> >- vholdl(lvp); > >>>> >- VI_UNLOCK(vp); > >>>> >- error = VOP_UNLOCK(lvp, flags); > >>>> >+ vholdnz(lvp); > >>>> >+ error = VOP_UNLOCK(lvp, 0); > >>>> > vdrop(lvp); > >>>> >- if (mtxlkflag == 0) > >>>> >- VI_LOCK(vp); > >>>> > } else { > >>>> >- if (mtxlkflag == 2) > >>>> >- VI_UNLOCK(vp); > >>>> > error = vop_stdunlock(ap); > >>>> > } > >>>> > > >>>> >@@ -845,10 +830,8 @@ null_getwritemount(struct > >>>vop_getwritemount_args > >>>> >*ap) > >>>> > VI_LOCK(vp); > >>>> > xp = VTONULL(vp); > >>>> > if (xp && (lowervp = xp->null_lowervp)) { > >>>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); > >>>> >+ vholdnz(lowervp); > >>>> > VI_UNLOCK(vp); > >>>> >- vholdl(lowervp); > >>>> >- VI_UNLOCK(lowervp); > >>>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > >>>> > vdrop(lowervp); > >>>> > } else { > >>>> > >>>> Hi mjg@, > >>>> > >>>> This causes trap 12 a few seconds after mountlate during boot. > >>>Reverting this > >>>> commit allowed it to boot. > >>>> > >>>> Sorry for no backtrace. I managed to > >>>> revert and test just prior to rushing out to catch the bus, with no > >>>time to > >>>> craft a proper email. I'll post the backtrace when I arrive at work. > >>> > >>>Hi mjg@, > >>> > >>>The gory details below. Don't be fooled by the panic when yppasswd is > >>>started. I was able to reproduce this panic in single user by simply > >>>mounting and using a nullfs. > >>> > >>>kernel trap 12 with interrupts disabled > >>> > >>> > >>>Fatal trap 12: page fault while in kernel mode > >>>cpuid = 0; apic id = 00 > >>>fault virtual address = 0xc > >>>fault code = supervisor read data, page not present > >>>instruction pointer = 0x20:0xffffffff806f0633 > >>>stack pointer = 0x28:0xfffffe004b3fa7c0 > >>>frame pointer = 0x28:0xfffffe004b3fa7e0 > >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>>processor eflags = resume, IOPL = 0 > >>>current process = 26 (syncer) > >>>trap number = 12 > >>>panic: page fault > >>>cpuid = 0 > >>>time = 1566821203 > >>>KDB: stack backtrace: > >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>>0xfffffe004b3fa470 > >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 > >>>panic() at panic+0x43/frame 0xfffffe004b3fa520 > >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 > >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 > >>>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 > >>>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 > >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp > >>= > >>>0xfffffe004b3fa7e0 --- > >>>propagate_priority() at propagate_priority+0x153/frame > >>>0xfffffe004b3fa7e0 > >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 > >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 > >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>>0xfffffe004b3fa920 > >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 > >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 > >>>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 > >>>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 > >>>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 > >>>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 > >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>>Uptime: 3m25s > >>>Dumping 921 out of 7974 > >>>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% > >>> > >>>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" > >>>(OFFSETOF_CURTHREAD)); > >>>(kgdb) #0 __curthread () at > >>>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>>#1 doadump (textdump=1) at > >>>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 > >>>#2 0xffffffff8068aead in kern_reboot (howto=260) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 > >>>#3 0xffffffff8068b369 in vpanic (fmt=, ap= >>>out>) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 > >>>#4 0xffffffff8068b163 in panic (fmt=) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 > >>>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, > >>eva=12) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 > >>>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, > >>>usermode=0) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 > >>>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 > >>>#8 > >>>#9 propagate_priority (td=0xfffff8003e43b000) > >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 > >>>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, > >>> owner=, queue=-512) > >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 > >>>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, > >>> v=) at > >>/opt/src/svn-current/sys/kern/kern_mutex.c:654 > >>>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( > >>> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, > >>vp=0xfffff80132e4eb40) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 > >>>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 > >>>#14 0xffffffff80766206 in __mnt_vnode_next_active > >>>(mvp=0xfffff80002449800, > >>> mp=) at > >>/opt/src/svn-current/sys/kern/vfs_subr.c:5682 > >>>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 > >>>#16 0xffffffff8076b4a6 in sync_fsync (ap=) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 > >>>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( > >>> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) > >>> at vnode_if.c:1312 > >>>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, > >>> td=0xfffff800061dc5a0) at ./vnode_if.h:549 > >>>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, > >>> slp=) at > >>/opt/src/svn-current/sys/kern/vfs_subr.c:2316 > >>>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 > >>>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 > >>>, > >>> arg=0x0, frame=0xfffffe004b3faac0) > >>> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 > >>>#22 > >>> > >>> > >>>dmesg output: > >>> > >>>Updating motd:. > >>>Mounting late filesystems:. > >>>Starting nscd. > >>>Security policy loaded: MAC/ntpd (mac_ntpd) > >>>Starting ntpd. > >>>Starting yppasswdd. > >>>kernel trap 12 with interrupts disabled > >>> > >>> > >>>Fatal trap 12: page fault while in kernel mode > >>>cpuid = 0; apic id = 00 > >>>fault virtual address = 0xc > >>>fault code = supervisor read data, page not present > >>>instruction pointer = 0x20:0xffffffff806f0633 > >>>stack pointer = 0x28:0xfffffe004b7fa7c0 > >>>frame pointer = 0x28:0xfffffe004b7fa7e0 > >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>>processor eflags = resume, IOPL = 0 > >>>current process = 26 (syncer) > >>>trap number = 12 > >>>panic: page fault > >>>cpuid = 0 > >>>time = 1566820700 > >>>KDB: stack backtrace: > >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>>0xfffffe004b7fa470 > >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 > >>>panic() at panic+0x43/frame 0xfffffe004b7fa520 > >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 > >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 > >>>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 > >>>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 > >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp > >>= > >>>0xfffffe004b7fa7e0 --- > >>>propagate_priority() at propagate_priority+0x153/frame > >>>0xfffffe004b7fa7e0 > >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 > >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 > >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>>0xfffffe004b7fa920 > >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 > >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 > >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>>Uptime: 1m38s > >>>Dumping 810 out of 7974 > >>>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- > >> > >>This may be a simple case of increasing the kernel stack. I'll try this > >>at noon. > > > > Increasing kernel stack pages from 8 to 20 still results in the panic. > > > > > > -- > > Pardon the typos and autocorrect, small keyboard in use. > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > > -- > Mateusz Guzik From owner-svn-src-all@freebsd.org Mon Aug 26 20:20:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 244CBE42EC; Mon, 26 Aug 2019 20:20:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HNfM0Cb5z3NVZ; Mon, 26 Aug 2019 20:20:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCFC5B7A9; Mon, 26 Aug 2019 20:20:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7QKKA5A021699; Mon, 26 Aug 2019 20:20:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7QKKAtS021698; Mon, 26 Aug 2019 20:20:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908262020.x7QKKAtS021698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 26 Aug 2019 20:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351518 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 20:20:11 -0000 Author: markj Date: Mon Aug 26 20:20:10 2019 New Revision: 351518 URL: https://svnweb.freebsd.org/changeset/base/351518 Log: Fix a few nits in vm_pqbatch_process_page(). - Don't bother masking off non-queue state flags when loading the page's atomic state, since it is only required for one of the function's assertions. Update the assertion instead. - Remove an incorrect comment regarding synchronization with the page daemon. The page daemon only ever checks for PGA_ENQUEUED with the page queue lock held. - When clearing requeue flags, only clear the flags that have been acted upon. Reviewed by: kib (previous version) Discussed with: alc Tested by: pho (part of a larger patch) MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21368 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Aug 26 18:57:29 2019 (r351517) +++ head/sys/vm/vm_page.c Mon Aug 26 20:20:10 2019 (r351518) @@ -3081,9 +3081,10 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa * the page queue lock held. In this case it is about to free the page, * which must not have any queue state. */ - qflags = atomic_load_8(&m->aflags) & PGA_QUEUE_STATE_MASK; - KASSERT(pq == vm_page_pagequeue(m) || qflags == 0, - ("page %p doesn't belong to queue %p but has queue state %#x", + qflags = atomic_load_8(&m->aflags); + KASSERT(pq == vm_page_pagequeue(m) || + (qflags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p doesn't belong to queue %p but has aflags %#x", m, pq, qflags)); if ((qflags & PGA_DEQUEUE) != 0) { @@ -3097,6 +3098,13 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa vm_pagequeue_cnt_inc(pq); vm_page_aflag_set(m, PGA_ENQUEUED); } + + /* + * Give PGA_REQUEUE_HEAD precedence over PGA_REQUEUE. + * In particular, if both flags are set in close succession, + * only PGA_REQUEUE_HEAD will be applied, even if it was set + * first. + */ if ((qflags & PGA_REQUEUE_HEAD) != 0) { KASSERT(m->queue == PQ_INACTIVE, ("head enqueue not supported for page %p", m)); @@ -3105,12 +3113,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa } else TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); - /* - * PGA_REQUEUE and PGA_REQUEUE_HEAD must be cleared after - * setting PGA_ENQUEUED in order to synchronize with the - * page daemon. - */ - vm_page_aflag_clear(m, PGA_REQUEUE | PGA_REQUEUE_HEAD); + vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | + PGA_REQUEUE_HEAD)); } } From owner-svn-src-all@freebsd.org Mon Aug 26 22:00:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 714CBE63DB; Mon, 26 Aug 2019 22:00:41 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HQtK2P3sz3yQ1; Mon, 26 Aug 2019 22:00:41 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f46.google.com with SMTP id l7so41296588ioj.6; Mon, 26 Aug 2019 15:00:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=3rLu+6wFnU1khWQofdzWu+RcbeDQ9a1GxxQMonNZUD4=; b=j2R26M7cYrFBjIYKrDqBItY47elQHiBHEHOHGiArfxU5UnzYyFPVi59ylmSY2gj3BY ZNaxhkG2OsXOtfNZBi/2R8XaitWc59ArgxgXV+OHO0BcQLYD+wNqroYuWQbMelvizFnM bIbpI3uSZciWrMacMpqKLTEsRH9KjiPPLLRQ6atKwILbXHJVU+NXdvYVdFgrqmuHilKt ZaM7jK+5CrI+i3rQKs/m00LYVE4UVl6J9BR8z1aXgM1K39SySe2hxB9Si+4OImvLlTwC pm2uA+hfTVsBJvEsOSnOoh21EDKDBzJGcKK9gnQ2FtxFoK/oYebytsrkoSOVmbKbkVhk 0Sqg== X-Gm-Message-State: APjAAAUwdKw/P1dD3oT9Jq5GPdaPD2l0JvZ/DOwfhLAlJD86isLej0Dj SYHpTeBpvGh7dLPhjeP7k0Kzi/mW X-Google-Smtp-Source: APXvYqwgdxb/46ZZaA8bd2FC9YqX1HzebMekZJeG8rOEjpNEJVH82IksByr6l+5R5r3qJq9xBpX6AQ== X-Received: by 2002:a02:ba99:: with SMTP id g25mr20436076jao.20.1566856840030; Mon, 26 Aug 2019 15:00:40 -0700 (PDT) Received: from mail-io1-f53.google.com (mail-io1-f53.google.com. [209.85.166.53]) by smtp.gmail.com with ESMTPSA id d6sm17432165iod.17.2019.08.26.15.00.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2019 15:00:39 -0700 (PDT) Received: by mail-io1-f53.google.com with SMTP id p12so41304343iog.5; Mon, 26 Aug 2019 15:00:39 -0700 (PDT) X-Received: by 2002:a5d:8599:: with SMTP id f25mr26946955ioj.265.1566856839560; Mon, 26 Aug 2019 15:00:39 -0700 (PDT) MIME-Version: 1.0 References: <201908261727.x7QHRbsc020978@repo.freebsd.org> In-Reply-To: <201908261727.x7QHRbsc020978@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 26 Aug 2019 15:00:28 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351514 - head/sys/dev/pci To: Alexander Motin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HQtK2P3sz3yQ1 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 26 Aug 2019 22:00:41 -0000 Hi Alexander, On Mon, Aug 26, 2019 at 10:27 AM Alexander Motin wrote: > > Author: mav > Date: Mon Aug 26 17:27:36 2019 > New Revision: 351514 > ... > - device_printf(dev, > - "HotPlug Command Timed Out - forcing detach\n"); > - sc->flags &= ~(PCIB_HOTPLUG_CMD_PENDING | PCIB_DETACH_PENDING); > - sc->flags |= PCIB_DETACHING; > - pcib_pcie_hotplug_update(sc, 0, 0, true); > + device_printf(dev, "HotPlug Command Timed Out\n"); > + sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; If this case is expected (and it seems like it is, at least in relatively common hardware), and the kernel isn't taking an action based on it anymore (formerly, it would then cause detach), is there any reason to print a message at all? What information should a user glean from the message, or what action should be taken? It seems like Nothing and None, respectively. So perhaps it is better to not print anything in this case? Or maybe mask it behind bootverbose. Best, Conrad From owner-svn-src-all@freebsd.org Tue Aug 27 00:01:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8257CC08B4; Tue, 27 Aug 2019 00:01:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HTZH2dqlz442g; Tue, 27 Aug 2019 00:01:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19358E2C1; Tue, 27 Aug 2019 00:01:59 +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 x7R01w5u052435; Tue, 27 Aug 2019 00:01:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R01vUB052426; Tue, 27 Aug 2019 00:01:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908270001.x7R01vUB052426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Aug 2019 00:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/tools/switch_tls X-SVN-Commit-Revision: 351522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:01:59 -0000 Author: jhb Date: Tue Aug 27 00:01:56 2019 New Revision: 351522 URL: https://svnweb.freebsd.org/changeset/base/351522 Log: Add kernel-side support for in-kernel TLS. KTLS adds support for in-kernel framing and encryption of Transport Layer Security (1.0-1.2) data on TCP sockets. KTLS only supports offload of TLS for transmitted data. Key negotation must still be performed in userland. Once completed, transmit session keys for a connection are provided to the kernel via a new TCP_TXTLS_ENABLE socket option. All subsequent data transmitted on the socket is placed into TLS frames and encrypted using the supplied keys. Any data written to a KTLS-enabled socket via write(2), aio_write(2), or sendfile(2) is assumed to be application data and is encoded in TLS frames with an application data type. Individual records can be sent with a custom type (e.g. handshake messages) via sendmsg(2) with a new control message (TLS_SET_RECORD_TYPE) specifying the record type. At present, rekeying is not supported though the in-kernel framework should support rekeying. KTLS makes use of the recently added unmapped mbufs to store TLS frames in the socket buffer. Each TLS frame is described by a single ext_pgs mbuf. The ext_pgs structure contains the header of the TLS record (and trailer for encrypted records) as well as references to the associated TLS session. KTLS supports two primary methods of encrypting TLS frames: software TLS and ifnet TLS. Software TLS marks mbufs holding socket data as not ready via M_NOTREADY similar to sendfile(2) when TLS framing information is added to an unmapped mbuf in ktls_frame(). ktls_enqueue() is then called to schedule TLS frames for encryption. In the case of sendfile_iodone() calls ktls_enqueue() instead of pru_ready() leaving the mbufs marked M_NOTREADY until encryption is completed. For other writes (vn_sendfile when pages are available, write(2), etc.), the PRUS_NOTREADY is set when invoking pru_send() along with invoking ktls_enqueue(). A pool of worker threads (the "KTLS" kernel process) encrypts TLS frames queued via ktls_enqueue(). Each TLS frame is temporarily mapped using the direct map and passed to a software encryption backend to perform the actual encryption. (Note: The use of PHYS_TO_DMAP could be replaced with sf_bufs if someone wished to make this work on architectures without a direct map.) KTLS supports pluggable software encryption backends. Internally, Netflix uses proprietary pure-software backends. This commit includes a simple backend in a new ktls_ocf.ko module that uses the kernel's OpenCrypto framework to provide AES-GCM encryption of TLS frames. As a result, software TLS is now a bit of a misnomer as it can make use of hardware crypto accelerators. Once software encryption has finished, the TLS frame mbufs are marked ready via pru_ready(). At this point, the encrypted data appears as regular payload to the TCP stack stored in unmapped mbufs. ifnet TLS permits a NIC to offload the TLS encryption and TCP segmentation. In this mode, a new send tag type (IF_SND_TAG_TYPE_TLS) is allocated on the interface a socket is routed over and associated with a TLS session. TLS records for a TLS session using ifnet TLS are not marked M_NOTREADY but are passed down the stack unencrypted. The ip_output_send() and ip6_output_send() helper functions that apply send tags to outbound IP packets verify that the send tag of the TLS record matches the outbound interface. If so, the packet is tagged with the TLS send tag and sent to the interface. The NIC device driver must recognize packets with the TLS send tag and schedule them for TLS encryption and TCP segmentation. If the the outbound interface does not match the interface in the TLS send tag, the packet is dropped. In addition, a task is scheduled to refresh the TLS send tag for the TLS session. If a new TLS send tag cannot be allocated, the connection is dropped. If a new TLS send tag is allocated, however, subsequent packets will be tagged with the correct TLS send tag. (This latter case has been tested by configuring both ports of a Chelsio T6 in a lagg and failing over from one port to another. As the connections migrated to the new port, new TLS send tags were allocated for the new port and connections resumed without being dropped.) ifnet TLS can be enabled and disabled on supported network interfaces via new '[-]txtls[46]' options to ifconfig(8). ifnet TLS is supported across both vlan devices and lagg interfaces using failover, lacp with flowid enabled, or lacp with flowid enabled. Applications may request the current KTLS mode of a connection via a new TCP_TXTLS_MODE socket option. They can also use this socket option to toggle between software and ifnet TLS modes. In addition, a testing tool is available in tools/tools/switch_tls. This is modeled on tcpdrop and uses similar syntax. However, instead of dropping connections, -s is used to force KTLS connections to switch to software TLS and -i is used to switch to ifnet TLS. Various sysctls and counters are available under the kern.ipc.tls sysctl node. The kern.ipc.tls.enable node must be set to true to enable KTLS (it is off by default). The use of unmapped mbufs must also be enabled via kern.ipc.mb_use_ext_pgs to enable KTLS. KTLS is enabled via the KERN_TLS kernel option. This patch is the culmination of years of work by several folks including Scott Long and Randall Stewart for the original design and implementation; Drew Gallatin for several optimizations including the use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records awaiting software encryption, and pluggable software crypto backends; and John Baldwin for modifications to support hardware TLS offload. Reviewed by: gallatin, hselasky, rrs Obtained from: Netflix Sponsored by: Netflix, Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21277 Added: head/sys/kern/uipc_ktls.c (contents, props changed) head/sys/modules/ktls_ocf/ head/sys/modules/ktls_ocf/Makefile (contents, props changed) head/sys/opencrypto/ktls_ocf.c (contents, props changed) head/sys/sys/ktls.h (contents, props changed) head/tools/tools/switch_tls/ head/tools/tools/switch_tls/Makefile (contents, props changed) head/tools/tools/switch_tls/switch_tls.c (contents, props changed) Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/share/man/man4/tcp.4 head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/kern/kern_mbuf.c head/sys/kern/kern_sendfile.c head/sys/kern/uipc_sockbuf.c head/sys/kern/uipc_socket.c head/sys/modules/Makefile head/sys/net/ieee8023ad_lacp.c head/sys/net/ieee8023ad_lacp.h head/sys/net/if.h head/sys/net/if_lagg.c head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/netinet/ip_output.c head/sys/netinet/tcp.h head/sys/netinet/tcp_output.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/netinet6/ip6_output.c head/sys/sys/mbuf.h head/sys/sys/param.h head/sys/sys/sockbuf.h Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Mon Aug 26 21:00:14 2019 (r351521) +++ head/sbin/ifconfig/ifconfig.8 Tue Aug 27 00:01:56 2019 (r351522) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd August 15, 2019 +.Dd August 26, 2019 .Dt IFCONFIG 8 .Os .Sh NAME @@ -538,6 +538,28 @@ large receive offloading, enable LRO on the interface. If the driver supports .Xr tcp 4 large receive offloading, disable LRO on the interface. +.It Cm txtls +Transmit TLS offload encrypts Transport Layer Security (TLS) records and +segments the encrypted record into one or more +.Xr tcp 4 +segments over either +.Xr ip 4 +or +.Xr ip6 4 . +If the driver supports transmit TLS offload, +enable transmit TLS offload on the interface. +Some drivers may not be able to support transmit TLS offload for +.Xr ip 4 +and +.Xr ip6 4 +packets, so they may enable only one of them. +.It Fl txtls +If the driver supports transmit TLS offload, +disable transmit TLS offload on the interface. +It will always disable TLS for +.Xr ip 4 +and +.Xr ip6 4 . .It Cm nomap If the driver supports unmapped network buffers, enable them on the interface. Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Mon Aug 26 21:00:14 2019 (r351521) +++ head/sbin/ifconfig/ifconfig.c Tue Aug 27 00:01:56 2019 (r351522) @@ -1257,7 +1257,7 @@ unsetifdescr(const char *val, int value, int s, const "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ "\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ -"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP" +"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" /* * Print the status of the interface. If an address family was @@ -1585,6 +1585,8 @@ static struct cmd basic_cmds[] = { DEF_CMD("-toe", -IFCAP_TOE, setifcap), DEF_CMD("lro", IFCAP_LRO, setifcap), DEF_CMD("-lro", -IFCAP_LRO, setifcap), + DEF_CMD("txtls", IFCAP_TXTLS, setifcap), + DEF_CMD("-txtls", -IFCAP_TXTLS, setifcap), DEF_CMD("wol", IFCAP_WOL, setifcap), DEF_CMD("-wol", -IFCAP_WOL, setifcap), DEF_CMD("wol_ucast", IFCAP_WOL_UCAST, setifcap), Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Mon Aug 26 21:00:14 2019 (r351521) +++ head/share/man/man4/tcp.4 Tue Aug 27 00:01:56 2019 (r351522) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd July 23, 2019 +.Dd August 26, 2019 .Dt TCP 4 .Os .Sh NAME @@ -293,6 +293,51 @@ If an SADB entry cannot be found for the destination, the system does not send any outgoing segments and drops any inbound segments. .Pp Each dropped segment is taken into account in the TCP protocol statistics. +.It Dv TCP_TXTLS_ENABLE +Enable in-kernel Transport Layer Security (TLS) for data written to this +socket. +The +.Vt struct tls_so_enable +argument defines the encryption and authentication algorithms and keys +used to encrypt the socket data as well as the maximum TLS record +payload size. +.Pp +All data written to this socket will be encapsulated in TLS records +and subsequently encrypted. +By default all data written to this socket is treated as application data. +Individual TLS records with a type other than application data +(for example, handshake messages), +may be transmitted by invoking +.Xr sendmsg 2 +with a custom TLS record type set in a +.Dv TLS_SET_RECORD_TYPE +control message. +The payload of this control message is a single byte holding the desired +TLS record type. +.Pp +Data read from this socket will still be encrypted and must be parsed by +a TLS-aware consumer. +.Pp +At present, only a single key may be set on a socket. +As such, users of this option must disable rekeying. +.It Dv TCP_TXTLS_MODE +The integer argument can be used to get or set the current TLS mode of a +socket. +Setting the mode can only used to toggle between software and NIC TLS after +TLS has been initially enabled via the +.Dv TCP_TXTLS_ENABLE +option. +The available modes are: +.Bl -tag -width "Dv TCP_TLS_MODE_IFNET" +.It Dv TCP_TLS_MODE_NONE +In-kernel TLS framing and encryption is not enabled for this socket. +.It Dv TCP_TLS_MODE_SW +TLS records are encrypted by the kernel prior to placing the data in the +socket buffer. +Typically this encryption is performed in software. +.It Dv TCP_TLS_MODE_IFNET +TLS records are encrypted by the network interface card (NIC). +.El .El .Pp The option level for the Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Aug 26 21:00:14 2019 (r351521) +++ head/sys/conf/NOTES Tue Aug 27 00:01:56 2019 (r351522) @@ -654,6 +654,10 @@ options IPSEC #IP security (requires device crypto) options IPSEC_SUPPORT #options IPSEC_DEBUG #debug for IP security + +# TLS framing and encryption of data transmitted over TCP sockets. +options KERN_TLS # TLS transmit offload + # # SMB/CIFS requester # NETSMB enables support for SMB protocol, it requires LIBMCHAIN and LIBICONV Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Aug 26 21:00:14 2019 (r351521) +++ head/sys/conf/files Tue Aug 27 00:01:56 2019 (r351522) @@ -3862,6 +3862,7 @@ kern/tty_ttydisc.c standard kern/uipc_accf.c standard kern/uipc_debug.c optional ddb kern/uipc_domain.c standard +kern/uipc_ktls.c optional kern_tls kern/uipc_mbuf.c standard kern/uipc_mbuf2.c standard kern/uipc_mbufhash.c standard Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Aug 26 21:00:14 2019 (r351521) +++ head/sys/conf/options Tue Aug 27 00:01:56 2019 (r351522) @@ -435,6 +435,7 @@ IPSEC opt_ipsec.h IPSEC_DEBUG opt_ipsec.h IPSEC_SUPPORT opt_ipsec.h IPSTEALTH +KERN_TLS KRPC LIBALIAS LIBMCHAIN Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Mon Aug 26 21:00:14 2019 (r351521) +++ head/sys/kern/kern_mbuf.c Tue Aug 27 00:01:56 2019 (r351522) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_param.h" +#include "opt_kern_tls.h" #include #include @@ -41,10 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -112,10 +115,10 @@ int nmbjumbop; /* limits number of page size jumbo c int nmbjumbo9; /* limits number of 9k jumbo clusters */ int nmbjumbo16; /* limits number of 16k jumbo clusters */ -bool mb_use_ext_pgs; /* use EXT_PGS mbufs for sendfile */ +bool mb_use_ext_pgs; /* use EXT_PGS mbufs for sendfile & TLS */ SYSCTL_BOOL(_kern_ipc, OID_AUTO, mb_use_ext_pgs, CTLFLAG_RWTUN, &mb_use_ext_pgs, 0, - "Use unmapped mbufs for sendfile(2)"); + "Use unmapped mbufs for sendfile(2) and TLS offload"); static quad_t maxmbufmem; /* overall real memory limit for all mbufs */ @@ -1281,13 +1284,27 @@ mb_free_ext(struct mbuf *m) uma_zfree(zone_jumbo16, m->m_ext.ext_buf); uma_zfree(zone_mbuf, mref); break; - case EXT_PGS: + case EXT_PGS: { +#ifdef KERN_TLS + struct mbuf_ext_pgs *pgs; + struct ktls_session *tls; +#endif + KASSERT(mref->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); mref->m_ext.ext_free(mref); - uma_zfree(zone_extpgs, mref->m_ext.ext_pgs); +#ifdef KERN_TLS + pgs = mref->m_ext.ext_pgs; + tls = pgs->tls; + if (tls != NULL && + !refcount_release_if_not_last(&tls->refcount)) + ktls_enqueue_to_free(pgs); + else +#endif + uma_zfree(zone_extpgs, mref->m_ext.ext_pgs); uma_zfree(zone_mbuf, mref); break; + } case EXT_SFBUF: case EXT_NET_DRV: case EXT_MOD_TYPE: Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Mon Aug 26 21:00:14 2019 (r351521) +++ head/sys/kern/kern_sendfile.c Tue Aug 27 00:01:56 2019 (r351522) @@ -30,12 +30,15 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kern_tls.h" + #include #include #include #include #include #include +#include #include #include #include @@ -85,6 +88,7 @@ struct sf_io { int npages; struct socket *so; struct mbuf *m; + struct ktls_session *tls; vm_page_t pa[]; }; @@ -262,6 +266,15 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i if (!refcount_release(&sfio->nios)) return; +#ifdef INVARIANTS + if ((sfio->m->m_flags & M_EXT) != 0 && + sfio->m->m_ext.ext_type == EXT_PGS) + KASSERT(sfio->tls == sfio->m->m_ext.ext_pgs->tls, + ("TLS session mismatch")); + else + KASSERT(sfio->tls == NULL, + ("non-ext_pgs mbuf with TLS session")); +#endif CURVNET_SET(so->so_vnet); if (sfio->error) { /* @@ -279,12 +292,29 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i so->so_error = EIO; mb_free_notready(sfio->m, sfio->npages); +#ifdef KERN_TLS + } else if (sfio->tls != NULL && sfio->tls->sw_encrypt != NULL) { + /* + * I/O operation is complete, but we still need to + * encrypt. We cannot do this in the interrupt thread + * of the disk controller, so forward the mbufs to a + * different thread. + * + * Donate the socket reference from sfio to rather + * than explicitly invoking soref(). + */ + ktls_enqueue(sfio->m, so, sfio->npages); + goto out_with_ref; +#endif } else (void)(so->so_proto->pr_usrreqs->pru_ready)(so, sfio->m, sfio->npages); SOCK_LOCK(so); sorele(so); +#ifdef KERN_TLS +out_with_ref: +#endif CURVNET_RESTORE(); free(sfio, M_TEMP); } @@ -526,6 +556,9 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h struct vnode *vp; struct vm_object *obj; struct socket *so; +#ifdef KERN_TLS + struct ktls_session *tls; +#endif struct mbuf_ext_pgs *ext_pgs; struct mbuf *m, *mh, *mhtail; struct sf_buf *sf; @@ -534,12 +567,18 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h struct vattr va; off_t off, sbytes, rem, obj_size; int bsize, error, ext_pgs_idx, hdrlen, max_pgs, softerr; +#ifdef KERN_TLS + int tls_enq_cnt; +#endif bool use_ext_pgs; obj = NULL; so = NULL; m = mh = NULL; sfs = NULL; +#ifdef KERN_TLS + tls = NULL; +#endif hdrlen = sbytes = 0; softerr = 0; use_ext_pgs = false; @@ -576,6 +615,9 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h * we implement that, but possibly shouldn't. */ (void)sblock(&so->so_snd, SBL_WAIT | SBL_NOINTR); +#ifdef KERN_TLS + tls = ktls_hold(so->so_snd.sb_tls_info); +#endif /* * Loop through the pages of the file, starting with the requested @@ -669,7 +711,14 @@ retry_space: if (hdr_uio != NULL && hdr_uio->uio_resid > 0) { hdr_uio->uio_td = td; hdr_uio->uio_rw = UIO_WRITE; - mh = m_uiotombuf(hdr_uio, M_WAITOK, space, 0, 0); +#ifdef KERN_TLS + if (tls != NULL) + mh = m_uiotombuf(hdr_uio, M_WAITOK, space, + tls->params.max_frame_len, M_NOMAP); + else +#endif + mh = m_uiotombuf(hdr_uio, M_WAITOK, + space, 0, 0); hdrlen = m_length(mh, &mhtail); space -= hdrlen; /* @@ -743,6 +792,15 @@ retry_space: sfio->so = so; sfio->error = 0; +#ifdef KERN_TLS + /* + * This doesn't use ktls_hold() because sfio->m will + * also have a reference on 'tls' that will be valid + * for all of sfio's lifetime. + */ + sfio->tls = tls; +#endif + error = sendfile_swapin(obj, sfio, &nios, off, space, npages, rhpages, flags); if (error != 0) { @@ -763,11 +821,22 @@ retry_space: * bufs are restricted to TCP as that is what has been * tested. In particular, unmapped mbufs have not * been tested with UNIX-domain sockets. + * + * TLS frames always require unmapped mbufs. */ - if (mb_use_ext_pgs && - so->so_proto->pr_protocol == IPPROTO_TCP) { + if ((mb_use_ext_pgs && + so->so_proto->pr_protocol == IPPROTO_TCP) +#ifdef KERN_TLS + || tls != NULL +#endif + ) { use_ext_pgs = true; - max_pgs = MBUF_PEXT_MAX_PGS; +#ifdef KERN_TLS + if (tls != NULL) + max_pgs = num_pages(tls->params.max_frame_len); + else +#endif + max_pgs = MBUF_PEXT_MAX_PGS; /* Start at last index, to wrap on first use. */ ext_pgs_idx = max_pgs - 1; @@ -946,6 +1015,14 @@ prepend_header: __func__, m_length(m, NULL), space, hdrlen)); CURVNET_SET(so->so_vnet); +#ifdef KERN_TLS + if (tls != NULL) { + error = ktls_frame(m, tls, &tls_enq_cnt, + TLS_RLTYPE_APP); + if (error != 0) + goto done; + } +#endif if (nios == 0) { /* * If sendfile_swapin() didn't initiate any I/Os, @@ -954,8 +1031,16 @@ prepend_header: * PRUS_NOTREADY flag. */ free(sfio, M_TEMP); - error = (*so->so_proto->pr_usrreqs->pru_send) - (so, 0, m, NULL, NULL, td); +#ifdef KERN_TLS + if (tls != NULL && tls->sw_encrypt != NULL) { + error = (*so->so_proto->pr_usrreqs->pru_send) + (so, PRUS_NOTREADY, m, NULL, NULL, td); + soref(so); + ktls_enqueue(m, so, tls_enq_cnt); + } else +#endif + error = (*so->so_proto->pr_usrreqs->pru_send) + (so, 0, m, NULL, NULL, td); } else { sfio->npages = npages; soref(so); @@ -1019,6 +1104,10 @@ out: mtx_destroy(&sfs->mtx); free(sfs, M_TEMP); } +#ifdef KERN_TLS + if (tls != NULL) + ktls_free(tls); +#endif if (error == ERESTART) error = EINTR; Added: head/sys/kern/uipc_ktls.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/uipc_ktls.c Tue Aug 27 00:01:56 2019 (r351522) @@ -0,0 +1,1450 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2014-2019 Netflix Inc. + * + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_rss.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +#include +#endif +#include +#ifdef RSS +#include +#include +#endif +#if defined(INET) || defined(INET6) +#include +#include +#endif +#include +#include +#include +#include +#include +#include + +struct ktls_wq { + struct mtx mtx; + STAILQ_HEAD(, mbuf_ext_pgs) head; + bool running; +} __aligned(CACHE_LINE_SIZE); + +static struct ktls_wq *ktls_wq; +static struct proc *ktls_proc; +LIST_HEAD(, ktls_crypto_backend) ktls_backends; +static struct rmlock ktls_backends_lock; +static uma_zone_t ktls_session_zone; +static uint16_t ktls_cpuid_lookup[MAXCPU]; + +SYSCTL_NODE(_kern_ipc, OID_AUTO, tls, CTLFLAG_RW, 0, + "Kernel TLS offload"); +SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, stats, CTLFLAG_RW, 0, + "Kernel TLS offload stats"); + +static int ktls_allow_unload; +SYSCTL_INT(_kern_ipc_tls, OID_AUTO, allow_unload, CTLFLAG_RDTUN, + &ktls_allow_unload, 0, "Allow software crypto modules to unload"); + +#ifdef RSS +static int ktls_bind_threads = 1; +#else +static int ktls_bind_threads; +#endif +SYSCTL_INT(_kern_ipc_tls, OID_AUTO, bind_threads, CTLFLAG_RDTUN, + &ktls_bind_threads, 0, + "Bind crypto threads to cores or domains at boot"); + +static u_int ktls_maxlen = 16384; +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, maxlen, CTLFLAG_RWTUN, + &ktls_maxlen, 0, "Maximum TLS record size"); + +static int ktls_number_threads; +SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, CTLFLAG_RD, + &ktls_number_threads, 0, + "Number of TLS threads in thread-pool"); + +static bool ktls_offload_enable; +SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RW, + &ktls_offload_enable, 0, + "Enable support for kernel TLS offload"); + +static bool ktls_cbc_enable = true; +SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, cbc_enable, CTLFLAG_RW, + &ktls_cbc_enable, 1, + "Enable Support of AES-CBC crypto for kernel TLS"); + +static counter_u64_t ktls_tasks_active; +SYSCTL_COUNTER_U64(_kern_ipc_tls, OID_AUTO, tasks_active, CTLFLAG_RD, + &ktls_tasks_active, "Number of active tasks"); + +static counter_u64_t ktls_cnt_on; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, so_inqueue, CTLFLAG_RD, + &ktls_cnt_on, "Number of TLS records in queue to tasks for SW crypto"); + +static counter_u64_t ktls_offload_total; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, offload_total, + CTLFLAG_RD, &ktls_offload_total, + "Total successful TLS setups (parameters set)"); + +static counter_u64_t ktls_offload_enable_calls; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, enable_calls, + CTLFLAG_RD, &ktls_offload_enable_calls, + "Total number of TLS enable calls made"); + +static counter_u64_t ktls_offload_active; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, active, CTLFLAG_RD, + &ktls_offload_active, "Total Active TLS sessions"); + +static counter_u64_t ktls_offload_failed_crypto; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, failed_crypto, CTLFLAG_RD, + &ktls_offload_failed_crypto, "Total TLS crypto failures"); + +static counter_u64_t ktls_switch_to_ifnet; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_to_ifnet, CTLFLAG_RD, + &ktls_switch_to_ifnet, "TLS sessions switched from SW to ifnet"); + +static counter_u64_t ktls_switch_to_sw; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_to_sw, CTLFLAG_RD, + &ktls_switch_to_sw, "TLS sessions switched from ifnet to SW"); + +static counter_u64_t ktls_switch_failed; +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, CTLFLAG_RD, + &ktls_switch_failed, "TLS sessions unable to switch between SW and ifnet"); + +SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD, 0, + "Software TLS session stats"); +SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD, 0, + "Hardware (ifnet) TLS session stats"); + +static counter_u64_t ktls_sw_cbc; +SYSCTL_COUNTER_U64(_kern_ipc_tls_sw, OID_AUTO, cbc, CTLFLAG_RD, &ktls_sw_cbc, + "Active number of software TLS sessions using AES-CBC"); + +static counter_u64_t ktls_sw_gcm; +SYSCTL_COUNTER_U64(_kern_ipc_tls_sw, OID_AUTO, gcm, CTLFLAG_RD, &ktls_sw_gcm, + "Active number of software TLS sessions using AES-GCM"); + +static counter_u64_t ktls_ifnet_cbc; +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, cbc, CTLFLAG_RD, + &ktls_ifnet_cbc, + "Active number of ifnet TLS sessions using AES-CBC"); + +static counter_u64_t ktls_ifnet_gcm; +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, gcm, CTLFLAG_RD, + &ktls_ifnet_gcm, + "Active number of ifnet TLS sessions using AES-GCM"); + +static counter_u64_t ktls_ifnet_reset; +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, reset, CTLFLAG_RD, + &ktls_ifnet_reset, "TLS sessions updated to a new ifnet send tag"); + +static counter_u64_t ktls_ifnet_reset_dropped; +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, reset_dropped, CTLFLAG_RD, + &ktls_ifnet_reset_dropped, + "TLS sessions dropped after failing to update ifnet send tag"); + +static counter_u64_t ktls_ifnet_reset_failed; +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, reset_failed, CTLFLAG_RD, + &ktls_ifnet_reset_failed, + "TLS sessions that failed to allocate a new ifnet send tag"); + +static int ktls_ifnet_permitted; +SYSCTL_UINT(_kern_ipc_tls_ifnet, OID_AUTO, permitted, CTLFLAG_RWTUN, + &ktls_ifnet_permitted, 1, + "Whether to permit hardware (ifnet) TLS sessions"); + +static MALLOC_DEFINE(M_KTLS, "ktls", "Kernel TLS"); + +static void ktls_cleanup(struct ktls_session *tls); +#if defined(INET) || defined(INET6) +static void ktls_reset_send_tag(void *context, int pending); +#endif +static void ktls_work_thread(void *ctx); + +int +ktls_crypto_backend_register(struct ktls_crypto_backend *be) +{ + struct ktls_crypto_backend *curr_be, *tmp; + + if (be->api_version != KTLS_API_VERSION) { + printf("KTLS: API version mismatch (%d vs %d) for %s\n", + be->api_version, KTLS_API_VERSION, + be->name); + return (EINVAL); + } + + rm_wlock(&ktls_backends_lock); + printf("KTLS: Registering crypto method %s with prio %d\n", + be->name, be->prio); + if (LIST_EMPTY(&ktls_backends)) { + LIST_INSERT_HEAD(&ktls_backends, be, next); + } else { + LIST_FOREACH_SAFE(curr_be, &ktls_backends, next, tmp) { + if (curr_be->prio < be->prio) { + LIST_INSERT_BEFORE(curr_be, be, next); + break; + } + if (LIST_NEXT(curr_be, next) == NULL) { + LIST_INSERT_AFTER(curr_be, be, next); + break; + } + } + } + rm_wunlock(&ktls_backends_lock); + return (0); +} + +int +ktls_crypto_backend_deregister(struct ktls_crypto_backend *be) +{ + struct ktls_crypto_backend *tmp; + + /* + * Don't error if the backend isn't registered. This permits + * MOD_UNLOAD handlers to use this function unconditionally. + */ + rm_wlock(&ktls_backends_lock); + LIST_FOREACH(tmp, &ktls_backends, next) { + if (tmp == be) + break; + } + if (tmp == NULL) { + rm_wunlock(&ktls_backends_lock); + return (0); + } + + if (!ktls_allow_unload) { + rm_wunlock(&ktls_backends_lock); + printf( + "KTLS: Deregistering crypto method %s is not supported\n", + be->name); + return (EBUSY); + } + + if (be->use_count) { + rm_wunlock(&ktls_backends_lock); + return (EBUSY); + } + + LIST_REMOVE(be, next); + rm_wunlock(&ktls_backends_lock); + return (0); +} + +#if defined(INET) || defined(INET6) +static uint16_t +ktls_get_cpu(struct socket *so) +{ + struct inpcb *inp; + uint16_t cpuid; + + inp = sotoinpcb(so); +#ifdef RSS + cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype); + if (cpuid != NETISR_CPUID_NONE) + return (cpuid); +#endif + /* + * Just use the flowid to shard connections in a repeatable + * fashion. Note that some crypto backends rely on the + * serialization provided by having the same connection use + * the same queue. + */ + cpuid = ktls_cpuid_lookup[inp->inp_flowid % ktls_number_threads]; + return (cpuid); +} +#endif + +static void +ktls_init(void *dummy __unused) +{ + struct thread *td; + struct pcpu *pc; + cpuset_t mask; + int error, i; + + ktls_tasks_active = counter_u64_alloc(M_WAITOK); + ktls_cnt_on = counter_u64_alloc(M_WAITOK); + ktls_offload_total = counter_u64_alloc(M_WAITOK); + ktls_offload_enable_calls = counter_u64_alloc(M_WAITOK); + ktls_offload_active = counter_u64_alloc(M_WAITOK); + ktls_offload_failed_crypto = counter_u64_alloc(M_WAITOK); + ktls_switch_to_ifnet = counter_u64_alloc(M_WAITOK); + ktls_switch_to_sw = counter_u64_alloc(M_WAITOK); + ktls_switch_failed = counter_u64_alloc(M_WAITOK); + ktls_sw_cbc = counter_u64_alloc(M_WAITOK); + ktls_sw_gcm = counter_u64_alloc(M_WAITOK); + ktls_ifnet_cbc = counter_u64_alloc(M_WAITOK); + ktls_ifnet_gcm = counter_u64_alloc(M_WAITOK); + ktls_ifnet_reset = counter_u64_alloc(M_WAITOK); + ktls_ifnet_reset_dropped = counter_u64_alloc(M_WAITOK); + ktls_ifnet_reset_failed = counter_u64_alloc(M_WAITOK); + + rm_init(&ktls_backends_lock, "ktls backends"); + LIST_INIT(&ktls_backends); + + ktls_wq = malloc(sizeof(*ktls_wq) * (mp_maxid + 1), M_KTLS, + M_WAITOK | M_ZERO); + + ktls_session_zone = uma_zcreate("ktls_session", + sizeof(struct ktls_session), +#ifdef INVARIANTS + trash_ctor, trash_dtor, trash_init, trash_fini, +#else + NULL, NULL, NULL, NULL, +#endif + UMA_ALIGN_CACHE, 0); + + /* + * Initialize the workqueues to run the TLS work. We create a + * work queue for each CPU. + */ + CPU_FOREACH(i) { + STAILQ_INIT(&ktls_wq[i].head); + mtx_init(&ktls_wq[i].mtx, "ktls work queue", NULL, MTX_DEF); + error = kproc_kthread_add(ktls_work_thread, &ktls_wq[i], + &ktls_proc, &td, 0, 0, "KTLS", "ktls_thr_%d", i); + if (error) + panic("Can't add KTLS thread %d error %d", i, error); + + /* + * Bind threads to cores. If ktls_bind_threads is > + * 1, then we bind to the NUMA domain. + */ + if (ktls_bind_threads) { + if (ktls_bind_threads > 1) { + pc = pcpu_find(i); + CPU_COPY(&cpuset_domain[pc->pc_domain], &mask); + } else { + CPU_SETOF(i, &mask); + } + error = cpuset_setthread(td->td_tid, &mask); + if (error) + panic( + "Unable to bind KTLS thread for CPU %d error %d", + i, error); + } + ktls_cpuid_lookup[ktls_number_threads] = i; + ktls_number_threads++; + } + printf("KTLS: Initialized %d threads\n", ktls_number_threads); +} +SYSINIT(ktls, SI_SUB_SMP + 1, SI_ORDER_ANY, ktls_init, NULL); + +#if defined(INET) || defined(INET6) +static int +ktls_create_session(struct socket *so, struct tls_enable *en, + struct ktls_session **tlsp) +{ + struct ktls_session *tls; + int error; + + /* Only TLS 1.0 - 1.2 are supported. */ + if (en->tls_vmajor != TLS_MAJOR_VER_ONE) + return (EINVAL); + if (en->tls_vminor < TLS_MINOR_VER_ZERO || + en->tls_vminor > TLS_MINOR_VER_TWO) + return (EINVAL); + + if (en->auth_key_len < 0 || en->auth_key_len > TLS_MAX_PARAM_SIZE) + return (EINVAL); + if (en->cipher_key_len < 0 || en->cipher_key_len > TLS_MAX_PARAM_SIZE) + return (EINVAL); + if (en->iv_len < 0 || en->iv_len > TLS_MAX_PARAM_SIZE) + return (EINVAL); + + /* All supported algorithms require a cipher key. */ + if (en->cipher_key_len == 0) + return (EINVAL); + + /* No flags are currently supported. */ + if (en->flags != 0) + return (EINVAL); + + /* Common checks for supported algorithms. */ + switch (en->cipher_algorithm) { + case CRYPTO_AES_NIST_GCM_16: + /* + * auth_algorithm isn't used, but permit GMAC values + * for compatibility. + */ + switch (en->auth_algorithm) { + case 0: + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + break; + default: + return (EINVAL); + } + if (en->auth_key_len != 0) + return (EINVAL); + if (en->iv_len != TLS_AEAD_GCM_LEN) + return (EINVAL); + break; + case CRYPTO_AES_CBC: + switch (en->auth_algorithm) { + case CRYPTO_SHA1_HMAC: + /* + * TLS 1.0 requires an implicit IV. TLS 1.1+ + * all use explicit IVs. + */ + if (en->tls_vminor == TLS_MINOR_VER_ZERO) { + if (en->iv_len != TLS_CBC_IMPLICIT_IV_LEN) + return (EINVAL); + break; + } + + /* FALLTHROUGH */ + case CRYPTO_SHA2_256_HMAC: + case CRYPTO_SHA2_384_HMAC: + /* Ignore any supplied IV. */ + en->iv_len = 0; + break; + default: + return (EINVAL); + } + if (en->auth_key_len == 0) + return (EINVAL); + break; + default: + return (EINVAL); + } + + tls = uma_zalloc(ktls_session_zone, M_WAITOK | M_ZERO); + + counter_u64_add(ktls_offload_active, 1); + + refcount_init(&tls->refcount, 1); + TASK_INIT(&tls->reset_tag_task, 0, ktls_reset_send_tag, tls); + + tls->wq_index = ktls_get_cpu(so); + + tls->params.cipher_algorithm = en->cipher_algorithm; + tls->params.auth_algorithm = en->auth_algorithm; + tls->params.tls_vmajor = en->tls_vmajor; + tls->params.tls_vminor = en->tls_vminor; + tls->params.flags = en->flags; + tls->params.max_frame_len = min(TLS_MAX_MSG_SIZE_V10_2, ktls_maxlen); + + /* Set the header and trailer lengths. */ + tls->params.tls_hlen = sizeof(struct tls_record_layer); + switch (en->cipher_algorithm) { + case CRYPTO_AES_NIST_GCM_16: + tls->params.tls_hlen += 8; + tls->params.tls_tlen = AES_GMAC_HASH_LEN; + tls->params.tls_bs = 1; + break; + case CRYPTO_AES_CBC: + switch (en->auth_algorithm) { + case CRYPTO_SHA1_HMAC: + if (en->tls_vminor == TLS_MINOR_VER_ZERO) { + /* Implicit IV, no nonce. */ + } else { + tls->params.tls_hlen += AES_BLOCK_LEN; + } + tls->params.tls_tlen = AES_BLOCK_LEN + + SHA1_HASH_LEN; + break; + case CRYPTO_SHA2_256_HMAC: + tls->params.tls_hlen += AES_BLOCK_LEN; + tls->params.tls_tlen = AES_BLOCK_LEN + + SHA2_256_HASH_LEN; + break; + case CRYPTO_SHA2_384_HMAC: + tls->params.tls_hlen += AES_BLOCK_LEN; + tls->params.tls_tlen = AES_BLOCK_LEN + + SHA2_384_HASH_LEN; + break; + default: + panic("invalid hmac"); + } + tls->params.tls_bs = AES_BLOCK_LEN; + break; + default: + panic("invalid cipher"); + } + + KASSERT(tls->params.tls_hlen <= MBUF_PEXT_HDR_LEN, + ("TLS header length too long: %d", tls->params.tls_hlen)); + KASSERT(tls->params.tls_tlen <= MBUF_PEXT_TRAIL_LEN, + ("TLS trailer length too long: %d", tls->params.tls_tlen)); + + if (en->auth_key_len != 0) { + tls->params.auth_key_len = en->auth_key_len; + tls->params.auth_key = malloc(en->auth_key_len, M_KTLS, + M_WAITOK); + error = copyin(en->auth_key, tls->params.auth_key, + en->auth_key_len); + if (error) + goto out; + } + + tls->params.cipher_key_len = en->cipher_key_len; + tls->params.cipher_key = malloc(en->cipher_key_len, M_KTLS, M_WAITOK); + error = copyin(en->cipher_key, tls->params.cipher_key, + en->cipher_key_len); + if (error) + goto out; + + /* + * This holds the implicit portion of the nonce for GCM and + * the initial implicit IV for TLS 1.0. The explicit portions + * of the IV are generated in ktls_frame() and ktls_seq(). + */ + if (en->iv_len != 0) { + MPASS(en->iv_len <= sizeof(tls->params.iv)); + tls->params.iv_len = en->iv_len; + error = copyin(en->iv, tls->params.iv, en->iv_len); + if (error) + goto out; + } + + *tlsp = tls; + return (0); + +out: + ktls_cleanup(tls); + return (error); +} + +static struct ktls_session * +ktls_clone_session(struct ktls_session *tls) +{ + struct ktls_session *tls_new; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 27 00:14:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4938CC1018; Tue, 27 Aug 2019 00:14:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HTs31JMzz44hr; Tue, 27 Aug 2019 00:14:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 96DF71F737; Tue, 27 Aug 2019 00:14:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908270001.x7R01vUB052426@repo.freebsd.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Mon, 26 Aug 2019 17:14:42 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908270001.x7R01vUB052426@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:14:47 -0000 On 8/26/19 5:01 PM, John Baldwin wrote: > Author: jhb > Date: Tue Aug 27 00:01:56 2019 > New Revision: 351522 > URL: https://svnweb.freebsd.org/changeset/base/351522 > > Log: > Add kernel-side support for in-kernel TLS. The length of the commit message notwithstanding, there is still quite a bit more work to do on this front. Making use of KTLS requires an SSL library that understands the new functionality, and for the full performance gain you want an application that makes use of SSL_sendfile. Netflix has both of these in the form of patches to OpenSSL and nginx. I'm currently working on a patchset suitable for merging into upstream OpenSSL's master (the Linux KTLS patches are merged into OpenSSL master already, so the FreeBSD patches are fairly small). One thing to note is that while the KTLS OCF backend in this commit is functional, it is not ideal. One of the SW crypto backends Netflix uses internally is based on Intel's ISA-L crypto library. I put together a port for this based on the public ISA-L crpyto library repository on GitHub today and hope to have it up for review soon. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Aug 27 00:26:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98AE5C1419; Tue, 27 Aug 2019 00:26:02 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HV612dGYz45G2; Tue, 27 Aug 2019 00:26:00 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2PJ6itjbkSrVc2PJ8inw3Q; Mon, 26 Aug 2019 18:25:58 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=FzyXbN09CKM9lWlxBvcA:9 a=M5MHzXmQ627LDLKR:21 a=1a13K5QEN1O5AAsE:21 a=lfw7kk5U3L1hpzWQ:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 246B3568; Mon, 26 Aug 2019 17:25:56 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7R0PtEH008597; Mon, 26 Aug 2019 17:25:55 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7R0PtNT008594; Mon, 26 Aug 2019 17:25:55 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908270025.x7R0PtNT008594@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> Comments: In-reply-to Mateusz Guzik message dated "Mon, 26 Aug 2019 22:15:01 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 17:25:55 -0700 X-CMAE-Envelope: MS4wfP5ezlWols/Km8ui44eBQIj6ZE+j95xATIY0pgPhNdNg4UV2vPDquhS4IC7yDNyaWh4l+FK+74gn/dNF6dK0vzNzjVZaqLNEV8BWdIMq7Y4N2YqV7Jhs NZsF/FAVabrotJgLpzSLV61He4R1OIN3wWqCkb/8YZcIcpv7gSumt3L+LM8enOajE3TclkPM1hzV704b5Tb3wI8Gv+SnI23sljSvUiUUGOVGYC2+HVZ6/FwN NxLMORRkPxoR9hh+r2wH86wqQPn01sXaAENI9z4IqnA= X-Rspamd-Queue-Id: 46HV612dGYz45G2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.84 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.27)[ip: (-5.69), ipnet: 64.59.128.0/20(-3.14), asn: 6327(-2.44), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:26:02 -0000 It won't build. Did you intend VOP_UNLOCK(vp,LK_INTERLOCK)? --- vfs_subr.o --- /opt/src/svn-current/sys/kern/vfs_subr.c:1037:17: error: too few arguments to function call, expected 2, have 1 VOP_UNLOCK(vp); ~~~~~~~~~~ ^ ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here static __inline int VOP_UNLOCK( ^ /opt/src/svn-current/sys/kern/vfs_subr.c:1401:16: error: too few arguments to function call, expected 2, have 1 VOP_UNLOCK(vp); ~~~~~~~~~~ ^ ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here static __inline int VOP_UNLOCK( ^ /opt/src/svn-current/sys/kern/vfs_subr.c:1413:15: error: too few arguments to function call, expected 2, have 1 VOP_UNLOCK(vp); ~~~~~~~~~~ ^ ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here static __inline int VOP_UNLOCK( ^ 3 errors generated. *** [vfs_subr.o] Error code 1 make[2]: stopped in /export/obj/opt/src/svn-current/amd64.amd64/sys/BREAK -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. In message , Mateusz Guzik writes: > Does this do the trick for you? > > https://people.freebsd.org/~mjg/vop_unlock-interlock.diff > > On 8/26/19, Cy Schubert wrote: > > On August 26, 2019 8:40:50 AM PDT, Cy Schubert > > wrote: > >>On August 26, 2019 7:11:22 AM PDT, Cy Schubert > >> wrote: > >>>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy > >>>Schubert wr > >>>ites: > >>>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik > >>>wrote: > >>>> >Author: mjg > >>>> >Date: Sun Aug 25 05:13:15 2019 > >>>> >New Revision: 351472 > >>>> >URL: https://svnweb.freebsd.org/changeset/base/351472 > >>>> > > >>>> >Log: > >>>> > nullfs: reduce areas protected by vnode interlock > >>>> > > >>>> >Some places only take the interlock to hold the vnode, which was a > >>>> >requiremnt > >>>> >before they started being manipulated with atomics. Use the newly > >>>> >introduced > >>>> > vholdnz to bump the count. > >>>> > > >>>> > Reviewed by: kib > >>>> > Tested by: pho > >>>> > Sponsored by: The FreeBSD Foundation > >>>> > Differential Revision: https://reviews.freebsd.org/D21358 > >>>> > > >>>> >Modified: > >>>> > head/sys/fs/nullfs/null_vnops.c > >>>> > > >>>> >Modified: head/sys/fs/nullfs/null_vnops.c > >>>> > >>>>========================================================================= > === > >>>> == > >>>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 > >>2019 (r35147 > >>>> 1) > >>>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 > >>2019 (r35147 > >>>> 2) > >>>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > >>>> > * We prevent it from being recycled by holding the vno > de > >>>> > * here. > >>>> > */ > >>>> >- vholdl(lvp); > >>>> >+ vholdnz(lvp); > >>>> > error = VOP_LOCK(lvp, flags); > >>>> > > >>>> > /* > >>>> >@@ -710,31 +710,16 @@ static int > >>>> > null_unlock(struct vop_unlock_args *ap) > >>>> > { > >>>> > struct vnode *vp = ap->a_vp; > >>>> >- int flags = ap->a_flags; > >>>> >- int mtxlkflag = 0; > >>>> > struct null_node *nn; > >>>> > struct vnode *lvp; > >>>> > int error; > >>>> > > >>>> >- if ((flags & LK_INTERLOCK) != 0) > >>>> >- mtxlkflag = 1; > >>>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { > >>>> >- VI_LOCK(vp); > >>>> >- mtxlkflag = 2; > >>>> >- } > >>>> > nn = VTONULL(vp); > >>>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { > >>>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); > >>>> >- flags |= LK_INTERLOCK; > >>>> >- vholdl(lvp); > >>>> >- VI_UNLOCK(vp); > >>>> >- error = VOP_UNLOCK(lvp, flags); > >>>> >+ vholdnz(lvp); > >>>> >+ error = VOP_UNLOCK(lvp, 0); > >>>> > vdrop(lvp); > >>>> >- if (mtxlkflag == 0) > >>>> >- VI_LOCK(vp); > >>>> > } else { > >>>> >- if (mtxlkflag == 2) > >>>> >- VI_UNLOCK(vp); > >>>> > error = vop_stdunlock(ap); > >>>> > } > >>>> > > >>>> >@@ -845,10 +830,8 @@ null_getwritemount(struct > >>>vop_getwritemount_args > >>>> >*ap) > >>>> > VI_LOCK(vp); > >>>> > xp = VTONULL(vp); > >>>> > if (xp && (lowervp = xp->null_lowervp)) { > >>>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); > >>>> >+ vholdnz(lowervp); > >>>> > VI_UNLOCK(vp); > >>>> >- vholdl(lowervp); > >>>> >- VI_UNLOCK(lowervp); > >>>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > >>>> > vdrop(lowervp); > >>>> > } else { > >>>> > >>>> Hi mjg@, > >>>> > >>>> This causes trap 12 a few seconds after mountlate during boot. > >>>Reverting this > >>>> commit allowed it to boot. > >>>> > >>>> Sorry for no backtrace. I managed to > >>>> revert and test just prior to rushing out to catch the bus, with no > >>>time to > >>>> craft a proper email. I'll post the backtrace when I arrive at work. > >>> > >>>Hi mjg@, > >>> > >>>The gory details below. Don't be fooled by the panic when yppasswd is > >>>started. I was able to reproduce this panic in single user by simply > >>>mounting and using a nullfs. > >>> > >>>kernel trap 12 with interrupts disabled > >>> > >>> > >>>Fatal trap 12: page fault while in kernel mode > >>>cpuid = 0; apic id = 00 > >>>fault virtual address = 0xc > >>>fault code = supervisor read data, page not present > >>>instruction pointer = 0x20:0xffffffff806f0633 > >>>stack pointer = 0x28:0xfffffe004b3fa7c0 > >>>frame pointer = 0x28:0xfffffe004b3fa7e0 > >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>>processor eflags = resume, IOPL = 0 > >>>current process = 26 (syncer) > >>>trap number = 12 > >>>panic: page fault > >>>cpuid = 0 > >>>time = 1566821203 > >>>KDB: stack backtrace: > >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>>0xfffffe004b3fa470 > >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 > >>>panic() at panic+0x43/frame 0xfffffe004b3fa520 > >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 > >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 > >>>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 > >>>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 > >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp > >>= > >>>0xfffffe004b3fa7e0 --- > >>>propagate_priority() at propagate_priority+0x153/frame > >>>0xfffffe004b3fa7e0 > >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 > >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 > >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>>0xfffffe004b3fa920 > >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 > >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 > >>>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 > >>>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 > >>>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 > >>>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 > >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>>Uptime: 3m25s > >>>Dumping 921 out of 7974 > >>>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% > >>> > >>>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" > >>>(OFFSETOF_CURTHREAD)); > >>>(kgdb) #0 __curthread () at > >>>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >>>#1 doadump (textdump=1) at > >>>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 > >>>#2 0xffffffff8068aead in kern_reboot (howto=260) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 > >>>#3 0xffffffff8068b369 in vpanic (fmt=, ap= >>>out>) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 > >>>#4 0xffffffff8068b163 in panic (fmt=) > >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 > >>>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, > >>eva=12) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 > >>>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, > >>>usermode=0) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 > >>>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) > >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 > >>>#8 > >>>#9 propagate_priority (td=0xfffff8003e43b000) > >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 > >>>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, > >>> owner=, queue=-512) > >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 > >>>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, > >>> v=) at > >>/opt/src/svn-current/sys/kern/kern_mutex.c:654 > >>>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( > >>> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, > >>vp=0xfffff80132e4eb40) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 > >>>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 > >>>#14 0xffffffff80766206 in __mnt_vnode_next_active > >>>(mvp=0xfffff80002449800, > >>> mp=) at > >>/opt/src/svn-current/sys/kern/vfs_subr.c:5682 > >>>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 > >>>#16 0xffffffff8076b4a6 in sync_fsync (ap=) > >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 > >>>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( > >>> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) > >>> at vnode_if.c:1312 > >>>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, > >>> td=0xfffff800061dc5a0) at ./vnode_if.h:549 > >>>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, > >>> slp=) at > >>/opt/src/svn-current/sys/kern/vfs_subr.c:2316 > >>>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 > >>>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 > >>>, > >>> arg=0x0, frame=0xfffffe004b3faac0) > >>> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 > >>>#22 > >>> > >>> > >>>dmesg output: > >>> > >>>Updating motd:. > >>>Mounting late filesystems:. > >>>Starting nscd. > >>>Security policy loaded: MAC/ntpd (mac_ntpd) > >>>Starting ntpd. > >>>Starting yppasswdd. > >>>kernel trap 12 with interrupts disabled > >>> > >>> > >>>Fatal trap 12: page fault while in kernel mode > >>>cpuid = 0; apic id = 00 > >>>fault virtual address = 0xc > >>>fault code = supervisor read data, page not present > >>>instruction pointer = 0x20:0xffffffff806f0633 > >>>stack pointer = 0x28:0xfffffe004b7fa7c0 > >>>frame pointer = 0x28:0xfffffe004b7fa7e0 > >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >>>processor eflags = resume, IOPL = 0 > >>>current process = 26 (syncer) > >>>trap number = 12 > >>>panic: page fault > >>>cpuid = 0 > >>>time = 1566820700 > >>>KDB: stack backtrace: > >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >>>0xfffffe004b7fa470 > >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 > >>>panic() at panic+0x43/frame 0xfffffe004b7fa520 > >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 > >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 > >>>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 > >>>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 > >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp > >>= > >>>0xfffffe004b7fa7e0 --- > >>>propagate_priority() at propagate_priority+0x153/frame > >>>0xfffffe004b7fa7e0 > >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 > >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 > >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >>>0xfffffe004b7fa920 > >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 > >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 > >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >>>Uptime: 1m38s > >>>Dumping 810 out of 7974 > >>>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- > >> > >>This may be a simple case of increasing the kernel stack. I'll try this > >>at noon. > > > > Increasing kernel stack pages from 8 to 20 still results in the panic. > > > > > > -- > > Pardon the typos and autocorrect, small keyboard in use. > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > > -- > Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 00:29:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CC68C1682; Tue, 27 Aug 2019 00:29:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HVB30P1mz45Sm; Tue, 27 Aug 2019 00:29:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E38D0E6A6; Tue, 27 Aug 2019 00:29:30 +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 x7R0TUCT068039; Tue, 27 Aug 2019 00:29:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R0TURs068038; Tue, 27 Aug 2019 00:29:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908270029.x7R0TURs068038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Aug 2019 00:29: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: r351523 - in stable: 11/sys/netinet 12/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/netinet 12/sys/netinet X-SVN-Commit-Revision: 351523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:29:31 -0000 Author: jhb Date: Tue Aug 27 00:29:30 2019 New Revision: 351523 URL: https://svnweb.freebsd.org/changeset/base/351523 Log: MFC 349474: Reject attempts to register a TCP stack being unloaded. Modified: stable/11/sys/netinet/tcp_subr.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/netinet/tcp_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Tue Aug 27 00:01:56 2019 (r351522) +++ stable/11/sys/netinet/tcp_subr.c Tue Aug 27 00:29:30 2019 (r351523) @@ -530,6 +530,9 @@ register_tcp_functions(struct tcp_function_block *blk, return (EINVAL); } } + if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) { + return (EINVAL); + } n = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait); if (n == NULL) { return (ENOMEM); @@ -545,7 +548,6 @@ register_tcp_functions(struct tcp_function_block *blk, return (EALREADY); } refcount_init(&blk->tfb_refcnt, 0); - blk->tfb_flags = 0; TAILQ_INSERT_TAIL(&t_functions, n, tf_next); rw_wunlock(&tcp_function_lock); return(0); From owner-svn-src-all@freebsd.org Tue Aug 27 00:29:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEFD3C167A; Tue, 27 Aug 2019 00:29:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HVB259jMz45Sl; Tue, 27 Aug 2019 00:29:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93499E6A5; Tue, 27 Aug 2019 00:29:30 +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 x7R0TUCn068033; Tue, 27 Aug 2019 00:29:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R0TUQx068032; Tue, 27 Aug 2019 00:29:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908270029.x7R0TUQx068032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Aug 2019 00:29:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351523 - in stable: 11/sys/netinet 12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/netinet 12/sys/netinet X-SVN-Commit-Revision: 351523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:29:30 -0000 Author: jhb Date: Tue Aug 27 00:29:30 2019 New Revision: 351523 URL: https://svnweb.freebsd.org/changeset/base/351523 Log: MFC 349474: Reject attempts to register a TCP stack being unloaded. Modified: stable/12/sys/netinet/tcp_subr.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/netinet/tcp_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/netinet/tcp_subr.c ============================================================================== --- stable/12/sys/netinet/tcp_subr.c Tue Aug 27 00:01:56 2019 (r351522) +++ stable/12/sys/netinet/tcp_subr.c Tue Aug 27 00:29:30 2019 (r351523) @@ -813,8 +813,12 @@ register_tcp_functions_as_names(struct tcp_function_bl } } + if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) { + *num_names = 0; + return (EINVAL); + } + refcount_init(&blk->tfb_refcnt, 0); - blk->tfb_flags = 0; blk->tfb_id = atomic_fetchadd_int(&next_tcp_stack_id, 1); for (i = 0; i < *num_names; i++) { n = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait); From owner-svn-src-all@freebsd.org Tue Aug 27 00:52:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DC72C2081; Tue, 27 Aug 2019 00:52:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HVhG2nwYz47Rp; Tue, 27 Aug 2019 00:52:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-ot1-x344.google.com with SMTP id c7so17098476otp.1; Mon, 26 Aug 2019 17:52:14 -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=ZQdubpB58tOMYx676cpn8qULFq0/zw7MSWLyfWfd0v0=; b=VBHCxLtZ9tSFldPSuN9YIe76PeCrPn7KxtxRmjKyCn+Xu4MmWg/x1yzJQTodFbCxFB bvQpuVdvBR0PGB7m00gZtmUUHlvHfz/vhwXk2/taWOVJemsk/1HDzrWd0QNm74mgTKMh //tW31rJuf3s5gRHS/RCObkmib7LDe0wQjh/Xxp5vtAPaX1hOQNWM49dIOzTMKZCEGj7 qoi/xkmRINxx3k2wm6wL0ZPPwCkLDPuxlAVdkpeaOz1SH8TjGF2TjrYtHNoUD8Tbn0sC N6+zjpe3GTecXyiexJMeF5vdEZ7Acf4FcDgY+V+UpifeYjk9I6AvzYEKYD8xwlZ82E9k VAyA== 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=ZQdubpB58tOMYx676cpn8qULFq0/zw7MSWLyfWfd0v0=; b=UWRwDYEXuSy54APE6uQ0ic2qEr+x/iL5nOmaesoLxlrmLDs9fCeBlV8QjT1fGMCm0e 2YE2NYNLjVRPdvm8dHWRE34WBqgneH4mJkOYDiqg2Pjk1cTR4T36x3bCjZfi9JWx7rSJ E06L0oux80bfS9b293r2ZaEi2syRU/ObdNbybJ7ZNq5Fj/VZ7h88cmTeACMZ8YfCmMLg p1pz9BBQzzA1p86l+DDd4Gvhp6rEI006T7jTlOIVemMWTTTgvfr4BlXlWT6UjDjapSFZ AgRCCYj5TCUKHrpyFpuRt/nI7DG3MZVzwr/x2YAmhHbjv5plAcRwsA4mF4kkQjantpum oeBg== X-Gm-Message-State: APjAAAUyeoQ5dJ7ZOwa6DPOz0wJevlY8Mauu49W8/AcR0XfaLA22pWD5 cmS4zbv9CSYZGWaS6MnVslOW6trq60UU4T6rq4R1Cg== X-Google-Smtp-Source: APXvYqwxQq7ooKgj3JBb069/27Hsa3pIdSc4pkqUXK+m6UarcaJXtRu7PS9/IQzyj+TZM3/QvkybSmb9spMl1shTEoY= X-Received: by 2002:a9d:744b:: with SMTP id p11mr16847125otk.201.1566867133173; Mon, 26 Aug 2019 17:52:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Mon, 26 Aug 2019 17:52:12 -0700 (PDT) In-Reply-To: <201908270025.x7R0PtNT008594@slippy.cwsent.com> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> From: Mateusz Guzik Date: Tue, 27 Aug 2019 02:52:12 +0200 Message-ID: Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HVhG2nwYz47Rp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=VBHCxLtZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::344 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.97 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (3.09), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[4.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 00:52:15 -0000 Sorry for the half-assed patch. I have a patch to remove the flags argument and the change above was port of it. Try this please: https://people.freebsd.org/~mjg/patches/vop_unlock-interlock2.diff On 8/27/19, Cy Schubert wrote: > It won't build. Did you intend VOP_UNLOCK(vp,LK_INTERLOCK)? > > --- vfs_subr.o --- > /opt/src/svn-current/sys/kern/vfs_subr.c:1037:17: error: too few arguments > to function call, expected 2, have 1 > VOP_UNLOCK(vp); > ~~~~~~~~~~ ^ > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > static __inline int VOP_UNLOCK( > ^ > /opt/src/svn-current/sys/kern/vfs_subr.c:1401:16: error: too few arguments > to function call, expected 2, have 1 > VOP_UNLOCK(vp); > ~~~~~~~~~~ ^ > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > static __inline int VOP_UNLOCK( > ^ > /opt/src/svn-current/sys/kern/vfs_subr.c:1413:15: error: too few arguments > to function call, expected 2, have 1 > VOP_UNLOCK(vp); > ~~~~~~~~~~ ^ > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > static __inline int VOP_UNLOCK( > ^ > 3 errors generated. > *** [vfs_subr.o] Error code 1 > > make[2]: stopped in /export/obj/opt/src/svn-current/amd64.amd64/sys/BREAK > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > In message > om> > , Mateusz Guzik writes: >> Does this do the trick for you? >> >> https://people.freebsd.org/~mjg/vop_unlock-interlock.diff >> >> On 8/26/19, Cy Schubert wrote: >> > On August 26, 2019 8:40:50 AM PDT, Cy Schubert >> > >> > wrote: >> >>On August 26, 2019 7:11:22 AM PDT, Cy Schubert >> >> wrote: >> >>>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy >> >>>Schubert wr >> >>>ites: >> >>>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik >> >>>wrote: >> >>>> >Author: mjg >> >>>> >Date: Sun Aug 25 05:13:15 2019 >> >>>> >New Revision: 351472 >> >>>> >URL: https://svnweb.freebsd.org/changeset/base/351472 >> >>>> > >> >>>> >Log: >> >>>> > nullfs: reduce areas protected by vnode interlock >> >>>> > >> >>>> >Some places only take the interlock to hold the vnode, which was a >> >>>> >requiremnt >> >>>> >before they started being manipulated with atomics. Use the newly >> >>>> >introduced >> >>>> > vholdnz to bump the count. >> >>>> > >> >>>> > Reviewed by: kib >> >>>> > Tested by: pho >> >>>> > Sponsored by: The FreeBSD Foundation >> >>>> > Differential Revision: https://reviews.freebsd.org/D21358 >> >>>> > >> >>>> >Modified: >> >>>> > head/sys/fs/nullfs/null_vnops.c >> >>>> > >> >>>> >Modified: head/sys/fs/nullfs/null_vnops.c >> >>>> >> >>>>========================================================================= >> === >> >>>> == >> >>>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 >> >>2019 (r35147 >> >>>> 1) >> >>>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 >> >>2019 (r35147 >> >>>> 2) >> >>>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) >> >>>> > * We prevent it from being recycled by holding the vno >> de >> >>>> > * here. >> >>>> > */ >> >>>> >- vholdl(lvp); >> >>>> >+ vholdnz(lvp); >> >>>> > error = VOP_LOCK(lvp, flags); >> >>>> > >> >>>> > /* >> >>>> >@@ -710,31 +710,16 @@ static int >> >>>> > null_unlock(struct vop_unlock_args *ap) >> >>>> > { >> >>>> > struct vnode *vp = ap->a_vp; >> >>>> >- int flags = ap->a_flags; >> >>>> >- int mtxlkflag = 0; >> >>>> > struct null_node *nn; >> >>>> > struct vnode *lvp; >> >>>> > int error; >> >>>> > >> >>>> >- if ((flags & LK_INTERLOCK) != 0) >> >>>> >- mtxlkflag = 1; >> >>>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { >> >>>> >- VI_LOCK(vp); >> >>>> >- mtxlkflag = 2; >> >>>> >- } >> >>>> > nn = VTONULL(vp); >> >>>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { >> >>>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); >> >>>> >- flags |= LK_INTERLOCK; >> >>>> >- vholdl(lvp); >> >>>> >- VI_UNLOCK(vp); >> >>>> >- error = VOP_UNLOCK(lvp, flags); >> >>>> >+ vholdnz(lvp); >> >>>> >+ error = VOP_UNLOCK(lvp, 0); >> >>>> > vdrop(lvp); >> >>>> >- if (mtxlkflag == 0) >> >>>> >- VI_LOCK(vp); >> >>>> > } else { >> >>>> >- if (mtxlkflag == 2) >> >>>> >- VI_UNLOCK(vp); >> >>>> > error = vop_stdunlock(ap); >> >>>> > } >> >>>> > >> >>>> >@@ -845,10 +830,8 @@ null_getwritemount(struct >> >>>vop_getwritemount_args >> >>>> >*ap) >> >>>> > VI_LOCK(vp); >> >>>> > xp = VTONULL(vp); >> >>>> > if (xp && (lowervp = xp->null_lowervp)) { >> >>>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); >> >>>> >+ vholdnz(lowervp); >> >>>> > VI_UNLOCK(vp); >> >>>> >- vholdl(lowervp); >> >>>> >- VI_UNLOCK(lowervp); >> >>>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); >> >>>> > vdrop(lowervp); >> >>>> > } else { >> >>>> >> >>>> Hi mjg@, >> >>>> >> >>>> This causes trap 12 a few seconds after mountlate during boot. >> >>>Reverting this >> >>>> commit allowed it to boot. >> >>>> >> >>>> Sorry for no backtrace. I managed to >> >>>> revert and test just prior to rushing out to catch the bus, with no >> >>>time to >> >>>> craft a proper email. I'll post the backtrace when I arrive at work. >> >>> >> >>>Hi mjg@, >> >>> >> >>>The gory details below. Don't be fooled by the panic when yppasswd is >> >>>started. I was able to reproduce this panic in single user by simply >> >>>mounting and using a nullfs. >> >>> >> >>>kernel trap 12 with interrupts disabled >> >>> >> >>> >> >>>Fatal trap 12: page fault while in kernel mode >> >>>cpuid = 0; apic id = 00 >> >>>fault virtual address = 0xc >> >>>fault code = supervisor read data, page not present >> >>>instruction pointer = 0x20:0xffffffff806f0633 >> >>>stack pointer = 0x28:0xfffffe004b3fa7c0 >> >>>frame pointer = 0x28:0xfffffe004b3fa7e0 >> >>>code segment = base 0x0, limit 0xfffff, type 0x1b >> >>> = DPL 0, pres 1, long 1, def32 0, gran 1 >> >>>processor eflags = resume, IOPL = 0 >> >>>current process = 26 (syncer) >> >>>trap number = 12 >> >>>panic: page fault >> >>>cpuid = 0 >> >>>time = 1566821203 >> >>>KDB: stack backtrace: >> >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >> >>>0xfffffe004b3fa470 >> >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 >> >>>panic() at panic+0x43/frame 0xfffffe004b3fa520 >> >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 >> >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 >> >>>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 >> >>>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 >> >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp >> >>= >> >>>0xfffffe004b3fa7e0 --- >> >>>propagate_priority() at propagate_priority+0x153/frame >> >>>0xfffffe004b3fa7e0 >> >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 >> >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 >> >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >> >>>0xfffffe004b3fa920 >> >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 >> >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 >> >>>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 >> >>>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 >> >>>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 >> >>>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 >> >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- >> >>>Uptime: 3m25s >> >>>Dumping 921 out of 7974 >> >>>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% >> >>> >> >>>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 >> >>>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" >> >>>(OFFSETOF_CURTHREAD)); >> >>>(kgdb) #0 __curthread () at >> >>>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 >> >>>#1 doadump (textdump=1) at >> >>>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 >> >>>#2 0xffffffff8068aead in kern_reboot (howto=260) >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 >> >>>#3 0xffffffff8068b369 in vpanic (fmt=, ap=> >>>out>) >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 >> >>>#4 0xffffffff8068b163 in panic (fmt=) >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 >> >>>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, >> >>eva=12) >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 >> >>>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, >> >>>usermode=0) >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 >> >>>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 >> >>>#8 >> >>>#9 propagate_priority (td=0xfffff8003e43b000) >> >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 >> >>>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, >> >>> owner=, queue=-512) >> >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 >> >>>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, >> >>> v=) at >> >>/opt/src/svn-current/sys/kern/kern_mutex.c:654 >> >>>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( >> >>> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, >> >>vp=0xfffff80132e4eb40) >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 >> >>>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 >> >>>#14 0xffffffff80766206 in __mnt_vnode_next_active >> >>>(mvp=0xfffff80002449800, >> >>> mp=) at >> >>/opt/src/svn-current/sys/kern/vfs_subr.c:5682 >> >>>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 >> >>>#16 0xffffffff8076b4a6 in sync_fsync (ap=) >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 >> >>>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( >> >>> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) >> >>> at vnode_if.c:1312 >> >>>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, >> >>> td=0xfffff800061dc5a0) at ./vnode_if.h:549 >> >>>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, >> >>> slp=) at >> >>/opt/src/svn-current/sys/kern/vfs_subr.c:2316 >> >>>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 >> >>>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 >> >>>, >> >>> arg=0x0, frame=0xfffffe004b3faac0) >> >>> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 >> >>>#22 >> >>> >> >>> >> >>>dmesg output: >> >>> >> >>>Updating motd:. >> >>>Mounting late filesystems:. >> >>>Starting nscd. >> >>>Security policy loaded: MAC/ntpd (mac_ntpd) >> >>>Starting ntpd. >> >>>Starting yppasswdd. >> >>>kernel trap 12 with interrupts disabled >> >>> >> >>> >> >>>Fatal trap 12: page fault while in kernel mode >> >>>cpuid = 0; apic id = 00 >> >>>fault virtual address = 0xc >> >>>fault code = supervisor read data, page not present >> >>>instruction pointer = 0x20:0xffffffff806f0633 >> >>>stack pointer = 0x28:0xfffffe004b7fa7c0 >> >>>frame pointer = 0x28:0xfffffe004b7fa7e0 >> >>>code segment = base 0x0, limit 0xfffff, type 0x1b >> >>> = DPL 0, pres 1, long 1, def32 0, gran 1 >> >>>processor eflags = resume, IOPL = 0 >> >>>current process = 26 (syncer) >> >>>trap number = 12 >> >>>panic: page fault >> >>>cpuid = 0 >> >>>time = 1566820700 >> >>>KDB: stack backtrace: >> >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >> >>>0xfffffe004b7fa470 >> >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 >> >>>panic() at panic+0x43/frame 0xfffffe004b7fa520 >> >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 >> >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 >> >>>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 >> >>>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 >> >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp >> >>= >> >>>0xfffffe004b7fa7e0 --- >> >>>propagate_priority() at propagate_priority+0x153/frame >> >>>0xfffffe004b7fa7e0 >> >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 >> >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 >> >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame >> >>>0xfffffe004b7fa920 >> >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 >> >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 >> >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- >> >>>Uptime: 1m38s >> >>>Dumping 810 out of 7974 >> >>>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- >> >> >> >>This may be a simple case of increasing the kernel stack. I'll try this >> >>at noon. >> > >> > Increasing kernel stack pages from 8 to 20 still results in the panic. >> > >> > >> > -- >> > Pardon the typos and autocorrect, small keyboard in use. >> > Cheers, >> > Cy Schubert >> > FreeBSD UNIX: Web: http://www.FreeBSD.org >> > >> > The need of the many outweighs the greed of the few. >> > >> >> >> -- >> Mateusz Guzik > > > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 01:16:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F8E5C2D96; Tue, 27 Aug 2019 01:16:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HWCl2pTLz48mx; Tue, 27 Aug 2019 01:16:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43690F07B; Tue, 27 Aug 2019 01:16:03 +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 x7R1G3uA098316; Tue, 27 Aug 2019 01:16:03 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R1G37I098315; Tue, 27 Aug 2019 01:16:03 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908270116.x7R1G37I098315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 27 Aug 2019 01:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351524 - 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: 351524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 01:16:03 -0000 Author: np Date: Tue Aug 27 01:16:02 2019 New Revision: 351524 URL: https://svnweb.freebsd.org/changeset/base/351524 Log: cxgbe/t4_tom: Limit work requests with immediate payload to a single descriptor. The per-tid tx credits are in demand during active Tx and it's best not to use too many just for payload. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Aug 27 00:29:30 2019 (r351523) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Aug 27 01:16:02 2019 (r351524) @@ -540,7 +540,7 @@ t4_close_conn(struct adapter *sc, struct toepcb *toep) static inline int max_imm_payload(int tx_credits) { - const int n = 2; /* Use only up to 2 desc for imm. data WR */ + const int n = 1; /* Use no more than one desc for imm. data WR */ KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, From owner-svn-src-all@freebsd.org Tue Aug 27 01:33:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25BC1C3BFE; Tue, 27 Aug 2019 01:33:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HWc81Brnz49yh; Tue, 27 Aug 2019 01:33:43 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-oi1-x234.google.com with SMTP id o6so13671435oic.9; Mon, 26 Aug 2019 18:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=W6hlwlQRev3D/J6RJj43HtGFrLvZhpRkme9+vXIn61c=; b=jcf5hOyUQwBj43nkvV3KtZoVDbSWiHVrM2VtY8nNSOpZlWVGDR/o+HRiyMXgnnZPEP AHY/SnDamyslgE6rbLwCJaVLRAPvP9qiAuN2skTYQ3POyPFLF7GsA5ea/aZv51gHp0E8 9/6LCVhBMAqkZCmJqU1AgcP5x9bHo1rP/ZxVaSS/0wNPOXvC8qg3I5A3tLuZD/nZ0Vkr ewUzykEONRWF6EyaldYh/sTFwQYg9rDgW2xKU4+tJuryP5zwD8i0+WrWThDfFCEhaGdb VhZrupnbEwYPqJEeGxgYa01tz5RTV5wXb+IfAfrTtctE9EpjOp9Xhoxq8BSVEjYMmq4d 5FoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=W6hlwlQRev3D/J6RJj43HtGFrLvZhpRkme9+vXIn61c=; b=a/3NDWStVGz2/rTVrSZC9hDdZHnXPhy6Vsul0gKEo5oRVSow5+Z/uDYiNJDQxhrXTc 3XNFbepzci9+PYlo9ZSh9yrk0TqZUtxVo8sf9o836VTPR6Qa67Wkwrn+suAv71x4TLzz k6tRX/ChQmH6i927BEC78ASnDsgFTwluYCWF5Uhf7Inyp/t5ZBfE5yDbG38A2EPE9zZw 9fRFu5zOyrnryTDrQYg7amQhqYcr2PJrGKpcEw62qz7JIzaRw/3fDl/nHrj2tuNz0ZAY pDF8B0B/wDsUxGk+SRpoeTVP2AY1nWDsF+CQHBz39RDarmOIpEvcPT5an2zLRwVNuSEF lQQQ== X-Gm-Message-State: APjAAAW4K1rRkCxPCszlFTbFqrgOJhEFyIlWfggXKdba0lEFtskW3UqO SXB1iMoqa6q3uhgvnNvdFUcDCDt8LeE= X-Google-Smtp-Source: APXvYqx7Imlu0ZBkbA4tJ59gcBZ07gAFB+PXWdSXrFQagcxA6dhyYowN488ClF/B2G+mW9t7jeo8yA== X-Received: by 2002:aca:2809:: with SMTP id 9mr14506330oix.163.1566869622061; Mon, 26 Aug 2019 18:33:42 -0700 (PDT) Received: from spectre.mavhome.dp.ua ([2600:1700:3580:3560:228:f8ff:fe04:d12]) by smtp.gmail.com with ESMTPSA id e2sm4665091otl.67.2019.08.26.18.33.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2019 18:33:41 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r351514 - head/sys/dev/pci To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head References: <201908261727.x7QHRbsc020978@repo.freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <38e64dee-013a-f46e-0937-8834dc6065aa@FreeBSD.org> Date: Mon, 26 Aug 2019 21:33:40 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46HWc81Brnz49yh X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=jcf5hOyU; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::234 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-6.00 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.82)[ip: (-8.84), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; RCVD_IN_DNSWL_NONE(0.00)[4.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 01:33:45 -0000 On 26.08.2019 18:00, Conrad Meyer wrote: > On Mon, Aug 26, 2019 at 10:27 AM Alexander Motin wrote: >> >> Author: mav >> Date: Mon Aug 26 17:27:36 2019 >> New Revision: 351514 >> ... >> - device_printf(dev, >> - "HotPlug Command Timed Out - forcing detach\n"); >> - sc->flags &= ~(PCIB_HOTPLUG_CMD_PENDING | PCIB_DETACH_PENDING); >> - sc->flags |= PCIB_DETACHING; >> - pcib_pcie_hotplug_update(sc, 0, 0, true); >> + device_printf(dev, "HotPlug Command Timed Out\n"); >> + sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; > > If this case is expected (and it seems like it is, at least in > relatively common hardware), and the kernel isn't taking an action > based on it anymore (formerly, it would then cause detach), is there > any reason to print a message at all? What information should a user > glean from the message, or what action should be taken? It seems like > Nothing and None, respectively. So perhaps it is better to not print > anything in this case? Or maybe mask it behind bootverbose. While you may be right, for now I would leave it visible just to show that something went wrong, in case somebody wish to diagnose some real issue that may have same symptoms. It is just one line per event, so it should not be too annoying. Most people will never see it, since PCIe hot-plug is still very rare. On the mentioned Supermicro board ACPI actually blocks hot-plug support, since FreeBSD does not announce ASPM capability. This is the next real issue we need to think about. Cosmetics will follow later. -- Alexander Motin From owner-svn-src-all@freebsd.org Tue Aug 27 03:05:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BA48C68EE; Tue, 27 Aug 2019 03:05:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HYfZ29z2z4G1f; Tue, 27 Aug 2019 03:05:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DBD6184F4; Tue, 27 Aug 2019 03:05:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R35vw8064195; Tue, 27 Aug 2019 03:05:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R35vlN064194; Tue, 27 Aug 2019 03:05:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270305.x7R35vlN064194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 03:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351526 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 351526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:05:58 -0000 Author: mav Date: Tue Aug 27 03:05:57 2019 New Revision: 351526 URL: https://svnweb.freebsd.org/changeset/base/351526 Log: MFC r351348 (by markj): Modify pipe_poll() to properly check for pending direct writes. With r349546, it is a responsibility of the writer to clear PIPE_DIRECTW after pinned data has been read. In particular, once a reader has drained this data, there is a small window where the pipe is empty but PIPE_DIRECTW is set. pipe_poll() was using the presence of PIPE_DIRECTW to determine whether to return POLLIN, so in this window it would claim that data was available to read when this was not the case. Fix this by modifying several checks for PIPE_DIRECTW to instead look at the number of residual bytes in data pinned by a direct writer. In some cases we really do want to check for PIPE_DIRECTW, since the presence of this flag indicates that any attempt to write to the pipe will block on the existing direct writer. Modified: stable/12/sys/kern/sys_pipe.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Tue Aug 27 01:40:38 2019 (r351525) +++ stable/12/sys/kern/sys_pipe.c Tue Aug 27 03:05:57 2019 (r351526) @@ -711,11 +711,9 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr /* * Direct copy, bypassing a kernel buffer. */ - } else if ((size = rpipe->pipe_map.cnt) && - (rpipe->pipe_state & PIPE_DIRECTW)) { + } else if ((size = rpipe->pipe_map.cnt) != 0) { if (size > uio->uio_resid) size = (u_int) uio->uio_resid; - PIPE_UNLOCK(rpipe); error = uiomove_fromphys(rpipe->pipe_map.ms, rpipe->pipe_map.pos, size, uio); @@ -821,32 +819,33 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio u_int size; int i; - PIPE_LOCK_ASSERT(wpipe, MA_NOTOWNED); - KASSERT(wpipe->pipe_state & PIPE_DIRECTW, - ("Clone attempt on non-direct write pipe!")); + PIPE_LOCK_ASSERT(wpipe, MA_OWNED); + KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, + ("%s: PIPE_DIRECTW set on %p", __func__, wpipe)); + KASSERT(wpipe->pipe_map.cnt == 0, + ("%s: pipe map for %p contains residual data", __func__, wpipe)); if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size) size = wpipe->pipe_buffer.size; else size = uio->uio_iov->iov_len; - if ((i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, + wpipe->pipe_state |= PIPE_DIRECTW; + PIPE_UNLOCK(wpipe); + i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ, - wpipe->pipe_map.ms, PIPENPAGES)) < 0) + wpipe->pipe_map.ms, PIPENPAGES); + PIPE_LOCK(wpipe); + if (i < 0) { + wpipe->pipe_state &= ~PIPE_DIRECTW; return (EFAULT); + } -/* - * set up the control block - */ wpipe->pipe_map.npages = i; wpipe->pipe_map.pos = ((vm_offset_t) uio->uio_iov->iov_base) & PAGE_MASK; wpipe->pipe_map.cnt = size; -/* - * and update the uio data - */ - uio->uio_iov->iov_len -= size; uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size; if (uio->uio_iov->iov_len == 0) @@ -866,6 +865,8 @@ pipe_destroy_write_buffer(struct pipe *wpipe) PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); + KASSERT(wpipe->pipe_map.cnt == 0, + ("%s: pipe map for %p contains residual data", __func__, wpipe)); wpipe->pipe_state &= ~PIPE_DIRECTW; vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages); @@ -891,6 +892,7 @@ pipe_clone_write_buffer(struct pipe *wpipe) size = wpipe->pipe_map.cnt; pos = wpipe->pipe_map.pos; + wpipe->pipe_map.cnt = 0; wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; @@ -948,7 +950,6 @@ retry: else goto retry; } - wpipe->pipe_map.cnt = 0; /* transfer not ready yet */ if (wpipe->pipe_buffer.cnt > 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; @@ -965,19 +966,15 @@ retry: goto retry; } - wpipe->pipe_state |= PIPE_DIRECTW; - - PIPE_UNLOCK(wpipe); error = pipe_build_write_buffer(wpipe, uio); - PIPE_LOCK(wpipe); if (error) { - wpipe->pipe_state &= ~PIPE_DIRECTW; pipeunlock(wpipe); goto error1; } while (wpipe->pipe_map.cnt != 0) { if (wpipe->pipe_state & PIPE_EOF) { + wpipe->pipe_map.cnt = 0; pipe_destroy_write_buffer(wpipe); pipeselwakeup(wpipe); pipeunlock(wpipe); @@ -1131,7 +1128,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc * pipe buffer. We break out if a signal occurs or the * reader goes away. */ - if (wpipe->pipe_state & PIPE_DIRECTW) { + if (wpipe->pipe_map.cnt != 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -1349,7 +1346,7 @@ pipe_ioctl(struct file *fp, u_long cmd, void *data, st PIPE_UNLOCK(mpipe); return (0); } - if (mpipe->pipe_state & PIPE_DIRECTW) + if (mpipe->pipe_map.cnt != 0) *(int *)data = mpipe->pipe_map.cnt; else *(int *)data = mpipe->pipe_buffer.cnt; @@ -1405,14 +1402,13 @@ pipe_poll(struct file *fp, int events, struct ucred *a goto locked_error; #endif if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) - if ((rpipe->pipe_state & PIPE_DIRECTW) || - (rpipe->pipe_buffer.cnt > 0)) + if (rpipe->pipe_map.cnt > 0 || rpipe->pipe_buffer.cnt > 0) revents |= events & (POLLIN | POLLRDNORM); if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF) || - (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && + ((wpipe->pipe_state & PIPE_DIRECTW) == 0 && ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF || wpipe->pipe_buffer.size == 0))) revents |= events & (POLLOUT | POLLWRNORM); @@ -1487,7 +1483,7 @@ pipe_stat(struct file *fp, struct stat *ub, struct ucr bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; - if (pipe->pipe_state & PIPE_DIRECTW) + if (pipe->pipe_map.cnt != 0) ub->st_size = pipe->pipe_map.cnt; else ub->st_size = pipe->pipe_buffer.cnt; @@ -1729,7 +1725,7 @@ filt_piperead(struct knote *kn, long hint) PIPE_LOCK_ASSERT(rpipe, MA_OWNED); kn->kn_data = rpipe->pipe_buffer.cnt; - if ((kn->kn_data == 0) && (rpipe->pipe_state & PIPE_DIRECTW)) + if (kn->kn_data == 0) kn->kn_data = rpipe->pipe_map.cnt; if ((rpipe->pipe_state & PIPE_EOF) || From owner-svn-src-all@freebsd.org Tue Aug 27 03:41:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86210C7AA6; Tue, 27 Aug 2019 03:41:27 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZRV2HJ8z4HYQ; Tue, 27 Aug 2019 03:41:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2SMDiffpzUIS22SMEirknQ; Mon, 26 Aug 2019 21:41:23 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=PrR0O5JK02BW0l_2Nk8A:9 a=AwRyc7TPWctOo_KJ:21 a=P6d614OK1xefZgYy:21 a=bhKgQFQpCuPVnCNV:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 1A2579A8; Mon, 26 Aug 2019 20:41:20 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7R3fJni062391; Mon, 26 Aug 2019 20:41:19 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7R3fJne062385; Mon, 26 Aug 2019 20:41:19 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908270341.x7R3fJne062385@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> Comments: In-reply-to Mateusz Guzik message dated "Tue, 27 Aug 2019 02:52:12 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 20:41:19 -0700 X-CMAE-Envelope: MS4wfAY4gPVtC3NfJrJh64qfPzHJFrhy6AfYZYoUwnXOwdl9yRdJqPd3ZIedkSQAQrPsBsBWbjUk523bZjptrSaIrqW5qccJBRaUjvxspNqYX1pyMIj9RFGI 7GuYy2IlbEOdzXDfQ8QZ5uoGpLooLi6JvS8AUJRwcrUWHUiPkU1hjhO7SHHwMB4aE1EhDyyhujeSFsZJbHuopFSaJAeGJv7QGXGBcCFgGtZWldfb2JQGjEGT p/czWj1DfrlanskL2ohxHdyqguTTzISzAKUB0FG7ryE= X-Rspamd-Queue-Id: 46HZRV2HJ8z4HYQ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.13) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-5.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; RCVD_IN_DNSWL_NONE(0.00)[13.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.49)[ip: (-6.78), ipnet: 64.59.128.0/20(-3.14), asn: 6327(-2.44), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:41:27 -0000 Making progress: Unread portion of the kernel message buffer: panic: null_unlock: LK_INTERLOCK passed cpuid = 2 time = 1566868081 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0054a954e0 vpanic() at vpanic+0x19d/frame 0xfffffe0054a95530 panic() at panic+0x43/frame 0xfffffe0054a95590 null_unlock() at null_unlock+0x8a/frame 0xfffffe0054a955d0 VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a955f0 unionfs_unlock() at unionfs_unlock+0x124/frame 0xfffffe0054a95650 VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a95670 vfs_domount() at vfs_domount+0xc3f/frame 0xfffffe0054a958a0 vfs_donmount() at vfs_donmount+0x934/frame 0xfffffe0054a95940 sys_nmount() at sys_nmount+0x69/frame 0xfffffe0054a95980 amd64_syscall() at amd64_syscall+0x3ae/frame 0xfffffe0054a95ab0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0054a95ab0 --- syscall (378, FreeBSD ELF64, sys_nmount), rip = 0x2bed6a4a, rsp = 0x7fffffffe2e8, rbp = 0x7fffffffec70 --- Uptime: 1m35s -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. In message , Mateusz Guzik writes: > Sorry for the half-assed patch. I have a patch to remove the flags > argument and the change above was port of it. > > Try this please: > https://people.freebsd.org/~mjg/patches/vop_unlock-interlock2.diff > > On 8/27/19, Cy Schubert wrote: > > It won't build. Did you intend VOP_UNLOCK(vp,LK_INTERLOCK)? > > > > --- vfs_subr.o --- > > /opt/src/svn-current/sys/kern/vfs_subr.c:1037:17: error: too few arguments > > to function call, expected 2, have 1 > > VOP_UNLOCK(vp); > > ~~~~~~~~~~ ^ > > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > > static __inline int VOP_UNLOCK( > > ^ > > /opt/src/svn-current/sys/kern/vfs_subr.c:1401:16: error: too few arguments > > to function call, expected 2, have 1 > > VOP_UNLOCK(vp); > > ~~~~~~~~~~ ^ > > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > > static __inline int VOP_UNLOCK( > > ^ > > /opt/src/svn-current/sys/kern/vfs_subr.c:1413:15: error: too few arguments > > to function call, expected 2, have 1 > > VOP_UNLOCK(vp); > > ~~~~~~~~~~ ^ > > ./vnode_if.h:873:1: note: 'VOP_UNLOCK' declared here > > static __inline int VOP_UNLOCK( > > ^ > > 3 errors generated. > > *** [vfs_subr.o] Error code 1 > > > > make[2]: stopped in /export/obj/opt/src/svn-current/amd64.amd64/sys/BREAK > > > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > > > In message > > > om> > > , Mateusz Guzik writes: > >> Does this do the trick for you? > >> > >> https://people.freebsd.org/~mjg/vop_unlock-interlock.diff > >> > >> On 8/26/19, Cy Schubert wrote: > >> > On August 26, 2019 8:40:50 AM PDT, Cy Schubert > >> > > >> > wrote: > >> >>On August 26, 2019 7:11:22 AM PDT, Cy Schubert > >> >> wrote: > >> >>>In message <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com>, Cy > >> >>>Schubert wr > >> >>>ites: > >> >>>> On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik > >> >>>wrote: > >> >>>> >Author: mjg > >> >>>> >Date: Sun Aug 25 05:13:15 2019 > >> >>>> >New Revision: 351472 > >> >>>> >URL: https://svnweb.freebsd.org/changeset/base/351472 > >> >>>> > > >> >>>> >Log: > >> >>>> > nullfs: reduce areas protected by vnode interlock > >> >>>> > > >> >>>> >Some places only take the interlock to hold the vnode, which was a > >> >>>> >requiremnt > >> >>>> >before they started being manipulated with atomics. Use the newly > >> >>>> >introduced > >> >>>> > vholdnz to bump the count. > >> >>>> > > >> >>>> > Reviewed by: kib > >> >>>> > Tested by: pho > >> >>>> > Sponsored by: The FreeBSD Foundation > >> >>>> > Differential Revision: https://reviews.freebsd.org/D21358 > >> >>>> > > >> >>>> >Modified: > >> >>>> > head/sys/fs/nullfs/null_vnops.c > >> >>>> > > >> >>>> >Modified: head/sys/fs/nullfs/null_vnops.c > >> >>>> > >> >>>>====================================================================== > === > >> === > >> >>>> == > >> >>>> >--- head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:11:43 > >> >>2019 (r35147 > >> >>>> 1) > >> >>>> >+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 25 05:13:15 > >> >>2019 (r35147 > >> >>>> 2) > >> >>>> >@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap) > >> >>>> > * We prevent it from being recycled by holding the vno > >> de > >> >>>> > * here. > >> >>>> > */ > >> >>>> >- vholdl(lvp); > >> >>>> >+ vholdnz(lvp); > >> >>>> > error = VOP_LOCK(lvp, flags); > >> >>>> > > >> >>>> > /* > >> >>>> >@@ -710,31 +710,16 @@ static int > >> >>>> > null_unlock(struct vop_unlock_args *ap) > >> >>>> > { > >> >>>> > struct vnode *vp = ap->a_vp; > >> >>>> >- int flags = ap->a_flags; > >> >>>> >- int mtxlkflag = 0; > >> >>>> > struct null_node *nn; > >> >>>> > struct vnode *lvp; > >> >>>> > int error; > >> >>>> > > >> >>>> >- if ((flags & LK_INTERLOCK) != 0) > >> >>>> >- mtxlkflag = 1; > >> >>>> >- else if (mtx_owned(VI_MTX(vp)) == 0) { > >> >>>> >- VI_LOCK(vp); > >> >>>> >- mtxlkflag = 2; > >> >>>> >- } > >> >>>> > nn = VTONULL(vp); > >> >>>> > if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { > >> >>>> >- VI_LOCK_FLAGS(lvp, MTX_DUPOK); > >> >>>> >- flags |= LK_INTERLOCK; > >> >>>> >- vholdl(lvp); > >> >>>> >- VI_UNLOCK(vp); > >> >>>> >- error = VOP_UNLOCK(lvp, flags); > >> >>>> >+ vholdnz(lvp); > >> >>>> >+ error = VOP_UNLOCK(lvp, 0); > >> >>>> > vdrop(lvp); > >> >>>> >- if (mtxlkflag == 0) > >> >>>> >- VI_LOCK(vp); > >> >>>> > } else { > >> >>>> >- if (mtxlkflag == 2) > >> >>>> >- VI_UNLOCK(vp); > >> >>>> > error = vop_stdunlock(ap); > >> >>>> > } > >> >>>> > > >> >>>> >@@ -845,10 +830,8 @@ null_getwritemount(struct > >> >>>vop_getwritemount_args > >> >>>> >*ap) > >> >>>> > VI_LOCK(vp); > >> >>>> > xp = VTONULL(vp); > >> >>>> > if (xp && (lowervp = xp->null_lowervp)) { > >> >>>> >- VI_LOCK_FLAGS(lowervp, MTX_DUPOK); > >> >>>> >+ vholdnz(lowervp); > >> >>>> > VI_UNLOCK(vp); > >> >>>> >- vholdl(lowervp); > >> >>>> >- VI_UNLOCK(lowervp); > >> >>>> > VOP_GETWRITEMOUNT(lowervp, ap->a_mpp); > >> >>>> > vdrop(lowervp); > >> >>>> > } else { > >> >>>> > >> >>>> Hi mjg@, > >> >>>> > >> >>>> This causes trap 12 a few seconds after mountlate during boot. > >> >>>Reverting this > >> >>>> commit allowed it to boot. > >> >>>> > >> >>>> Sorry for no backtrace. I managed to > >> >>>> revert and test just prior to rushing out to catch the bus, with no > >> >>>time to > >> >>>> craft a proper email. I'll post the backtrace when I arrive at work. > >> >>> > >> >>>Hi mjg@, > >> >>> > >> >>>The gory details below. Don't be fooled by the panic when yppasswd is > >> >>>started. I was able to reproduce this panic in single user by simply > >> >>>mounting and using a nullfs. > >> >>> > >> >>>kernel trap 12 with interrupts disabled > >> >>> > >> >>> > >> >>>Fatal trap 12: page fault while in kernel mode > >> >>>cpuid = 0; apic id = 00 > >> >>>fault virtual address = 0xc > >> >>>fault code = supervisor read data, page not present > >> >>>instruction pointer = 0x20:0xffffffff806f0633 > >> >>>stack pointer = 0x28:0xfffffe004b3fa7c0 > >> >>>frame pointer = 0x28:0xfffffe004b3fa7e0 > >> >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >> >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >> >>>processor eflags = resume, IOPL = 0 > >> >>>current process = 26 (syncer) > >> >>>trap number = 12 > >> >>>panic: page fault > >> >>>cpuid = 0 > >> >>>time = 1566821203 > >> >>>KDB: stack backtrace: > >> >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >> >>>0xfffffe004b3fa470 > >> >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b3fa4c0 > >> >>>panic() at panic+0x43/frame 0xfffffe004b3fa520 > >> >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b3fa580 > >> >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b3fa5e0 > >> >>>trap() at trap+0x29d/frame 0xfffffe004b3fa6f0 > >> >>>calltrap() at calltrap+0x8/frame 0xfffffe004b3fa6f0 > >> >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b3fa7c0, rbp > >> >>= > >> >>>0xfffffe004b3fa7e0 --- > >> >>>propagate_priority() at propagate_priority+0x153/frame > >> >>>0xfffffe004b3fa7e0 > >> >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b3fa830 > >> >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b3fa8c0 > >> >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >> >>>0xfffffe004b3fa920 > >> >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b3fa980 > >> >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b3fa9c0 > >> >>>VOP_FSYNC_APV() at VOP_FSYNC_APV+0x56/frame 0xfffffe004b3fa9e0 > >> >>>sched_sync() at sched_sync+0x379/frame 0xfffffe004b3faa70 > >> >>>fork_exit() at fork_exit+0x83/frame 0xfffffe004b3faab0 > >> >>>fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b3faab0 > >> >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >> >>>Uptime: 3m25s > >> >>>Dumping 921 out of 7974 > >> >>>MB:..2%..11%..21%..32%..42%..51%..61%..72%..82%..91% > >> >>> > >> >>>__curthread () at /opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >> >>>246 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" > >> >>>(OFFSETOF_CURTHREAD)); > >> >>>(kgdb) #0 __curthread () at > >> >>>/opt/src/svn-current/sys/amd64/include/pcpu.h:246 > >> >>>#1 doadump (textdump=1) at > >> >>>/opt/src/svn-current/sys/kern/kern_shutdown.c:392 > >> >>>#2 0xffffffff8068aead in kern_reboot (howto=260) > >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:479 > >> >>>#3 0xffffffff8068b369 in vpanic (fmt=, ap= >> >>>out>) > >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:905 > >> >>>#4 0xffffffff8068b163 in panic (fmt=) > >> >>> at /opt/src/svn-current/sys/kern/kern_shutdown.c:832 > >> >>>#5 0xffffffff80a11c2c in trap_fatal (frame=0xfffffe004b3fa700, > >> >>eva=12) > >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:943 > >> >>>#6 0xffffffff80a11c79 in trap_pfault (frame=0xfffffe004b3fa700, > >> >>>usermode=0) > >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:767 > >> >>>#7 0xffffffff80a1126d in trap (frame=0xfffffe004b3fa700) > >> >>> at /opt/src/svn-current/sys/amd64/amd64/trap.c:443 > >> >>>#8 > >> >>>#9 propagate_priority (td=0xfffff8003e43b000) > >> >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:279 > >> >>>#10 0xffffffff806f13db in turnstile_wait (ts=0xfffff8000258a780, > >> >>> owner=, queue=-512) > >> >>> at /opt/src/svn-current/sys/kern/subr_turnstile.c:785 > >> >>>#11 0xffffffff80669271 in __mtx_lock_sleep (c=0xfffff80132e4ebf0, > >> >>> v=) at > >> >>/opt/src/svn-current/sys/kern/kern_mutex.c:654 > >> >>>#12 0xffffffff80767b1b in mnt_vnode_next_active_relock ( > >> >>> mvp=0xfffff80002449800, mp=0xfffff80132d1e000, > >> >>vp=0xfffff80132e4eb40) > >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5590 > >> >>>#13 mnt_vnode_next_active (mvp=, mp=0xfffff80132d1e000) > >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:5649 > >> >>>#14 0xffffffff80766206 in __mnt_vnode_next_active > >> >>>(mvp=0xfffff80002449800, > >> >>> mp=) at > >> >>/opt/src/svn-current/sys/kern/vfs_subr.c:5682 > >> >>>#15 vfs_msync (mp=0xfffff80132d1e000, flags=2) > >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4238 > >> >>>#16 0xffffffff8076b4a6 in sync_fsync (ap=) > >> >>> at /opt/src/svn-current/sys/kern/vfs_subr.c:4468 > >> >>>#17 0xffffffff80a7be46 in VOP_FSYNC_APV ( > >> >>> vop=0xffffffff80cb4120 , a=0xfffffe004b3faa08) > >> >>> at vnode_if.c:1312 > >> >>>#18 0xffffffff80769319 in VOP_FSYNC (vp=, waitfor=3, > >> >>> td=0xfffff800061dc5a0) at ./vnode_if.h:549 > >> >>>#19 sync_vnode (bo=, td=0xfffff800061dc5a0, > >> >>> slp=) at > >> >>/opt/src/svn-current/sys/kern/vfs_subr.c:2316 > >> >>>#20 sched_sync () at /opt/src/svn-current/sys/kern/vfs_subr.c:2418 > >> >>>#21 0xffffffff80647e33 in fork_exit (callout=0xffffffff80768fa0 > >> >>>, > >> >>> arg=0x0, frame=0xfffffe004b3faac0) > >> >>> at /opt/src/svn-current/sys/kern/kern_fork.c:1045 > >> >>>#22 > >> >>> > >> >>> > >> >>>dmesg output: > >> >>> > >> >>>Updating motd:. > >> >>>Mounting late filesystems:. > >> >>>Starting nscd. > >> >>>Security policy loaded: MAC/ntpd (mac_ntpd) > >> >>>Starting ntpd. > >> >>>Starting yppasswdd. > >> >>>kernel trap 12 with interrupts disabled > >> >>> > >> >>> > >> >>>Fatal trap 12: page fault while in kernel mode > >> >>>cpuid = 0; apic id = 00 > >> >>>fault virtual address = 0xc > >> >>>fault code = supervisor read data, page not present > >> >>>instruction pointer = 0x20:0xffffffff806f0633 > >> >>>stack pointer = 0x28:0xfffffe004b7fa7c0 > >> >>>frame pointer = 0x28:0xfffffe004b7fa7e0 > >> >>>code segment = base 0x0, limit 0xfffff, type 0x1b > >> >>> = DPL 0, pres 1, long 1, def32 0, gran 1 > >> >>>processor eflags = resume, IOPL = 0 > >> >>>current process = 26 (syncer) > >> >>>trap number = 12 > >> >>>panic: page fault > >> >>>cpuid = 0 > >> >>>time = 1566820700 > >> >>>KDB: stack backtrace: > >> >>>db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >> >>>0xfffffe004b7fa470 > >> >>>vpanic() at vpanic+0x19d/frame 0xfffffe004b7fa4c0 > >> >>>panic() at panic+0x43/frame 0xfffffe004b7fa520 > >> >>>trap_fatal() at trap_fatal+0x39c/frame 0xfffffe004b7fa580 > >> >>>trap_pfault() at trap_pfault+0x49/frame 0xfffffe004b7fa5e0 > >> >>>trap() at trap+0x29d/frame 0xfffffe004b7fa6f0 > >> >>>calltrap() at calltrap+0x8/frame 0xfffffe004b7fa6f0 > >> >>>--- trap 0xc, rip = 0xffffffff806f0633, rsp = 0xfffffe004b7fa7c0, rbp > >> >>= > >> >>>0xfffffe004b7fa7e0 --- > >> >>>propagate_priority() at propagate_priority+0x153/frame > >> >>>0xfffffe004b7fa7e0 > >> >>>turnstile_wait() at turnstile_wait+0x32b/frame 0xfffffe004b7fa830 > >> >>>__mtx_lock_sleep() at __mtx_lock_sleep+0x191/frame 0xfffffe004b7fa8c0 > >> >>>mnt_vnode_next_active() at mnt_vnode_next_active+0x2cb/frame > >> >>>0xfffffe004b7fa920 > >> >>>vfs_msync() at vfs_msync+0x266/frame 0xfffffe004b7fa980 > >> >>>sync_fsync() at sync_fsync+0xe6/frame 0xfffffe004b7fa9c0 > >> >>>--- trap 0, rip = 0, rsp = 0, rbp = 0 --- > >> >>>Uptime: 1m38s > >> >>>Dumping 810 out of 7974 > >> >>>MB:..2%..12%..22%..32%..42%..52%..62%..72%..81%..91%---<>--- > >> >> > >> >>This may be a simple case of increasing the kernel stack. I'll try this > >> >>at noon. > >> > > >> > Increasing kernel stack pages from 8 to 20 still results in the panic. > >> > > >> > > >> > -- > >> > Pardon the typos and autocorrect, small keyboard in use. > >> > Cheers, > >> > Cy Schubert > >> > FreeBSD UNIX: Web: http://www.FreeBSD.org > >> > > >> > The need of the many outweighs the greed of the few. > >> > > >> > >> > >> -- > >> Mateusz Guzik > > > > > > > > > -- > Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 03:52:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB9C0C801F; Tue, 27 Aug 2019 03:52:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZh756J3z4JHN; Tue, 27 Aug 2019 03:52:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9104318E23; Tue, 27 Aug 2019 03:52:23 +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 x7R3qNbT094379; Tue, 27 Aug 2019 03:52:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R3qNtY094377; Tue, 27 Aug 2019 03:52:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270352.x7R3qNtY094377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 03:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351527 - in stable/12: sbin/camcontrol sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: sbin/camcontrol sys/sys X-SVN-Commit-Revision: 351527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:52:23 -0000 Author: mav Date: Tue Aug 27 03:52:22 2019 New Revision: 351527 URL: https://svnweb.freebsd.org/changeset/base/351527 Log: MFC r350393: Decode some more IDENTIFY DEVICE bits. Modified: stable/12/sbin/camcontrol/camcontrol.c stable/12/sys/sys/ata.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:05:57 2019 (r351526) +++ stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:52:22 2019 (r351527) @@ -1540,6 +1540,7 @@ atacapprint(struct ata_params *parm) printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } + printf("additional product id %.8s\n", parm->product_id); if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { printf("media serial number %.30s\n", parm->media_serial); @@ -1669,35 +1670,39 @@ atacapprint(struct ata_params *parm) } else printf("\n"); printf("Native Command Queuing (NCQ) "); - if (parm->satacapabilities != 0xffff && - (parm->satacapabilities & ATA_SUPPORT_NCQ)) { + if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) { printf("yes %d tags\n", ATA_QUEUE_LEN(parm->queue) + 1); + printf("NCQ Priority Information %s\n", + parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ? + "yes" : "no"); + printf("NCQ Non-Data Command %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ? + "yes" : "no"); + printf("NCQ Streaming %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? + "yes" : "no"); + printf("Receive & Send FPDMA Queued %s\n", + parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? + "yes" : "no"); + printf("NCQ Autosense %s\n", + parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ? + "yes" : "no"); } else printf("no\n"); - printf("NCQ Queue Management %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ? - "yes" : "no"); - printf("NCQ Streaming %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? - "yes" : "no"); - printf("Receive & Send FPDMA Queued %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? - "yes" : "no"); - printf("SMART %s %s\n", parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); - printf("microcode download %s %s\n", - parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("security %s %s\n", parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no"); printf("power management %s %s\n", parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); + printf("microcode download %s %s\n", + parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("advanced power management %s %s", parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no"); @@ -1740,6 +1745,15 @@ atacapprint(struct ata_params *parm) printf("free-fall %s %s\n", parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no", parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no"); + printf("sense data reporting %s %s\n", + parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no"); + printf("extended power conditions %s %s\n", + parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no"); + printf("device statistics notification %s %s\n", + parm->support2 & ATA_SUPPORT_DSN ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_DSN ? "yes" : "no"); printf("Data Set Management (DSM/TRIM) "); if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) { printf("yes\n"); @@ -1762,6 +1776,8 @@ atacapprint(struct ata_params *parm) } else { printf("no\n"); } + printf("encrypts all user data %s\n", + parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no"); printf("Sanitize "); if (parm->multi & ATA_SUPPORT_SANITIZE) { printf("yes\t\t%s%s%s\n", Modified: stable/12/sys/sys/ata.h ============================================================================== --- stable/12/sys/sys/ata.h Tue Aug 27 03:05:57 2019 (r351526) +++ stable/12/sys/sys/ata.h Tue Aug 27 03:52:22 2019 (r351527) @@ -143,7 +143,8 @@ struct ata_params { /*77*/ u_int16_t satacapabilities2; #define ATA_SATA_CURR_GEN_MASK 0x0006 #define ATA_SUPPORT_NCQ_STREAM 0x0010 -#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020 +#define ATA_SUPPORT_NCQ_NON_DATA 0x0020 +#define ATA_SUPPORT_NCQ_QMANAGEMENT ATA_SUPPORT_NCQ_NON_DATA #define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040 /*78*/ u_int16_t satasupport; #define ATA_SUPPORT_NONZERO 0x0002 @@ -152,6 +153,7 @@ struct ata_params { #define ATA_SUPPORT_INORDERDATA 0x0010 #define ATA_SUPPORT_ASYNCNOTIF 0x0020 #define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 +#define ATA_SUPPORT_NCQ_AUTOSENSE 0x0080 /*79*/ u_int16_t sataenabled; #define ATA_ENABLED_DAPST 0x0080 @@ -285,7 +287,8 @@ struct ata_params { #define ATA_FORM_FACTOR_C_FAST 0x0009 /*169*/ u_int16_t support_dsm; #define ATA_SUPPORT_DSM_TRIM 0x0001 - u_int16_t reserved170[6]; +/*170*/ u_int8_t product_id[8]; /* Additional Product Identifier */ + u_int16_t reserved174[2]; /*176*/ u_int8_t media_serial[60]; /*206*/ u_int16_t sct; u_int16_t reserved207[2]; From owner-svn-src-all@freebsd.org Tue Aug 27 03:53:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE3C6C80C9; Tue, 27 Aug 2019 03:53:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZjG4CXvz4JQd; Tue, 27 Aug 2019 03:53:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 727DD18E3D; Tue, 27 Aug 2019 03:53:22 +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 x7R3rM38094474; Tue, 27 Aug 2019 03:53:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R3rMwO094473; Tue, 27 Aug 2019 03:53:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270353.x7R3rMwO094473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 03:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351528 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 351528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:53:22 -0000 Author: mav Date: Tue Aug 27 03:53:22 2019 New Revision: 351528 URL: https://svnweb.freebsd.org/changeset/base/351528 Log: MFC r350424: Use present now scsi_mode_sense_subpage(). Modified: stable/12/sbin/camcontrol/timestamp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/timestamp.c ============================================================================== --- stable/12/sbin/camcontrol/timestamp.c Tue Aug 27 03:52:22 2019 (r351527) +++ stable/12/sbin/camcontrol/timestamp.c Tue Aug 27 03:53:22 2019 (r351528) @@ -79,7 +79,6 @@ set_restore_flags(struct cam_device *device, uint8_t * int error = 0; struct scsi_control_ext_page *control_page = NULL; struct scsi_mode_header_10 *mode_hdr = NULL; - struct scsi_mode_sense_10 *cdb = NULL; union ccb *ccb = NULL; unsigned long mode_buf_size = sizeof(struct scsi_mode_header_10) + sizeof(struct scsi_mode_blk_desc) + @@ -96,25 +95,19 @@ set_restore_flags(struct cam_device *device, uint8_t * * Get the control extension subpage, we'll send it back modified to * enable SCSI control over the tape drive's timestamp */ - scsi_mode_sense_len(&ccb->csio, + scsi_mode_sense_subpage(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, /*tag_action*/ task_attr, /*dbd*/ 0, /*page_control*/ SMS_PAGE_CTRL_CURRENT, /*page*/ SCEP_PAGE_CODE, + /*subpage*/ SCEP_SUBPAGE_CODE, /*param_buf*/ &mode_buf[0], /*param_len*/ mode_buf_size, /*minimum_cmd_size*/ 10, /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ timeout ? timeout : 5000); - /* - * scsi_mode_sense_len does not have a subpage argument at the moment, - * so we have to manually set the subpage code before calling - * cam_send_ccb(). - */ - cdb = (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes; - cdb->subpage = SCEP_SUBPAGE_CODE; ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; if (retry_count > 0) From owner-svn-src-all@freebsd.org Tue Aug 27 03:54:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93096C816E; Tue, 27 Aug 2019 03:54:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZkZ48WGz4JY7; Tue, 27 Aug 2019 03:54:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70A7018E3F; Tue, 27 Aug 2019 03:54:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R3sUR6094585; Tue, 27 Aug 2019 03:54:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R3sTR7094581; Tue, 27 Aug 2019 03:54:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270354.x7R3sTR7094581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 03:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351529 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 351529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:54:30 -0000 Author: mav Date: Tue Aug 27 03:54:29 2019 New Revision: 351529 URL: https://svnweb.freebsd.org/changeset/base/351529 Log: MFC r350457: Make `camcontrol modepage` to use 10 byte commands. While old devices may not support 10 byte MODE SENSE/MODE SELECT commands, new ones may not be able to report all mode pages with 6 byte commands. This patch makes camcontrol by default start with 10 byte commands and fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced. Modified: stable/12/sbin/camcontrol/camcontrol.8 stable/12/sbin/camcontrol/camcontrol.c stable/12/sbin/camcontrol/camcontrol.h stable/12/sbin/camcontrol/modeedit.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.8 Tue Aug 27 03:53:22 2019 (r351528) +++ stable/12/sbin/camcontrol/camcontrol.8 Tue Aug 27 03:54:29 2019 (r351529) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2019 +.Dd July 30, 2019 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -122,6 +122,7 @@ .Ic modepage .Op device id .Op generic args +.Op Fl 6 .Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl .Op Fl b | Fl e @@ -723,6 +724,13 @@ The .Ic modepage command takes several arguments: .Bl -tag -width 12n +.It Fl 6 +Use 6 byte MODE commands instead of default 10 byte. +Old devices may not support 10 byte MODE commands, while new devices may +not be able to report all mode pages with 6 byte commands. +If not specified, +.Nm +starts with 10 byte commands and falls back to 6 byte on error. .It Fl d Disable block descriptors for mode sense. .It Fl b Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:53:22 2019 (r351528) +++ stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:54:29 2019 (r351529) @@ -230,7 +230,7 @@ static struct camcontrol_opts option_table[] = { {"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""}, #ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, - {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"}, + {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, @@ -4611,18 +4611,25 @@ reassignblocks(struct cam_device *device, u_int32_t *b #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, - int task_attr, int retry_count, int timeout, u_int8_t *data, - int datalen) +mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page, + int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, + int datalen) { union ccb *ccb; - int retval; + int error_code, sense_key, asc, ascq; ccb = cam_getccb(device); - if (ccb == NULL) errx(1, "mode_sense: couldn't allocate CCB"); +retry: + /* + * MODE SENSE(6) can't handle more then 255 bytes. If there are more, + * device must return error, so we should not get trucated data. + */ + if (*cdb_len == 6 && datalen > 255) + datalen = 255; + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_mode_sense_subpage(&ccb->csio, @@ -4635,36 +4642,47 @@ mode_sense(struct cam_device *device, int dbd, int pc, /* subpage */ subpage, /* param_buf */ data, /* param_len */ datalen, - /* minimum_cmd_size */ 0, + /* minimum_cmd_size */ *cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); + /* Record what CDB size the above function really set. */ + *cdb_len = ccb->csio.cdb_len; + if (arglist & CAM_ARG_ERR_RECOVER) ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; - if (((retval = cam_send_ccb(device, ccb)) < 0) - || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + if (cam_send_ccb(device, ccb) < 0) + err(1, "error sending mode sense command"); + + /* In case of ILLEGEL REQUEST try to fall back to 6-byte command. */ + if (*cdb_len != 6 && + ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID || + (scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq) + && sense_key == SSD_KEY_ILLEGAL_REQUEST))) { + *cdb_len = 6; + goto retry; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } cam_freeccb(ccb); cam_close_device(device); - if (retval < 0) - err(1, "error sending mode sense command"); - else - errx(1, "error sending mode sense command"); + errx(1, "mode sense command returned error"); } cam_freeccb(ccb); } void -mode_select(struct cam_device *device, int save_pages, int task_attr, - int retry_count, int timeout, u_int8_t *data, int datalen) +mode_select(struct cam_device *device, int cdb_len, int save_pages, + int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen) { union ccb *ccb; int retval; @@ -4676,7 +4694,7 @@ mode_select(struct cam_device *device, int save_pages, CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - scsi_mode_select(&ccb->csio, + scsi_mode_select_len(&ccb->csio, /* retries */ retry_count, /* cbfcnp */ NULL, /* tag_action */ task_attr, @@ -4684,6 +4702,7 @@ mode_select(struct cam_device *device, int save_pages, /* save_pages */ save_pages, /* param_buf */ data, /* param_len */ datalen, + /* minimum_cmd_size */ cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); @@ -4718,10 +4737,13 @@ modepage(struct cam_device *device, int argc, char **a { char *str_subpage; int c, page = -1, subpage = -1, pc = 0; - int binary = 0, dbd = 0, edit = 0, list = 0; + int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { + case '6': + cdb_len = 6; + break; case 'b': binary = 1; break; @@ -4761,11 +4783,11 @@ modepage(struct cam_device *device, int argc, char **a errx(1, "you must specify a mode page!"); if (list != 0) { - mode_list(device, dbd, pc, list > 1, task_attr, retry_count, - timeout); + mode_list(device, cdb_len, dbd, pc, list > 1, task_attr, + retry_count, timeout); } else { - mode_edit(device, dbd, pc, page, subpage, edit, binary, - task_attr, retry_count, timeout); + mode_edit(device, cdb_len, dbd, pc, page, subpage, edit, + binary, task_attr, retry_count, timeout); } } Modified: stable/12/sbin/camcontrol/camcontrol.h ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.h Tue Aug 27 03:53:22 2019 (r351528) +++ stable/12/sbin/camcontrol/camcontrol.h Tue Aug 27 03:54:29 2019 (r351529) @@ -88,16 +88,17 @@ int epc(struct cam_device *device, int argc, char **ar int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); -void mode_sense(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retry_count, int timeout, - uint8_t *data, int datalen); -void mode_select(struct cam_device *device, int save_pages, int task_attr, - int retry_count, int timeout, u_int8_t *data, int datalen); -void mode_edit(struct cam_device *device, int dbd, int pc, int page, - int subpage, int edit, int binary, int task_attr, +void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retry_count, + int timeout, uint8_t *data, int datalen); +void mode_select(struct cam_device *device, int cdb_len, int save_pages, + int task_attr, int retry_count, int timeout, u_int8_t *data, + int datalen); +void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int edit, int binary, int task_attr, int retry_count, int timeout); -void mode_list(struct cam_device *device, int dbd, int pc, int subpages, - int task_attr, int retry_count, int timeout); +void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, + int subpages, int task_attr, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout); Modified: stable/12/sbin/camcontrol/modeedit.c ============================================================================== --- stable/12/sbin/camcontrol/modeedit.c Tue Aug 27 03:53:22 2019 (r351528) +++ stable/12/sbin/camcontrol/modeedit.c Tue Aug 27 03:54:29 2019 (r351529) @@ -60,15 +60,9 @@ __FBSDID("$FreeBSD$"); #define PAGENAME_START '"' /* Page name delimiter. */ #define PAGENAME_END '"' /* Page name delimiter. */ #define PAGEENTRY_END ';' /* Page entry terminator (optional). */ -#define MAX_COMMAND_SIZE 255 /* Mode/Log sense data buffer size. */ +#define MAX_DATA_SIZE 4096 /* Mode/Log sense data buffer size. */ #define PAGE_CTRL_SHIFT 6 /* Bit offset to page control field. */ - -/* Macros for working with mode pages. */ -#define MODE_PAGE_HEADER(mh) \ - (struct scsi_mode_page_header *)find_mode_page_6(mh) - - struct editentry { STAILQ_ENTRY(editentry) link; char *name; @@ -106,13 +100,12 @@ static int editentry_save(void *hook, char *name); static struct editentry *editentry_lookup(char *name); static int editentry_set(char *name, char *newvalue, int editonly); -static void editlist_populate(struct cam_device *device, int dbd, - int pc, int page, int subpage, - int task_attr, int retries, - int timeout); -static void editlist_save(struct cam_device *device, int dbd, - int pc, int page, int subpage, - int task_attr, int retries, int timeout); +static void editlist_populate(struct cam_device *device, + int cdb_len, int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); +static void editlist_save(struct cam_device *device, int cdb_len, + int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void nameentry_create(int page, int subpage, char *name); static struct pagename *nameentry_lookup(int page, int subpage); static int load_format(const char *pagedb_path, int lpage, @@ -120,9 +113,9 @@ static int load_format(const char *pagedb_path, int static int modepage_write(FILE *file, int editonly); static int modepage_read(FILE *file); static void modepage_edit(void); -static void modepage_dump(struct cam_device *device, int dbd, - int pc, int page, int subpage, int task_attr, - int retries, int timeout); +static void modepage_dump(struct cam_device *device, int cdb_len, + int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void cleanup_editfile(void); @@ -552,12 +545,11 @@ load_format(const char *pagedb_path, int lpage, int ls } static void -editlist_populate(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retries, int timeout) +editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t len; @@ -565,11 +557,18 @@ editlist_populate(struct cam_device *device, int dbd, STAILQ_INIT(&editlist); /* Fetch changeable values; use to build initial editlist. */ - mode_sense(device, dbd, 1, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries, + timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; @@ -584,40 +583,80 @@ editlist_populate(struct cam_device *device, int dbd, buff_decode_visit(mode_pars, len, format, editentry_create, 0); /* Fetch the current/saved values; use to set editentry values. */ - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); buff_decode_visit(mode_pars, len, format, editentry_update, 0); } static void -editlist_save(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retries, int timeout) +editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - size_t len, hlen; + size_t len, hlen, mphlen; /* Make sure that something changed before continuing. */ if (! editlist_changed) return; /* Preload the CDB buffer with the current mode page data. */ - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); /* Initial headers & offsets. */ - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + /* + * Tape drives include write protect (WP), Buffered Mode and Speed + * settings in the device-specific parameter. Clearing this + * parameter on a mode select can have the effect of turning off + * write protect or buffered mode, or changing the speed setting of + * the tape drive. + * + * Disks report DPO/FUA support via the device specific parameter + * for MODE SENSE, but the bit is reserved for MODE SELECT. So we + * clear this for disks (and other non-tape devices) to avoid + * potential errors from the target device. + */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + hlen = sizeof(*mh); + /* Eliminate block descriptors. */ + if (mh->blk_desc_len > 0) { + bcopy(find_mode_page_6(mh), mh + 1, + mh->data_length + 1 - hlen - + mh->blk_desc_len); + mh->blk_desc_len = 0; + } + mh->data_length = 0; /* Reserved for MODE SELECT command. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + hlen = sizeof(*mh); + /* Eliminate block descriptors. */ + if (scsi_2btoul(mh->blk_desc_len) > 0) { + bcopy(find_mode_page_10(mh), mh + 1, + scsi_2btoul(mh->data_length) + 1 - hlen - + scsi_2btoul(mh->blk_desc_len)); + scsi_ulto2b(0, mh->blk_desc_len); + } + scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { - hlen = sizeof(*mph); + mphlen = sizeof(*mph); mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; } else { mphsp = (struct scsi_mode_page_header_sp *)mph; - hlen = sizeof(*mphsp); + mphlen = sizeof(*mphsp); mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } @@ -626,27 +665,6 @@ editlist_save(struct cam_device *device, int dbd, int /* Encode the value data to be passed back to the device. */ buff_encode_visit(mode_pars, len, format, editentry_save, 0); - /* Eliminate block descriptors. */ - bcopy(mph, mh + 1, hlen + len); - - /* Recalculate headers & offsets. */ - mh->data_length = 0; /* Reserved for MODE SELECT command. */ - mh->blk_desc_len = 0; /* No block descriptors. */ - /* - * Tape drives include write protect (WP), Buffered Mode and Speed - * settings in the device-specific parameter. Clearing this - * parameter on a mode select can have the effect of turning off - * write protect or buffered mode, or changing the speed setting of - * the tape drive. - * - * Disks report DPO/FUA support via the device specific parameter - * for MODE SENSE, but the bit is reserved for MODE SELECT. So we - * clear this for disks (and other non-tape devices) to avoid - * potential errors from the target device. - */ - if (device->pd_type != T_SEQUENTIAL) - mh->dev_spec = 0; - mph = MODE_PAGE_HEADER(mh); mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */ /* @@ -654,9 +672,8 @@ editlist_save(struct cam_device *device, int dbd, int * page 3 (saved values) then request the changes be permanently * recorded. */ - mode_select(device, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), - task_attr, retries, timeout, (u_int8_t *)mh, - sizeof(*mh) + hlen + len); + mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), + task_attr, retries, timeout, data, hlen + mphlen + len); } static int @@ -825,21 +842,27 @@ modepage_edit(void) } static void -modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage, - int task_attr, int retries, int timeout) +modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t indx, len; - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; @@ -869,8 +892,9 @@ cleanup_editfile(void) } void -mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage, - int edit, int binary, int task_attr, int retry_count, int timeout) +mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page, + int subpage, int edit, int binary, int task_attr, int retry_count, + int timeout) { const char *pagedb_path; /* Path to modepage database. */ @@ -901,8 +925,8 @@ mode_edit(struct cam_device *device, int dbd, int pc, exit(EX_OSFILE); } - editlist_populate(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + editlist_populate(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } if (edit) { @@ -911,12 +935,12 @@ mode_edit(struct cam_device *device, int dbd, int pc, errx(EX_USAGE, "it only makes sense to edit page 0 " "(current) or page 3 (saved values)"); modepage_edit(); - editlist_save(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + editlist_save(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } else if (binary || STAILQ_EMPTY(&editlist)) { /* Display without formatting information. */ - modepage_dump(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + modepage_dump(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } else { /* Display with format. */ modepage_write(stdout, 0); @@ -924,16 +948,15 @@ mode_edit(struct cam_device *device, int dbd, int pc, } void -mode_list(struct cam_device *device, int dbd, int pc, int subpages, +mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; struct pagename *nameentry; const char *pagedb_path; - int len, page, subpage; + int len, off, page, subpage; if ((pagedb_path = getenv("SCSI_MODES")) == NULL) pagedb_path = DEFAULT_SCSI_MODE_DB; @@ -944,26 +967,36 @@ mode_list(struct cam_device *device, int dbd, int pc, } /* Build the list of all mode pages by querying the "all pages" page. */ - mode_sense(device, dbd, pc, SMS_ALL_PAGES_PAGE, + mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE, subpages ? SMS_SUBPAGE_ALL : 0, task_attr, retry_count, timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - len = sizeof(*mh) + mh->blk_desc_len; /* Skip block descriptors. */ + /* Skip block descriptors. */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + len = mh->data_length; + off = sizeof(*mh) + mh->blk_desc_len; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + len = scsi_2btoul(mh->data_length); + off = sizeof(*mh) + scsi_2btoul(mh->blk_desc_len); + } /* Iterate through the pages in the reply. */ - while (len < mh->data_length) { + while (off < len) { /* Locate the next mode page header. */ - mph = (struct scsi_mode_page_header *)((intptr_t)mh + len); + mph = (struct scsi_mode_page_header *)(data + off); if ((mph->page_code & SMPH_SPF) == 0) { page = mph->page_code & SMS_PAGE_CODE; subpage = 0; - len += sizeof(*mph) + mph->page_length; + off += sizeof(*mph) + mph->page_length; } else { mphsp = (struct scsi_mode_page_header_sp *)mph; page = mphsp->page_code & SMS_PAGE_CODE; subpage = mphsp->subpage; - len += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length); + off += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length); } nameentry = nameentry_lookup(page, subpage); From owner-svn-src-all@freebsd.org Tue Aug 27 03:55:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9ED2C8241; Tue, 27 Aug 2019 03:55:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZlv5XTHz4Jh8; Tue, 27 Aug 2019 03:55:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8711A18E43; Tue, 27 Aug 2019 03:55:39 +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 x7R3tdjr094723; Tue, 27 Aug 2019 03:55:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R3tc9r094717; Tue, 27 Aug 2019 03:55:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270355.x7R3tc9r094717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 03:55:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351530 - in stable/12: sbin/camcontrol sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: sbin/camcontrol sys/cam/scsi X-SVN-Commit-Revision: 351530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:55:39 -0000 Author: mav Date: Tue Aug 27 03:55:38 2019 New Revision: 351530 URL: https://svnweb.freebsd.org/changeset/base/351530 Log: MFC r350676, r350677: Make `camcontrol modepage` support block descriptors. It allows to read and write block descriptors alike to mode page parameters. It allows to change block size or short-stroke HDDs or overprovision SSDs. Depenting on -P parameter the change can be either persistent or till reset. In case of block size change device may need reformat after the setting. In case of SSD overprovisioning format or sanitize may be needed to really free the flash. During implementation appeared that csio_encode_visit() can not handle integers of more then 4 bytes, that makes 8-byte LBA handling awkward. I had to split it into two 4-byte halves now. Relnotes: yes Sponsored by: iXsystems, Inc. Modified: stable/12/sbin/camcontrol/camcontrol.8 stable/12/sbin/camcontrol/camcontrol.c stable/12/sbin/camcontrol/camcontrol.h stable/12/sbin/camcontrol/modeedit.c stable/12/sys/cam/scsi/scsi_all.c stable/12/sys/cam/scsi/scsi_all.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.8 Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sbin/camcontrol/camcontrol.8 Tue Aug 27 03:55:38 2019 (r351530) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 2019 +.Dd August 6, 2019 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -125,6 +125,8 @@ .Op Fl 6 .Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl +.Op Fl D +.Op Fl L .Op Fl b | Fl e .Op Fl d .Nm @@ -733,6 +735,11 @@ If not specified, starts with 10 byte commands and falls back to 6 byte on error. .It Fl d Disable block descriptors for mode sense. +.It Fl D +Display/edit block descriptors instead of mode page. +.It Fl L +Use long LBA block descriptors. +Allows number of LBAs bigger then 2^^32. .It Fl b Displays mode page data in binary format. .It Fl e Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sbin/camcontrol/camcontrol.c Tue Aug 27 03:55:38 2019 (r351530) @@ -230,7 +230,7 @@ static struct camcontrol_opts option_table[] = { {"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""}, #ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, - {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"}, + {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:DLP:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, @@ -4611,9 +4611,9 @@ reassignblocks(struct cam_device *device, u_int32_t *b #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page, - int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, - int datalen) +mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc, + int page, int subpage, int task_attr, int retry_count, int timeout, + u_int8_t *data, int datalen) { union ccb *ccb; int error_code, sense_key, asc, ascq; @@ -4645,6 +4645,11 @@ retry: /* minimum_cmd_size */ *cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); + if (llbaa && ccb->csio.cdb_len == 10) { + struct scsi_mode_sense_10 *cdb = + (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes; + cdb->byte2 |= SMS10_LLBAA; + } /* Record what CDB size the above function really set. */ *cdb_len = ccb->csio.cdb_len; @@ -4736,8 +4741,8 @@ modepage(struct cam_device *device, int argc, char **a int task_attr, int retry_count, int timeout) { char *str_subpage; - int c, page = -1, subpage = -1, pc = 0; - int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0; + int c, page = -1, subpage = -1, pc = 0, llbaa = 0; + int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4769,6 +4774,12 @@ modepage(struct cam_device *device, int argc, char **a if (subpage < 0) errx(1, "invalid mode subpage %d", subpage); break; + case 'D': + desc = 1; + break; + case 'L': + llbaa = 1; + break; case 'P': pc = strtol(optarg, NULL, 0); if ((pc < 0) || (pc > 3)) @@ -4779,15 +4790,21 @@ modepage(struct cam_device *device, int argc, char **a } } - if (page == -1 && list == 0) + if (page == -1 && desc == 0 && list == 0) errx(1, "you must specify a mode page!"); + if (dbd && desc) + errx(1, "-d and -D are incompatible!"); + + if (llbaa && cdb_len != 10) + errx(1, "LLBAA bit is not present in MODE SENSE(6)!"); + if (list != 0) { mode_list(device, cdb_len, dbd, pc, list > 1, task_attr, retry_count, timeout); } else { - mode_edit(device, cdb_len, dbd, pc, page, subpage, edit, - binary, task_attr, retry_count, timeout); + mode_edit(device, cdb_len, desc, dbd, llbaa, pc, page, subpage, + edit, binary, task_attr, retry_count, timeout); } } Modified: stable/12/sbin/camcontrol/camcontrol.h ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.h Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sbin/camcontrol/camcontrol.h Tue Aug 27 03:55:38 2019 (r351530) @@ -88,15 +88,15 @@ int epc(struct cam_device *device, int argc, char **ar int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); -void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, - int page, int subpage, int task_attr, int retry_count, +void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, + int pc, int page, int subpage, int task_attr, int retry_count, int timeout, uint8_t *data, int datalen); void mode_select(struct cam_device *device, int cdb_len, int save_pages, int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen); -void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, - int page, int subpage, int edit, int binary, int task_attr, - int retry_count, int timeout); +void mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, + int llbaa, int pc, int page, int subpage, int edit, int binary, + int task_attr, int retry_count, int timeout); void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, Modified: stable/12/sbin/camcontrol/modeedit.c ============================================================================== --- stable/12/sbin/camcontrol/modeedit.c Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sbin/camcontrol/modeedit.c Tue Aug 27 03:55:38 2019 (r351530) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -96,6 +97,8 @@ static void editentry_create(void *hook, int letter, int count, char *name); static void editentry_update(void *hook, int letter, void *arg, int count, char *name); +static void editentry_create_desc(void *hook, int letter, void *arg, + int count, char *name); static int editentry_save(void *hook, char *name); static struct editentry *editentry_lookup(char *name); static int editentry_set(char *name, char *newvalue, @@ -103,9 +106,16 @@ static int editentry_set(char *name, char *newvalue, static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_populate_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_save_desc(struct cam_device *device, int cdb_len, + int llbaa, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void nameentry_create(int page, int subpage, char *name); static struct pagename *nameentry_lookup(int page, int subpage); static int load_format(const char *pagedb_path, int lpage, @@ -116,6 +126,10 @@ static void modepage_edit(void); static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void modepage_dump_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void cleanup_editfile(void); @@ -182,6 +196,43 @@ editentry_update(void *hook __unused, int letter, void } } +static void +editentry_create_desc(void *hook __unused, int letter, void *arg, int count, + char *name) +{ + struct editentry *newentry; /* Buffer to hold new entry. */ + + /* Allocate memory for the new entry and a copy of the entry name. */ + if ((newentry = malloc(sizeof(struct editentry))) == NULL || + (newentry->name = strdup(name)) == NULL) + err(EX_OSERR, NULL); + + /* Trim any trailing whitespace for the entry name. */ + RTRIM(newentry->name); + + newentry->editable = 1; + newentry->type = letter; + newentry->size = count; + newentry->value.svalue = NULL; + + STAILQ_INSERT_TAIL(&editlist, newentry, link); + + switch (letter) { + case 'i': /* Byte-sized integral type. */ + case 'b': /* Bit-sized integral types. */ + case 't': + newentry->value.ivalue = (intptr_t)arg; + break; + + case 'c': /* Character array. */ + case 'z': /* Null-padded string. */ + editentry_set(name, (char *)arg, 0); + break; + default: + ; /* NOTREACHED */ + } +} + static int editentry_save(void *hook __unused, char *name) { @@ -238,17 +289,14 @@ editentry_set(char *name, char *newvalue, int editonly struct editentry *dest; /* Modepage entry to update. */ char *cval; /* Pointer to new string value. */ char *convertend; /* End-of-conversion pointer. */ - int ival; /* New integral value. */ + long long ival, newival; /* New integral value. */ int resolution; /* Resolution in bits for integer conversion. */ /* * Macro to determine the maximum value of the given size for the current * resolution. - * XXX Lovely x86's optimize out the case of shifting by 32 and gcc doesn't - * currently workaround it (even for int64's), so we have to kludge it. */ -#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \ - INT_MAX: (1 << (resolution * (size))) - 1) +#define RESOLUTION_MAX(size) ((1LL << (resolution * (size))) - 1) assert(newvalue != NULL); if (*newvalue == '\0') @@ -265,13 +313,13 @@ editentry_set(char *name, char *newvalue, int editonly case 't': /* Convert the value string to an integer. */ resolution = (dest->type == 'i')? 8: 1; - ival = (int)strtol(newvalue, &convertend, 0); + ival = strtoll(newvalue, &convertend, 0); if (*convertend != '\0') returnerr(EINVAL); if (ival > RESOLUTION_MAX(dest->size) || ival < 0) { - int newival = (ival < 0)? 0: RESOLUTION_MAX(dest->size); - warnx("value %d is out of range for entry %s; clipping " - "to %d", ival, name, newival); + newival = (ival < 0) ? 0 : RESOLUTION_MAX(dest->size); + warnx("value %lld is out of range for entry %s; " + "clipping to %lld", ival, name, newival); ival = newival; } if (dest->value.ivalue != ival) @@ -548,7 +596,7 @@ static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -557,8 +605,8 @@ editlist_populate(struct cam_device *device, int cdb_l STAILQ_INIT(&editlist); /* Fetch changeable values; use to build initial editlist. */ - mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries, - timeout, data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, 0, 1, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); if (cdb_len == 6) { struct scsi_mode_header_6 *mh = @@ -583,16 +631,77 @@ editlist_populate(struct cam_device *device, int cdb_l buff_decode_visit(mode_pars, len, format, editentry_create, 0); /* Fetch the current/saved values; use to set editentry values. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); buff_decode_visit(mode_pars, len, format, editentry_update, 0); } static void +editlist_populate_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + char num[8]; + struct sbuf sb; + size_t len; + u_int longlba, dlen, i; + + STAILQ_INIT(&editlist); + + /* Fetch the current/saved values. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + longlba = 0; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + longlba = (mh->flags & SMH_LONGLBA) != 0; + } + dlen = longlba ? 16 : 8; + len = MIN(len, sizeof(data) - (desc - data)); + + sbuf_new(&sb, format, sizeof(format), SBUF_FIXEDLEN); + num[0] = 0; + for (i = 0; i * dlen < len; i++) { + if (i > 0) + snprintf(num, sizeof(num), " %d", i + 1); + if (longlba) { + sbuf_printf(&sb, "{Number of Logical Blocks%s High} i4\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i4\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i4\n", num); + } else if (device->pd_type == T_DIRECT) { + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } else { + sbuf_printf(&sb, "{Density Code%s} i1\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i3\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } + } + sbuf_finish(&sb); + sbuf_delete(&sb); + + /* Decode the value data, creating edit_entries for each value. */ + buff_decode_visit(desc, len, format, editentry_create_desc, 0); +} + +static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -603,7 +712,7 @@ editlist_save(struct cam_device *device, int cdb_len, return; /* Preload the CDB buffer with the current mode page data. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); /* Initial headers & offsets. */ @@ -676,6 +785,56 @@ editlist_save(struct cam_device *device, int cdb_len, task_attr, retries, timeout, data, hlen + mphlen + len); } +static void +editlist_save_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t len, hlen; + + /* Make sure that something changed before continuing. */ + if (! editlist_changed) + return; + + /* Preload the CDB buffer with the current mode page data. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + /* Initial headers & offsets. */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + mh->data_length = 0; /* Reserved for MODE SELECT command. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Encode the value data to be passed back to the device. */ + buff_encode_visit(desc, len, format, editentry_save, 0); + + /* + * Write the changes back to the device. If the user editted control + * page 3 (saved values) then request the changes be permanently + * recorded. + */ + mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), + task_attr, retries, timeout, data, hlen + len); +} + static int modepage_write(FILE *file, int editonly) { @@ -689,7 +848,7 @@ modepage_write(FILE *file, int editonly) fprintf(file, "%s: %s\n", scan->name, scan->value.svalue); } else { - fprintf(file, "%s: %d\n", scan->name, + fprintf(file, "%s: %u\n", scan->name, scan->value.ivalue); } } @@ -845,13 +1004,13 @@ static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t indx, len; - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); if (cdb_len == 6) { @@ -880,7 +1039,38 @@ modepage_dump(struct cam_device *device, int cdb_len, } putchar('\n'); } +static void +modepage_dump_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t indx, len; + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Print the raw mode page data with newlines each 8 bytes. */ + for (indx = 0; indx < len; indx++) { + printf("%02x%c", desc[indx], + (((indx + 1) % 8) == 0) ? '\n' : ' '); + } + putchar('\n'); +} + static void cleanup_editfile(void) { @@ -892,16 +1082,19 @@ cleanup_editfile(void) } void -mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page, - int subpage, int edit, int binary, int task_attr, int retry_count, - int timeout) +mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, int llbaa, + int pc, int page, int subpage, int edit, int binary, int task_attr, + int retry_count, int timeout) { const char *pagedb_path; /* Path to modepage database. */ - if (edit && binary) - errx(EX_USAGE, "cannot edit in binary mode."); - - if (! binary) { + if (binary) { + if (edit) + errx(EX_USAGE, "cannot edit in binary mode."); + } else if (desc) { + editlist_populate_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { if ((pagedb_path = getenv("SCSI_MODES")) == NULL) pagedb_path = DEFAULT_SCSI_MODE_DB; @@ -935,12 +1128,22 @@ mode_edit(struct cam_device *device, int cdb_len, int errx(EX_USAGE, "it only makes sense to edit page 0 " "(current) or page 3 (saved values)"); modepage_edit(); - editlist_save(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + editlist_save_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + editlist_save(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else if (binary || STAILQ_EMPTY(&editlist)) { /* Display without formatting information. */ - modepage_dump(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + modepage_dump_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + modepage_dump(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else { /* Display with format. */ modepage_write(stdout, 0); @@ -951,7 +1154,7 @@ void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; struct pagename *nameentry; @@ -967,7 +1170,7 @@ mode_list(struct cam_device *device, int cdb_len, int } /* Build the list of all mode pages by querying the "all pages" page. */ - mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE, + mode_sense(device, &cdb_len, dbd, 0, pc, SMS_ALL_PAGES_PAGE, subpages ? SMS_SUBPAGE_ALL : 0, task_attr, retry_count, timeout, data, sizeof(data)); Modified: stable/12/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.c Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sys/cam/scsi/scsi_all.c Tue Aug 27 03:55:38 2019 (r351530) @@ -2056,7 +2056,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x30, 0x13, SS_RDEF, /* XXX TBD */ "Cleaning volume expired") }, /* DT WRO BK */ - { SST(0x31, 0x00, SS_RDEF, + { SST(0x31, 0x00, SS_FATAL | ENXIO, "Medium format corrupted") }, /* D L RO B */ { SST(0x31, 0x01, SS_RDEF, Modified: stable/12/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.h Tue Aug 27 03:54:29 2019 (r351529) +++ stable/12/sys/cam/scsi/scsi_all.h Tue Aug 27 03:55:38 2019 (r351530) @@ -3622,7 +3622,9 @@ struct scsi_mode_header_10 u_int8_t data_length[2];/* Sense data length */ u_int8_t medium_type; u_int8_t dev_spec; - u_int8_t unused[2]; + u_int8_t flags; +#define SMH_LONGLBA 0x01 + u_int8_t unused; u_int8_t blk_desc_len[2]; }; From owner-svn-src-all@freebsd.org Tue Aug 27 03:58:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE556C82D2; Tue, 27 Aug 2019 03:58:00 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZpc0Hs7z4Jpg; Tue, 27 Aug 2019 03:57:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x244.google.com with SMTP id 16so13871050oiq.6; Mon, 26 Aug 2019 20:57: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=R22Rr96VbR5b3Aj7JH7+/PsoUHmca6enB02xtHPtzMM=; b=l/w0C4j7a91/0bbYTrP0/nNZiZsmlVmVeX4H7kM/gCX1WHPX6hoM5R/B1D8PLgnMyK OV9ls/lsoQzHBFPvMH3EjOHsMGU76GP+d6gWrPc0K49tw5wxfbq8PUVqTORfjVMXPQCn 1b2BSGOIKLPdzdqxcsOLfcXMHqp3A5S85GVlnJkP8cswAi+bXvcMQWA6E8zCUcMYpRa8 /r2/n3kRxxUNmJR+hTQmPlmoV7J4EW3uiHcZ6cIryjfZhIamXHqY9Z+tH45BcdaIZl0w OIKJDK1vOqWJtURF+kbdQBgf+t/XD0UuUjzrmVjWFTTGJLxDyGIzvvieNgHQ0WTABtze CR8Q== 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=R22Rr96VbR5b3Aj7JH7+/PsoUHmca6enB02xtHPtzMM=; b=pMn12LPAAyZlloqWXxlIr8tmj7hD0apDyrK/acimlHAW6F+LEHkdbfh/WU9yapplAR 1s76yV/usNvkU99c+oQ7XID2Yg2E8sKBfDkV/alJzmwihT+iLu+3Jq5cNE+M8p+uUMyg 88tKTvVlOA6F21m1L3LO6WPFVNPtkWpaLETSq7zNtEWwldnCUQdenEJV8DBnvWyOi5LZ JuQRQDWUowmQiKoMOSAvR3r/5DkR0NCvLTo4S6lUydY8Kn5f27UrNXb5JpajyTXz9DKg Tst9WNoCByTmW4gzxB11o/tXiGk2X5eqEFFCPgiNHoHI5pcwq1JqfKFoI9EE7a0kbPvf D+Yg== X-Gm-Message-State: APjAAAXLKOvMqjff4REvxSlK1CoAy7WyodhVF/JQQ8yFVukaz1DXR6cg SP0DG9MsTpgeh9GW/76uuLcRAUDvg9qKkWybOAUDCg== X-Google-Smtp-Source: APXvYqysdVUMmthPRPY++dkUQVWQZs+z7DKEmC1jRj/kcXny47TP08xxGtX2cGthc6PQjvpBLSTxSKYgVJscSXu1yrs= X-Received: by 2002:aca:bb42:: with SMTP id l63mr15186999oif.85.1566878278677; Mon, 26 Aug 2019 20:57:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Mon, 26 Aug 2019 20:57:58 -0700 (PDT) In-Reply-To: <201908270341.x7R3fJne062385@slippy.cwsent.com> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> <201908270341.x7R3fJne062385@slippy.cwsent.com> From: Mateusz Guzik Date: Tue, 27 Aug 2019 05:57:58 +0200 Message-ID: Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HZpc0Hs7z4Jpg X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=l/w0C4j7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::244 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.35), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[4.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 03:58:00 -0000 On 8/27/19, Cy Schubert wrote: > Making progress: > > Unread portion of the kernel message buffer: > > panic: null_unlock: LK_INTERLOCK passed > cpuid = 2 > time = 1566868081 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe0054a954e0 > vpanic() at vpanic+0x19d/frame 0xfffffe0054a95530 > panic() at panic+0x43/frame 0xfffffe0054a95590 > null_unlock() at null_unlock+0x8a/frame 0xfffffe0054a955d0 > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a955f0 > unionfs_unlock() at unionfs_unlock+0x124/frame 0xfffffe0054a95650 > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a95670 > vfs_domount() at vfs_domount+0xc3f/frame 0xfffffe0054a958a0 > vfs_donmount() at vfs_donmount+0x934/frame 0xfffffe0054a95940 > sys_nmount() at sys_nmount+0x69/frame 0xfffffe0054a95980 > amd64_syscall() at amd64_syscall+0x3ae/frame 0xfffffe0054a95ab0 > fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0054a95ab0 > --- syscall (378, FreeBSD ELF64, sys_nmount), rip = 0x2bed6a4a, rsp = > 0x7fffffffe2e8, rbp = 0x7fffffffec70 --- > Uptime: 1m35s > Ok, this explains everything. I did not think anyone uses unionfs, let alone stacked on top of nullfs. I'll have a patch later. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 04:01:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72A21C8502; Tue, 27 Aug 2019 04:01:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZtG1ZcSz4K11; Tue, 27 Aug 2019 04:01:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F195D18E82; Tue, 27 Aug 2019 04:01:09 +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 x7R419ki096585; Tue, 27 Aug 2019 04:01:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R419bs096584; Tue, 27 Aug 2019 04:01:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270401.x7R419bs096584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351531 - stable/12/sys/dev/nvd X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/nvd X-SVN-Commit-Revision: 351531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:01:10 -0000 Author: mav Date: Tue Aug 27 04:01:09 2019 New Revision: 351531 URL: https://svnweb.freebsd.org/changeset/base/351531 Log: MFC r351004, r351006: Make nvd(4) report NGUID or EUI64 as GEOM::lunid. With support for multiple namespaces and multiple ports in NVMe there is now a need for reliable unique namespace identification alike to SCSI. Sponsored by: iXsystems, Inc. Modified: stable/12/sys/dev/nvd/nvd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvd/nvd.c ============================================================================== --- stable/12/sys/dev/nvd/nvd.c Tue Aug 27 03:55:38 2019 (r351530) +++ stable/12/sys/dev/nvd/nvd.c Tue Aug 27 04:01:09 2019 (r351531) @@ -54,6 +54,7 @@ struct nvd_controller; static disk_ioctl_t nvd_ioctl; static disk_strategy_t nvd_strategy; static dumper_t nvd_dump; +static disk_getattr_t nvd_getattr; static void nvd_done(void *arg, const struct nvme_completion *cpl); static void nvd_gone(struct nvd_disk *ndisk); @@ -294,6 +295,51 @@ nvd_dump(void *arg, void *virt, vm_offset_t phys, off_ return (nvme_ns_dump(ndisk->ns, virt, offset, len)); } +static int +nvd_getattr(struct bio *bp) +{ + struct nvd_disk *ndisk = (struct nvd_disk *)bp->bio_disk->d_drv1; + const struct nvme_namespace_data *nsdata; + u_int i; + + if (!strcmp("GEOM::lunid", bp->bio_attribute)) { + nsdata = nvme_ns_get_data(ndisk->ns); + + /* Try to return NGUID as lunid. */ + for (i = 0; i < sizeof(nsdata->nguid); i++) { + if (nsdata->nguid[i] != 0) + break; + } + if (i < sizeof(nsdata->nguid)) { + if (bp->bio_length < sizeof(nsdata->nguid) * 2 + 1) + return (EFAULT); + for (i = 0; i < sizeof(nsdata->nguid); i++) { + sprintf(&bp->bio_data[i * 2], "%02x", + nsdata->nguid[i]); + } + bp->bio_completed = bp->bio_length; + return (0); + } + + /* Try to return EUI64 as lunid. */ + for (i = 0; i < sizeof(nsdata->eui64); i++) { + if (nsdata->eui64[i] != 0) + break; + } + if (i < sizeof(nsdata->eui64)) { + if (bp->bio_length < sizeof(nsdata->eui64) * 2 + 1) + return (EFAULT); + for (i = 0; i < sizeof(nsdata->eui64); i++) { + sprintf(&bp->bio_data[i * 2], "%02x", + nsdata->eui64[i]); + } + bp->bio_completed = bp->bio_length; + return (0); + } + } + return (-1); +} + static void nvd_done(void *arg, const struct nvme_completion *cpl) { @@ -403,6 +449,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar disk->d_strategy = nvd_strategy; disk->d_ioctl = nvd_ioctl; disk->d_dump = nvd_dump; + disk->d_getattr = nvd_getattr; disk->d_gone = nvd_gonecb; disk->d_name = NVD_STR; disk->d_unit = ndisk->unit; From owner-svn-src-all@freebsd.org Tue Aug 27 04:01:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F3B6C857E; Tue, 27 Aug 2019 04:01:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZv9112Nz4K9H; Tue, 27 Aug 2019 04:01:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04D6C18EC4; Tue, 27 Aug 2019 04:01:57 +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 x7R41u98098125; Tue, 27 Aug 2019 04:01:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R41uXe098123; Tue, 27 Aug 2019 04:01:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270401.x7R41uXe098123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351532 - stable/12/sys/dev/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/nvme X-SVN-Commit-Revision: 351532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:01:57 -0000 Author: mav Date: Tue Aug 27 04:01:56 2019 New Revision: 351532 URL: https://svnweb.freebsd.org/changeset/base/351532 Log: MFC r351028: Report NOIOB and NPWG fields as stripe size. Namespace Optimal I/O Boundary field added in NVMe 1.3 and Namespace Preferred Write Granularity added in 1.4 allow upper layers to align I/Os for improved SSD performance and endurance. I don't have hardware reportig those yet, but NPWG could probably be reported by bhyve. Sponsored by: iXsystems, Inc. Modified: stable/12/sys/dev/nvme/nvme_ns.c stable/12/sys/dev/nvme/nvme_private.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ns.c Tue Aug 27 04:01:09 2019 (r351531) +++ stable/12/sys/dev/nvme/nvme_ns.c Tue Aug 27 04:01:56 2019 (r351532) @@ -231,7 +231,11 @@ uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns) { - return (ns->stripesize); + if (((ns->data.nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && ns->data.npwg != 0) { + return ((ns->data.npwg + 1) * nvme_ns_get_sector_size(ns)); + } + return (ns->boundary); } static void @@ -447,12 +451,12 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct bp->bio_driver1 = cb_fn; - if (ns->stripesize > 0 && + if (ns->boundary > 0 && (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)) { num_bios = nvme_get_num_segments(bp->bio_offset, - bp->bio_bcount, ns->stripesize); + bp->bio_bcount, ns->boundary); if (num_bios > 1) - return (nvme_ns_split_bio(ns, bp, ns->stripesize)); + return (nvme_ns_split_bio(ns, bp, ns->boundary)); } switch (bp->bio_cmd) { @@ -511,27 +515,8 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t ns->ctrlr = ctrlr; ns->id = id; - ns->stripesize = 0; /* - * Older Intel devices advertise in vendor specific space an alignment - * that improves performance. If present use for the stripe size. NVMe - * 1.3 standardized this as NOIOB, and newer Intel drives use that. - */ - switch (pci_get_devid(ctrlr->dev)) { - case 0x09538086: /* Intel DC PC3500 */ - case 0x0a538086: /* Intel DC PC3520 */ - case 0x0a548086: /* Intel DC PC4500 */ - case 0x0a558086: /* Dell Intel P4600 */ - if (ctrlr->cdata.vs[3] != 0) - ns->stripesize = - (1 << ctrlr->cdata.vs[3]) * ctrlr->min_page_size; - break; - default: - break; - } - - /* * Namespaces are reconstructed after a controller reset, so check * to make sure we only call mtx_init once on each mtx. * @@ -574,6 +559,27 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t printf("lba format %d exceeds number supported (%d)\n", flbas_fmt, ns->data.nlbaf + 1); return (ENXIO); + } + + /* + * Older Intel devices advertise in vendor specific space an alignment + * that improves performance. If present use for the stripe size. NVMe + * 1.3 standardized this as NOIOB, and newer Intel drives use that. + */ + switch (pci_get_devid(ctrlr->dev)) { + case 0x09538086: /* Intel DC PC3500 */ + case 0x0a538086: /* Intel DC PC3520 */ + case 0x0a548086: /* Intel DC PC4500 */ + case 0x0a558086: /* Dell Intel P4600 */ + if (ctrlr->cdata.vs[3] != 0) + ns->boundary = + (1 << ctrlr->cdata.vs[3]) * ctrlr->min_page_size; + else + ns->boundary = 0; + break; + default: + ns->boundary = ns->data.noiob * nvme_ns_get_sector_size(ns); + break; } if (nvme_ctrlr_has_dataset_mgmt(&ctrlr->cdata)) Modified: stable/12/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/12/sys/dev/nvme/nvme_private.h Tue Aug 27 04:01:09 2019 (r351531) +++ stable/12/sys/dev/nvme/nvme_private.h Tue Aug 27 04:01:56 2019 (r351532) @@ -223,7 +223,7 @@ struct nvme_namespace { uint32_t flags; struct cdev *cdev; void *cons_cookie[NVME_MAX_CONSUMERS]; - uint32_t stripesize; + uint32_t boundary; struct mtx lock; }; From owner-svn-src-all@freebsd.org Tue Aug 27 04:02:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79B25C861F; Tue, 27 Aug 2019 04:02:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZvk2hnSz4KQr; Tue, 27 Aug 2019 04:02:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F4DF19010; Tue, 27 Aug 2019 04:02:26 +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 x7R42QEH000533; Tue, 27 Aug 2019 04:02:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R42Pw1000532; Tue, 27 Aug 2019 04:02:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270402.x7R42Pw1000532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:02:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351533 - stable/12/sbin/nvmecontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/nvmecontrol X-SVN-Commit-Revision: 351533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:02:26 -0000 Author: mav Date: Tue Aug 27 04:02:25 2019 New Revision: 351533 URL: https://svnweb.freebsd.org/changeset/base/351533 Log: MFC r351038: Print few more useful identify fields. Modified: stable/12/sbin/nvmecontrol/identify.c stable/12/sbin/nvmecontrol/identify_ext.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/nvmecontrol/identify.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify.c Tue Aug 27 04:01:56 2019 (r351532) +++ stable/12/sbin/nvmecontrol/identify.c Tue Aug 27 04:02:25 2019 (r351533) @@ -62,6 +62,7 @@ static struct options { void print_namespace(struct nvme_namespace_data *nsdata) { + char cbuf[UINT128_DIG + 1]; uint32_t i; uint32_t lbaf, lbads, ms, rp; uint8_t thin_prov, ptype; @@ -73,15 +74,12 @@ print_namespace(struct nvme_namespace_data *nsdata) flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & NVME_NS_DATA_FLBAS_FORMAT_MASK; - printf("Size (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nsze, - (long long)nsdata->nsze / 1024 / 1024); - printf("Capacity (in LBAs): %lld (%lldM)\n", - (long long)nsdata->ncap, - (long long)nsdata->ncap / 1024 / 1024); - printf("Utilization (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nuse, - (long long)nsdata->nuse / 1024 / 1024); + printf("Size: %lld blocks\n", + (long long)nsdata->nsze); + printf("Capacity: %lld blocks\n", + (long long)nsdata->ncap); + printf("Utilization: %lld blocks\n", + (long long)nsdata->nuse); printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); @@ -148,7 +146,22 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "", (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) & NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : ""); - printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob); + printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob); + printf("NVM Capacity: %s bytes\n", + uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf))); + if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) { + printf("Preferred Write Granularity: %u blocks", + nsdata->npwg + 1); + printf("Preferred Write Alignment: %u blocks", + nsdata->npwa + 1); + printf("Preferred Deallocate Granul: %u blocks", + nsdata->npdg + 1); + printf("Preferred Deallocate Align: %u blocks", + nsdata->npda + 1); + printf("Optimal Write Size: %u blocks", + nsdata->nows + 1); + } printf("Globally Unique Identifier: "); for (i = 0; i < sizeof(nsdata->nguid); i++) printf("%02x", nsdata->nguid[i]); Modified: stable/12/sbin/nvmecontrol/identify_ext.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify_ext.c Tue Aug 27 04:01:56 2019 (r351532) +++ stable/12/sbin/nvmecontrol/identify_ext.c Tue Aug 27 04:02:25 2019 (r351533) @@ -121,7 +121,7 @@ nvme_print_controller(struct nvme_controller_data *cda if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, @@ -184,6 +184,14 @@ nvme_print_controller(struct nvme_controller_data *cda ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); + if (cdata->ver >= 0x010200) { + printf("Total NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.tnvmcap), + cbuf, sizeof(cbuf))); + printf("Unallocated NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.unvmcap), + cbuf, sizeof(cbuf))); + } printf("\n"); printf("NVM Command Set Attributes\n"); @@ -235,13 +243,6 @@ nvme_print_controller(struct nvme_controller_data *cda (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" : (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : ""); - if (nsmgmt) { - printf("\n"); - printf("Namespace Drive Attributes\n"); - printf("==========================\n"); - printf("NVM total cap: %s\n", - uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf))); - printf("NVM unallocated cap: %s\n", - uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); - } + if (cdata->ver >= 0x010201) + printf("\nNVM Subsystem Name: %.256s\n", cdata->subnqn); } From owner-svn-src-all@freebsd.org Tue Aug 27 04:03:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E146DC86F8; Tue, 27 Aug 2019 04:03:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZxB5VWCz4KZq; Tue, 27 Aug 2019 04:03:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E52719027; Tue, 27 Aug 2019 04:03:42 +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 x7R43gik000658; Tue, 27 Aug 2019 04:03:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R43ggl000657; Tue, 27 Aug 2019 04:03:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270403.x7R43ggl000657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351534 - stable/12/sys/dev/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/nvme X-SVN-Commit-Revision: 351534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:03:43 -0000 Author: mav Date: Tue Aug 27 04:03:42 2019 New Revision: 351534 URL: https://svnweb.freebsd.org/changeset/base/351534 Log: MFC r351320: Formalize NVMe controller consumer life cycle. This fixes possible double call of fail_fn, for example on hot removal. It also allows ctrlr_fn to safely return NULL cookie in case of failure and not get useless ns_fn or fail_fn call with NULL cookie later. Modified: stable/12/sys/dev/nvme/nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme.c ============================================================================== --- stable/12/sys/dev/nvme/nvme.c Tue Aug 27 04:02:25 2019 (r351533) +++ stable/12/sys/dev/nvme/nvme.c Tue Aug 27 04:03:42 2019 (r351534) @@ -330,16 +330,21 @@ nvme_notify(struct nvme_consumer *cons, return; cmpset = atomic_cmpset_32(&ctrlr->notification_sent, 0, 1); - if (cmpset == 0) return; if (cons->ctrlr_fn != NULL) ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr); else - ctrlr_cookie = NULL; + ctrlr_cookie = (void *)(uintptr_t)0xdeadc0dedeadc0de; ctrlr->cons_cookie[cons->id] = ctrlr_cookie; + + /* ctrlr_fn has failed. Nothing to notify here any more. */ + if (ctrlr_cookie == NULL) + return; + if (ctrlr->is_failed) { + ctrlr->cons_cookie[cons->id] = NULL; if (cons->fail_fn != NULL) (*cons->fail_fn)(ctrlr_cookie); /* @@ -395,13 +400,16 @@ nvme_notify_async_consumers(struct nvme_controller *ct uint32_t log_page_size) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL) - (*cons->async_fn)(ctrlr->cons_cookie[i], async_cpl, + if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + (*cons->async_fn)(ctrlr_cookie, async_cpl, log_page_id, log_page_buffer, log_page_size); + } } } @@ -409,6 +417,7 @@ void nvme_notify_fail_consumers(struct nvme_controller *ctrlr) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; /* @@ -422,8 +431,12 @@ nvme_notify_fail_consumers(struct nvme_controller *ctr for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != NULL) - cons->fail_fn(ctrlr->cons_cookie[i]); + if (cons->id != INVALID_CONSUMER_ID && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + ctrlr->cons_cookie[i] = NULL; + if (cons->fail_fn != NULL) + cons->fail_fn(ctrlr_cookie); + } } } @@ -432,6 +445,7 @@ nvme_notify_ns(struct nvme_controller *ctrlr, int nsid { struct nvme_consumer *cons; struct nvme_namespace *ns = &ctrlr->ns[nsid - 1]; + void *ctrlr_cookie; uint32_t i; if (!ctrlr->is_initialized) @@ -439,9 +453,9 @@ nvme_notify_ns(struct nvme_controller *ctrlr, int nsid for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL) - ns->cons_cookie[cons->id] = - (*cons->ns_fn)(ns, ctrlr->cons_cookie[cons->id]); + if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) + ns->cons_cookie[i] = (*cons->ns_fn)(ns, ctrlr_cookie); } } From owner-svn-src-all@freebsd.org Tue Aug 27 04:04:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 099D1C8791; Tue, 27 Aug 2019 04:04:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HZxv6XGwz4KjB; Tue, 27 Aug 2019 04:04:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C204C19028; Tue, 27 Aug 2019 04:04:19 +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 x7R44Jtt000743; Tue, 27 Aug 2019 04:04:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R44JBt000742; Tue, 27 Aug 2019 04:04:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270404.x7R44JBt000742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351535 - stable/12/sys/dev/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/nvme X-SVN-Commit-Revision: 351535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:04:20 -0000 Author: mav Date: Tue Aug 27 04:04:19 2019 New Revision: 351535 URL: https://svnweb.freebsd.org/changeset/base/351535 Log: MFC r351352: Improve NVMe hot unplug handling. If device is unplugged from the system (CSTS register reads return 0xffffffff), it makes no sense to send any more recovery requests or expect any responses back. If there is a detach call in such state, just stop all activity and free resources. If there is no detach call (hot-plug is not supported), rely on normal timeout handling, but when it trigger controller reset, do not wait for impossible and quickly report failure. Sponsored by: iXsystems, Inc. Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c stable/12/sys/dev/nvme/nvme_qpair.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ctrlr.c Tue Aug 27 04:03:42 2019 (r351534) +++ stable/12/sys/dev/nvme/nvme_ctrlr.c Tue Aug 27 04:04:19 2019 (r351535) @@ -207,10 +207,13 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr) int i; ctrlr->is_failed = TRUE; + nvme_admin_qpair_disable(&ctrlr->adminq); nvme_qpair_fail(&ctrlr->adminq); if (ctrlr->ioq != NULL) { - for (i = 0; i < ctrlr->num_io_queues; i++) + for (i = 0; i < ctrlr->num_io_queues; i++) { + nvme_io_qpair_disable(&ctrlr->ioq[i]); nvme_qpair_fail(&ctrlr->ioq[i]); + } } nvme_notify_fail_consumers(ctrlr); } @@ -249,17 +252,20 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrl int ms_waited; uint32_t csts; - csts = nvme_mmio_read_4(ctrlr, csts); - ms_waited = 0; - while (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) != desired_val) { + while (1) { + csts = nvme_mmio_read_4(ctrlr, csts); + if (csts == 0xffffffff) /* Hot unplug. */ + return (ENXIO); + if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) + == desired_val) + break; if (ms_waited++ > ctrlr->ready_timeout_in_ms) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } DELAY(1000); - csts = nvme_mmio_read_4(ctrlr, csts); } return (0); @@ -1338,12 +1344,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { - int i; + int gone, i; if (ctrlr->resource == NULL) goto nores; - nvme_notify_fail_consumers(ctrlr); + /* + * Check whether it is a hot unplug or a clean driver detach. + * If device is not there any more, skip any shutdown commands. + */ + gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + if (gone) + nvme_ctrlr_fail(ctrlr); + else + nvme_notify_fail_consumers(ctrlr); for (i = 0; i < NVME_MAX_NAMESPACES; i++) nvme_ns_destruct(&ctrlr->ns[i]); @@ -1351,12 +1365,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev if (ctrlr->cdev) destroy_dev(ctrlr->cdev); - nvme_ctrlr_destroy_qpairs(ctrlr); - for (i = 0; i < ctrlr->num_io_queues; i++) { + if (!gone) + nvme_ctrlr_destroy_qpairs(ctrlr); + for (i = 0; i < ctrlr->num_io_queues; i++) nvme_io_qpair_destroy(&ctrlr->ioq[i]); - } free(ctrlr->ioq, M_NVME); - nvme_admin_qpair_destroy(&ctrlr->adminq); /* @@ -1366,9 +1379,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev * shutdown notification in case the system is shutdown before * reloading the driver. */ - nvme_ctrlr_shutdown(ctrlr); + if (!gone) + nvme_ctrlr_shutdown(ctrlr); - nvme_ctrlr_disable(ctrlr); + if (!gone) + nvme_ctrlr_disable(ctrlr); if (ctrlr->taskqueue) taskqueue_free(ctrlr->taskqueue); @@ -1407,14 +1422,19 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) cc |= NVME_SHN_NORMAL << NVME_CC_REG_SHN_SHIFT; nvme_mmio_write_4(ctrlr, cc, cc); - csts = nvme_mmio_read_4(ctrlr, csts); - while ((NVME_CSTS_GET_SHST(csts) != NVME_SHST_COMPLETE) && (ticks++ < 5*hz)) { - pause("nvme shn", 1); + while (1) { csts = nvme_mmio_read_4(ctrlr, csts); + if (csts == 0xffffffff) /* Hot unplug. */ + break; + if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) + break; + if (ticks++ > 5*hz) { + nvme_printf(ctrlr, "did not complete shutdown within" + " 5 seconds of notification\n"); + break; + } + pause("nvme shn", 1); } - if (NVME_CSTS_GET_SHST(csts) != NVME_SHST_COMPLETE) - nvme_printf(ctrlr, "did not complete shutdown within 5 seconds " - "of notification\n"); } void Modified: stable/12/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_qpair.c Tue Aug 27 04:03:42 2019 (r351534) +++ stable/12/sys/dev/nvme/nvme_qpair.c Tue Aug 27 04:04:19 2019 (r351535) @@ -911,7 +911,8 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - cfs ? " and fatal error status" : ""); + (csts == 0xffffffff) ? " and possible hot unplug" : + (cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); } } From owner-svn-src-all@freebsd.org Tue Aug 27 04:13:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42B56C8B93; Tue, 27 Aug 2019 04:13:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hb8P1f7qz4LCf; Tue, 27 Aug 2019 04:13:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00B82191EC; Tue, 27 Aug 2019 04:13:25 +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 x7R4DOsN006897; Tue, 27 Aug 2019 04:13:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R4DMwX006886; Tue, 27 Aug 2019 04:13:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270413.x7R4DMwX006886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351536 - in stable/12/sys: amd64/conf conf dev/ntb dev/ntb/ntb_hw i386/conf modules/ntb modules/ntb/ntb_hw_amd X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: amd64/conf conf dev/ntb dev/ntb/ntb_hw i386/conf modules/ntb modules/ntb/ntb_hw_amd X-SVN-Commit-Revision: 351536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:13:25 -0000 Author: mav Date: Tue Aug 27 04:13:22 2019 New Revision: 351536 URL: https://svnweb.freebsd.org/changeset/base/351536 Log: MFC r349594, r349595, r349601: Add driver for NTB in AMD SoC. This patch is the driver for NTB hardware in AMD SoCs (ported from Linux) and enables the NTB infrastructure like Doorbells, Scratchpads and Memory window in AMD SoC. This driver has been validated using ntb_transport and if_ntb driver already available in FreeBSD. Submitted by: Rajesh Kumar Relnotes: yes Added: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c - copied, changed from r349594, head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h - copied unchanged from r349594, head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h stable/12/sys/modules/ntb/ntb_hw_amd/ - copied from r349594, head/sys/modules/ntb/ntb_hw_amd/ Modified: stable/12/sys/amd64/conf/NOTES stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/dev/ntb/ntb.c stable/12/sys/dev/ntb/ntb.h stable/12/sys/dev/ntb/ntb_if.m stable/12/sys/dev/ntb/ntb_transport.c stable/12/sys/i386/conf/NOTES stable/12/sys/modules/ntb/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/conf/NOTES ============================================================================== --- stable/12/sys/amd64/conf/NOTES Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/amd64/conf/NOTES Tue Aug 27 04:13:22 2019 (r351536) @@ -398,6 +398,7 @@ device wpifw device if_ntb # Virtual NTB network interface device ntb_transport # NTB packet transport driver device ntb # NTB hardware interface +device ntb_hw_amd # AMD NTB hardware driver device ntb_hw_intel # Intel NTB hardware driver device ntb_hw_plx # PLX NTB hardware driver Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/conf/files.amd64 Tue Aug 27 04:13:22 2019 (r351536) @@ -346,8 +346,9 @@ dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb dev/ntb/ntb_transport.c optional ntb_transport | if_ntb -dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw -dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_hw/ntb_hw_amd.c optional ntb_hw_amd | ntb_hw dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/nvd/nvd.c optional nvd nvme Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/conf/files.i386 Tue Aug 27 04:13:22 2019 (r351536) @@ -284,8 +284,9 @@ dev/nctgpio/nctgpio.c optional nctgpio dev/nfe/if_nfe.c optional nfe pci dev/ntb/if_ntb/if_ntb.c optional if_ntb dev/ntb/ntb_transport.c optional ntb_transport | if_ntb -dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw -dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb.c optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_intel | ntb_hw_plx | ntb_hw +dev/ntb/ntb_hw/ntb_hw_amd.c optional ntb_hw_amd | ntb_hw dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/nvd/nvd.c optional nvd nvme Modified: stable/12/sys/dev/ntb/ntb.c ============================================================================== --- stable/12/sys/dev/ntb/ntb.c Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/dev/ntb/ntb.c Tue Aug 27 04:13:22 2019 (r351536) @@ -243,6 +243,30 @@ ntb_db_event(device_t dev, uint32_t vec) } } +int +ntb_port_number(device_t ntb) +{ + return (NTB_PORT_NUMBER(device_get_parent(ntb))); +} + +int +ntb_peer_port_count(device_t ntb) +{ + return (NTB_PEER_PORT_COUNT(device_get_parent(ntb))); +} + +int +ntb_peer_port_number(device_t ntb, int pidx) +{ + return (NTB_PEER_PORT_NUMBER(device_get_parent(ntb), pidx)); +} + +int +ntb_peer_port_idx(device_t ntb, int port) +{ + return (NTB_PEER_PORT_IDX(device_get_parent(ntb), port)); +} + bool ntb_link_is_up(device_t ntb, enum ntb_speed *speed, enum ntb_width *width) { Modified: stable/12/sys/dev/ntb/ntb.h ============================================================================== --- stable/12/sys/dev/ntb/ntb.h Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/dev/ntb/ntb.h Tue Aug 27 04:13:22 2019 (r351536) @@ -64,6 +64,51 @@ void ntb_link_event(device_t ntb); */ void ntb_db_event(device_t ntb, uint32_t vec); +/** + * ntb_port_number() - get the local port number + * @ntb: NTB device context. + * + * Hardware driver returns local port number in compliance with topology. + * + * Return: the local port number + */ +int ntb_port_number(device_t ntb); + +/** + * ntb_port_count() - get the number of peer device ports + * @ntb: NTB device context. + * + * By default hardware driver supports just one peer device. + * + * Return: the number of peer ports + */ +int ntb_peer_port_count(device_t ntb); + +/** + * ntb_peer_port_number() - get the peer port by given index + * @ntb: NTB device context. + * @idx: Peer port index (should be zero for now). + * + * By default hardware driver supports just one peer device, so this method + * shall return the corresponding value. + * + * Return: the peer device port or an error number + */ +int ntb_peer_port_number(device_t ntb, int pidx); + +/* + * ntb_peer_port_idx() - get the peer device port index by given port + * number + * @ntb: NTB device context. + * @port: Peer port number + * + * By default hardware driver supports just one peer device, so given a + * valid peer port number, the return value shall be zero. + * + * Return: the peer port index or an error number + */ +int ntb_peer_port_idx(device_t ntb, int port); + /* * ntb_link_is_up() - get the current ntb link state * @ntb: NTB device context Copied and modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c (from r349594, head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c) ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Tue Jul 2 05:25:18 2019 (r349594, copy source) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Tue Aug 27 04:13:22 2019 (r351536) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -93,6 +94,26 @@ SYSCTL_UINT(_hw_ntb, OID_AUTO, debug_level, CTLFLAG_RW device_printf(ntb->device, __VA_ARGS__); \ } while (0) +#ifdef __i386__ +static __inline uint64_t +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset) +{ + + return (bus_space_read_4(tag, handle, offset) | + ((uint64_t)bus_space_read_4(tag, handle, offset + 4)) << 32); +} + +static __inline void +bus_space_write_8(bus_space_tag_t tag, bus_space_handle_t handle, + bus_size_t offset, uint64_t val) +{ + + bus_space_write_4(tag, handle, offset, val); + bus_space_write_4(tag, handle, offset + 4, val >> 32); +} +#endif + /* * AMD NTB INTERFACE ROUTINES */ @@ -316,11 +337,6 @@ amd_ntb_mw_get_range(device_t dev, unsigned mw_idx, vm *plimit = BUS_SPACE_MAXADDR_32BIT; } - amd_ntb_printf(1, "%s: mw %d padd %p vadd %p psize 0x%lx " - "align 0x%lx asize 0x%lx alimit %p\n", __func__, mw_idx, - (void *)*base, (void *)*vbase, (uint64_t)*size, (uint64_t)*align, - (uint64_t)*align_size, (void *)*plimit); - return (0); } @@ -353,14 +369,14 @@ amd_ntb_mw_set_trans(device_t dev, unsigned mw_idx, bu * set and verify setting the translation address */ amd_ntb_peer_reg_write(8, bar_info->xlat_off, (uint64_t)addr); - amd_ntb_printf(0, "%s: mw %d xlat_off 0x%x cur_val 0x%lx addr %p\n", + amd_ntb_printf(0, "%s: mw %d xlat_off 0x%x cur_val 0x%jx addr %p\n", __func__, mw_idx, bar_info->xlat_off, amd_ntb_peer_reg_read(8, bar_info->xlat_off), (void *)addr); /* set and verify setting the limit */ if (mw_idx != 0) { amd_ntb_reg_write(8, bar_info->limit_off, (uint64_t)size); - amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%lx limit 0x%x\n", + amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%jx limit 0x%x\n", __func__, bar_info->limit_off, amd_ntb_peer_reg_read(8, bar_info->limit_off), (uint32_t)size); } else { @@ -470,7 +486,7 @@ amd_ntb_db_read(device_t dev) dbstat_off = (uint64_t)amd_ntb_reg_read(2, AMD_DBSTAT_OFFSET); - amd_ntb_printf(1, "%s: dbstat_off 0x%lx\n", __func__, dbstat_off); + amd_ntb_printf(1, "%s: dbstat_off 0x%jx\n", __func__, dbstat_off); return (dbstat_off); } @@ -480,7 +496,7 @@ amd_ntb_db_clear(device_t dev, uint64_t db_bits) { struct amd_ntb_softc *ntb = device_get_softc(dev); - amd_ntb_printf(1, "%s: db_bits 0x%lx\n", __func__, db_bits); + amd_ntb_printf(1, "%s: db_bits 0x%jx\n", __func__, db_bits); amd_ntb_reg_write(2, AMD_DBSTAT_OFFSET, (uint16_t)db_bits); } @@ -490,7 +506,7 @@ amd_ntb_db_set_mask(device_t dev, uint64_t db_bits) struct amd_ntb_softc *ntb = device_get_softc(dev); DB_MASK_LOCK(ntb); - amd_ntb_printf(1, "%s: db_mask 0x%x db_bits 0x%lx\n", + amd_ntb_printf(1, "%s: db_mask 0x%x db_bits 0x%jx\n", __func__, ntb->db_mask, db_bits); ntb->db_mask |= db_bits; @@ -504,7 +520,7 @@ amd_ntb_db_clear_mask(device_t dev, uint64_t db_bits) struct amd_ntb_softc *ntb = device_get_softc(dev); DB_MASK_LOCK(ntb); - amd_ntb_printf(1, "%s: db_mask 0x%x db_bits 0x%lx\n", + amd_ntb_printf(1, "%s: db_mask 0x%x db_bits 0x%jx\n", __func__, ntb->db_mask, db_bits); ntb->db_mask &= ~db_bits; @@ -517,7 +533,7 @@ amd_ntb_peer_db_set(device_t dev, uint64_t db_bits) { struct amd_ntb_softc *ntb = device_get_softc(dev); - amd_ntb_printf(1, "%s: db_bits 0x%lx\n", __func__, db_bits); + amd_ntb_printf(1, "%s: db_bits 0x%jx\n", __func__, db_bits); amd_ntb_reg_write(2, AMD_DBREQ_OFFSET, (uint16_t)db_bits); } @@ -660,17 +676,17 @@ amd_ntb_hw_info_handler(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "AMD Doorbell: 0x%x\n", amd_ntb_reg_read(4, AMD_DBSTAT_OFFSET)); sbuf_printf(sb, "AMD NTB Incoming XLAT: \n"); - sbuf_printf(sb, "AMD XLAT1: 0x%lx\n", + sbuf_printf(sb, "AMD XLAT1: 0x%jx\n", amd_ntb_peer_reg_read(8, AMD_BAR1XLAT_OFFSET)); - sbuf_printf(sb, "AMD XLAT23: 0x%lx\n", + sbuf_printf(sb, "AMD XLAT23: 0x%jx\n", amd_ntb_peer_reg_read(8, AMD_BAR23XLAT_OFFSET)); - sbuf_printf(sb, "AMD XLAT45: 0x%lx\n", + sbuf_printf(sb, "AMD XLAT45: 0x%jx\n", amd_ntb_peer_reg_read(8, AMD_BAR45XLAT_OFFSET)); sbuf_printf(sb, "AMD LMT1: 0x%x\n", amd_ntb_reg_read(4, AMD_BAR1LMT_OFFSET)); - sbuf_printf(sb, "AMD LMT23: 0x%lx\n", + sbuf_printf(sb, "AMD LMT23: 0x%jx\n", amd_ntb_reg_read(8, AMD_BAR23LMT_OFFSET)); - sbuf_printf(sb, "AMD LMT45: 0x%lx\n", + sbuf_printf(sb, "AMD LMT45: 0x%jx\n", amd_ntb_reg_read(8, AMD_BAR45LMT_OFFSET)); rc = sbuf_finish(sb); Copied: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h (from r349594, head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h Tue Aug 27 04:13:22 2019 (r351536, copy of r349594, head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h) @@ -0,0 +1,259 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright (C) 2019 Advanced Micro Devices, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * BSD LICENSE + * + * Copyright (C) 2019 Advanced Micro Devices, Inc. + * + * 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 copy + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * 3. Neither the name of AMD corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + * Contact Information : + * Rajesh Kumar + * + * $FreeBSD$ + */ + +#ifndef NTB_HW_AMD_H +#define NTB_HW_AMD_H + +#define NTB_HW_AMD_VENDOR_ID 0x1022 +#define NTB_HW_AMD_DEVICE_ID 0x145B + +#define NTB_DEF_PEER_CNT 1 +#define NTB_DEF_PEER_IDX 0 + +#define BIT(n) (1 << n) +#define AMD_LINK_HB_TIMEOUT (1 * hz) + +#define NTB_LIN_STA_ACTIVE_BIT 0x00000002 +#define NTB_LNK_STA_SPEED_MASK 0x000F0000 +#define NTB_LNK_STA_WIDTH_MASK 0x03F00000 +#define NTB_LNK_STA_ACTIVE(x) (!!((x) & NTB_LIN_STA_ACTIVE_BIT)) +#define NTB_LNK_STA_SPEED(x) (((x) & NTB_LNK_STA_SPEED_MASK) >> 16) +#define NTB_LNK_STA_WIDTH(x) (((x) & NTB_LNK_STA_WIDTH_MASK) >> 20) + +#define amd_ntb_bar_read(SIZE, bar, offset) \ + bus_space_read_ ## SIZE (ntb->bar_info[(bar)].pci_bus_tag, \ + ntb->bar_info[(bar)].pci_bus_handle, (offset)) +#define amd_ntb_bar_write(SIZE, bar, offset, val) \ + bus_space_write_ ## SIZE (ntb->bar_info[(bar)].pci_bus_tag, \ + ntb->bar_info[(bar)].pci_bus_handle, (offset), (val)) +#define amd_ntb_reg_read(SIZE, offset) \ + amd_ntb_bar_read(SIZE, NTB_CONFIG_BAR, offset) +#define amd_ntb_reg_write(SIZE, offset, val) \ + amd_ntb_bar_write(SIZE, NTB_CONFIG_BAR, offset, val) +#define amd_ntb_peer_reg_read(SIZE, offset) \ + amd_ntb_bar_read(SIZE, NTB_CONFIG_BAR, offset + AMD_PEER_OFFSET) +#define amd_ntb_peer_reg_write(SIZE, offset, val) \ + amd_ntb_bar_write(SIZE, NTB_CONFIG_BAR, offset + AMD_PEER_OFFSET, val) + +#define DB_MASK_LOCK(sc) mtx_lock_spin(&(sc)->db_mask_lock) +#define DB_MASK_UNLOCK(sc) mtx_unlock_spin(&(sc)->db_mask_lock) +#define DB_MASK_ASSERT(sc, f) mtx_assert(&(sc)->db_mask_lock, (f)) + +/* amd_ntb_conn_type are hardware numbers, cannot change. */ +enum amd_ntb_conn_type { + NTB_CONN_NONE = -1, + NTB_CONN_PRI, + NTB_CONN_SEC, +}; + +enum ntb_default_port { + NTB_PORT_PRI_USD, + NTB_PORT_SEC_DSD +}; + +enum amd_ntb_bar { + NTB_CONFIG_BAR = 0, + NTB_BAR_1, + NTB_BAR_2, + NTB_BAR_3, + NTB_MAX_BARS +}; + +struct amd_ntb_hw_info { + uint32_t device_id; + const char *desc; +}; + +struct amd_ntb_pci_bar_info { + bus_space_tag_t pci_bus_tag; + bus_space_handle_t pci_bus_handle; + struct resource *pci_resource; + vm_paddr_t pbase; + caddr_t vbase; + vm_size_t size; + vm_memattr_t map_mode; + int pci_resource_id; + + /* Configuration register offsets */ + uint32_t xlat_off; + uint32_t limit_off; +}; + +struct amd_ntb_int_info { + struct resource *res; + void *tag; + int rid; +}; + +struct amd_ntb_vec { + struct amd_ntb_softc *ntb; + uint32_t num; + unsigned masked; +}; + +enum { + /* AMD NTB Capability */ + AMD_MW_CNT = 3, + AMD_DB_CNT = 16, + AMD_MSIX_VECTOR_CNT = 24, + AMD_SPADS_CNT = 16, + + /* AMD NTB Link Status Offset */ + AMD_LINK_STATUS_OFFSET = 0x68, + + /* AMD NTB register offset */ + AMD_CNTL_OFFSET = 0x200, + + /* NTB control register bits */ + PMM_REG_CTL = BIT(21), + SMM_REG_CTL = BIT(20), + SMM_REG_ACC_PATH = BIT(18), + PMM_REG_ACC_PATH = BIT(17), + NTB_CLK_EN = BIT(16), + + AMD_STA_OFFSET = 0x204, + AMD_PGSLV_OFFSET = 0x208, + AMD_SPAD_MUX_OFFSET = 0x20C, + AMD_SPAD_OFFSET = 0x210, + AMD_RSMU_HCID = 0x250, + AMD_RSMU_SIID = 0x254, + AMD_PSION_OFFSET = 0x300, + AMD_SSION_OFFSET = 0x330, + AMD_MMINDEX_OFFSET = 0x400, + AMD_MMDATA_OFFSET = 0x404, + AMD_SIDEINFO_OFFSET = 0x408, + + AMD_SIDE_MASK = BIT(0), + AMD_SIDE_READY = BIT(1), + + /* limit register */ + AMD_ROMBARLMT_OFFSET = 0x410, + AMD_BAR1LMT_OFFSET = 0x414, + AMD_BAR23LMT_OFFSET = 0x418, + AMD_BAR45LMT_OFFSET = 0x420, + + /* xlat address */ + AMD_ROMBARXLAT_OFFSET = 0x428, + AMD_BAR1XLAT_OFFSET = 0x430, + AMD_BAR23XLAT_OFFSET = 0x438, + AMD_BAR45XLAT_OFFSET = 0x440, + + /* doorbell and interrupt */ + AMD_DBFM_OFFSET = 0x450, + AMD_DBREQ_OFFSET = 0x454, + AMD_MIRRDBSTAT_OFFSET = 0x458, + AMD_DBMASK_OFFSET = 0x45C, + AMD_DBSTAT_OFFSET = 0x460, + AMD_INTMASK_OFFSET = 0x470, + AMD_INTSTAT_OFFSET = 0x474, + + /* event type */ + AMD_PEER_FLUSH_EVENT = BIT(0), + AMD_PEER_RESET_EVENT = BIT(1), + AMD_PEER_D3_EVENT = BIT(2), + AMD_PEER_PMETO_EVENT = BIT(3), + AMD_PEER_D0_EVENT = BIT(4), + AMD_LINK_UP_EVENT = BIT(5), + AMD_LINK_DOWN_EVENT = BIT(6), + AMD_EVENT_INTMASK = (AMD_PEER_FLUSH_EVENT | + AMD_PEER_RESET_EVENT | AMD_PEER_D3_EVENT | + AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT | + AMD_LINK_UP_EVENT | AMD_LINK_DOWN_EVENT), + + AMD_PMESTAT_OFFSET = 0x480, + AMD_PMSGTRIG_OFFSET = 0x490, + AMD_LTRLATENCY_OFFSET = 0x494, + AMD_FLUSHTRIG_OFFSET = 0x498, + + /* SMU register*/ + AMD_SMUACK_OFFSET = 0x4A0, + AMD_SINRST_OFFSET = 0x4A4, + AMD_RSPNUM_OFFSET = 0x4A8, + AMD_SMU_SPADMUTEX = 0x4B0, + AMD_SMU_SPADOFFSET = 0x4B4, + + AMD_PEER_OFFSET = 0x400, +}; + +struct amd_ntb_softc { + /* ntb.c context. Do not move! Must go first! */ + void *ntb_store; + + device_t device; + enum amd_ntb_conn_type conn_type; + + struct amd_ntb_pci_bar_info bar_info[NTB_MAX_BARS]; + struct amd_ntb_int_info int_info[AMD_MSIX_VECTOR_CNT]; + struct amd_ntb_vec *msix_vec; + uint16_t allocated_interrupts; + + struct callout hb_timer; + + uint8_t mw_count; + uint8_t spad_count; + uint8_t db_count; + uint8_t msix_vec_count; + + struct mtx db_mask_lock; + + volatile uint32_t ntb_ctl; + volatile uint32_t lnk_sta; + volatile uint32_t peer_sta; + volatile uint32_t cntl_sta; + + uint16_t db_valid_mask; + uint16_t db_mask; + uint32_t int_mask; + + unsigned int self_spad; + unsigned int peer_spad; +}; + +static void amd_init_side_info(struct amd_ntb_softc *ntb); +static void amd_deinit_side_info(struct amd_ntb_softc *ntb); +static int amd_ntb_detach(device_t device); + +#endif Modified: stable/12/sys/dev/ntb/ntb_if.m ============================================================================== --- stable/12/sys/dev/ntb/ntb_if.m Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/dev/ntb/ntb_if.m Tue Aug 27 04:13:22 2019 (r351536) @@ -61,6 +61,24 @@ HEADER { }; }; +METHOD int port_number { + device_t ntb; +}; + +METHOD int peer_port_count { + device_t ntb; +}; + +METHOD int peer_port_number { + device_t ntb; + int pidx; +}; + +METHOD int peer_port_idx { + device_t ntb; + int port; +}; + METHOD bool link_is_up { device_t ntb; enum ntb_speed *speed; Modified: stable/12/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_transport.c Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/dev/ntb/ntb_transport.c Tue Aug 27 04:13:22 2019 (r351536) @@ -179,7 +179,6 @@ struct ntb_transport_mw { bus_addr_t addr_limit; /* Tx buff is off vbase / phys_addr */ caddr_t vbase; - size_t xlat_size; size_t buff_size; /* Rx buff is off virt_addr / dma_addr */ bus_dma_tag_t dma_tag; @@ -376,7 +375,6 @@ ntb_transport_attach(device_t dev) goto err; mw->buff_size = 0; - mw->xlat_size = 0; mw->virt_addr = NULL; mw->dma_addr = 0; @@ -462,6 +460,13 @@ ntb_transport_attach(device_t dev) ntb_link_enable(dev, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); + for (i = 0; i < nt->mw_count; i++) { + mw = &nt->mw_vec[i]; + rc = ntb_mw_set_trans(nt->dev, i, mw->dma_addr, mw->buff_size); + if (rc != 0) + ntb_printf(0, "load time mw%d xlat fails, rc %d\n", i, rc); + } + if (enable_xeon_watchdog != 0) callout_reset(&nt->link_watchdog, 0, xeon_link_watchdog_hb, nt); @@ -1088,6 +1093,7 @@ static void ntb_transport_link_work(void *arg) { struct ntb_transport_ctx *nt = arg; + struct ntb_transport_mw *mw; device_t dev = nt->dev; struct ntb_transport_qp *qp; uint64_t val64, size; @@ -1132,9 +1138,26 @@ ntb_transport_link_work(void *arg) ntb_spad_read(dev, NTBT_MW0_SZ_LOW + (i * 2), &val); val64 |= val; - rc = ntb_set_mw(nt, i, val64); - if (rc != 0) - goto free_mws; + mw = &nt->mw_vec[i]; + val64 = roundup(val64, mw->xlat_align_size); + if (mw->buff_size != val64) { + + rc = ntb_set_mw(nt, i, val64); + if (rc != 0) { + ntb_printf(0, "link up set mw%d fails, rc %d\n", + i, rc); + goto free_mws; + } + + /* Notify HW the memory location of the receive buffer */ + rc = ntb_mw_set_trans(nt->dev, i, mw->dma_addr, + mw->buff_size); + if (rc != 0) { + ntb_printf(0, "link up mw%d xlat fails, rc %d\n", + i, rc); + goto free_mws; + } + } } nt->link_is_up = true; @@ -1179,42 +1202,37 @@ ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, s { struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; struct ntb_load_cb_args cba; - size_t xlat_size, buff_size; - int rc; + size_t buff_size; if (size == 0) return (EINVAL); - xlat_size = roundup(size, mw->xlat_align_size); - buff_size = xlat_size; + buff_size = roundup(size, mw->xlat_align_size); /* No need to re-setup */ - if (mw->xlat_size == xlat_size) + if (mw->buff_size == buff_size) return (0); if (mw->buff_size != 0) ntb_free_mw(nt, num_mw); /* Alloc memory for receiving data. Must be aligned */ - mw->xlat_size = xlat_size; mw->buff_size = buff_size; if (bus_dma_tag_create(bus_get_dma_tag(nt->dev), mw->xlat_align, 0, mw->addr_limit, BUS_SPACE_MAXADDR, NULL, NULL, mw->buff_size, 1, mw->buff_size, 0, NULL, NULL, &mw->dma_tag)) { - ntb_printf(0, "Unable to create MW tag of size %zu/%zu\n", - mw->buff_size, mw->xlat_size); - mw->xlat_size = 0; + ntb_printf(0, "Unable to create MW tag of size %zu\n", + mw->buff_size); mw->buff_size = 0; return (ENOMEM); } if (bus_dmamem_alloc(mw->dma_tag, (void **)&mw->virt_addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, &mw->dma_map)) { bus_dma_tag_destroy(mw->dma_tag); - ntb_printf(0, "Unable to allocate MW buffer of size %zu/%zu\n", - mw->buff_size, mw->xlat_size); - mw->xlat_size = 0; + ntb_printf(0, "Unable to allocate MW buffer of size %zu\n", + mw->buff_size); mw->buff_size = 0; return (ENOMEM); } @@ -1222,22 +1240,13 @@ ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, s mw->buff_size, ntb_load_cb, &cba, BUS_DMA_NOWAIT) || cba.error) { bus_dmamem_free(mw->dma_tag, mw->virt_addr, mw->dma_map); bus_dma_tag_destroy(mw->dma_tag); - ntb_printf(0, "Unable to load MW buffer of size %zu/%zu\n", - mw->buff_size, mw->xlat_size); - mw->xlat_size = 0; + ntb_printf(0, "Unable to load MW buffer of size %zu\n", + mw->buff_size); mw->buff_size = 0; return (ENOMEM); } mw->dma_addr = cba.addr; - /* Notify HW the memory location of the receive buffer */ - rc = ntb_mw_set_trans(nt->dev, num_mw, mw->dma_addr, mw->xlat_size); - if (rc) { - ntb_printf(0, "Unable to set mw%d translation\n", num_mw); - ntb_free_mw(nt, num_mw); - return (rc); - } - return (0); } @@ -1253,7 +1262,6 @@ ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) bus_dmamap_unload(mw->dma_tag, mw->dma_map); bus_dmamem_free(mw->dma_tag, mw->virt_addr, mw->dma_map); bus_dma_tag_destroy(mw->dma_tag); - mw->xlat_size = 0; mw->buff_size = 0; mw->virt_addr = NULL; } @@ -1280,7 +1288,7 @@ ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt else num_qps_mw = nt->qp_count / mw_count; - rx_size = mw->xlat_size / num_qps_mw; + rx_size = mw->buff_size / num_qps_mw; qp->rx_buff = mw->virt_addr + rx_size * (qp_num / mw_count); rx_size -= sizeof(struct ntb_rx_info); Modified: stable/12/sys/i386/conf/NOTES ============================================================================== --- stable/12/sys/i386/conf/NOTES Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/i386/conf/NOTES Tue Aug 27 04:13:22 2019 (r351536) @@ -643,6 +643,7 @@ device wpifw device if_ntb # Virtual NTB network interface device ntb_transport # NTB packet transport driver device ntb # NTB hardware interface +device ntb_hw_amd # AMD NTB hardware driver device ntb_hw_intel # Intel NTB hardware driver device ntb_hw_plx # PLX NTB hardware driver Modified: stable/12/sys/modules/ntb/Makefile ============================================================================== --- stable/12/sys/modules/ntb/Makefile Tue Aug 27 04:04:19 2019 (r351535) +++ stable/12/sys/modules/ntb/Makefile Tue Aug 27 04:13:22 2019 (r351536) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= ntb ntb_hw_intel ntb_hw_plx ntb_transport if_ntb +SUBDIR= ntb ntb_hw_amd ntb_hw_intel ntb_hw_plx ntb_transport if_ntb .include From owner-svn-src-all@freebsd.org Tue Aug 27 04:14:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6599EC8C11; Tue, 27 Aug 2019 04:14:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hb9q2mK6z4LL4; Tue, 27 Aug 2019 04:14:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4080E191ED; Tue, 27 Aug 2019 04:14:39 +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 x7R4EdoA007021; Tue, 27 Aug 2019 04:14:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R4EclF007020; Tue, 27 Aug 2019 04:14:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270414.x7R4EclF007020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351537 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 351537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:14:39 -0000 Author: mav Date: Tue Aug 27 04:14:38 2019 New Revision: 351537 URL: https://svnweb.freebsd.org/changeset/base/351537 Log: MFC r351056, r351083: Add support for PCI Device ID 0x148B in ntb_hw_amd driver. Submitted by: Rajesh Kumar Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Tue Aug 27 04:13:22 2019 (r351536) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Tue Aug 27 04:14:38 2019 (r351537) @@ -80,8 +80,35 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_AMD_NTB, "amd_ntb_hw", "amd_ntb_hw driver memory allocations"); -struct pci_device_table amd_ntb_devs[] = { - { PCI_DEV(NTB_HW_AMD_VENDOR_ID, NTB_HW_AMD_DEVICE_ID), +static const struct amd_ntb_hw_info amd_ntb_hw_info_list[] = { + + { .vendor_id = NTB_HW_AMD_VENDOR_ID, + .device_id = NTB_HW_AMD_DEVICE_ID1, + .mw_count = 3, + .bar_start_idx = 1, + .spad_count = 16, + .db_count = 16, + .msix_vector_count = 24, + .quirks = QUIRK_MW0_32BIT, + .desc = "AMD Non-Transparent Bridge"}, + + { .vendor_id = NTB_HW_AMD_VENDOR_ID, + .device_id = NTB_HW_AMD_DEVICE_ID2, + .mw_count = 2, + .bar_start_idx = 2, + .spad_count = 16, + .db_count = 16, + .msix_vector_count = 24, + .quirks = 0, + .desc = "AMD Non-Transparent Bridge"}, +}; + +static const struct pci_device_table amd_ntb_devs[] = { + { PCI_DEV(NTB_HW_AMD_VENDOR_ID, NTB_HW_AMD_DEVICE_ID1), + .driver_data = (uintptr_t)&amd_ntb_hw_info_list[0], + PCI_DESCR("AMD Non-Transparent Bridge") }, + { PCI_DEV(NTB_HW_AMD_VENDOR_ID, NTB_HW_AMD_DEVICE_ID2), + .driver_data = (uintptr_t)&amd_ntb_hw_info_list[1], PCI_DESCR("AMD Non-Transparent Bridge") } }; @@ -299,7 +326,7 @@ amd_ntb_mw_count(device_t dev) { struct amd_ntb_softc *ntb = device_get_softc(dev); - return (ntb->mw_count); + return (ntb->hw_info->mw_count); } static int @@ -310,10 +337,10 @@ amd_ntb_mw_get_range(device_t dev, unsigned mw_idx, vm struct amd_ntb_softc *ntb = device_get_softc(dev); struct amd_ntb_pci_bar_info *bar_info; - if (mw_idx < 0 || mw_idx >= ntb->mw_count) + if (mw_idx < 0 || mw_idx >= ntb->hw_info->mw_count) return (EINVAL); - bar_info = &ntb->bar_info[mw_idx+1]; + bar_info = &ntb->bar_info[ntb->hw_info->bar_start_idx + mw_idx]; if (base != NULL) *base = bar_info->pbase; @@ -331,10 +358,15 @@ amd_ntb_mw_get_range(device_t dev, unsigned mw_idx, vm *align_size = 1; if (plimit != NULL) { - if (mw_idx != 0) - *plimit = BUS_SPACE_MAXADDR; - else + /* + * For Device ID 0x145B (which has 3 memory windows), + * memory window 0 use a 32-bit bar. The remaining + * cases all use 64-bit bar. + */ + if ((mw_idx == 0) && (ntb->hw_info->quirks & QUIRK_MW0_32BIT)) *plimit = BUS_SPACE_MAXADDR_32BIT; + else + *plimit = BUS_SPACE_MAXADDR; } return (0); @@ -346,44 +378,52 @@ amd_ntb_mw_set_trans(device_t dev, unsigned mw_idx, bu struct amd_ntb_softc *ntb = device_get_softc(dev); struct amd_ntb_pci_bar_info *bar_info; - if (mw_idx < 0 || mw_idx >= ntb->mw_count) + if (mw_idx < 0 || mw_idx >= ntb->hw_info->mw_count) return (EINVAL); - bar_info = &ntb->bar_info[mw_idx+1]; + bar_info = &ntb->bar_info[ntb->hw_info->bar_start_idx + mw_idx]; - /* make sure the range fits in the usable mw size */ + /* Make sure the range fits in the usable mw size. */ if (size > bar_info->size) { - amd_ntb_printf(0, "%s: size 0x%x greater than mw_size 0x%x\n", - __func__, (uint32_t)size, (uint32_t)bar_info->size); + amd_ntb_printf(0, "%s: size 0x%jx greater than mw_size 0x%jx\n", + __func__, (uintmax_t)size, (uintmax_t)bar_info->size); return (EINVAL); } - amd_ntb_printf(1, "%s: mw %d mw_size 0x%x size 0x%x base %p\n", - __func__, mw_idx, (uint32_t)bar_info->size, - (uint32_t)size, (void *)bar_info->pci_bus_handle); + amd_ntb_printf(1, "%s: mw %d mw_size 0x%jx size 0x%jx base %p\n", + __func__, mw_idx, (uintmax_t)bar_info->size, + (uintmax_t)size, (void *)bar_info->pci_bus_handle); /* * AMD NTB XLAT and Limit registers needs to be written only after - * link enable + * link enable. * - * set and verify setting the translation address + * Set and verify setting the translation address register. */ amd_ntb_peer_reg_write(8, bar_info->xlat_off, (uint64_t)addr); amd_ntb_printf(0, "%s: mw %d xlat_off 0x%x cur_val 0x%jx addr %p\n", __func__, mw_idx, bar_info->xlat_off, amd_ntb_peer_reg_read(8, bar_info->xlat_off), (void *)addr); - /* set and verify setting the limit */ - if (mw_idx != 0) { - amd_ntb_reg_write(8, bar_info->limit_off, (uint64_t)size); - amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%jx limit 0x%x\n", + /* + * Set and verify setting the limit register. + * + * For Device ID 0x145B (which has 3 memory windows), + * memory window 0 use a 32-bit bar. The remaining + * cases all use 64-bit bar. + */ + if ((mw_idx == 0) && (ntb->hw_info->quirks & QUIRK_MW0_32BIT)) { + amd_ntb_reg_write(4, bar_info->limit_off, (uint32_t)size); + amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%x limit 0x%x\n", __func__, bar_info->limit_off, - amd_ntb_peer_reg_read(8, bar_info->limit_off), (uint32_t)size); + amd_ntb_peer_reg_read(4, bar_info->limit_off), + (uint32_t)size); } else { - amd_ntb_reg_write(4, bar_info->limit_off, (uint64_t)size); - amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%x limit 0x%x\n", + amd_ntb_reg_write(8, bar_info->limit_off, (uint64_t)size); + amd_ntb_printf(1, "%s: limit_off 0x%x cur_val 0x%jx limit 0x%jx\n", __func__, bar_info->limit_off, - amd_ntb_peer_reg_read(4, bar_info->limit_off), (uint32_t)size); + amd_ntb_peer_reg_read(8, bar_info->limit_off), + (uintmax_t)size); } return (0); @@ -396,7 +436,7 @@ amd_ntb_mw_clear_trans(device_t dev, unsigned mw_idx) amd_ntb_printf(1, "%s: mw_idx %d\n", __func__, mw_idx); - if (mw_idx < 0 || mw_idx >= ntb->mw_count) + if (mw_idx < 0 || mw_idx >= ntb->hw_info->mw_count) return (EINVAL); return (amd_ntb_mw_set_trans(dev, mw_idx, 0, 0)); @@ -409,10 +449,10 @@ amd_ntb_mw_set_wc(device_t dev, unsigned int mw_idx, v struct amd_ntb_pci_bar_info *bar_info; int rc; - if (mw_idx < 0 || mw_idx >= ntb->mw_count) + if (mw_idx < 0 || mw_idx >= ntb->hw_info->mw_count) return (EINVAL); - bar_info = &ntb->bar_info[mw_idx+1]; + bar_info = &ntb->bar_info[ntb->hw_info->bar_start_idx + mw_idx]; if (mode == bar_info->map_mode) return (0); @@ -431,10 +471,10 @@ amd_ntb_mw_get_wc(device_t dev, unsigned mw_idx, vm_me amd_ntb_printf(1, "%s: mw_idx %d\n", __func__, mw_idx); - if (mw_idx < 0 || mw_idx >= ntb->mw_count) + if (mw_idx < 0 || mw_idx >= ntb->hw_info->mw_count) return (EINVAL); - bar_info = &ntb->bar_info[mw_idx+1]; + bar_info = &ntb->bar_info[ntb->hw_info->bar_start_idx + mw_idx]; *mode = bar_info->map_mode; return (0); @@ -448,9 +488,10 @@ amd_ntb_db_vector_count(device_t dev) { struct amd_ntb_softc *ntb = device_get_softc(dev); - amd_ntb_printf(1, "%s: db_count 0x%x\n", __func__, ntb->db_count); + amd_ntb_printf(1, "%s: db_count 0x%x\n", __func__, + ntb->hw_info->db_count); - return (ntb->db_count); + return (ntb->hw_info->db_count); } static uint64_t @@ -470,9 +511,9 @@ amd_ntb_db_vector_mask(device_t dev, uint32_t vector) struct amd_ntb_softc *ntb = device_get_softc(dev); amd_ntb_printf(1, "%s: vector %d db_count 0x%x db_valid_mask 0x%x\n", - __func__, vector, ntb->db_count, ntb->db_valid_mask); + __func__, vector, ntb->hw_info->db_count, ntb->db_valid_mask); - if (vector < 0 || vector >= ntb->db_count) + if (vector < 0 || vector >= ntb->hw_info->db_count) return (0); return (ntb->db_valid_mask & (1 << vector)); @@ -545,7 +586,8 @@ amd_ntb_spad_count(device_t dev) { struct amd_ntb_softc *ntb = device_get_softc(dev); - amd_ntb_printf(1, "%s: spad_count 0x%x\n", __func__, ntb->spad_count); + amd_ntb_printf(1, "%s: spad_count 0x%x\n", __func__, + ntb->spad_count); return (ntb->spad_count); } @@ -662,11 +704,11 @@ amd_ntb_hw_info_handler(SYSCTL_HANDLER_ARGS) } sbuf_printf(sb, "AMD Memory window count: %d\n", - ntb->mw_count); + ntb->hw_info->mw_count); sbuf_printf(sb, "AMD Spad count: %d\n", ntb->spad_count); sbuf_printf(sb, "AMD Doorbell count: %d\n", - ntb->db_count); + ntb->hw_info->db_count); sbuf_printf(sb, "AMD MSI-X vec count: %d\n\n", ntb->msix_vec_count); sbuf_printf(sb, "AMD Doorbell valid mask: 0x%x\n", @@ -757,7 +799,7 @@ amd_link_hb(void *arg) static void amd_ntb_interrupt(struct amd_ntb_softc *ntb, uint16_t vec) { - if (vec < AMD_DB_CNT) + if (vec < ntb->hw_info->db_count) ntb_db_event(ntb->device, vec); else amd_ntb_printf(0, "Invalid vector %d\n", vec); @@ -891,7 +933,7 @@ amd_ntb_init_isr(struct amd_ntb_softc *ntb) ntb->db_mask = ntb->db_valid_mask; - rc = amd_ntb_create_msix_vec(ntb, AMD_MSIX_VECTOR_CNT); + rc = amd_ntb_create_msix_vec(ntb, ntb->hw_info->msix_vector_count); if (rc != 0) { amd_ntb_printf(0, "Error creating msix vectors: %d\n", rc); return (ENOMEM); @@ -899,13 +941,13 @@ amd_ntb_init_isr(struct amd_ntb_softc *ntb) /* * Check the number of MSI-X message supported by the device. - * Minimum necessary MSI-X message count should be equal to db_count + * Minimum necessary MSI-X message count should be equal to db_count. */ supported_vectors = pci_msix_count(ntb->device); - num_vectors = MIN(supported_vectors, ntb->db_count); - if (num_vectors < ntb->db_count) { + num_vectors = MIN(supported_vectors, ntb->hw_info->db_count); + if (num_vectors < ntb->hw_info->db_count) { amd_ntb_printf(0, "No minimum msix: supported %d db %d\n", - supported_vectors, ntb->db_count); + supported_vectors, ntb->hw_info->db_count); msi = true; goto err_msix_enable; } @@ -918,12 +960,12 @@ amd_ntb_init_isr(struct amd_ntb_softc *ntb) goto err_msix_enable; } - if (num_vectors < ntb->db_count) { + if (num_vectors < ntb->hw_info->db_count) { amd_ntb_printf(0, "Allocated only %d MSI-X\n", num_vectors); msi = true; /* - * Else set ntb->db_count = ntb->msix_vec_count = num_vectors, - * msi=false and dont release msi + * Else set ntb->hw_info->db_count = ntb->msix_vec_count = + * num_vectors, msi=false and dont release msi. */ } @@ -942,16 +984,16 @@ err_msix_enable: } } - ntb->db_count = ntb->msix_vec_count = num_vectors; + ntb->hw_info->db_count = ntb->msix_vec_count = num_vectors; if (intx) { num_vectors = 1; - ntb->db_count = 1; + ntb->hw_info->db_count = 1; ntb->msix_vec_count = 0; } amd_ntb_printf(0, "%s: db %d msix %d msi %d intx %d\n", - __func__, ntb->db_count, ntb->msix_vec_count, (int)msi, (int)intx); + __func__, ntb->hw_info->db_count, ntb->msix_vec_count, (int)msi, (int)intx); rc = amd_ntb_setup_isr(ntb, num_vectors, msi, intx); if (rc != 0) { @@ -1002,10 +1044,7 @@ amd_ntb_get_topo(struct amd_ntb_softc *ntb) static int amd_ntb_init_dev(struct amd_ntb_softc *ntb) { - ntb->mw_count = AMD_MW_CNT; - ntb->spad_count = AMD_SPADS_CNT; - ntb->db_count = AMD_DB_CNT; - ntb->db_valid_mask = (1ull << ntb->db_count) - 1; + ntb->db_valid_mask = (1ull << ntb->hw_info->db_count) - 1; mtx_init(&ntb->db_mask_lock, "amd ntb db bits", NULL, MTX_SPIN); switch (ntb->conn_type) { @@ -1105,7 +1144,7 @@ amd_ntb_map_pci_bars(struct amd_ntb_softc *ntb) if (rc != 0) goto out; - /* Memory Window 0 BAR - BAR 1*/ + /* Memory Window 0 BAR - BAR 1 */ ntb->bar_info[NTB_BAR_1].pci_resource_id = PCIR_BAR(1); rc = map_bar(ntb, &ntb->bar_info[NTB_BAR_1]); if (rc != 0) @@ -1153,12 +1192,15 @@ amd_ntb_unmap_pci_bars(struct amd_ntb_softc *ntb) static int amd_ntb_probe(device_t device) { + struct amd_ntb_softc *ntb = device_get_softc(device); const struct pci_device_table *tbl; tbl = PCI_MATCH(device, amd_ntb_devs); if (tbl == NULL) return (ENXIO); + ntb->hw_info = (struct amd_ntb_hw_info *)tbl->driver_data; + ntb->spad_count = ntb->hw_info->spad_count; device_set_desc(device, tbl->descr); return (BUS_PROBE_GENERIC); Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h Tue Aug 27 04:13:22 2019 (r351536) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.h Tue Aug 27 04:14:38 2019 (r351537) @@ -48,7 +48,8 @@ #define NTB_HW_AMD_H #define NTB_HW_AMD_VENDOR_ID 0x1022 -#define NTB_HW_AMD_DEVICE_ID 0x145B +#define NTB_HW_AMD_DEVICE_ID1 0x145B +#define NTB_HW_AMD_DEVICE_ID2 0x148B #define NTB_DEF_PEER_CNT 1 #define NTB_DEF_PEER_IDX 0 @@ -82,6 +83,8 @@ #define DB_MASK_UNLOCK(sc) mtx_unlock_spin(&(sc)->db_mask_lock) #define DB_MASK_ASSERT(sc, f) mtx_assert(&(sc)->db_mask_lock, (f)) +#define QUIRK_MW0_32BIT 0x01 + /* amd_ntb_conn_type are hardware numbers, cannot change. */ enum amd_ntb_conn_type { NTB_CONN_NONE = -1, @@ -103,8 +106,15 @@ enum amd_ntb_bar { }; struct amd_ntb_hw_info { - uint32_t device_id; - const char *desc; + uint16_t vendor_id; + uint16_t device_id; + uint8_t mw_count; + uint8_t bar_start_idx; + uint8_t spad_count; + uint8_t db_count; + uint8_t msix_vector_count; + uint8_t quirks; + char *desc; }; struct amd_ntb_pci_bar_info { @@ -135,12 +145,6 @@ struct amd_ntb_vec { }; enum { - /* AMD NTB Capability */ - AMD_MW_CNT = 3, - AMD_DB_CNT = 16, - AMD_MSIX_VECTOR_CNT = 24, - AMD_SPADS_CNT = 16, - /* AMD NTB Link Status Offset */ AMD_LINK_STATUS_OFFSET = 0x68, @@ -226,15 +230,14 @@ struct amd_ntb_softc { enum amd_ntb_conn_type conn_type; struct amd_ntb_pci_bar_info bar_info[NTB_MAX_BARS]; - struct amd_ntb_int_info int_info[AMD_MSIX_VECTOR_CNT]; + struct amd_ntb_int_info int_info[16]; struct amd_ntb_vec *msix_vec; uint16_t allocated_interrupts; struct callout hb_timer; - uint8_t mw_count; + struct amd_ntb_hw_info *hw_info; uint8_t spad_count; - uint8_t db_count; uint8_t msix_vec_count; struct mtx db_mask_lock; From owner-svn-src-all@freebsd.org Tue Aug 27 04:15:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52333C8CA5; Tue, 27 Aug 2019 04:15:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HbBf1RYMz4LS8; Tue, 27 Aug 2019 04:15:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12E89191EE; Tue, 27 Aug 2019 04:15:22 +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 x7R4FLrR007118; Tue, 27 Aug 2019 04:15:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R4FL7E007117; Tue, 27 Aug 2019 04:15:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270415.x7R4FL7E007117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351538 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 351538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:15:22 -0000 Author: mav Date: Tue Aug 27 04:15:21 2019 New Revision: 351538 URL: https://svnweb.freebsd.org/changeset/base/351538 Log: MFC r351072: Implement new methods for Intel and PLX NTB. This restores parity with AMD NTB driver. Though without any drivers supporting more then one peer and respective KPI modification to pass peer index to most of the calls this addition is pretty useless now. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Tue Aug 27 04:14:38 2019 (r351537) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Tue Aug 27 04:15:21 2019 (r351538) @@ -1977,6 +1977,44 @@ atom_perform_link_restart(struct ntb_softc *ntb) } static int +intel_ntb_port_number(device_t dev) +{ + struct ntb_softc *ntb = device_get_softc(dev); + + return (ntb->dev_type == NTB_DEV_USD ? 0 : 1); +} + +static int +intel_ntb_peer_port_count(device_t dev) +{ + + return (1); +} + +static int +intel_ntb_peer_port_number(device_t dev, int pidx) +{ + struct ntb_softc *ntb = device_get_softc(dev); + + if (pidx != 0) + return (-EINVAL); + + return (ntb->dev_type == NTB_DEV_USD ? 1 : 0); +} + +static int +intel_ntb_peer_port_idx(device_t dev, int port) +{ + int peer_port; + + peer_port = intel_ntb_peer_port_number(dev, 0); + if (peer_port == -EINVAL || port != peer_port) + return (-EINVAL); + + return (0); +} + +static int intel_ntb_link_enable(device_t dev, enum ntb_speed speed __unused, enum ntb_width width __unused) { @@ -3086,6 +3124,10 @@ static device_method_t ntb_intel_methods[] = { DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ + DEVMETHOD(ntb_port_number, intel_ntb_port_number), + DEVMETHOD(ntb_peer_port_count, intel_ntb_peer_port_count), + DEVMETHOD(ntb_peer_port_number, intel_ntb_peer_port_number), + DEVMETHOD(ntb_peer_port_idx, intel_ntb_peer_port_idx), DEVMETHOD(ntb_link_is_up, intel_ntb_link_is_up), DEVMETHOD(ntb_link_enable, intel_ntb_link_enable), DEVMETHOD(ntb_link_disable, intel_ntb_link_disable), Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Tue Aug 27 04:14:38 2019 (r351537) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Tue Aug 27 04:15:21 2019 (r351538) @@ -470,7 +470,44 @@ ntb_plx_detach(device_t dev) return (0); } +static int +ntb_plx_port_number(device_t dev) +{ + struct ntb_plx_softc *sc = device_get_softc(dev); + return (sc->link ? 1 : 0); +} + +static int +ntb_plx_peer_port_count(device_t dev) +{ + + return (1); +} + +static int +ntb_plx_peer_port_number(device_t dev, int pidx) +{ + struct ntb_plx_softc *sc = device_get_softc(dev); + + if (pidx != 0) + return (-EINVAL); + + return (sc->link ? 0 : 1); +} + +static int +ntb_plx_peer_port_idx(device_t dev, int port) +{ + int peer_port; + + peer_port = ntb_plx_peer_port_number(dev, 0); + if (peer_port == -EINVAL || port != peer_port) + return (-EINVAL); + + return (0); +} + static bool ntb_plx_link_is_up(device_t dev, enum ntb_speed *speed, enum ntb_width *width) { @@ -974,6 +1011,10 @@ static device_method_t ntb_plx_methods[] = { DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ + DEVMETHOD(ntb_port_number, ntb_plx_port_number), + DEVMETHOD(ntb_peer_port_count, ntb_plx_peer_port_count), + DEVMETHOD(ntb_peer_port_number, ntb_plx_peer_port_number), + DEVMETHOD(ntb_peer_port_idx, ntb_plx_peer_port_idx), DEVMETHOD(ntb_link_is_up, ntb_plx_link_is_up), DEVMETHOD(ntb_link_enable, ntb_plx_link_enable), DEVMETHOD(ntb_link_disable, ntb_plx_link_disable), From owner-svn-src-all@freebsd.org Tue Aug 27 04:16:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D365C8D3E; Tue, 27 Aug 2019 04:16:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HbDC1Ndbz4LZP; Tue, 27 Aug 2019 04:16:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1107C191EF; Tue, 27 Aug 2019 04:16:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R4GgQ6007246; Tue, 27 Aug 2019 04:16:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R4GgSr007244; Tue, 27 Aug 2019 04:16:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908270416.x7R4GgSr007244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 04:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351539 - in stable/12: share/man/man4 sys/dev/ntb X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/ntb X-SVN-Commit-Revision: 351539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:16:43 -0000 Author: mav Date: Tue Aug 27 04:16:42 2019 New Revision: 351539 URL: https://svnweb.freebsd.org/changeset/base/351539 Log: MFC r351105, r351107: Limit memory window usage in ntb_transport to 256MB. This adds safety net for the case of misconfigured NTB with too big memory window, for which we may be unable to allocate a memory buffer, which does not make much sense for the network interface. While there, fix the code to really work with asymmetric window sizes setup. This makes driver just print warning message on boot instead of hanging if too large memory window is configured. Modified: stable/12/share/man/man4/ntb_transport.4 stable/12/sys/dev/ntb/ntb_transport.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ntb_transport.4 ============================================================================== --- stable/12/share/man/man4/ntb_transport.4 Tue Aug 27 04:15:21 2019 (r351538) +++ stable/12/share/man/man4/ntb_transport.4 Tue Aug 27 04:16:42 2019 (r351539) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2016-2017 Alexander Motin +.\" Copyright (c) 2016-2019 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2017 +.Dd August 15, 2019 .Dt NTB_TRANSPORT 4 .Os .Sh NAME @@ -51,6 +51,10 @@ The following tunables are settable from the .It Va hw.ntb_transport.debug_level Driver debug level. The default value is 0, higher means more verbose. +.It Va hw.ntb_transport.max_mw_size +Limits maximum memory window usage. +Allocation of big physically contiguous memory buffer may be a problem, +while too big buffers makes no much sense for low latency network interface. .It Va hint.ntb_transport. Ns Ar X Ns Va .config Configures a set of the transport consumers, separated by commas. Each consumer can be configured as: "[][:]", where: Modified: stable/12/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_transport.c Tue Aug 27 04:15:21 2019 (r351538) +++ stable/12/sys/dev/ntb/ntb_transport.c Tue Aug 27 04:16:42 2019 (r351539) @@ -81,7 +81,7 @@ SYSCTL_UINT(_hw_ntb_transport, OID_AUTO, debug_level, static unsigned transport_mtu = 0x10000; -static uint64_t max_mw_size; +static uint64_t max_mw_size = 256*1024*1024; SYSCTL_UQUAD(_hw_ntb_transport, OID_AUTO, max_mw_size, CTLFLAG_RDTUN, &max_mw_size, 0, "If enabled (non-zero), limit the size of large memory windows. " "Both sides of the NTB MUST set the same value here."); @@ -177,14 +177,17 @@ struct ntb_transport_mw { size_t xlat_align; size_t xlat_align_size; bus_addr_t addr_limit; - /* Tx buff is off vbase / phys_addr */ + /* Tx buff is vbase / phys_addr / tx_size */ caddr_t vbase; - size_t buff_size; - /* Rx buff is off virt_addr / dma_addr */ + size_t tx_size; + /* Rx buff is virt_addr / dma_addr / rx_size */ bus_dma_tag_t dma_tag; bus_dmamap_t dma_map; caddr_t virt_addr; bus_addr_t dma_addr; + size_t rx_size; + /* rx_size increased to size alignment requirements of the hardware. */ + size_t buff_size; }; struct ntb_transport_child { @@ -331,7 +334,7 @@ ntb_transport_attach(device_t dev) struct ntb_transport_child **cpp = &nt->child; struct ntb_transport_child *nc; struct ntb_transport_mw *mw; - uint64_t db_bitmap, size; + uint64_t db_bitmap; int rc, i, db_count, spad_count, qp, qpu, qpo, qpt; char cfg[128] = ""; char buf[32]; @@ -374,6 +377,15 @@ ntb_transport_attach(device_t dev) if (rc != 0) goto err; + mw->tx_size = mw->phys_size; + if (max_mw_size != 0 && mw->tx_size > max_mw_size) { + device_printf(dev, "Memory window %d limited from " + "%ju to %ju\n", i, (uintmax_t)mw->phys_size, + max_mw_size); + mw->tx_size = max_mw_size; + } + + mw->rx_size = 0; mw->buff_size = 0; mw->virt_addr = NULL; mw->dma_addr = 0; @@ -388,10 +400,7 @@ ntb_transport_attach(device_t dev) * that NTB windows are symmetric and this allocation remain, * but even if not, we will just reallocate it later. */ - size = mw->phys_size; - if (max_mw_size != 0 && size > max_mw_size) - size = max_mw_size; - ntb_set_mw(nt, i, size); + ntb_set_mw(nt, i, mw->tx_size); } qpu = 0; @@ -556,7 +565,7 @@ ntb_transport_init_queue(struct ntb_transport_ctx *nt, struct ntb_transport_mw *mw; struct ntb_transport_qp *qp; vm_paddr_t mw_base; - uint64_t mw_size, qp_offset; + uint64_t qp_offset; size_t tx_size; unsigned num_qps_mw, mw_num, mw_count; @@ -578,9 +587,8 @@ ntb_transport_init_queue(struct ntb_transport_ctx *nt, num_qps_mw = nt->qp_count / mw_count; mw_base = mw->phys_addr; - mw_size = mw->phys_size; - tx_size = mw_size / num_qps_mw; + tx_size = mw->tx_size / num_qps_mw; qp_offset = tx_size * (qp_num / mw_count); qp->tx_mw = mw->vbase + qp_offset; @@ -1103,11 +1111,7 @@ ntb_transport_link_work(void *arg) /* send the local info, in the opposite order of the way we read it */ for (i = 0; i < nt->mw_count; i++) { - size = nt->mw_vec[i].phys_size; - - if (max_mw_size != 0 && size > max_mw_size) - size = max_mw_size; - + size = nt->mw_vec[i].tx_size; ntb_peer_spad_write(dev, NTBT_MW0_SZ_HIGH + (i * 2), size >> 32); ntb_peer_spad_write(dev, NTBT_MW0_SZ_LOW + (i * 2), size); @@ -1139,6 +1143,7 @@ ntb_transport_link_work(void *arg) val64 |= val; mw = &nt->mw_vec[i]; + mw->rx_size = val64; val64 = roundup(val64, mw->xlat_align_size); if (mw->buff_size != val64) { @@ -1288,7 +1293,7 @@ ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt else num_qps_mw = nt->qp_count / mw_count; - rx_size = mw->buff_size / num_qps_mw; + rx_size = mw->rx_size / num_qps_mw; qp->rx_buff = mw->virt_addr + rx_size * (qp_num / mw_count); rx_size -= sizeof(struct ntb_rx_info); From owner-svn-src-all@freebsd.org Tue Aug 27 04:17:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB93DC8DE8; Tue, 27 Aug 2019 04:17:44 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HbFM59QFz4Lj5; Tue, 27 Aug 2019 04:17:43 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2SvKiwUSiSrVc2SvMiobHh; Mon, 26 Aug 2019 22:17:41 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=UtRFE5K7Ulp2Whtco6EA:9 a=CjuIK1q_8ugA:10 a=7uh6xexeqkIA:10 a=9Wj_ytqOLHUA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=BVt-rVABO2UG3ysEI_l-:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 83254A83; Mon, 26 Aug 2019 21:17:38 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7R4Hc65024860; Mon, 26 Aug 2019 21:17:38 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7R4HcfE024857; Mon, 26 Aug 2019 21:17:38 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908270417.x7R4HcfE024857@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> <201908270341.x7R3fJne062385@slippy.cwsent.com> Comments: In-reply-to Mateusz Guzik message dated "Tue, 27 Aug 2019 05:57:58 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 21:17:38 -0700 X-CMAE-Envelope: MS4wfP9HOaC487ijs5Ar1oK8iox2bfVk4E4n/GQqj4+7BcVjX0RqOrqeCdsOEpo/ouy7ZXNcgtTR+sdp4++7HDY54rs3SS38QstetaxCm9eX2QRoXFkMJoeV d9mbZrKSSJftmX02KmEsQDIoKnDqzvzUYAzQ2bfyW0n/Cqp5WjWWr0pLkvniWG2JVYsWNIDK+5qc6Gquo1nLMd2a/NdOgw6aUABRAbcnz58aurgOfjH3K8No 6bHnVS7mMAhdnRUTSHHJfTnR0Lx3JMmnen3pgS5cvW0= X-Rspamd-Queue-Id: 46HbFM59QFz4Lj5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.138) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.94 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; RCVD_IN_DNSWL_NONE(0.00)[138.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.38)[ip: (-6.23), ipnet: 64.59.128.0/20(-3.14), asn: 6327(-2.44), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:17:45 -0000 In message , Mateusz Guzik writes: > On 8/27/19, Cy Schubert wrote: > > Making progress: > > > > Unread portion of the kernel message buffer: > > > > panic: null_unlock: LK_INTERLOCK passed > > cpuid = 2 > > time = 1566868081 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > > 0xfffffe0054a954e0 > > vpanic() at vpanic+0x19d/frame 0xfffffe0054a95530 > > panic() at panic+0x43/frame 0xfffffe0054a95590 > > null_unlock() at null_unlock+0x8a/frame 0xfffffe0054a955d0 > > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a955f0 > > unionfs_unlock() at unionfs_unlock+0x124/frame 0xfffffe0054a95650 > > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a95670 > > vfs_domount() at vfs_domount+0xc3f/frame 0xfffffe0054a958a0 > > vfs_donmount() at vfs_donmount+0x934/frame 0xfffffe0054a95940 > > sys_nmount() at sys_nmount+0x69/frame 0xfffffe0054a95980 > > amd64_syscall() at amd64_syscall+0x3ae/frame 0xfffffe0054a95ab0 > > fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0054a95ab0 > > --- syscall (378, FreeBSD ELF64, sys_nmount), rip = 0x2bed6a4a, rsp = > > 0x7fffffffe2e8, rbp = 0x7fffffffec70 --- > > Uptime: 1m35s > > > > Ok, this explains everything. I did not think anyone uses unionfs, > let alone stacked on top of nullfs. I'll have a patch later. It's for a few jails. Thanks for persevering. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Tue Aug 27 04:19:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A72AC8EA6; Tue, 27 Aug 2019 04:19:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HbHf2svRz4Lr5; Tue, 27 Aug 2019 04:19:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58ECF191F1; Tue, 27 Aug 2019 04:19:42 +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 x7R4JgvC007434; Tue, 27 Aug 2019 04:19:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R4JeLg007426; Tue, 27 Aug 2019 04:19:40 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908270419.x7R4JeLg007426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 27 Aug 2019 04:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351540 - in head/sys/dev/cxgbe: . cxgbei iw_cxgbe tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . cxgbei iw_cxgbe tom X-SVN-Commit-Revision: 351540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 04:19:42 -0000 Author: np Date: Tue Aug 27 04:19:40 2019 New Revision: 351540 URL: https://svnweb.freebsd.org/changeset/base/351540 Log: cxgbe/t4_tom: Initialize all TOE connection parameters in one place. Remove now-redundant items from toepcb and synq_entry and the code to support them. Let the driver calculate tx_align, rx_coalesce, and sndbuf by default. Reviewed by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21387 Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c head/sys/dev/cxgbe/iw_cxgbe/qp.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Aug 27 04:19:40 2019 (r351540) @@ -697,7 +697,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) ISCSI_DATA_DIGEST_SIZE; } so->so_options |= SO_NO_DDP; - toep->ulp_mode = ULP_MODE_ISCSI; + toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; send_iscsi_flowc_wr(icc->sc, toep, ci->max_tx_pdu_len); Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/qp.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.c Tue Aug 27 04:19:40 2019 (r351540) @@ -1415,7 +1415,7 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw ret = c4iw_wait_for_reply(rdev, &ep->com.wr_wait, ep->hwtid, qhp->wq.sq.qid, ep->com.so, __func__); - toep->ulp_mode = ULP_MODE_RDMA; + toep->params.ulp_mode = ULP_MODE_RDMA; free_ird(rhp, qhp->attr.max_ird); return ret; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/t4_main.c Tue Aug 27 04:19:40 2019 (r351540) @@ -6229,9 +6229,9 @@ t4_sysctls(struct adapter *sc) "(-1 = default, 0 = reno, 1 = tahoe, 2 = newreno, " "3 = highspeed)"); - sc->tt.sndbuf = 256 * 1024; + sc->tt.sndbuf = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sndbuf", CTLFLAG_RW, - &sc->tt.sndbuf, 0, "max hardware send buffer size"); + &sc->tt.sndbuf, 0, "hardware send buffer"); sc->tt.ddp = 0; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "ddp", @@ -6239,7 +6239,7 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_zcopy", CTLFLAG_RW, &sc->tt.ddp, 0, "Enable zero-copy aio_read(2)"); - sc->tt.rx_coalesce = 1; + sc->tt.rx_coalesce = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_coalesce", CTLFLAG_RW, &sc->tt.rx_coalesce, 0, "receive coalescing"); @@ -6251,7 +6251,7 @@ t4_sysctls(struct adapter *sc) CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_tls_rx_ports, "I", "TCP ports that use inline TLS+TOE RX"); - sc->tt.tx_align = 1; + sc->tt.tx_align = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tx_align", CTLFLAG_RW, &sc->tt.tx_align, 0, "chop and align payload"); Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 27 04:19:40 2019 (r351540) @@ -102,7 +102,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_h make_established(toep, be32toh(cpl->snd_isn) - 1, be32toh(cpl->rcv_isn) - 1, cpl->tcp_opt); - if (toep->ulp_mode == ULP_MODE_TLS) + if (ulp_mode(toep) == ULP_MODE_TLS) tls_establish(toep); done: @@ -165,96 +165,6 @@ do_act_open_rpl(struct sge_iq *iq, const struct rss_he return (0); } -/* - * Options2 for active open. - */ -static uint32_t -calc_opt2a(struct socket *so, struct toepcb *toep, - const struct offload_settings *s) -{ - struct tcpcb *tp = so_sototcpcb(so); - struct port_info *pi = toep->vi->pi; - struct adapter *sc = pi->adapter; - uint32_t opt2 = 0; - - /* - * rx flow control, rx coalesce, congestion control, and tx pace are all - * explicitly set by the driver. On T5+ the ISS is also set by the - * driver to the value picked by the kernel. - */ - if (is_t4(sc)) { - opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; - opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; - } else { - opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ - opt2 |= F_T5_ISS; /* ISS provided in CPL */ - } - - if (s->sack > 0 || (s->sack < 0 && (tp->t_flags & TF_SACK_PERMIT))) - opt2 |= F_SACK_EN; - - if (s->tstamp > 0 || (s->tstamp < 0 && (tp->t_flags & TF_REQ_TSTMP))) - opt2 |= F_TSTAMPS_EN; - - if (tp->t_flags & TF_REQ_SCALE) - opt2 |= F_WND_SCALE_EN; - - if (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn == 1)) - opt2 |= F_CCTRL_ECN; - - /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ - - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - - /* These defaults are subject to ULP specific fixups later. */ - opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); - - opt2 |= V_PACE(0); - - if (s->cong_algo >= 0) - opt2 |= V_CONG_CNTRL(s->cong_algo); - else if (sc->tt.cong_algorithm >= 0) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); - else { - struct cc_algo *cc = CC_ALGO(tp); - - if (strcasecmp(cc->name, "reno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); - else if (strcasecmp(cc->name, "tahoe") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); - if (strcasecmp(cc->name, "newreno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - if (strcasecmp(cc->name, "highspeed") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); - else { - /* - * Use newreno in case the algorithm selected by the - * host stack is not supported by the hardware. - */ - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - } - } - - if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) - opt2 |= V_RX_COALESCE(M_RX_COALESCE); - - /* Note that ofld_rxq is already set according to s->rxq. */ - opt2 |= F_RSS_QUEUE_VALID; - opt2 |= V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); - -#ifdef USE_DDP_RX_FLOW_CONTROL - if (toep->ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_DDP; -#endif - - if (toep->ulp_mode == ULP_MODE_TLS) { - opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); - opt2 |= F_RX_FC_DISABLE; - } - - return (htobe32(opt2)); -} - void t4_init_connect_cpl_handlers(void) { @@ -322,7 +232,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru struct wrqe *wr = NULL; struct ifnet *rt_ifp = rt->rt_ifp; struct vi_info *vi; - int mtu_idx, rscale, qid_atid, rc, isipv6, txqid, rxqid; + int qid_atid, rc, isipv6; struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); int reason; @@ -353,18 +263,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru if (!settings.offload) DONT_OFFLOAD_ACTIVE_OPEN(EPERM); - if (settings.txq >= 0 && settings.txq < vi->nofldtxq) - txqid = settings.txq; - else - txqid = arc4random() % vi->nofldtxq; - txqid += vi->first_ofld_txq; - if (settings.rxq >= 0 && settings.rxq < vi->nofldrxq) - rxqid = settings.rxq; - else - rxqid = arc4random() % vi->nofldrxq; - rxqid += vi->first_ofld_rxq; - - toep = alloc_toepcb(vi, txqid, rxqid, M_NOWAIT | M_ZERO); + toep = alloc_toepcb(vi, M_NOWAIT); if (toep == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); @@ -377,27 +276,16 @@ t4_connect(struct toedev *tod, struct socket *so, stru if (toep->l2te == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); + toep->vnet = so->so_vnet; + init_conn_params(vi, &settings, &inp->inp_inc, so, NULL, + toep->l2te->idx, &toep->params); + init_toepcb(vi, toep); + isipv6 = nam->sa_family == AF_INET6; wr = alloc_wrqe(act_open_cpl_size(sc, isipv6), toep->ctrlq); if (wr == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); - toep->vnet = so->so_vnet; - set_ulp_mode(toep, select_ulp_mode(so, sc, &settings)); - SOCKBUF_LOCK(&so->so_rcv); - toep->opt0_rcv_bufsize = min(select_rcv_wnd(so) >> 10, M_RCV_BUFSIZ); - SOCKBUF_UNLOCK(&so->so_rcv); - - /* - * The kernel sets request_r_scale based on sb_max whereas we need to - * take hardware's MAX_RCV_WND into account too. This is normally a - * no-op as MAX_RCV_WND is much larger than the default sb_max. - */ - if (tp->t_flags & TF_REQ_SCALE) - rscale = tp->request_r_scale = select_rcv_wscale(); - else - rscale = 0; - mtu_idx = find_best_mtu_idx(sc, &inp->inp_inc, &settings); qid_atid = V_TID_QID(toep->ofld_rxq->iq.abs_id) | V_TID_TID(toep->tid) | V_TID_COOKIE(CPL_COOKIE_TOM); @@ -438,9 +326,13 @@ t4_connect(struct toedev *tod, struct socket *so, stru cpl->peer_port = inp->inp_fport; cpl->peer_ip_hi = *(uint64_t *)&inp->in6p_faddr.s6_addr[0]; cpl->peer_ip_lo = *(uint64_t *)&inp->in6p_faddr.s6_addr[8]; - cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->opt0_rcv_bufsize, toep->ulp_mode, &settings); - cpl->opt2 = calc_opt2a(so, toep, &settings); + cpl->opt0 = calc_options0(vi, &toep->params); + cpl->opt2 = calc_options2(vi, &toep->params); + + CTR6(KTR_CXGBE, + "%s: atid %u, toep %p, inp %p, opt0 %#016lx, opt2 %#08x", + __func__, toep->tid, toep, inp, be64toh(cpl->opt0), + be32toh(cpl->opt2)); } else { struct cpl_act_open_req *cpl = wrtod(wr); struct cpl_t5_act_open_req *cpl5 = (void *)cpl; @@ -467,13 +359,14 @@ t4_connect(struct toedev *tod, struct socket *so, stru qid_atid)); inp_4tuple_get(inp, &cpl->local_ip, &cpl->local_port, &cpl->peer_ip, &cpl->peer_port); - cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->opt0_rcv_bufsize, toep->ulp_mode, &settings); - cpl->opt2 = calc_opt2a(so, toep, &settings); - } + cpl->opt0 = calc_options0(vi, &toep->params); + cpl->opt2 = calc_options2(vi, &toep->params); - CTR5(KTR_CXGBE, "%s: atid %u (%s), toep %p, inp %p", __func__, - toep->tid, tcpstates[tp->t_state], toep, inp); + CTR6(KTR_CXGBE, + "%s: atid %u, toep %p, inp %p, opt0 %#016lx, opt2 %#08x", + __func__, toep->tid, toep, inp, be64toh(cpl->opt0), + be32toh(cpl->opt2)); + } offload_socket(so, toep); rc = t4_l2t_send(sc, wr, toep->l2te); Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Aug 27 04:19:40 2019 (r351540) @@ -77,7 +77,7 @@ static void t4_aiotx_cancel(struct kaiocb *job); static void t4_aiotx_queue_toep(struct socket *so, struct toepcb *toep); void -send_flowc_wr(struct toepcb *toep, struct flowc_tx_params *ftxp) +send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) { struct wrqe *wr; struct fw_flowc_wr *flowc; @@ -91,17 +91,17 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT), ("%s: flowc for tid %u sent already", __func__, toep->tid)); - if (ftxp != NULL) + if (tp != NULL) nparams = 8; else nparams = 6; - if (toep->ulp_mode == ULP_MODE_TLS) + if (ulp_mode(toep) == ULP_MODE_TLS) nparams++; if (toep->tls.fcplenmax != 0) nparams++; - if (toep->tc_idx != -1) { - MPASS(toep->tc_idx >= 0 && - toep->tc_idx < sc->chip_params->nsched_cls); + if (toep->params.tc_idx != -1) { + MPASS(toep->params.tc_idx >= 0 && + toep->params.tc_idx < sc->chip_params->nsched_cls); nparams++; } @@ -133,30 +133,23 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par FLOWC_PARAM(CH, pi->tx_chan); FLOWC_PARAM(PORT, pi->tx_chan); FLOWC_PARAM(IQID, toep->ofld_rxq->iq.abs_id); - if (ftxp) { - uint32_t sndbuf = min(ftxp->snd_space, sc->tt.sndbuf); - - FLOWC_PARAM(SNDNXT, ftxp->snd_nxt); - FLOWC_PARAM(RCVNXT, ftxp->rcv_nxt); - FLOWC_PARAM(SNDBUF, sndbuf); - FLOWC_PARAM(MSS, ftxp->mss); - - CTR6(KTR_CXGBE, - "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", - __func__, toep->tid, ftxp->mss, sndbuf, ftxp->snd_nxt, - ftxp->rcv_nxt); - } else { - FLOWC_PARAM(SNDBUF, 512); - FLOWC_PARAM(MSS, 512); - - CTR2(KTR_CXGBE, "%s: tid %u", __func__, toep->tid); + FLOWC_PARAM(SNDBUF, toep->params.sndbuf); + FLOWC_PARAM(MSS, toep->params.emss); + if (tp) { + FLOWC_PARAM(SNDNXT, tp->snd_nxt); + FLOWC_PARAM(RCVNXT, tp->rcv_nxt); } - if (toep->ulp_mode == ULP_MODE_TLS) - FLOWC_PARAM(ULP_MODE, toep->ulp_mode); + CTR6(KTR_CXGBE, + "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", + __func__, toep->tid, toep->params.emss, toep->params.sndbuf, + tp ? tp->snd_nxt : 0, tp ? tp->rcv_nxt : 0); + + if (ulp_mode(toep) == ULP_MODE_TLS) + FLOWC_PARAM(ULP_MODE, ulp_mode(toep)); if (toep->tls.fcplenmax != 0) FLOWC_PARAM(TXDATAPLEN_MAX, toep->tls.fcplenmax); - if (toep->tc_idx != -1) - FLOWC_PARAM(SCHEDCLASS, toep->tc_idx); + if (toep->params.tc_idx != -1) + FLOWC_PARAM(SCHEDCLASS, toep->params.tc_idx); #undef FLOWC_PARAM KASSERT(paramidx == nparams, ("nparams mismatch")); @@ -197,7 +190,7 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); } - if (toep->tc_idx != tc_idx) { + if (toep->params.tc_idx != tc_idx) { struct wrqe *wr; struct fw_flowc_wr *flowc; int nparams = 1, flowclen, flowclen16; @@ -236,9 +229,9 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb t4_wrq_tx(sc, wr); } - if (toep->tc_idx >= 0) - t4_release_cl_rl(sc, port_id, toep->tc_idx); - toep->tc_idx = tc_idx; + if (toep->params.tc_idx >= 0) + t4_release_cl_rl(sc, port_id, toep->params.tc_idx); + toep->params.tc_idx = tc_idx; return (0); } @@ -313,30 +306,30 @@ assign_rxopt(struct tcpcb *tp, uint16_t opt) INP_LOCK_ASSERT(inp); - toep->tcp_opt = opt; - toep->mtu_idx = G_TCPOPT_MSS(opt); - tp->t_maxseg = sc->params.mtus[toep->mtu_idx]; + toep->params.mtu_idx = G_TCPOPT_MSS(opt); + tp->t_maxseg = sc->params.mtus[toep->params.mtu_idx]; if (inp->inp_inc.inc_flags & INC_ISIPV6) tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr); - toep->emss = tp->t_maxseg; + toep->params.emss = tp->t_maxseg; if (G_TCPOPT_TSTAMP(opt)) { + toep->params.tstamp = 1; + toep->params.emss -= TCPOLEN_TSTAMP_APPA; tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */ tp->ts_recent = 0; /* hmmm */ tp->ts_recent_age = tcp_ts_getticks(); - toep->emss -= TCPOLEN_TSTAMP_APPA; - } + } else + toep->params.tstamp = 0; - CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u", - __func__, toep->tid, toep->mtu_idx, - sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss); - - if (G_TCPOPT_SACK(opt)) + if (G_TCPOPT_SACK(opt)) { + toep->params.sack = 1; tp->t_flags |= TF_SACK_PERMIT; /* should already be set */ - else + } else { + toep->params.sack = 0; tp->t_flags &= ~TF_SACK_PERMIT; /* sack disallowed by peer */ + } if (G_TCPOPT_WSCALE_OK(opt)) tp->t_flags |= TF_RCVD_SCALE; @@ -346,7 +339,13 @@ assign_rxopt(struct tcpcb *tp, uint16_t opt) (TF_RCVD_SCALE | TF_REQ_SCALE)) { tp->rcv_scale = tp->request_r_scale; tp->snd_scale = G_TCPOPT_SND_WSCALE(opt); - } + } else + toep->params.wscale = 0; + + CTR6(KTR_CXGBE, + "assign_rxopt: tid %d, mtu_idx %u, emss %u, ts %u, sack %u, wscale %u", + toep->tid, toep->params.mtu_idx, toep->params.emss, + toep->params.tstamp, toep->params.sack, toep->params.wscale); } /* @@ -361,9 +360,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui struct inpcb *inp = toep->inp; struct socket *so = inp->inp_socket; struct tcpcb *tp = intotcpcb(inp); - long bufsize; uint16_t tcpopt = be16toh(opt); - struct flowc_tx_params ftxp; INP_WLOCK_ASSERT(inp); KASSERT(tp->t_state == TCPS_SYN_SENT || @@ -379,7 +376,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->irs = irs; tcp_rcvseqinit(tp); - tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10; + tp->rcv_wnd = (u_int)toep->params.opt0_bufsize << 10; tp->rcv_adv += tp->rcv_wnd; tp->last_ack_sent = tp->rcv_nxt; @@ -390,20 +387,8 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->snd_max = iss + 1; assign_rxopt(tp, tcpopt); + send_flowc_wr(toep, tp); - SOCKBUF_LOCK(&so->so_snd); - if (so->so_snd.sb_flags & SB_AUTOSIZE && V_tcp_do_autosndbuf) - bufsize = V_tcp_autosndbuf_max; - else - bufsize = sbspace(&so->so_snd); - SOCKBUF_UNLOCK(&so->so_snd); - - ftxp.snd_nxt = tp->snd_nxt; - ftxp.rcv_nxt = tp->rcv_nxt; - ftxp.snd_space = bufsize; - ftxp.mss = toep->emss; - send_flowc_wr(toep, &ftxp); - soisconnected(so); } @@ -459,7 +444,7 @@ t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp) SOCKBUF_LOCK_ASSERT(sb); rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { if (toep->tls.rcv_over >= rx_credits) { toep->tls.rcv_over -= rx_credits; rx_credits = 0; @@ -578,7 +563,7 @@ max_dsgl_nsegs(int tx_credits) static inline void write_tx_wr(void *dst, struct toepcb *toep, unsigned int immdlen, - unsigned int plen, uint8_t credits, int shove, int ulp_submode, int txalign) + unsigned int plen, uint8_t credits, int shove, int ulp_submode) { struct fw_ofld_tx_data_wr *txwr = dst; @@ -586,20 +571,18 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i V_FW_WR_IMMDLEN(immdlen)); txwr->flowid_len16 = htobe32(V_FW_WR_FLOWID(toep->tid) | V_FW_WR_LEN16(credits)); - txwr->lsodisable_to_flags = htobe32(V_TX_ULP_MODE(toep->ulp_mode) | + txwr->lsodisable_to_flags = htobe32(V_TX_ULP_MODE(ulp_mode(toep)) | V_TX_ULP_SUBMODE(ulp_submode) | V_TX_URG(0) | V_TX_SHOVE(shove)); txwr->plen = htobe32(plen); - if (txalign > 0) { - struct tcpcb *tp = intotcpcb(toep->inp); - - if (plen < 2 * toep->emss) + if (toep->params.tx_align > 0) { + if (plen < 2 * toep->params.emss) txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE); else txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_ALIGNPLD | - (tp->t_flags & TF_NODELAY ? 0 : + (toep->params.nagle == 0 ? 0 : F_FW_OFLD_TX_DATA_WR_ALIGNPLDSHOVE)); } } @@ -694,11 +677,11 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep KASSERT(toep->flags & TPF_FLOWC_WR_SENT, ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid)); - KASSERT(toep->ulp_mode == ULP_MODE_NONE || - toep->ulp_mode == ULP_MODE_TCPDDP || - toep->ulp_mode == ULP_MODE_TLS || - toep->ulp_mode == ULP_MODE_RDMA, - ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); + KASSERT(ulp_mode(toep) == ULP_MODE_NONE || + ulp_mode(toep) == ULP_MODE_TCPDDP || + ulp_mode(toep) == ULP_MODE_TLS || + ulp_mode(toep) == ULP_MODE_RDMA, + ("%s: ulp_mode %u for toep %p", __func__, ulp_mode(toep), toep)); #ifdef VERBOSE_TRACES CTR5(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", @@ -837,8 +820,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep } txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, plen, credits, shove, 0, - sc->tt.tx_align); + write_tx_wr(txwr, toep, plen, plen, credits, shove, 0); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -856,8 +838,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep } txwr = wrtod(wr); credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, plen, credits, shove, 0, - sc->tt.tx_align); + write_tx_wr(txwr, toep, 0, plen, credits, shove, 0); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -877,7 +858,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep toep->tx_nocompl >= toep->tx_total / 4) compl = 1; - if (compl || toep->ulp_mode == ULP_MODE_RDMA) { + if (compl || ulp_mode(toep) == ULP_MODE_RDMA) { txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; @@ -951,8 +932,8 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, INP_WLOCK_ASSERT(inp); KASSERT(toep->flags & TPF_FLOWC_WR_SENT, ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid)); - KASSERT(toep->ulp_mode == ULP_MODE_ISCSI, - ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); + KASSERT(ulp_mode(toep) == ULP_MODE_ISCSI, + ("%s: ulp_mode %u for toep %p", __func__, ulp_mode(toep), toep)); if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) return; @@ -1035,7 +1016,7 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode, sc->tt.tx_align); + shove, ulp_submode); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -1053,7 +1034,7 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, txwr = wrtod(wr); credits = howmany(wr_len, 16); write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode, sc->tt.tx_align); + shove, ulp_submode); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -1119,7 +1100,7 @@ t4_tod_output(struct toedev *tod, struct tcpcb *tp) ("%s: inp %p dropped.", __func__, inp)); KASSERT(toep != NULL, ("%s: toep is NULL", __func__)); - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, 0); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, 0); @@ -1145,7 +1126,7 @@ t4_send_fin(struct toedev *tod, struct tcpcb *tp) toep->flags |= TPF_SEND_FIN; if (tp->t_state >= TCPS_ESTABLISHED) { - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, 0); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, 0); @@ -1232,7 +1213,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head so = inp->inp_socket; socantrcvmore(so); - if (toep->ulp_mode == ULP_MODE_TCPDDP) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { DDP_LOCK(toep); if (__predict_false(toep->ddp.flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) @@ -1240,7 +1221,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head DDP_UNLOCK(toep); } - if (toep->ulp_mode != ULP_MODE_RDMA) { + if (ulp_mode(toep) != ULP_MODE_RDMA) { KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, be32toh(cpl->rcv_nxt))); @@ -1551,14 +1532,14 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp->rcv_nxt += len; if (tp->rcv_wnd < len) { - KASSERT(toep->ulp_mode == ULP_MODE_RDMA, + KASSERT(ulp_mode(toep) == ULP_MODE_RDMA, ("%s: negative window size", __func__)); } tp->rcv_wnd -= len; tp->t_rcvtime = ticks; - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_LOCK(toep); so = inp_inpcbtosocket(inp); sb = &so->so_rcv; @@ -1569,7 +1550,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header __func__, tid, len); m_freem(m); SOCKBUF_UNLOCK(sb); - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_UNLOCK(toep); INP_WUNLOCK(inp); @@ -1600,7 +1581,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header sb->sb_flags &= ~SB_AUTOSIZE; } - if (toep->ulp_mode == ULP_MODE_TCPDDP) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { int changed = !(toep->ddp.flags & DDP_ON) ^ cpl->ddp_off; if (toep->ddp.waiting_count != 0 || toep->ddp.active_count != 0) @@ -1643,7 +1624,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp->rcv_adv += rx_credits; } - if (toep->ulp_mode == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && + if (ulp_mode(toep) == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && sbavail(sb) != 0) { CTR2(KTR_CXGBE, "%s: tid %u queueing AIO task", __func__, tid); @@ -1651,7 +1632,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header } sorwakeup_locked(so); SOCKBUF_UNLOCK_ASSERT(sb); - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_UNLOCK(toep); INP_WUNLOCK(inp); @@ -1761,7 +1742,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header #endif toep->flags &= ~TPF_TX_SUSPENDED; CURVNET_SET(toep->vnet); - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, plen); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, plen); @@ -1774,7 +1755,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header SOCKBUF_LOCK(sb); sbu = sbused(sb); - if (toep->ulp_mode == ULP_MODE_ISCSI) { + if (ulp_mode(toep) == ULP_MODE_ISCSI) { if (__predict_false(sbu > 0)) { /* Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 27 04:19:40 2019 (r351540) @@ -767,7 +767,7 @@ do_rx_data_ddp(struct sge_iq *iq, const struct rss_hea __func__, vld, tid, toep); } - if (toep->ulp_mode == ULP_MODE_ISCSI) { + if (ulp_mode(toep) == ULP_MODE_ISCSI) { t4_cpl_handler[CPL_RX_ISCSI_DDP](iq, rss, m); return (0); } Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 27 04:19:40 2019 (r351540) @@ -348,7 +348,7 @@ send_reset_synqe(struct toedev *tod, struct synq_entry struct ifnet *ifp = m->m_pkthdr.rcvif; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; struct wrqe *wr; struct fw_flowc_wr *flowc; struct cpl_abort_req *req; @@ -368,8 +368,8 @@ send_reset_synqe(struct toedev *tod, struct synq_entry return; /* abort already in progress */ synqe->flags |= TPF_ABORT_SHUTDOWN; - ofld_txq = &sc->sge.ofld_txq[synqe->txqid]; - ofld_rxq = &sc->sge.ofld_rxq[synqe->rxqid]; + ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; + ofld_rxq = &sc->sge.ofld_rxq[synqe->params.rxq_idx]; /* The wrqe will have two WRs - a flowc followed by an abort_req */ flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); @@ -836,7 +836,7 @@ done_with_synqe(struct adapter *sc, struct synq_entry { struct listen_ctx *lctx = synqe->lctx; struct inpcb *inp = lctx->inp; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; int ntids; INP_WLOCK_ASSERT(inp); @@ -887,7 +887,7 @@ do_abort_req_synqe(struct sge_iq *iq, const struct rss INP_WLOCK(inp); - ofld_txq = &sc->sge.ofld_txq[synqe->txqid]; + ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; /* * If we'd initiated an abort earlier the reply to it is responsible for @@ -962,28 +962,6 @@ t4_offload_socket(struct toedev *tod, void *arg, struc synqe->flags |= TPF_SYNQE_EXPANDED; } -static inline void -save_qids_in_synqe(struct synq_entry *synqe, struct vi_info *vi, - struct offload_settings *s) -{ - uint32_t txqid, rxqid; - - if (s->txq >= 0 && s->txq < vi->nofldtxq) - txqid = s->txq; - else - txqid = arc4random() % vi->nofldtxq; - txqid += vi->first_ofld_txq; - - if (s->rxq >= 0 && s->rxq < vi->nofldrxq) - rxqid = s->rxq; - else - rxqid = arc4random() % vi->nofldrxq; - rxqid += vi->first_ofld_rxq; - - synqe->txqid = txqid; - synqe->rxqid = rxqid; -} - static void t4opt_to_tcpopt(const struct tcp_options *t4opt, struct tcpopt *to) { @@ -1006,95 +984,6 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_flags |= TOF_SACKPERM; } -/* - * Options2 for passive open. - */ -static uint32_t -calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, - const struct tcp_options *tcpopt, struct tcphdr *th, int ulp_mode, - struct cc_algo *cc, const struct offload_settings *s) -{ - struct sge_ofld_rxq *ofld_rxq = &sc->sge.ofld_rxq[rxqid]; - uint32_t opt2 = 0; - - /* - * rx flow control, rx coalesce, congestion control, and tx pace are all - * explicitly set by the driver. On T5+ the ISS is also set by the - * driver to the value picked by the kernel. - */ - if (is_t4(sc)) { - opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; - opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; - } else { - opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ - opt2 |= F_T5_ISS; /* ISS provided in CPL */ - } - - if (tcpopt->sack && (s->sack > 0 || (s->sack < 0 && V_tcp_do_rfc1323))) - opt2 |= F_SACK_EN; - - if (tcpopt->tstamp && - (s->tstamp > 0 || (s->tstamp < 0 && V_tcp_do_rfc1323))) - opt2 |= F_TSTAMPS_EN; - - if (tcpopt->wsf < 15 && V_tcp_do_rfc1323) - opt2 |= F_WND_SCALE_EN; - - if (th->th_flags & (TH_ECE | TH_CWR) && - (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn))) - opt2 |= F_CCTRL_ECN; - - /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ - - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - - /* These defaults are subject to ULP specific fixups later. */ - opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); - - opt2 |= V_PACE(0); - - if (s->cong_algo >= 0) - opt2 |= V_CONG_CNTRL(s->cong_algo); - else if (sc->tt.cong_algorithm >= 0) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); - else { - if (strcasecmp(cc->name, "reno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); - else if (strcasecmp(cc->name, "tahoe") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); - if (strcasecmp(cc->name, "newreno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - if (strcasecmp(cc->name, "highspeed") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); - else { - /* - * Use newreno in case the algorithm selected by the - * host stack is not supported by the hardware. - */ - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - } - } - - if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) - opt2 |= V_RX_COALESCE(M_RX_COALESCE); - - /* Note that ofld_rxq is already set according to s->rxq. */ - opt2 |= F_RSS_QUEUE_VALID; - opt2 |= V_RSS_QUEUE(ofld_rxq->iq.abs_id); - -#ifdef USE_DDP_RX_FLOW_CONTROL - if (ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_DDP; -#endif - - if (ulp_mode == ULP_MODE_TLS) { - opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); - opt2 |= F_RX_FC_DISABLE; - } - - return (htobe32(opt2)); -} - static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th) @@ -1189,7 +1078,7 @@ send_synack(struct adapter *sc, struct synq_entry *syn { struct wrqe *wr; struct cpl_pass_accept_rpl *rpl; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; wr = alloc_wrqe(is_t4(sc) ? sizeof(struct cpl_pass_accept_rpl) : sizeof(struct cpl_t5_pass_accept_rpl), &sc->sge.ctrlq[0]); @@ -1385,6 +1274,9 @@ found: } atomic_store_int(&synqe->ok_to_respond, 0); + init_conn_params(vi, &settings, &inc, so, &cpl->tcpopt, e->idx, + &synqe->params); + /* * If all goes well t4_syncache_respond will get called during * syncache_add. Note that syncache_add releases the pcb lock. @@ -1395,27 +1287,12 @@ found: if (atomic_load_int(&synqe->ok_to_respond) > 0) { uint64_t opt0; uint32_t opt2; - u_int wnd; - int rscale, mtu_idx, rx_credits; - mtu_idx = find_best_mtu_idx(sc, &inc, &settings); - rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; - wnd = max(so->sol_sbrcv_hiwat, MIN_RCV_WND); - wnd = min(wnd, MAX_RCV_WND); - rx_credits = min(wnd >> 10, M_RCV_BUFSIZ); + opt0 = calc_options0(vi, &synqe->params); + opt2 = calc_options2(vi, &synqe->params); - save_qids_in_synqe(synqe, vi, &settings); - synqe->ulp_mode = select_ulp_mode(so, sc, &settings); - - opt0 = calc_opt0(so, vi, e, mtu_idx, rscale, rx_credits, - synqe->ulp_mode, &settings); - opt2 = calc_opt2p(sc, pi, synqe->rxqid, &cpl->tcpopt, &th, - synqe->ulp_mode, CC_ALGO(intotcpcb(inp)), &settings); - insert_tid(sc, tid, synqe, ntids); synqe->tid = tid; - synqe->l2e_idx = e->idx; - synqe->rcv_bufsize = rx_credits; synqe->syn = m; m = NULL; @@ -1427,8 +1304,8 @@ found: } CTR6(KTR_CXGBE, - "%s: stid %u, tid %u, lctx %p, synqe %p, mode %d, SYNACK", - __func__, stid, tid, lctx, synqe, synqe->ulp_mode); + "%s: stid %u, tid %u, synqe %p, opt0 %#016lx, opt2 %#08x", + __func__, stid, tid, synqe, be64toh(opt0), be32toh(opt2)); } else REJECT_PASS_ACCEPT_REQ(false); @@ -1540,18 +1417,19 @@ reset: return (0); } - KASSERT(synqe->rxqid == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], + KASSERT(synqe->params.rxq_idx == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], ("%s: CPL arrived on unexpected rxq. %d %d", __func__, - synqe->rxqid, (int)(iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0]))); + synqe->params.rxq_idx, + (int)(iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0]))); - toep = alloc_toepcb(vi, synqe->txqid, synqe->rxqid, M_NOWAIT); + toep = alloc_toepcb(vi, M_NOWAIT); if (toep == NULL) goto reset; toep->tid = tid; - toep->l2te = &sc->l2t->l2tab[synqe->l2e_idx]; + toep->l2te = &sc->l2t->l2tab[synqe->params.l2t_idx]; toep->vnet = lctx->vnet; - set_ulp_mode(toep, synqe->ulp_mode); - toep->opt0_rcv_bufsize = synqe->rcv_bufsize; + bcopy(&synqe->params, &toep->params, sizeof(toep->params)); + init_toepcb(vi, toep); MPASS(be32toh(cpl->snd_isn) - 1 == synqe->iss); MPASS(be32toh(cpl->rcv_isn) - 1 == synqe->irs); Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Tue Aug 27 04:16:42 2019 (r351539) +++ head/sys/dev/cxgbe/tom/t4_tls.c Tue Aug 27 04:19:40 2019 (r351540) @@ -590,7 +590,7 @@ program_key_context(struct tcpcb *tp, struct toepcb *t "KEY_WRITE_TX", uk_ctx->proto_ver); if (G_KEY_GET_LOC(uk_ctx->l_p_key) == KEY_WRITE_RX && - toep->ulp_mode != ULP_MODE_TLS) + ulp_mode(toep) != ULP_MODE_TLS) return (EOPNOTSUPP); /* Don't copy the 'tx' and 'rx' fields. */ @@ -788,7 +788,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so INP_WUNLOCK(inp); break; case TCP_TLSOM_CLR_TLS_TOM: - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { CTR2(KTR_CXGBE, "%s: tid %d CLR_TLS_TOM", __func__, toep->tid); tls_clr_ofld_mode(toep); @@ -797,7 +797,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so INP_WUNLOCK(inp); break; case TCP_TLSOM_CLR_QUIES: - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { CTR2(KTR_CXGBE, "%s: tid %d CLR_QUIES", __func__, toep->tid); tls_clr_quiesce(toep); @@ -820,7 +820,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so */ optval = TLS_TOM_NONE; if (can_tls_offload(td_adapter(toep->td))) { - switch (toep->ulp_mode) { + switch (ulp_mode(toep)) { case ULP_MODE_NONE: case ULP_MODE_TCPDDP: optval = TLS_TOM_TXONLY; @@ -853,7 +853,7 @@ tls_init_toep(struct toepcb *toep) tls_ofld->key_location = TLS_SFO_WR_CONTEXTLOC_DDR; tls_ofld->rx_key_addr = -1; tls_ofld->tx_key_addr = -1; - if (toep->ulp_mode == ULP_MODE_TLS) + if (ulp_mode(toep) == ULP_MODE_TLS) callout_init_mtx(&tls_ofld->handshake_timer, &tls_handshake_lock, 0); } @@ -882,7 +882,7 @@ void tls_uninit_toep(struct toepcb *toep) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 27 05:18:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B6B7CA316; Tue, 27 Aug 2019 05:18:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HcbN5Ncqz4PJP; Tue, 27 Aug 2019 05:18:24 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x242.google.com with SMTP id b25so14016897oib.4; Mon, 26 Aug 2019 22:18:24 -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=1Bl6nG/cv4QU7TswMSuSRJDq7KYs5rKmg/gq+2bjjXg=; b=pZNB7QQEwJYmuBVVSt3rrhae2TocQC1whI71Hh2KZNmC+eSrgRVLQwgy3uLEDSUcam 9TuTKfdLHEq21cfgml0hD8myqKy7eAXUYmjSTa61HxkunC0QEYvF+ixlq1FjP14ojeHA I9V7wMSWSqd8P+eDOvUX1a0AEBeGmBSHZGuBwhl2zzwbuIORNM5+2WvRfGL4R2JY87Bs d5vpthAVdY9T+KnSK9+h3yS3qsSKEwt19DjAPckH1SJjSyDZfScNLlXC2Td/7lx9O6gY Bn9zESpcy6nj0V8sacwayDbziRgpyfiP1tHB3+YtPXga0+61SAXjzc5OMso1jNd6psX3 LutQ== 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=1Bl6nG/cv4QU7TswMSuSRJDq7KYs5rKmg/gq+2bjjXg=; b=mJFDPHNJQVKIluvRSC7rwNGH016u/1GQJ9ygtuP0losrltGP78Cylz+4Hd6Lr4+tYt 5RA9Z8jax9+V0JrQR1BXUI/7TStZXsR0Zp5CN+38scHwcqbkZ8R6SnEab1l94W3H9QRh nRXlzIpbQhmFqnGBY91Ge2SnNmVxhaZk+yW92v64Rvd2eOB5mc8Epbh7yk7Xkf7y6s+o iTaUPrvXeX9kGIvf/qANmljQf0obGszzpN8uU2hKvQaOEa+rR2Mbk8/Tz2jDnvO9kqeJ 59hXGvKpJTrSn56DDbpxBPW9oLBlhP3ZfRIgakEEMb0JqRBw1F4G2Nv+Gd7TWoHPPlRn uouw== X-Gm-Message-State: APjAAAWFTw3Qn46phUCaCON0hKypt5/ymZqIkSgGymTN7YalUChBFY9o fuZ6GSo7XR4h20Oqtos9X8uigvloqml5YZBuhSM= X-Google-Smtp-Source: APXvYqzaXn13uNqcYd7TDfvL7viPm+cQdpMD7bHCFM8giYohDkvftbj5LXxqqnNp+3ciWqoHH2EXjth/IqpE9FJn73k= X-Received: by 2002:aca:bb42:: with SMTP id l63mr15346725oif.85.1566883103335; Mon, 26 Aug 2019 22:18:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Mon, 26 Aug 2019 22:18:22 -0700 (PDT) In-Reply-To: <201908270417.x7R4HcfE024857@slippy.cwsent.com> References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> <201908270341.x7R3fJne062385@slippy.cwsent.com> <201908270417.x7R4HcfE024857@slippy.cwsent.com> From: Mateusz Guzik Date: Tue, 27 Aug 2019 07:18:22 +0200 Message-ID: Subject: Re: svn commit: r351472 - head/sys/fs/nullfs To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46HcbN5Ncqz4PJP X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=pZNB7QQE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::242 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (2.45), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 05:18:26 -0000 This survived light testing for me: https://people.freebsd.org/~mjg/unionfs-interlock.diff note unionfs instantly panics with DEBUG_VFS_LOCKS regardless of any of this work. On 8/27/19, Cy Schubert wrote: > In message > om> > , Mateusz Guzik writes: >> On 8/27/19, Cy Schubert wrote: >> > Making progress: >> > >> > Unread portion of the kernel message buffer: >> > >> > panic: null_unlock: LK_INTERLOCK passed >> > cpuid = 2 >> > time = 1566868081 >> > KDB: stack backtrace: >> > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame >> > 0xfffffe0054a954e0 >> > vpanic() at vpanic+0x19d/frame 0xfffffe0054a95530 >> > panic() at panic+0x43/frame 0xfffffe0054a95590 >> > null_unlock() at null_unlock+0x8a/frame 0xfffffe0054a955d0 >> > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a955f0 >> > unionfs_unlock() at unionfs_unlock+0x124/frame 0xfffffe0054a95650 >> > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a95670 >> > vfs_domount() at vfs_domount+0xc3f/frame 0xfffffe0054a958a0 >> > vfs_donmount() at vfs_donmount+0x934/frame 0xfffffe0054a95940 >> > sys_nmount() at sys_nmount+0x69/frame 0xfffffe0054a95980 >> > amd64_syscall() at amd64_syscall+0x3ae/frame 0xfffffe0054a95ab0 >> > fast_syscall_common() at fast_syscall_common+0x101/frame >> > 0xfffffe0054a95ab0 >> > --- syscall (378, FreeBSD ELF64, sys_nmount), rip = 0x2bed6a4a, rsp = >> > 0x7fffffffe2e8, rbp = 0x7fffffffec70 --- >> > Uptime: 1m35s >> > >> >> Ok, this explains everything. I did not think anyone uses unionfs, >> let alone stacked on top of nullfs. I'll have a patch later. > > It's for a few jails. Thanks for persevering. > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 06:05:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EDC5CBB01; Tue, 27 Aug 2019 06:05:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hddp4KVfz4S4r; Tue, 27 Aug 2019 06:05:34 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 2UbiixAXySrVc2Ubjioq3M; Tue, 27 Aug 2019 00:05:32 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=XtL3EJd_C5O2CnR2E_EA:9 a=CjuIK1q_8ugA:10 a=7uh6xexeqkIA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=BVt-rVABO2UG3ysEI_l-:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id C8F14BF3; Mon, 26 Aug 2019 23:05:28 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x7R65SkT005406; Mon, 26 Aug 2019 23:05:28 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x7R65Ss4005403; Mon, 26 Aug 2019 23:05:28 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201908270605.x7R65Ss4005403@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mateusz Guzik cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351472 - head/sys/fs/nullfs In-reply-to: References: <201908250513.x7P5DFFx017824@repo.freebsd.org> <6C6BF3A4-DC07-4D9A-9A5F-FA075BF535A8@cschubert.com> <201908261411.x7QEBMWi075354@slippy.cwsent.com> <201908270025.x7R0PtNT008594@slippy.cwsent.com> <201908270341.x7R3fJne062385@slippy.cwsent.com> <201908270417.x7R4HcfE024857@slippy.cwsent.com> Comments: In-reply-to Mateusz Guzik message dated "Tue, 27 Aug 2019 07:18:22 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 26 Aug 2019 23:05:28 -0700 X-CMAE-Envelope: MS4wfLwlbdfF8kv232mVEklW4gXGN6H8sHifyvsPW5mgPETNDAUjPc7lzUhy0wTnDg+IUqMlNFqq04PTzKsrAjfJmnJkOR0QPD1fMIJ9VQydPi5mu3M5XXuG tUVlYaGp2e2eKirk+ecKXqeqy66W4o2Hd+IqjkCSm5zQPOMoOBKtJia9O53XrJZaTLzJJbzrxD+GCv7jKsfrf/IBZWMlkbjX1h+fJCa5RwX65dA75PG1GexN DLl/jr3AWbjz0ZK2WfQabLJFiMzD2hS8EUjMBB3mMKE= X-Rspamd-Queue-Id: 46Hddp4KVfz4S4r X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.89 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; RCVD_IN_DNSWL_NONE(0.00)[137.136.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.32)[ip: (-5.93), ipnet: 64.59.128.0/20(-3.14), asn: 6327(-2.44), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 06:05:35 -0000 It works for me too. Thank you. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. In message , Mateusz Guzik writes: > This survived light testing for me: > > https://people.freebsd.org/~mjg/unionfs-interlock.diff > > note unionfs instantly panics with DEBUG_VFS_LOCKS regardless > of any of this work. > > On 8/27/19, Cy Schubert wrote: > > In message > > > om> > > , Mateusz Guzik writes: > >> On 8/27/19, Cy Schubert wrote: > >> > Making progress: > >> > > >> > Unread portion of the kernel message buffer: > >> > > >> > panic: null_unlock: LK_INTERLOCK passed > >> > cpuid = 2 > >> > time = 1566868081 > >> > KDB: stack backtrace: > >> > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > >> > 0xfffffe0054a954e0 > >> > vpanic() at vpanic+0x19d/frame 0xfffffe0054a95530 > >> > panic() at panic+0x43/frame 0xfffffe0054a95590 > >> > null_unlock() at null_unlock+0x8a/frame 0xfffffe0054a955d0 > >> > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a955f0 > >> > unionfs_unlock() at unionfs_unlock+0x124/frame 0xfffffe0054a95650 > >> > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x56/frame 0xfffffe0054a95670 > >> > vfs_domount() at vfs_domount+0xc3f/frame 0xfffffe0054a958a0 > >> > vfs_donmount() at vfs_donmount+0x934/frame 0xfffffe0054a95940 > >> > sys_nmount() at sys_nmount+0x69/frame 0xfffffe0054a95980 > >> > amd64_syscall() at amd64_syscall+0x3ae/frame 0xfffffe0054a95ab0 > >> > fast_syscall_common() at fast_syscall_common+0x101/frame > >> > 0xfffffe0054a95ab0 > >> > --- syscall (378, FreeBSD ELF64, sys_nmount), rip = 0x2bed6a4a, rsp = > >> > 0x7fffffffe2e8, rbp = 0x7fffffffec70 --- > >> > Uptime: 1m35s > >> > > >> > >> Ok, this explains everything. I did not think anyone uses unionfs, > >> let alone stacked on top of nullfs. I'll have a patch later. > > > > It's for a few jails. Thanks for persevering. > > > > > > -- > > Cheers, > > Cy Schubert > > FreeBSD UNIX: Web: http://www.FreeBSD.org > > > > The need of the many outweighs the greed of the few. > > > > > > > > > -- > Mateusz Guzik > From owner-svn-src-all@freebsd.org Tue Aug 27 07:17:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53A31CD38B; Tue, 27 Aug 2019 07:17:32 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HgDr1Tlpz4WHl; Tue, 27 Aug 2019 07:17:32 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 116031B226; Tue, 27 Aug 2019 07:17:32 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R7HVcd014172; Tue, 27 Aug 2019 07:17:31 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R7HVv4014170; Tue, 27 Aug 2019 07:17:31 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201908270717.x7R7HVv4014170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 27 Aug 2019 07:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351541 - stable/12/sys/dev/sound/pci/hda X-SVN-Group: stable-12 X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: stable/12/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 351541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 07:17:32 -0000 Author: araujo Date: Tue Aug 27 07:17:31 2019 New Revision: 351541 URL: https://svnweb.freebsd.org/changeset/base/351541 Log: MFC r350433: Fix sound on headset jack for ALC255 and ALC256 codec. PR: 219350 [1], [2] Submitted by: Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1] Neel Chauhan (neel_at_neelc.org) [2] Yuri Momotyuk (yurkis_at_gmail.com) [3] Reported by: miwi Reviewed by: mav Obtained from: https://github.com/trueos/trueos/pull/279 [3] MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19017 Modified: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c stable/12/sys/dev/sound/pci/hda/hdac.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdaa_patches.c Tue Aug 27 04:19:40 2019 (r351540) +++ stable/12/sys/dev/sound/pci/hda/hdaa_patches.c Tue Aug 27 07:17:31 2019 (r351541) @@ -425,12 +425,21 @@ hdac_pin_patch(struct hdaa_widget *w) } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) { switch (nid) { case 24: - config = 0x01a1913c; + config = 0x01a1913c; break; case 26: - config = 0x01a1913d; + config = 0x01a1913d; break; } + } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) { + switch (nid) { + case 20: + patch = "as=1 seq=0"; + break; + case 33: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) @@ -768,6 +777,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo) hdaa_write_coef(dev, 0x20, 0x07, 0x7cb); } break; + } + if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) { + val = hdaa_read_coef(dev, 0x20, 0x46); + hdaa_write_coef(dev, 0x20, 0x46, val|0x3000); } if (subid == APPLE_INTEL_MAC) hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid, Modified: stable/12/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.h Tue Aug 27 04:19:40 2019 (r351540) +++ stable/12/sys/dev/sound/pci/hda/hdac.h Tue Aug 27 07:17:31 2019 (r351541) @@ -203,6 +203,7 @@ #define DELL_XPSM1210_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01d7) #define DELL_OPLX745_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01da) #define DELL_XPS9560_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x07be) +#define DELL_I7577_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0802) #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0xffff) /* Clevo */ From owner-svn-src-all@freebsd.org Tue Aug 27 08:21:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 923B4CF93B; Tue, 27 Aug 2019 08:21:15 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mail.nginx.com (mail.nginx.com [206.251.255.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46HhfM3P6Yz4bBK; Tue, 27 Aug 2019 08:21:15 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from [192.168.33.76] (unknown [82.204.252.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.nginx.com (Postfix) with ESMTPSA id E0DB82C50CDB; Tue, 27 Aug 2019 08:21:06 +0000 (UTC) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... To: John Baldwin References: <201908270001.x7R01vUB052426@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Maxim Konovalov Openpgp: preference=signencrypt Autocrypt: addr=maxim.konovalov@gmail.com; keydata= mQGiBDzqHSERBACUPYN18/fnXdsI3CsH/UgX7CL1yLSgTCTbEA7p/jPA78svM0KtaHdZG+mh ZH9u//SaPuKPoF6OST7pb5ee48bppzL8v1+zYIAUWib/ImR/ZEGi5SzMmYtNCrK3YTblaHoe KKSrVwYvFi4HYQZWG3hcXaozhZRVQTnGnDdQYriSVwCg24PlUzXu1n8lw+4zDlW3eGIkxEMD /RpnH5n8maXO5MYRvuBpGGTF7x3iV0somnLhQ1Th1WD/7OhRRzfRpXarG8ObyxyPx52et6tG V9IjSdO+uuVgtTUFRKsr6QYk/y49blntpGtd4kTHMy99Zt/GP/CBBWn7dQtMGABDobA0ZU5I LkSlZ+DHtZLEkIXljhxIyhbwsIQzBACKTwIrcF0trhi2dibKMOWqy8RYP5iKe1vXy5SCdcU7 HxicHGzI0oRdlCHTjh0pik8YWI24d18UdHDhvWHxbF/QCBbW+RAyiNASzzdsiIswo9Zvras/ NZbnagHBtP80kBhLVC4udmO7GKYxKjpgsuqihaFJdcpoxx8J6mv2sTxK1rQhTWF4aW0gS29u b3ZhbG92IDxtYXhpbUBuZ2lueC5jb20+iGUEExEKACUCGwMGCwkIBwMCBhUIAgkKCwQWAgMB Ah4BAheABQJT9a+bAhkBAAoJEOzw6QssFyCDIfkAnipxGxSmdmjVmbcHHykfNsAEJ2bvAJ47 cIgMc4xPafu4R6+g1FXMlGhDiLkBDQQ86h0kEAQAgnnpxiAEyPMbrmBFl+EPukQ+vAmPHsWJ R4ASroOK5IzRbvkuxY4Qs5JcgieLcXS3xByPK6k7x+ep0E/0kQLOKHk8hiaEcR/jrzitEjCR rknbnoDRD0esEoXYCXLBJnnqmxrmY1sWvae/W4g/a3llwhIRaxo8AGQyzAyb6FgLvmsAAwYD /jrEYR09a/j3g9rVgP8dsADIH3jxtnxCNkEINAWbchCvjQQOblhWWU0FKjtjDxjsanwCj5Zg QRPrSQQG0BNeviM1yWfg1L9SYZVfv29ryQw9znMBCWiJPvyEKQ5BkcLXnr3UcQ036mkSNdV2 w2MDOLtmiT048clx8V4lfT+vcK5kiEYEGBECAAYFAjzqHSQACgkQ7PDpCywXIINCNgCgxAU2 CBSYytZ08F0WHxxMeInrYi0An2zFJGYtLghVu9Q0P8Okqu2blMIC Message-ID: <285e9e26-a2fb-e882-c4bf-ce66e3814870@gmail.com> Date: Tue, 27 Aug 2019 11:21:04 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908270001.x7R01vUB052426@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46HhfM3P6Yz4bBK X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.91)[-0.906,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 08:21:15 -0000 On 27/08/2019 03:01, John Baldwin wrote: > Author: jhb > Date: Tue Aug 27 00:01:56 2019 > New Revision: 351522 > URL: https://svnweb.freebsd.org/changeset/base/351522 > > Log: > Add kernel-side support for in-kernel TLS. > [...] > This patch is the culmination of years of work by several folks > including Scott Long and Randall Stewart for the original design and > implementation; Drew Gallatin for several optimizations including the > use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records > awaiting software encryption, and pluggable software crypto backends; > and John Baldwin for modifications to support hardware TLS offload. > This is super-cool, gentlemen! My congratulations with great job done. -- Maxim Konovalov From owner-svn-src-all@freebsd.org Tue Aug 27 08:28:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F72CCFDCF; Tue, 27 Aug 2019 08:28:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hhpv3gPjz4bmk; Tue, 27 Aug 2019 08:28:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FC401BF08; Tue, 27 Aug 2019 08:28:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R8SdEM055387; Tue, 27 Aug 2019 08:28:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R8Sdmh055386; Tue, 27 Aug 2019 08:28:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908270828.x7R8Sdmh055386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 27 Aug 2019 08:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351542 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 08:28:39 -0000 Author: kib Date: Tue Aug 27 08:28:38 2019 New Revision: 351542 URL: https://svnweb.freebsd.org/changeset/base/351542 Log: vn_vget_ino_gen(): relock the lower vnode on error. The function' interface assumes that the lower vnode is passed and returned locked always. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Aug 27 07:17:31 2019 (r351541) +++ head/sys/kern/vfs_vnops.c Tue Aug 27 08:28:38 2019 (r351542) @@ -2097,7 +2097,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, VOP_UNLOCK(vp, 0); error = alloc(mp, alloc_arg, lkflags, rvp); vfs_unbusy(mp); - if (*rvp != vp) + if (error != 0 || *rvp != vp) vn_lock(vp, ltype | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { if (error == 0) { From owner-svn-src-all@freebsd.org Tue Aug 27 09:20:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7565ED0FAD; Tue, 27 Aug 2019 09:20:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HjyB2S5fz4f14; Tue, 27 Aug 2019 09:20:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 359271C7F7; Tue, 27 Aug 2019 09:20:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7R9K2CA085225; Tue, 27 Aug 2019 09:20:02 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7R9K1jJ085222; Tue, 27 Aug 2019 09:20:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201908270920.x7R9K1jJ085222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 27 Aug 2019 09:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351543 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 351543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 09:20:02 -0000 Author: mmel Date: Tue Aug 27 09:20:01 2019 New Revision: 351543 URL: https://svnweb.freebsd.org/changeset/base/351543 Log: Add support for RK3288 into existing RockChip drivers. This patch ensures only minimal level of compatibility necessary to boot on RK3288 based boards. GPIO and pinctrl interaction, missing in current implementation, will be improved by own patch in the near future. MFC after: 2 weeks MFC with: r351452 Modified: head/sys/arm64/rockchip/if_dwc_rk.c head/sys/arm64/rockchip/rk_gpio.c head/sys/arm64/rockchip/rk_grf.c Modified: head/sys/arm64/rockchip/if_dwc_rk.c ============================================================================== --- head/sys/arm64/rockchip/if_dwc_rk.c Tue Aug 27 08:28:38 2019 (r351542) +++ head/sys/arm64/rockchip/if_dwc_rk.c Tue Aug 27 09:20:01 2019 (r351543) @@ -65,6 +65,13 @@ __FBSDID("$FreeBSD$"); #define RK3328_GRF_MACPHY_CON3 0x0B0C #define RK3328_GRF_MACPHY_STATUS 0x0B10 +static struct ofw_compat_data compat_data[] = { + {"rockchip,rk3288-gmac", 1}, + {"rockchip,rk3328-gmac", 1}, + {"rockchip,rk3399-gmac", 1}, + {NULL, 0} +}; + #ifdef notyet static void rk3328_set_delays(struct syscon *grf, phandle_t node) @@ -117,8 +124,7 @@ if_dwc_rk_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!(ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac") || - ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac"))) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Rockchip Gigabit Ethernet Controller"); Modified: head/sys/arm64/rockchip/rk_gpio.c ============================================================================== --- head/sys/arm64/rockchip/rk_gpio.c Tue Aug 27 08:28:38 2019 (r351542) +++ head/sys/arm64/rockchip/rk_gpio.c Tue Aug 27 09:20:01 2019 (r351543) @@ -50,8 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "opt_soc.h" - #include "gpio_if.h" #define RK_GPIO_SWPORTA_DR 0x00 /* Data register */ @@ -196,6 +194,7 @@ rk_gpio_pin_max(device_t dev, int *maxpin) { /* Each bank have always 32 pins */ + /* XXX not true*/ *maxpin = 32; return (0); } @@ -225,6 +224,7 @@ rk_gpio_pin_getflags(device_t dev, uint32_t pin, uint3 sc = device_get_softc(dev); + /* XXX Combine this with parent (pinctrl) */ RK_GPIO_LOCK(sc); reg = RK_GPIO_READ(sc, RK_GPIO_SWPORTA_DDR); RK_GPIO_UNLOCK(sc); @@ -242,6 +242,7 @@ rk_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32 { /* Caps are managed by the pinctrl device */ + /* XXX Pass this to parent (pinctrl) */ *caps = 0; return (0); } @@ -254,6 +255,7 @@ rk_gpio_pin_setflags(device_t dev, uint32_t pin, uint3 sc = device_get_softc(dev); + /* XXX Combine this with parent (pinctrl) */ RK_GPIO_LOCK(sc); reg = RK_GPIO_READ(sc, RK_GPIO_SWPORTA_DDR); @@ -394,6 +396,14 @@ rk_gpio_map_gpios(device_t bus, phandle_t dev, phandle return (0); } +static phandle_t +rk_gpio_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the GPIO bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + static device_method_t rk_gpio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rk_gpio_probe), @@ -414,6 +424,9 @@ static device_method_t rk_gpio_methods[] = { DEVMETHOD(gpio_pin_config_32, rk_gpio_pin_config_32), DEVMETHOD(gpio_map_gpios, rk_gpio_map_gpios), + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, rk_gpio_get_node), + DEVMETHOD_END }; @@ -425,5 +438,10 @@ static driver_t rk_gpio_driver = { static devclass_t rk_gpio_devclass; +/* + * GPIO driver is always a child of rk_pinctrl driver and should be probed + * and attached within rk_pinctrl_attach function. Due to this, bus pass order + * must be same as bus pass order of rk_pinctrl driver. + */ EARLY_DRIVER_MODULE(rk_gpio, simplebus, rk_gpio_driver, - rk_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); + rk_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm64/rockchip/rk_grf.c ============================================================================== --- head/sys/arm64/rockchip/rk_grf.c Tue Aug 27 08:28:38 2019 (r351542) +++ head/sys/arm64/rockchip/rk_grf.c Tue Aug 27 09:20:01 2019 (r351543) @@ -44,16 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "opt_soc.h" - static struct ofw_compat_data compat_data[] = { -#ifdef SOC_ROCKCHIP_RK3328 + {"rockchip,rk3288-grf", 1}, {"rockchip,rk3328-grf", 1}, -#endif -#ifdef SOC_ROCKCHIP_RK3399 {"rockchip,rk3399-grf", 1}, {"rockchip,rk3399-pmugrf", 1}, -#endif {NULL, 0} }; From owner-svn-src-all@freebsd.org Tue Aug 27 09:56:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91FE6D188C; Tue, 27 Aug 2019 09:56:40 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HkmR4Yqhz3BtS; Tue, 27 Aug 2019 09:56:39 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm1-x341.google.com with SMTP id i63so2324700wmg.4; Tue, 27 Aug 2019 02:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:cc:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=WK0lKMqesdW4pxEf2rIAmFAaCc0uJnbzqMsYYTMVE6o=; b=B523OmJL/V+dhMxSN0xAGJEJKYk6jAEu1bsnQWXbNgb+hFbAm9jrd5Q6jg7d3uVU9O e0Fm2cPEMVbSKqG6LIR9J6Qb7SzOvWc1myuhShSQpLKwqEBw5n6LAIV34nPaIembV4Tg NfebPoMvX5ahC+0soOdao4N34LRsV4IhDWok6xOX24YllrlkGjsROGs/l1Wev/J5ZMB4 osTuc19luKnFbuSMfpPFDvLOcGzC/5aV5ncEj43y/GAM+B658OQ28YvvINHqORc1ivQT qYQTXwfhj0qZ6FnatV9FEhAK/jxlk5zAApwLGQrln5w+9WH0318LRP9XLw/MnIE4nUqf 3G8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:cc:references :openpgp:autocrypt:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=WK0lKMqesdW4pxEf2rIAmFAaCc0uJnbzqMsYYTMVE6o=; b=Q9HQTdfAQIVrSHENUlSG0MPJdrcwbnlUfh96FLWl2LKKHhlN9PSEq9Nr+BCPTsi/HG cX+RdebNQSFuFxSZww2h/RiKC0qgDQYzw1LjqIUrD683lf9KLK1Lk9wvGtmupeJOMgto nqhNBeMq95/EN2tqVElTS9qj2oodvO5oNfoSTqhZzMm87iiZXWiw5grPebaEgB7kNqB9 1NqRIv2+I1c5f+BDAm1ksoMDGQJ7gFoh870+d1edpHabZ1Vk7FCfzrkxFrZp+ZUfpsw2 sehCrfN5TISaP9HW62jDBWbMid6brelWeZgKiU3s4HBHprT0QRuXutaKVb54x2cjeQCG G8UA== X-Gm-Message-State: APjAAAUu/Jc2Rp4cDEWexe20EoaUmDYI3McVZFdd/zd1DxExJZBqbDFx sWHaOzmSEdJg08ledniMnrxZp4/G X-Google-Smtp-Source: APXvYqxhuEbb5cPU+3GaWQNOx7jsFi+MMX9KLsTT7iEQZHSUipT64MywEnpRMEbFXHnAGyWEW5EOZQ== X-Received: by 2002:a1c:4383:: with SMTP id q125mr9190881wma.16.1566899796803; Tue, 27 Aug 2019 02:56:36 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id 91sm48168093wrp.3.2019.08.27.02.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Aug 2019 02:56:36 -0700 (PDT) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r351187 - head/sys/arm64/rockchip To: Peter Jeremy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908180919.x7I9JXGj021325@repo.freebsd.org> <20190825072844.GA4799@server.rulingia.com> Openpgp: preference=signencrypt Autocrypt: addr=mmel@freebsd.org; prefer-encrypt=mutual; keydata= mQENBFYuVRkBCADZiwLCCne3wG9b9k+R2Neo5zVo2bLaZRfNNY/v9kg283i0sb1Da4EdEiNT 15El5UyozhphUIbIR/zrVpxF1TvvFdoCyzx6a68bNY2d9dBrDcNDZC+XnyDdHQoobN87DWT1 mRVkmbg9LHZ/SVUOkGYuWyE+8UYeDAcUizuXwSK5zFWmeTyIoWNa68ifrWLfQe0p4x5jC/AI VURCi17p360vU4fhgwoMvEEhrRBWCr4DYHToFjIt2WdBy3GR1qoO0+Xkd6G+OoBULo+XDfgu L2WdPvh0K69F9/LgHkMmG5Il7SCe62QGpG2vaCgRV7BQhLX+kxlvM+WrdRatWRml4Y/3ABEB AAG0IE1pY2hhbCBNZWxvdW4gPG1tZWxAZnJlZWJzZC5vcmc+iQFXBBMBCgBBAhsDBQsJCAcD BRUKCQgLBRYDAgEAAh4BAheAAhkBFiEEAN1KEEuAn+Apg413aR6ya17FqqoFAlw3aO8FCQ9v FVYACgkQaR6ya17FqqrIFwf/V/NRuAutw1cZ/HRCwfp00KY+8g730KwOaAMhPYvq8tqf8krD whFRWt9s4DSVTVJUC2dRZa5g1MS77iQL/WWzBUhJj7rW4uMpcKpi7UXi060sKrnE+1ZBvanG 8YCMTHKxQgQDD0cBqsyOAfrSA+Pyya3/HyAh1vvjQZfu5vWxA1X5NX5l5KtonprJ+ybVacwO W34yfWSX+ncx089JpUknenGdI+gVoKfa6uh/8YiCZTI5poxBttrOB8NGfylTsTTTbw2pkire Vkc87qq++I9bBNtTqWOZjB/3KBUd4q1veEUa4MS63TWtAvcEcsxHiBv4AH6npPO/iPycuGGh qldT1LkBDQRWLlUZAQgAuqBGR9LbUP86pYT2Zd+HZsiOun24LxPQwK6KZuysB0so02isa7ac T6t5uBfyfmdgzfvsc6dqU8bI65e8JtDwwVVF1Y4fF6cmNcmJqU10Gw5/bAu9re9JJWx2g/OJ tYMhwmqEE5DcS6GwgvJZI+9hgoSLL3mZ+GsO25NM4BhVH1o1AE4Q3O0HZMMnIzH+pma0augZ Xc3Qep17/Occ+1A7xEbn8VAYx8cwjkYUy7JyvVx4ecuj+i+uoCXhNhX5QdIcn4UMT1233Bcd yVZtZsLTI26ByFmrquGjkmN+/hra/s+nKfcegOKeHWVY/uFgDRk0TEYd6QuddZWo7+XMZLps wQARAQABiQElBBgBCgAPAhsMBQJZjBHDBQkHICOqAAoJEGkesmtexaqquysH/iDgRIrlMvFT GLyktZws/K/C03gWZ/tWwJV5+SFqRoasM+Z+9+cb44XA3rReqieLsYF5qSXTXHBPhEg1+9V9 KEPLpwektLtAv8zynN+6VVffwyRWQ4PIZmHCMT6PJP+Rk0DU6VrDc3ch58erduuyRDsbh32g 96nYMNvDsLhDvq44GPHLfglUHRY6wHo3IxAH2HosaWNC10R13JSrCdFnPMeIa+nSE+11hAdB mWpuPgVX2VNErtrwSBr7LsyCZ4yLO0bN5fKM0/Tavc9EcI9qDBrnts/EfZoCHhDtTMEFnQZM ybsMso20I/nxYPFuWuuFn7uQeoYrwWxt15SkN0RgtV2JATwEGAEKACYCGwwWIQQA3UoQS4Cf 4CmDjXdpHrJrXsWqqgUCXDdpmwUJD28WAgAKCRBpHrJrXsWqqtOrB/9Okk/dm2/mAs3tbA6l lKOZAwfUwBonwG7YhK9dOb5No/bJoY8G9s2IVXqwWKqCDv1qKC4M8pMXPD9fVsfNPG8GA1GZ rpZoZxHFteXZHoE1grpWypE0T3hp1W0hQNWXKv0MSuEMRVKU1m/iyLa10X7q8BaKtEDs35Xf DCh7eVg1vqiKtWyFn1u+y9Gy1Ztc/SKTs8mQvMYNUdBZuV6vN0VSz3I6wD9HVfo6Eo3M7cVp qqQ+KhrrGiCCYQPfZwpFAJSSgV3bR5O0BlNaGKJOoVTV1yexRbVEStswiFP8JFQp6U+S3nqE FFob7daQBLxi80oUVRn6eEdzR8tBhIy7sbeD Message-ID: <6da78585-2bc7-0228-e443-799643d08783@freebsd.org> Date: Tue, 27 Aug 2019 11:56:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190825072844.GA4799@server.rulingia.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46HkmR4Yqhz3BtS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=B523OmJL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of melounmichal@gmail.com designates 2a00:1450:4864:20::341 as permitted sender) smtp.mailfrom=melounmichal@gmail.com X-Spamd-Result: default: False [-3.95 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[mmel@freebsd.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (3.09), ipnet: 2a00:1450::/32(-3.00), asn: 15169(-2.33), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 09:56:40 -0000 On 25.08.2019 9:28, Peter Jeremy wrote: > On 2019-Aug-18 09:19:33 +0000, Michal Meloun > wrote: >> Improve rk_pinctrl driver: > > Sorry for the late notice but this breaks my Rock64 (RK3328). > Sorry for late response. Seems like this is caused by unnoticed dependency between patches in my worktree, sorry for this. I hope that r351543 solves it. Can you, please, try r351543 on Rock64 because I haven't any rk3328 based board for real test? Thanks Michal > I'm using: U-Boot 2017.09-rockchip-ayufan-1035-gd646df03ac (Oct 26 > 2018 - 08:36:01 +0000) > > At r351452, the kernel boot looks like: ... gic0: Interrupt Controller> mem > 0xff811000-0xff811fff,0xff812000-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff > irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer > 0x43b irqs 160 rk_pinctrl0: on > ofwbus0 rk_pinctrl0: Cannot attach GPIO subdevice: gpio0@ff210000 > rk_pinctrl0: Cannot attach GPIO subdevice: gpio1@ff220000 > rk_pinctrl0: Cannot attach GPIO subdevice: gpio2@ff230000 > rk_pinctrl0: Cannot attach GPIO subdevice: gpio3@ff240000 panic: > acquiring blockable sleep lock with spinlock or critical section > held (sleep mutex) pmap @ /usr/src/sys/arm64/arm64/pmap.c:5819 > cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self() at > db_trace_self_wrapper+0x28 pc = 0xffff00000054c9ac lr = > 0xffff0000000e2908 sp = 0xffff000000010100 fp = > 0xffff000000010310 > > db_trace_self_wrapper() at vpanic+0x18c pc = 0xffff0000000e2908 lr > = 0xffff00000027e848 sp = 0xffff000000010320 fp = > 0xffff0000000103c0 > > vpanic() at panic+0x44 pc = 0xffff00000027e848 lr = > 0xffff00000027e5f8 sp = 0xffff0000000103d0 fp = > 0xffff000000010450 > > panic() at witness_checkorder+0xa80 pc = 0xffff00000027e5f8 lr = > 0xffff0000002e5348 sp = 0xffff000000010460 fp = > 0xffff0000000104d0 > > witness_checkorder() at __mtx_lock_flags+0xb0 pc = > 0xffff0000002e5348 lr = 0xffff00000025e574 sp = 0xffff0000000104e0 > fp = 0xffff000000010520 > > __mtx_lock_flags() at pmap_fault+0x1bc pc = 0xffff00000025e574 lr > = 0xffff000000566c00 sp = 0xffff000000010530 fp = > 0xffff000000010550 > > pmap_fault() at data_abort+0xc0 pc = 0xffff000000566c00 lr = > 0xffff000000568a68 sp = 0xffff000000010560 fp = > 0xffff000000010610 > > data_abort() at do_el1h_sync+0x128 pc = 0xffff000000568a68 lr = > 0xffff0000005688a4 sp = 0xffff000000010620 fp = > 0xffff000000010650 > > do_el1h_sync() at handle_el1h_sync+0x74 pc = 0xffff0000005688a4 lr > = 0xffff00000054f074 sp = 0xffff000000010660 fp = > 0xffff000000010770 > > handle_el1h_sync() at simple_mfd_syscon_modify_4+0x60 pc = > 0xffff00000054f074 lr = 0xffff0000000fd334 sp = 0xffff000000010780 > fp = 0xffff000000010830 > > simple_mfd_syscon_modify_4() at rk_pinctrl_configure_pins+0x1b4 pc > = 0xffff0000000fd334 lr = 0xffff0000005795fc sp = > 0xffff000000010840 fp = 0xffff0000000108c0 > > rk_pinctrl_configure_pins() at pinctrl_configure_children+0x120 pc > = 0xffff0000005795fc lr = 0xffff0000000fc4dc sp = > 0xffff0000000108d0 fp = 0xffff000000010950 > > pinctrl_configure_children() at fdt_pinctrl_configure_tree+0x20 pc > = 0xffff0000000fc4dc lr = 0xffff0000000fc3a8 sp = > 0xffff000000010960 fp = 0xffff000000010970 > > fdt_pinctrl_configure_tree() at rk_pinctrl_attach+0x310 pc = > 0xffff0000000fc3a8 lr = 0xffff000000579414 sp = 0xffff000000010980 > fp = 0xffff0000000109e0 > > rk_pinctrl_attach() at device_attach+0x3f4 pc = 0xffff000000579414 > lr = 0xffff0000002b3f18 sp = 0xffff0000000109f0 fp = > 0xffff000000010a40 > > device_attach() at bus_generic_new_pass+0x12c pc = > 0xffff0000002b3f18 lr = 0xffff0000002b5ccc sp = 0xffff000000010a50 > fp = 0xffff000000010a80 > > bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc = > 0xffff0000002b5ccc lr = 0xffff0000002b5c84 sp = 0xffff000000010a90 > fp = 0xffff000000010ac0 > > bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc = > 0xffff0000002b5c84 lr = 0xffff0000002b5c84 sp = 0xffff000000010ad0 > fp = 0xffff000000010b00 > > bus_generic_new_pass() at bus_set_pass+0x8c pc = 0xffff0000002b5c84 > lr = 0xffff0000002b1674 sp = 0xffff000000010b10 fp = > 0xffff000000010b40 > > bus_set_pass() at mi_startup+0x238 pc = 0xffff0000002b1674 lr = > 0xffff000000217b50 sp = 0xffff000000010b50 fp = > 0xffff000000010bb0 > > mi_startup() at virtdone+0x54 pc = 0xffff000000217b50 lr = > 0xffff000000001084 sp = 0xffff000000010bc0 fp = > 0x0000000000000000 ---- > > When I revert r351187, I get: ... gic0: Controller> mem > 0xff811000-0xff811fff,0xff812000-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff > irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer > 0x43b irqs 160 rk_pinctrl0: on > ofwbus0 rk_i2c0: mem 0xff160000-0xff160fff irq 16 on > ofwbus0 iicbus0: on rk_i2c0 gpio0: Bank controller> mem 0xff210000-0xff2100ff irq 51 on rk_pinctrl0 > gpiobus0: on gpio0 gpio1: controller> mem 0xff220000-0xff2200ff irq 52 on rk_pinctrl0 > gpiobus1: on gpio1 gpio2: controller> mem 0xff230000-0xff2300ff irq 53 on rk_pinctrl0 > gpiobus2: on gpio2 gpio3: controller> mem 0xff240000-0xff2400ff irq 54 on rk_pinctrl0 > gpiobus3: on gpio3 rk805_pmu0: at > addr 0x30 irq 55 on iicbus0 ... > > I haven't dug into this further yet. > From owner-svn-src-all@freebsd.org Tue Aug 27 11:46:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BB4CD3432; Tue, 27 Aug 2019 11:46:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HnC505krz3HLk; Tue, 27 Aug 2019 11:46:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA6F31E35E; Tue, 27 Aug 2019 11:46:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RBkO4o079468; Tue, 27 Aug 2019 11:46:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RBkNAu079456; Tue, 27 Aug 2019 11:46:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908271146.x7RBkNAu079456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 27 Aug 2019 11:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351544 - in head: lib/msun/man share/man/man3 sys/sys tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: lib/msun/man share/man/man3 sys/sys tests/sys/sys X-SVN-Commit-Revision: 351544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 11:46:25 -0000 Author: trasz Date: Tue Aug 27 11:46:22 2019 New Revision: 351544 URL: https://svnweb.freebsd.org/changeset/base/351544 Log: Introduce , a fixed-point math library from Netflix.
 This makes it possible to perform mathematical operations
on fractional values without using floating point. It operates on Q numbers, which are integer-sized, opaque structures initialized to hold a chosen number of integer and fractional
bits.
 For a general description of the Q number system, see the "Fixed Point Representation & Fractional Math" whitepaper[1]; for the actual API see the qmath(3) man page. This is one of dependencies for the upcoming stats(3) framework[2] that will be applied to the TCP stack in a later commit. 1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf 2. https://reviews.freebsd.org/D20477 Reviewed by: bcr (man pages, earlier version), sef (earlier version) Discussed with: cem, dteske, imp, lstewart Sponsored By: Klara Inc, Netflix Obtained from: Netflix Differential Revision: https://reviews.freebsd.org/D20116 Added: head/share/man/man3/Q_FRAWMASK.3 (contents, props changed) head/share/man/man3/Q_IFRAWMASK.3 (contents, props changed) head/share/man/man3/Q_INI.3 (contents, props changed) head/share/man/man3/Q_IRAWMASK.3 (contents, props changed) head/share/man/man3/Q_QABS.3 (contents, props changed) head/share/man/man3/Q_QADDI.3 (contents, props changed) head/share/man/man3/Q_QADDQ.3 (contents, props changed) head/share/man/man3/Q_SIGNED.3 (contents, props changed) head/share/man/man3/Q_SIGNSHFT.3 (contents, props changed) head/share/man/man3/qmath.3 (contents, props changed) head/sys/sys/qmath.h (contents, props changed) head/tests/sys/sys/qmath_test.c (contents, props changed) Modified: head/lib/msun/man/math.3 head/share/man/man3/Makefile head/tests/sys/sys/Makefile Modified: head/lib/msun/man/math.3 ============================================================================== --- head/lib/msun/man/math.3 Tue Aug 27 09:20:01 2019 (r351543) +++ head/lib/msun/man/math.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -217,6 +217,7 @@ rarely, and then only in very-close-to-halfway cases. .Xr complex 3 , .Xr fenv 3 , .Xr ieee 3 , +.Xr qmath 3 , .Xr tgmath 3 .Sh HISTORY A math library with many of the present functions appeared in Modified: head/share/man/man3/Makefile ============================================================================== --- head/share/man/man3/Makefile Tue Aug 27 09:20:01 2019 (r351543) +++ head/share/man/man3/Makefile Tue Aug 27 11:46:22 2019 (r351544) @@ -13,6 +13,16 @@ MAN= assert.3 \ makedev.3 \ offsetof.3 \ ${PTHREAD_MAN} \ + Q_FRAWMASK.3 \ + Q_IFRAWMASK.3 \ + Q_INI.3 \ + Q_IRAWMASK.3 \ + Q_QABS.3 \ + Q_QADDI.3 \ + Q_QADDQ.3 \ + Q_SIGNED.3 \ + Q_SIGNSHFT.3 \ + qmath.3 \ queue.3 \ sigevent.3 \ siginfo.3 \ @@ -72,6 +82,68 @@ MLINKS+= fpgetround.3 fpgetmask.3 \ MLINKS+= makedev.3 major.3 \ makedev.3 minor.3 MLINKS+= ${PTHREAD_MLINKS} +MLINKS+= Q_FRAWMASK.3 Q_GFRAW.3 \ + Q_FRAWMASK.3 Q_GFABSVAL.3 \ + Q_FRAWMASK.3 Q_GFVAL.3 \ + Q_FRAWMASK.3 Q_SFVAL.3 +MLINKS+= Q_IFRAWMASK.3 Q_IFVALIMASK.3 \ + Q_IFRAWMASK.3 Q_IFVALFMASK.3 \ + Q_IFRAWMASK.3 Q_GIFRAW.3 \ + Q_IFRAWMASK.3 Q_GIFABSVAL.3 \ + Q_IFRAWMASK.3 Q_GIFVAL.3 \ + Q_IFRAWMASK.3 Q_SIFVAL.3 \ + Q_IFRAWMASK.3 Q_SIFVALS.3 +MLINKS+= Q_INI.3 Q_NCBITS.3 \ + Q_INI.3 Q_BT.3 \ + Q_INI.3 Q_TC.3 \ + Q_INI.3 Q_NTBITS.3 \ + Q_INI.3 Q_NFCBITS.3 \ + Q_INI.3 Q_MAXNFBITS.3 \ + Q_INI.3 Q_NFBITS.3 \ + Q_INI.3 Q_NIBITS.3 \ + Q_INI.3 Q_RPSHFT.3 \ + Q_INI.3 Q_ABS.3 \ + Q_INI.3 Q_MAXSTRLEN.3 \ + Q_INI.3 Q_TOSTR.3 \ + Q_INI.3 Q_SHL.3 \ + Q_INI.3 Q_SHR.3 \ + Q_INI.3 Q_DEBUG.3 \ + Q_INI.3 Q_DFV2BFV.3 +MLINKS+= Q_IRAWMASK.3 Q_GIRAW.3 \ + Q_IRAWMASK.3 Q_GIABSVAL.3 \ + Q_IRAWMASK.3 Q_GIVAL.3 \ + Q_IRAWMASK.3 Q_SIVAL.3 +MLINKS+= Q_QABS.3 Q_Q2D.3 \ + Q_QABS.3 Q_Q2F.3 +MLINKS+= Q_QADDI.3 Q_QDIVI.3 \ + Q_QADDI.3 Q_QMULI.3 \ + Q_QADDI.3 Q_QSUBI.3 \ + Q_QADDI.3 Q_QFRACI.3 \ + Q_QADDI.3 Q_QCPYVALI.3 +MLINKS+= Q_QADDQ.3 Q_QDIVQ.3 \ + Q_QADDQ.3 Q_QMULQ.3 \ + Q_QADDQ.3 Q_QSUBQ.3 \ + Q_QADDQ.3 Q_NORMPREC.3 \ + Q_QADDQ.3 Q_QMAXQ.3 \ + Q_QADDQ.3 Q_QMINQ.3 \ + Q_QADDQ.3 Q_QCLONEQ.3 \ + Q_QADDQ.3 Q_QCPYVALQ.3 +MLINKS+= Q_SIGNED.3 Q_LTZ.3 \ + Q_SIGNED.3 Q_PRECEQ.3 \ + Q_SIGNED.3 Q_QLTQ.3 \ + Q_SIGNED.3 Q_QLEQ.3 \ + Q_SIGNED.3 Q_QGTQ.3 \ + Q_SIGNED.3 Q_QGEQ.3 \ + Q_SIGNED.3 Q_QEQ.3 \ + Q_SIGNED.3 Q_QNEQ.3 \ + Q_SIGNED.3 Q_OFLOW.3 \ + Q_SIGNED.3 Q_RELPREC.3 +MLINKS+= Q_SIGNSHFT.3 Q_SSIGN.3 \ + Q_SIGNSHFT.3 Q_CRAWMASK.3 \ + Q_SIGNSHFT.3 Q_SRAWMASK.3 \ + Q_SIGNSHFT.3 Q_GCRAW.3 \ + Q_SIGNSHFT.3 Q_GCVAL.3 \ + Q_SIGNSHFT.3 Q_SCVAL.3 MLINKS+= queue.3 LIST_CLASS_ENTRY.3 \ queue.3 LIST_CLASS_HEAD.3 \ queue.3 LIST_EMPTY.3 \ Added: head/share/man/man3/Q_FRAWMASK.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_FRAWMASK.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,125 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_FRAWMASK 3 +.Os +.Sh NAME +.Nm Q_FRAWMASK , +.Nm Q_GFRAW , +.Nm Q_GFABSVAL , +.Nm Q_GFVAL , +.Nm Q_SFVAL +.Nd fixed-point math functions which manipulate the fractional data bits +.Sh SYNOPSIS +.In sys/qmath.h +.Ft ITYPE +.Fn Q_FRAWMASK "QTYPE q" +.Ft ITYPE +.Fn Q_GFRAW "QTYPE q" +.Ft ITYPE +.Fn Q_GFABSVAL "QTYPE q" +.Ft ITYPE +.Fn Q_GFVAL "QTYPE q" +.Ft QTYPE +.Fn Q_SFVAL "QTYPE q" "ITYPE fv" +.Sh DESCRIPTION +.Fn Q_FRAWMASK +returns a +.Fa q Ns -specific +bit mask for +.Fa q Ap s +fractional data bits. +.Pp +.Fn Q_GFRAW +returns +.Fa q Ap s +raw masked fractional data bits. +.Pp +.Fn Q_GFABSVAL +and +.Fn Q_GFVAL +return the absolute and real values of +.Fa q Ap s +fractional data bits respectively. +.Pp +.Fn Q_SFVAL +sets +.Fa q Ap s +fractional data bits to the value +.Fa fv . +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +The +.Fa ITYPE +refers to the +.Xr stdint 7 +integer types. +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_FRAWMASK , +.Fn Q_GFRAW , +.Fn Q_GFABSVAL +and +.Fn Q_GFVAL +return their respective values as integers of the same underlying ITYPE as +.Fa q . +.Pp +.Fn Q_SFVAL +returns the value of +.Fa q +post set. +.Sh SEE ALSO +.Xr errno 2 , +.Xr qmath 3 , +.Xr stdint 7 +.Sh HISTORY +The +.Xr qmath 3 +functions first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Xr qmath 3 +functions and this manual page were written by +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org +and sponsored by Netflix, Inc. Added: head/share/man/man3/Q_IFRAWMASK.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_IFRAWMASK.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,162 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_IFRAWMASK 3 +.Os +.Sh NAME +.Nm Q_IFRAWMASK , +.Nm Q_IFVALIMASK , +.Nm Q_IFVALFMASK , +.Nm Q_GIFRAW , +.Nm Q_GIFABSVAL , +.Nm Q_GIFVAL , +.Nm Q_SIFVAL , +.Nm Q_SIFVALS +.Nd fixed-point math functions which manipulate the combined integer/fractional +data bits +.Sh SYNOPSIS +.In sys/qmath.h +.Ft ITYPE +.Fn Q_IFRAWMASK "QTYPE q" +.Ft ITYPE +.Fn Q_IFVALIMASK "QTYPE q" +.Ft ITYPE +.Fn Q_IFVALFMASK "QTYPE q" +.Ft ITYPE +.Fn Q_GIFRAW "QTYPE q" +.Ft ITYPE +.Fn Q_GIFABSVAL "QTYPE q" +.Ft ITYPE +.Fn Q_GIFVAL "QTYPE q" +.Ft QTYPE +.Fn Q_SIFVAL "QTYPE q" "ITYPE ifv" +.Ft QTYPE +.Fn Q_SIFVALS "QTYPE q" "ITYPE iv" "ITYPE fv" +.Sh DESCRIPTION +.Fn Q_IFRAWMASK +returns a +.Fa q Ns -specific +bit mask for +.Fa q Ap s +combined integer and fractional data bits. +.Pp +.Fn Q_IFVALIMASK +and +.Fn Q_IFVALFMASK +return +.Fa q Ns -specific +bit masks for the integer and fractional bits of +.Fa q Ap s +combined integer and fractional data bits value, i.e., are applicable to the +values returned by +.Fn Q_GIFABSVAL +and +.Fn Q_GIFVAL . +.Pp +.Fn Q_GIFRAW +returns +.Fa q Ap s +raw masked integer/fractional data bits. +.Pp +.Fn Q_GIFABSVAL +and +.Fn Q_GIFVAL +return the absolute and real values of +.Fa q Ap s +integer/fractional data bits respectively. +.Pp +.Fn Q_SIFVAL +sets +.Fa q Ap s +combined integer/fractional data bits to the value +.Fa ifv , +whereas +.Fn Q_SIFVALS +independently sets +.Fa q Ap s +integer and fractional data bits to the separate values +.Fa iv +and +.Fa fv . +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +The +.Fa ITYPE +refers to the +.Xr stdint 7 +integer types. +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_IFRAWMASK , +.Fn Q_IFVALIMASK , +.Fn Q_IFVALFMASK , +.Fn Q_GIFABSVAL , +.Fn Q_GIFVAL , +.Fn Q_GIFRAW , +.Fn Q_GIFABSVAL +and +.Fn Q_GIFVAL +return their respective values as integers of the same underlying ITYPE as +.Fa q . +.Pp +.Fn Q_SIFVAL +and +.Fn Q_SIFVALS +return the value of +.Fa q +post change. +.Sh SEE ALSO +.Xr errno 2 , +.Xr qmath 3 , +.Xr stdint 7 +.Sh HISTORY +The +.Xr qmath 3 +functions first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Xr qmath 3 +functions and this manual page were written by +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org +and sponsored by Netflix, Inc. Added: head/share/man/man3/Q_INI.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_INI.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,261 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_INI 3 +.Os +.Sh NAME +.Nm Q_INI , +.Nm Q_NCBITS , +.Nm Q_BT , +.Nm Q_TC , +.Nm Q_NTBITS , +.Nm Q_NFCBITS , +.Nm Q_MAXNFBITS , +.Nm Q_NFBITS , +.Nm Q_NIBITS , +.Nm Q_RPSHFT , +.Nm Q_ABS , +.Nm Q_MAXSTRLEN , +.Nm Q_TOSTR , +.Nm Q_SHL , +.Nm Q_SHR , +.Nm Q_DEBUG +.Nd fixed-point math miscellaneous functions/variables +.Sh SYNOPSIS +.In sys/qmath.h +.Ft QTYPE +.Fn Q_INI "QTYPE *q" "ITYPE iv" "ITYPE dfv" "int rpshft" +.Fd Q_NCBITS +.Ft __typeof(q) +.Fn Q_BT "QTYPE q" +.Ft ITYPE +.Fn Q_TC "QTYPE q" "ITYPE v" +.Ft uint32_t +.Fn Q_NTBITS "QTYPE q" +.Ft uint32_t +.Fn Q_NFCBITS "QTYPE q" +.Ft uint32_t +.Fn Q_MAXNFBITS "QTYPE q" +.Ft uint32_t +.Fn Q_NFBITS "QTYPE q" +.Ft uint32_t +.Fn Q_NIBITS "QTYPE q" +.Ft uint32_t +.Fn Q_RPSHFT "QTYPE q" +.Ft NTYPE +.Fn Q_ABS "NTYPE n" +.Ft uint32_t +.Fn Q_MAXSTRLEN "QTYPE q" "int base" +.Ft char * +.Fn Q_TOSTR "QTYPE q" "int prec" "int base" "char *s" "int slen" +.Ft ITYPE +.Fn Q_SHL "QTYPE q" "ITYPE iv" +.Ft ITYPE +.Fn Q_SHR "QTYPE q" "ITYPE iv" +.Ft char *, ... +.Fn Q_DEBUG "QTYPE q" "char *prefmt" "char *postfmt" "incfmt" +.Ft ITYPE +.Fn Q_DFV2BFV "ITYPE dfv" "int nfbits" +.Sh DESCRIPTION +.Fn Q_INI +initialises a Q number with the supplied integral value +.Fa iv +and decimal fractional value +.Fa dfv , +with appropriate control bits based on the requested radix shift point +.Fa rpshft . +.Fa dfv +must be passed as a preprocessor literal to preserve leading zeroes. +.Pp +The +.Dv Q_NCBITS +defined constant specifies the number of reserved control bits, currently 3. +.Pp +.Fn Q_NTBITS , +.Fn Q_NFCBITS , +.Fn Q_MAXNFBITS , +.Fn Q_NFBITS +and +.Fn Q_NIBITS +return the +.Fa q Ns -specific +count of total, control-encoded fractional, maximum fractional, effective +fractional, and integer bits applicable to +.Fa q +respectively. +.Pp +.Fn Q_BT +returns the C data type of +.Fa q , +while +.Fn Q_TC +returns +.Fa v +type casted to the C data type of +.Fa q . +.Pp +.Fn Q_RPSHFT +returns the bit position of +.Fa q Ap s +binary radix point relative to bit zero. +.Pp +.Fn Q_ABS +returns the absolute value of any standard numeric type +.Pq that uses the MSB as a sign bit, but not Q numbers +passed in as +.Fa n . +The function is signed/unsigned type safe. +.Pp +.Fn Q_SHL +and +.Fn Q_SHR +return the integral value +.Fa v +left or right shifted by the appropriate amount for +.Fa q . +.Pp +.Fn Q_MAXSTRLEN +calculates the maximum number of characters that may be required to render the +C-string representation of +.Fa q +with numeric base +.Fa base . +.Pp +.Fn Q_TOSTR +renders the C-string representation of +.Fa q +with numeric base +.Fa base +and fractional precision +.Fa prec +into +.Fa s +which has an available capacity of +.Fa slen +characters. +.Fa base +must be in range +.Bq 2,16 . +Specifying +.Fa prec +as -1 renders the number's fractional component with maximum precision. +If +.Fa slen +is greater than zero but insufficient to hold the complete C-string, the '\\0' +C-string terminator will be written to +.Fa *s , +thereby returning a zero length C-string. +.Pp +.Fn Q_DEBUG +returns a format string and associated data suitable for printf-like rendering +of debugging information pertaining to +.Fa q . +If either +.Fa prefmt +and/or +.Fa postfmt +are specified, they are prepended and appended to the resulting format string +respectively. +The +.Fa incfmt +boolean specifies whether to include +.Pq Vt true +or exclude +.Pq Vt false +the raw format string itself in the debugging output. +.Pp +.Fn Q_DFV2BFV +converts decimal fractional value +.Fa dfv +to its binary-encoded representation with +.Fa nfbits +of binary precision. +.Fa dfv +must be passed as a preprocessor literal to preserve leading zeroes. +The returned value can be used to set a Q number's fractional bits, for example +using +.Fn Q_SFVAL . +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +The +.Fa ITYPE +refers to the +.Xr stdint 7 +integer types. +.Fa NTYPE +is used to refer to any numeric type and is therefore a superset of +.Fa QTYPE +and +.Fa ITYPE . +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_INI +returns the initialised Q number which can be used to chain initialise +additional Q numbers. +.Pp +.Fn Q_TOSTR +returns a pointer to the '\\0' C-string terminator appended to +.Fa s +after the rendered numeric data, or NULL on buffer overflow. +.Pp +.Fn Q_DFV2BFV +returns the binary-encoded representation of decimal fractional value +.Fa dfv +with +.Fa nfbits +of binary precision. +.Sh SEE ALSO +.Xr errno 2 , +.Xr qmath 3 , +.Xr stdint 7 +.Sh HISTORY +The +.Xr qmath 3 +functions first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Xr qmath 3 +functions and this manual page were written by +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org +and sponsored by Netflix, Inc. Added: head/share/man/man3/Q_IRAWMASK.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_IRAWMASK.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,125 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_IRAWMASK 3 +.Os +.Sh NAME +.Nm Q_IRAWMASK , +.Nm Q_GIRAW , +.Nm Q_GIABSVAL , +.Nm Q_GIVAL , +.Nm Q_SIVAL +.Nd fixed-point math functions which manipulate the integer data bits +.Sh SYNOPSIS +.In sys/qmath.h +.Ft ITYPE +.Fn Q_IRAWMASK "QTYPE q" +.Ft ITYPE +.Fn Q_GIRAW "QTYPE q" +.Ft ITYPE +.Fn Q_GIABSVAL "QTYPE q" +.Ft ITYPE +.Fn Q_GIVAL "QTYPE q" +.Ft QTYPE +.Fn Q_SIVAL "QTYPE q" "ITYPE iv" +.Sh DESCRIPTION +.Fn Q_IRAWMASK +returns a +.Fa q Ns -specific +bit mask for +.Fa q Ap s +integer data bits. +.Pp +.Fn Q_GIRAW +returns +.Fa q Ap s +raw masked integer data bits. +.Pp +.Fn Q_GIABSVAL +and +.Fn Q_GIVAL +return the absolute and real values of +.Fa q Ap s +integer data bits respectively. +.Pp +.Fn Q_SIVAL +sets +.Fa q Ap s +integer data bits to the value +.Fa iv . +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +The +.Fa ITYPE +refers to the +.Xr stdint 7 +integer types. +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_IRAWMASK , +.Fn Q_GIRAW , +.Fn Q_GIABSVAL +and +.Fn Q_GIVAL +return their respective values as integers of the same underlying ITYPE as +.Fa q . +.Pp +.Fn Q_SIVAL +returns the value of +.Fa q +post change. +.Sh SEE ALSO +.Xr errno 2 , +.Xr qmath 3 , +.Xr stdint 7 +.Sh HISTORY +The +.Xr qmath 3 +functions first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Xr qmath 3 +functions and this manual page were written by +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org +and sponsored by Netflix, Inc. Added: head/share/man/man3/Q_QABS.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_QABS.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,101 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_QABS 3 +.Os +.Sh NAME +.Nm Q_QABS , +.Nm Q_Q2S , +.Nm Q_Q2F +.Nd fixed-point math functions which operate on a single Q number +.Sh SYNOPSIS +.In sys/qmath.h +.Ft QTYPE +.Fn Q_QABS "QTYPE q" +.Ft double +.Fn Q_Q2D "QTYPE q" +.Ft float +.Fn Q_Q2F "QTYPE q" +.Sh DESCRIPTION +The +.Fn Q_QABS +function returns an absolute value representation of +.Fa q . +.Pp +The +.Fn Q_Q2D +and +.Fn Q_Q2F +functions return the double and float representations of +.Fa q +respectively. +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_QABS +function returns a QTYPE that is identical to that of +.Fa q . +.Pp +The +.Fn Q_Q2D +and +.Fn Q_Q2F +functions return the double and float representations of +.Fa q +respectively. +.Sh SEE ALSO +.Xr errno 2 , +.Xr qmath 3 , +.Xr stdint 7 +.Sh HISTORY +The +.Xr qmath 3 +functions first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Xr qmath 3 +functions and this manual page were written by +.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org +and sponsored by Netflix, Inc. Added: head/share/man/man3/Q_QADDI.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/Q_QADDI.3 Tue Aug 27 11:46:22 2019 (r351544) @@ -0,0 +1,134 @@ +.\" +.\" Copyright (c) 2018 Netflix, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification, immediately at the beginning of the file. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt Q_QADDI 3 +.Os +.Sh NAME +.Nm Q_QADDI , +.Nm Q_QDIVI , +.Nm Q_QMULI , +.Nm Q_QSUBI , +.Nm Q_QFRACI , +.Nm Q_QCPYVALI +.Nd fixed-point math functions which apply integers to a Q number +.Sh SYNOPSIS +.In sys/qmath.h +.Ft int +.Fn Q_QADDI "QTYPE *a" "ITYPE b" +.Ft int +.Fn Q_QDIVI "QTYPE *a" "ITYPE b" +.Ft int +.Fn Q_QMULI "QTYPE *a" "ITYPE b" +.Ft int +.Fn Q_QSUBI "QTYPE *a" "ITYPE b" +.Ft int +.Fn Q_QFRACI "QTYPE *q" "ITYPE n" "ITYPE d" +.Ft int +.Fn Q_QCPYVALI "QTYPE *q" "ITYPE i" +.Sh DESCRIPTION +The +.Fn Q_QADDI , +.Fn Q_QDIVI , +.Fn Q_QMULI +and +.Fn Q_QSUBI +functions add, divide, multiply or subtract +.Fa b +to/by/from +.Fa a +respectively, storing the result in +.Fa a . +.Pp +The +.Fn Q_QFRACI +function computes the fraction +.Fa n +divided by +.Fa d +and stores the fixed-point result in +.Fa q . +.Pp +The +.Fn Q_QCPYVALI +function overwrites +.Fa q Ap s +integer and fractional bits with the Q representation of integer value +.Fa i . +.Pp +All of those functions operate on +the following data types: +.Vt s8q_t , +.Vt u8q_t , +.Vt s16q_t , +.Vt u16q_t , +.Vt s32q_t , +.Vt u32q_t , +.Vt s64q_t , +and +.Vt u64q_t , +which are referred to generically as +.Fa QTYPE . +The +.Fa ITYPE +refers to the +.Xr stdint 7 +integer types. +.Pp +For more details, see +.Xr qmath 3 . +.Sh RETURN VALUES +.Fn Q_QADDI , +.Fn Q_QDIVI , +.Fn Q_QMULI , +.Fn Q_QSUBI , +.Fn Q_QFRACI +and *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 27 13:04:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECA93D584B for ; Tue, 27 Aug 2019 13:04:30 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HpxB1KXgz3MgJ for ; Tue, 27 Aug 2019 13:04:29 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x743.google.com with SMTP id 4so1647678qki.6 for ; Tue, 27 Aug 2019 06:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rhSXkYcEGIOYhxZZwncpguLsSegUw0Sf+2LU8IJPBdM=; b=O/P8X7rcGrtLk2N7aybp9RWmOcNdpuscGTxIPZ91oBIiZ0f8KcL3GSw4JdKpSZqubL Jg/oNVuLonvVpvL0aJtWAgyB1ZbP0XO7V3jxYeVpQx514XxB1V9CnDNc4QslkMMl75Gn yroFNg0YAKbtKDZmxxBZz/WR4uKJ8gg8DSpC1YwbaYneJlWSDTW57TKWh6ToHjLCnB3P MouCTA362pMRf1tilFHzBrIwhsSVkDj0b9o+bGe/xcV/rt7lcOh4/FXRE2Pn6Wu889VZ DHwVI6CpDIYZe//J4LwlJz0nGbmyIbAsrLEOO8kVPgmga1mX2Y33CbMFgoOMDICiwhw2 NhsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rhSXkYcEGIOYhxZZwncpguLsSegUw0Sf+2LU8IJPBdM=; b=N6l/cQr3u1BiSiLagHGKvHx/rZYtuLMMxI0l2OmuTodGaQILmiGuzZyIl/yvjk39sM nDyZvglAz3QlKynq3LzfbT/5GaPXJexlBFxEV7A8adYAlxMETQXeW2BPNi0+xSCR5NDs PchyjmwFSFeho+7NBjOrrzfMaJ6yt8Yx2fsGbV+jwSuhKRzftFe0JF0N27OzMqe0rI4i bLGgdiKl9SL0NVav6qMRQMzMgmo6VyRTdTGQZucDN+TYTY6/Po1jXFJzffj7cZGa/1WQ xg/Q3wxrIozkh+nw+u7Z2skopqKIqPHxHN4r6ghTtgHTsHVBjRn3JJ/ny/2RFCKM6+u3 nElA== X-Gm-Message-State: APjAAAW1GN4Xn2O1061bECR4+SoJ/O0RT3OPxkigcjky227DuzFahNV2 j0F2YDeoFsYlPvl5vbjaMJkXmw== X-Google-Smtp-Source: APXvYqyMZqnweXAsRDZ+5i/3AUX44jGaWLE9aFx2IZEzVvi2ep8C4rBmMUYVGuef42owAx50IonLDA== X-Received: by 2002:a37:4986:: with SMTP id w128mr21040709qka.417.1566911069133; Tue, 27 Aug 2019 06:04:29 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id o17sm1318676qkk.36.2019.08.27.06.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2019 06:04:28 -0700 (PDT) Date: Tue, 27 Aug 2019 09:04:27 -0400 From: Shawn Webb To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... Message-ID: <20190827130427.r27c6jswyxipkln5@mutt-hbsd> References: <201908270001.x7R01vUB052426@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xrquq2h6prvg2w7t" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 46HpxB1KXgz3MgJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=O/P8X7rc; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::743 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-5.54 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; RCVD_IN_DNSWL_NONE(0.00)[3.4.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.47)[ip: (2.88), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 13:04:31 -0000 --xrquq2h6prvg2w7t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2019 at 05:14:42PM -0700, John Baldwin wrote: > On 8/26/19 5:01 PM, John Baldwin wrote: > > Author: jhb > > Date: Tue Aug 27 00:01:56 2019 > > New Revision: 351522 > > URL: https://svnweb.freebsd.org/changeset/base/351522 > >=20 > > Log: > > Add kernel-side support for in-kernel TLS. >=20 > The length of the commit message notwithstanding, there is still quite a = bit > more work to do on this front. Making use of KTLS requires an SSL library > that understands the new functionality, and for the full performance gain > you want an application that makes use of SSL_sendfile. Netflix has both > of these in the form of patches to OpenSSL and nginx. I'm currently work= ing > on a patchset suitable for merging into upstream OpenSSL's master (the > Linux KTLS patches are merged into OpenSSL master already, so the FreeBSD > patches are fairly small). Hey John, Thanks a lot for working to get this in! I'm curious if there's any desire to help LibreSSL adopt same/similar patches as OpenSSL. Doing so would help LibreSSL on FreeBSD maintain feature parity with OpenSSL. I respect your opinion and would love to hear your thoughts. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --xrquq2h6prvg2w7t Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl1lKlYACgkQ/y5nonf4 4frT9g//VGyS24NrOsVpiCLanwZ2bHFqfLYRVb3Dq/+OnvoFM3CCYipVhw/HDfrh C7gWrAFJ+tWJA+Ctb0WowIuzGkXbDVvJ1m3OtO6Lt1Ad1Y0nWxa367D6Cpj/4EeV YjBFFch80iABSJ44Ld14vai4HL5/dxd5b2AFIO5d6wZQVy8IlJ3aCogAGhum3YpI ZUXYmsVmVHFIqjtXS2Nung+FFDNo4G7g0iD5Wm01yxqC3QJ38ieQhhZ/I1r1btNH t+8MxgxEs7N6I9TSqvrGIGuLy+HAe3Q6t050JBZqaCcYAWEAZLj+YRgAf4/UJqRg yOtwiNTLqvkW7xTXMt3HseFQevXGXSn2wrca6rLhIo1FxeHQDL23NQr6n3RtPVOG VChDc3Dfa5f8Tv2HZzRoECURnlzfLdHWx/+CTEfru0ieiRhokUJPtSNY02jhJCmc VgMTpRsbfQ2RYsnEVi54NjyCiTliX5g6QS2BQk+cSlV/ozaMbSRqzbS/9ikDu6TH RBGpwObkifKZxtupkO742oeUYGBb2JKY63SFzPRcYwmfffbS99sC5BwT4sQff1uh mVdBjS8fwQyIYU8RJ7ddOstxOOceHBGgFMq8EC8yTcY/wfzoOWMbFV0w38uz9r7M x8FayT2v3eNc1aqbGq0bA8DYJsNO47MyrFB7Qp8CDCJWMtxBm0M= =U8yI -----END PGP SIGNATURE----- --xrquq2h6prvg2w7t-- From owner-svn-src-all@freebsd.org Tue Aug 27 13:55:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE7D3D66DE; Tue, 27 Aug 2019 13:55:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hr4K5Xphz3Q61; Tue, 27 Aug 2019 13:55:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A14B31FB0E; Tue, 27 Aug 2019 13:55:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RDtjE7072138; Tue, 27 Aug 2019 13:55:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RDtj33072137; Tue, 27 Aug 2019 13:55:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908271355.x7RDtj33072137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 27 Aug 2019 13:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351545 - head/tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/tests/sys/sys X-SVN-Commit-Revision: 351545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 13:55:45 -0000 Author: trasz Date: Tue Aug 27 13:55:45 2019 New Revision: 351545 URL: https://svnweb.freebsd.org/changeset/base/351545 Log: Fix build on 32 bit archs. Modified: head/tests/sys/sys/qmath_test.c Modified: head/tests/sys/sys/qmath_test.c ============================================================================== --- head/tests/sys/sys/qmath_test.c Tue Aug 27 11:46:22 2019 (r351544) +++ head/tests/sys/sys/qmath_test.c Tue Aug 27 13:55:45 2019 (r351545) @@ -448,10 +448,10 @@ ATF_TC_BODY(qfraci_s64q, tc) maxe_dbl = fabs(1.0 / Q_NFBITS(a_s64q)); delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQFRACI(%ld / %ld): |%10f - %10f| = %10f " + "\tQFRACI(%jd / %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -495,10 +495,10 @@ ATF_TC_BODY(qmuli_s64q, tc) maxe_dbl = fabs((1.0 / Q_NFBITS(a_s64q)) * (double)b_int); delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQMULI(%ld * %ld): |%10f - %10f| = %10f " + "\tQMULI(%jd * %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)(intmax_t)a_int, b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -546,10 +546,10 @@ ATF_TC_BODY(qaddi_s64q, tc) #endif delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQADDI(%ld + %ld): |%10f - %10f| = %10f " + "\tQADDI(%jd + %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -594,10 +594,10 @@ ATF_TC_BODY(qsubi_s64q, tc) #endif delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQSUBI(%ld - %ld): |%10f - %10f| = %10f " + "\tQSUBI(%jd - %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } From owner-svn-src-all@freebsd.org Tue Aug 27 14:04:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5BEFD6AEB; Tue, 27 Aug 2019 14:04:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HrGS4sGZz3Qj4; Tue, 27 Aug 2019 14:04:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8882F1FCEC; Tue, 27 Aug 2019 14:04:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RE4WIK078960; Tue, 27 Aug 2019 14:04:32 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RE4W9a078959; Tue, 27 Aug 2019 14:04:32 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201908271404.x7RE4W9a078959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 27 Aug 2019 14:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351546 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 351546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 14:04:32 -0000 Author: jhibbits Date: Tue Aug 27 14:04:32 2019 New Revision: 351546 URL: https://svnweb.freebsd.org/changeset/base/351546 Log: Revert a part of r350883 that should never have gone in The wire_count change is not part of the unification, and doesn't even make sense. Reported by: markj Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Aug 27 13:55:45 2019 (r351545) +++ head/sys/powerpc/booke/pmap.c Tue Aug 27 14:04:32 2019 (r351546) @@ -2807,7 +2807,7 @@ retry: if (vm_page_pa_tryrelock(pmap, PTE_PA(pte), &pa)) goto retry; m = PHYS_TO_VM_PAGE(PTE_PA(pte)); - m->wire_count++; + vm_page_wire(m); } } From owner-svn-src-all@freebsd.org Tue Aug 27 14:06:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43601D6B74; Tue, 27 Aug 2019 14:06:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HrJq0zW5z3Qrd; Tue, 27 Aug 2019 14:06:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03CC81FCF3; Tue, 27 Aug 2019 14:06:35 +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 x7RE6YR7079323; Tue, 27 Aug 2019 14:06:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RE6Ynj079322; Tue, 27 Aug 2019 14:06:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908271406.x7RE6Ynj079322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 27 Aug 2019 14:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351547 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 14:06:35 -0000 Author: markj Date: Tue Aug 27 14:06:34 2019 New Revision: 351547 URL: https://svnweb.freebsd.org/changeset/base/351547 Log: Fix several logic issues in domainset_empty_vm(). - Don't add 1 to the result of DOMAINSET_FLS. - Do not modify domainsets containing only empty domains. - Always flatten a _PREFER policy to _ROUNDROBIN if the preferred domain is empty. Previously we were doing this only when ds_cnt > 1. These bugs could cause hangs during boot if a VM domain is empty. Tested by: hselasky Reviewed by: hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21420 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Tue Aug 27 14:04:32 2019 (r351546) +++ head/sys/kern/kern_cpuset.c Tue Aug 27 14:06:34 2019 (r351547) @@ -500,25 +500,31 @@ _domainset_create(struct domainset *domain, struct dom static bool domainset_empty_vm(struct domainset *domain) { - int i, j, max; + domainset_t empty; + int i, j; - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = 0; i < max; i++) - if (DOMAINSET_ISSET(i, &domain->ds_mask) && VM_DOMAIN_EMPTY(i)) - DOMAINSET_CLR(i, &domain->ds_mask); + DOMAINSET_ZERO(&empty); + for (i = 0; i < vm_ndomains; i++) + if (VM_DOMAIN_EMPTY(i)) + DOMAINSET_SET(i, &empty); + if (DOMAINSET_SUBSET(&empty, &domain->ds_mask)) + return (true); + + /* Remove empty domains from the set and recompute. */ + DOMAINSET_NAND(&domain->ds_mask, &empty); domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = j = 0; i < max; i++) { + for (i = j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++) if (DOMAINSET_ISSET(i, &domain->ds_mask)) domain->ds_order[j++] = i; - else if (domain->ds_policy == DOMAINSET_POLICY_PREFER && - domain->ds_prefer == i && domain->ds_cnt > 1) { - domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN; - domain->ds_prefer = -1; - } + + /* Convert a PREFER policy referencing an empty domain to RR. */ + if (domain->ds_policy == DOMAINSET_POLICY_PREFER && + DOMAINSET_ISSET(domain->ds_prefer, &empty)) { + domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN; + domain->ds_prefer = -1; } - return (DOMAINSET_EMPTY(&domain->ds_mask)); + return (false); } /* From owner-svn-src-all@freebsd.org Tue Aug 27 14:39:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 450BED776B; Tue, 27 Aug 2019 14:39:57 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay05.pair.com (relay05.pair.com [216.92.24.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hs3K14kmz3xj6; Tue, 27 Aug 2019 14:39:56 +0000 (UTC) (envelope-from pho@holm.cc) Received: from x8.osted.lan (87-58-223-204-dynamic.dk.customer.tdc.net [87.58.223.204]) by relay05.pair.com (Postfix) with ESMTP id B423A1A36D3; Tue, 27 Aug 2019 10:39:54 -0400 (EDT) Received: from x8.osted.lan (localhost [127.0.0.1]) by x8.osted.lan (8.15.2/8.15.2) with ESMTPS id x7REdrNZ005158 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 27 Aug 2019 16:39:53 +0200 (CEST) (envelope-from pho@x8.osted.lan) Received: (from pho@localhost) by x8.osted.lan (8.15.2/8.15.2/Submit) id x7REdrG5005157; Tue, 27 Aug 2019 16:39:53 +0200 (CEST) (envelope-from pho) Date: Tue, 27 Aug 2019 16:39:53 +0200 From: Peter Holm To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... Message-ID: <20190827143953.GA5092@x8.osted.lan> References: <201908270001.x7R01vUB052426@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908270001.x7R01vUB052426@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 46Hs3K14kmz3xj6 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.940,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 14:39:57 -0000 On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: > Author: jhb > Date: Tue Aug 27 00:01:56 2019 > New Revision: 351522 > URL: https://svnweb.freebsd.org/changeset/base/351522 > > Log: > Add kernel-side support for in-kernel TLS. > Could this be yours? 20190827 15:55:34 all (496/668): sendfile12.sh Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out of swap space panic: non-ext_pgs mbuf with TLS session cpuid = 9 time = 1566914176 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0307ef4820 vpanic() at vpanic+0x19d/frame 0xfffffe0307ef4870 panic() at panic+0x43/frame 0xfffffe0307ef48d0 sendfile_iodone() at sendfile_iodone+0x28e/frame 0xfffffe0307ef4920 vnode_pager_generic_getpages_done_async() at vnode_pager_generic_getpages_done_async+0x3a/frame 0xfffffe0307ef4940 bufdone() at bufdone+0x70/frame 0xfffffe0307ef49c0 g_io_deliver() at g_io_deliver+0x298/frame 0xfffffe0307ef4a10 md_kthread() at md_kthread+0x266/frame 0xfffffe0307ef4a70 fork_exit() at fork_exit+0x84/frame 0xfffffe0307ef4ab0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0307ef4ab0 https://people.freebsd.org/~pho/stress/log/mjguzik014.txt - Peter From owner-svn-src-all@freebsd.org Tue Aug 27 15:34:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEE39D88A2; Tue, 27 Aug 2019 15:34:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HtGP4dz9z41J3; Tue, 27 Aug 2019 15:34:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8139B20DA4; Tue, 27 Aug 2019 15:34:37 +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 x7RFYbCk039476; Tue, 27 Aug 2019 15:34:37 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RFYbxw039475; Tue, 27 Aug 2019 15:34:37 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908271534.x7RFYbxw039475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 27 Aug 2019 15:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351548 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 15:34:37 -0000 Author: asomers Date: Tue Aug 27 15:34:37 2019 New Revision: 351548 URL: https://svnweb.freebsd.org/changeset/base/351548 Log: ping: raise WARNS level to 6 Submitted by: Ján Sučan MFC after: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21405 Modified: head/sbin/ping/Makefile Modified: head/sbin/ping/Makefile ============================================================================== --- head/sbin/ping/Makefile Tue Aug 27 14:06:34 2019 (r351547) +++ head/sbin/ping/Makefile Tue Aug 27 15:34:37 2019 (r351548) @@ -9,7 +9,6 @@ SRCS= ping.c utils.c MAN= ping.8 BINOWN= root BINMODE=4555 -WARNS?= 3 LIBADD= m .if ${MK_DYNAMICROOT} == "no" From owner-svn-src-all@freebsd.org Tue Aug 27 15:42:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C86BD8B07; Tue, 27 Aug 2019 15:42:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HtR51JTTz41h6; Tue, 27 Aug 2019 15:42:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E19920E34; Tue, 27 Aug 2019 15:42:09 +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 x7RFg8Lp045410; Tue, 27 Aug 2019 15:42:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RFg8XN045409; Tue, 27 Aug 2019 15:42:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908271542.x7RFg8XN045409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 27 Aug 2019 15:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351549 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 15:42:09 -0000 Author: markj Date: Tue Aug 27 15:42:08 2019 New Revision: 351549 URL: https://svnweb.freebsd.org/changeset/base/351549 Log: Remove an extraneous + 1 in _domainset_create(). DOMAINSET_FLS, like our fls(), is 1-indexed. Reported by: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Tue Aug 27 15:34:37 2019 (r351548) +++ head/sys/kern/kern_cpuset.c Tue Aug 27 15:42:08 2019 (r351549) @@ -457,7 +457,7 @@ static struct domainset * _domainset_create(struct domainset *domain, struct domainlist *freelist) { struct domainset *ndomain; - int i, j, max; + int i, j; KASSERT(domain->ds_cnt <= vm_ndomains, ("invalid domain count in domainset %p", domain)); @@ -476,8 +476,7 @@ _domainset_create(struct domainset *domain, struct dom if (ndomain == NULL) { LIST_INSERT_HEAD(&cpuset_domains, domain, ds_link); domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = 0, j = 0; i < max; i++) + for (i = 0, j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++) if (DOMAINSET_ISSET(i, &domain->ds_mask)) domain->ds_order[j++] = i; } From owner-svn-src-all@freebsd.org Tue Aug 27 16:02:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76A95D90E7; Tue, 27 Aug 2019 16:02:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Httd2YFSz42g4; Tue, 27 Aug 2019 16:02:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C6D6E6D40; Tue, 27 Aug 2019 16:02:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... To: Peter Holm Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827143953.GA5092@x8.osted.lan> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> Date: Tue, 27 Aug 2019 09:02:31 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190827143953.GA5092@x8.osted.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 16:02:33 -0000 On 8/27/19 7:39 AM, Peter Holm wrote: > On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: >> Author: jhb >> Date: Tue Aug 27 00:01:56 2019 >> New Revision: 351522 >> URL: https://svnweb.freebsd.org/changeset/base/351522 >> >> Log: >> Add kernel-side support for in-kernel TLS. >> > > Could this be yours? > > 20190827 15:55:34 all (496/668): sendfile12.sh > Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out of swap space > panic: non-ext_pgs mbuf with TLS session Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it would trip over this assertion for any use-after-free. I see in gdb that you couldn't see sfio because of clang's poor debug info. It would be really good to try to find the contents of sfio to debug this further. You should be able to find it via 'bp->b_caller1' in frame 14: 'p *(struct sf_io *)bp->b_caller1' -- John Baldwin From owner-svn-src-all@freebsd.org Tue Aug 27 16:03:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F363D916B; Tue, 27 Aug 2019 16:03:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Htvx1MsWz42p7; Tue, 27 Aug 2019 16:03:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 869F16D41; Tue, 27 Aug 2019 16:03:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... To: Shawn Webb Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827130427.r27c6jswyxipkln5@mutt-hbsd> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <79fdf63c-b919-398b-a282-171146994b14@FreeBSD.org> Date: Tue, 27 Aug 2019 09:03:39 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190827130427.r27c6jswyxipkln5@mutt-hbsd> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 16:03:41 -0000 On 8/27/19 6:04 AM, Shawn Webb wrote: > On Mon, Aug 26, 2019 at 05:14:42PM -0700, John Baldwin wrote: >> On 8/26/19 5:01 PM, John Baldwin wrote: >>> Author: jhb >>> Date: Tue Aug 27 00:01:56 2019 >>> New Revision: 351522 >>> URL: https://svnweb.freebsd.org/changeset/base/351522 >>> >>> Log: >>> Add kernel-side support for in-kernel TLS. >> >> The length of the commit message notwithstanding, there is still quite a bit >> more work to do on this front. Making use of KTLS requires an SSL library >> that understands the new functionality, and for the full performance gain >> you want an application that makes use of SSL_sendfile. Netflix has both >> of these in the form of patches to OpenSSL and nginx. I'm currently working >> on a patchset suitable for merging into upstream OpenSSL's master (the >> Linux KTLS patches are merged into OpenSSL master already, so the FreeBSD >> patches are fairly small). > > Hey John, > > Thanks a lot for working to get this in! I'm curious if there's any > desire to help LibreSSL adopt same/similar patches as OpenSSL. Doing > so would help LibreSSL on FreeBSD maintain feature parity with > OpenSSL. I do not have any plans to implement the needed changes in other SSL implementations. Others are free to work on it however. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Aug 27 16:41:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A4C9D9D2D; Tue, 27 Aug 2019 16:41:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hvl71nzCz44PY; Tue, 27 Aug 2019 16:41:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F6BB218B8; Tue, 27 Aug 2019 16:41:07 +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 x7RGf7ct075850; Tue, 27 Aug 2019 16:41:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RGf6LC075849; Tue, 27 Aug 2019 16:41:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908271641.x7RGf6LC075849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 27 Aug 2019 16:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351550 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 351550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 16:41:07 -0000 Author: mav Date: Tue Aug 27 16:41:06 2019 New Revision: 351550 URL: https://svnweb.freebsd.org/changeset/base/351550 Log: Always check cam_periph_error() status for ERESTART. Even if we do not expect retries, we better be sure, since otherwise it may result in use after free kernel panic. I've noticed that it retries SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 15:42:08 2019 (r351549) +++ head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 16:41:06 2019 (r351550) @@ -1684,8 +1684,9 @@ probe_device_check: case PROBE_TUR_FOR_NEGOTIATION: case PROBE_DV_EXIT: if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { - cam_periph_error(done_ccb, 0, - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART) + goto outr; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ @@ -1735,8 +1736,9 @@ probe_device_check: struct ccb_scsiio *csio; if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { - cam_periph_error(done_ccb, 0, - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART) + goto outr; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ From owner-svn-src-all@freebsd.org Tue Aug 27 17:05:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35220DA75F; Tue, 27 Aug 2019 17:05:31 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay05.pair.com (relay05.pair.com [216.92.24.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46HwHH0d76z45nD; Tue, 27 Aug 2019 17:05:30 +0000 (UTC) (envelope-from pho@holm.cc) Received: from x8.osted.lan (87-58-223-204-dynamic.dk.customer.tdc.net [87.58.223.204]) by relay05.pair.com (Postfix) with ESMTP id 753D61A389A; Tue, 27 Aug 2019 13:05:29 -0400 (EDT) Received: from x8.osted.lan (localhost [127.0.0.1]) by x8.osted.lan (8.15.2/8.15.2) with ESMTPS id x7RH5SCv007146 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 27 Aug 2019 19:05:28 +0200 (CEST) (envelope-from pho@x8.osted.lan) Received: (from pho@localhost) by x8.osted.lan (8.15.2/8.15.2/Submit) id x7RH5R0P007145; Tue, 27 Aug 2019 19:05:27 +0200 (CEST) (envelope-from pho) Date: Tue, 27 Aug 2019 19:05:27 +0200 From: Peter Holm To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... Message-ID: <20190827170527.GA7111@x8.osted.lan> References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827143953.GA5092@x8.osted.lan> <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 46HwHH0d76z45nD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.940,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 17:05:31 -0000 On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote: > On 8/27/19 7:39 AM, Peter Holm wrote: > > On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: > >> Author: jhb > >> Date: Tue Aug 27 00:01:56 2019 > >> New Revision: 351522 > >> URL: https://svnweb.freebsd.org/changeset/base/351522 > >> > >> Log: > >> Add kernel-side support for in-kernel TLS. > >> > > > > Could this be yours? > > > > 20190827 15:55:34 all (496/668): sendfile12.sh > > Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out of swap space > > panic: non-ext_pgs mbuf with TLS session > > Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it > would trip over this assertion for any use-after-free. I see in gdb that you > couldn't see sfio because of clang's poor debug info. It would be really good > to try to find the contents of sfio to debug this further. > > You should be able to find it via 'bp->b_caller1' in frame 14: > > 'p *(struct sf_io *)bp->b_caller1' > Here's a repeat where the involved files are compiled with "-O0": https://people.freebsd.org/~pho/stress/log/jhb009.txt Let me know if you need the kernel + core. - Peter From owner-svn-src-all@freebsd.org Tue Aug 27 17:22:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E0EDDAD2F; Tue, 27 Aug 2019 17:22:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Hwfd3k3Qz46tB; Tue, 27 Aug 2019 17:22:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f47.google.com with SMTP id o11so6490740lfb.12; Tue, 27 Aug 2019 10:22:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tqXfSnjGDh5wtO+upAeU+Q7nNIkO+XsB+ek0IuZfdcw=; b=tP579vjHO4LGVoZbP+y4JnBMwYQYCM5+u1CCeNBdv+I8B3/blssRJvCBr8Flf/Ni4f wCdpXMc0cYJOJYycmoyrV9t0cFf7T6D63QmgB1ZDzX3yOfEDkUJP3F0o05kYsfWnG2EP /lnEgV9UgSqAM3fsghreqq5c3zA1iqGN1EA1IDTEEKHFV0eCL3MS/95Xw5dwrqF/Yp3b tQEOrdQ0Ns4Xx/elNWkRdZ4C0mGj76oEvrTe84rDZXmSfJfzp+6fgcpEKnNejbq7/CIt UmxvApow1a0rnzR7sgNAuWxizR2ZumvicUw+CsVLQm0e6hzLetb0uUMythzl72Yyvwdl /8vQ== X-Gm-Message-State: APjAAAUHCHqP2iCVEFHpVaacXD1qPVJHwc9LrAlD4wMKQdJkcsY9oF74 1FBNi8V4AWhgE21er2Odp8fE7rz1qyrxuRaXYnGBeKLFtpU= X-Google-Smtp-Source: APXvYqyQ2R7cQV4lLl3m0L6UrlRrcnB3sH/Vv+fgS0yHS1qXAfjvMxfI8y8TmGIs5jXRd6DN6pLivqJ1SG34GPeLqCg= X-Received: by 2002:ac2:51d0:: with SMTP id u16mr14967589lfm.178.1566926535407; Tue, 27 Aug 2019 10:22:15 -0700 (PDT) MIME-Version: 1.0 References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827143953.GA5092@x8.osted.lan> <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> <20190827170527.GA7111@x8.osted.lan> In-Reply-To: <20190827170527.GA7111@x8.osted.lan> From: Alan Somers Date: Tue, 27 Aug 2019 11:22:03 -0600 Message-ID: Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... To: Peter Holm Cc: John Baldwin , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46Hwfd3k3Qz46tB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Aug 2019 17:22:17 -0000 On Tue, Aug 27, 2019 at 11:05 AM Peter Holm wrote: > On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote: > > On 8/27/19 7:39 AM, Peter Holm wrote: > > > On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: > > >> Author: jhb > > >> Date: Tue Aug 27 00:01:56 2019 > > >> New Revision: 351522 > > >> URL: https://svnweb.freebsd.org/changeset/base/351522 > > >> > > >> Log: > > >> Add kernel-side support for in-kernel TLS. > > >> > > > > > > Could this be yours? > > > > > > 20190827 15:55:34 all (496/668): sendfile12.sh > > > Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was > killed: out of swap space > > > panic: non-ext_pgs mbuf with TLS session > > > > Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then > it > > would trip over this assertion for any use-after-free. I see in gdb > that you > > couldn't see sfio because of clang's poor debug info. It would be > really good > > to try to find the contents of sfio to debug this further. > > > > You should be able to find it via 'bp->b_caller1' in frame 14: > > > > 'p *(struct sf_io *)bp->b_caller1' > > > > Here's a repeat where the involved files are compiled with "-O0": > https://people.freebsd.org/~pho/stress/log/jhb009.txt > > Let me know if you need the kernel + core. > > - Peter > This panic is easily reproducible by the fusefs test suite. $ cd /usr/tests/sys/fs/fusefs/ $ ./read --gtest_filter=Read.sendfile panic: non-ext_pgs mbuf with TLS session cpuid = 3 time = 1566926504 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0050bdc560 vpanic() at vpanic+0x19d/frame 0xfffffe0050bdc5b0 panic() at panic+0x43/frame 0xfffffe0050bdc610 sendfile_iodone() at sendfile_iodone+0x28e/frame 0xfffffe0050bdc660 vn_sendfile() at vn_sendfile+0x1598/frame 0xfffffe0050bdc8f0 sendfile() at sendfile+0x127/frame 0xfffffe0050bdc980 amd64_syscall() at amd64_syscall+0x2b9/frame 0xfffffe0050bdcab0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0050bdcab0 --- syscall (393, FreeBSD ELF64, sys_sendfile), rip = 0x80052d9ea, rsp = 0x7fffffffe5a8, rbp = 0x7fffffffe790 --- -Alan From owner-svn-src-all@freebsd.org Tue Aug 27 17:59:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F551DB689; Tue, 27 Aug 2019 17:59:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HxTB1wx3z48W3; Tue, 27 Aug 2019 17:59:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE98226F7; Tue, 27 Aug 2019 17:59:10 +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 x7RHx9K1021541; Tue, 27 Aug 2019 17:59:09 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RHx9WL021540; Tue, 27 Aug 2019 17:59:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908271759.x7RHx9WL021540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 27 Aug 2019 17:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351551 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 351551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 17:59:10 -0000 Author: manu Date: Tue Aug 27 17:59:09 2019 New Revision: 351551 URL: https://svnweb.freebsd.org/changeset/base/351551 Log: arm64: rk3328: pinctrl: Add gpio banks and fix iomux Since r351187 the pinctrl driver need to know the gpio bank as it directly attach the gpio driver to handle some setup that might be present in the dts, add the gpio banks table for rk3328. While here fix some IOMUX definition that prevented to boot on RK3328 as pinctrl wasn't configured correctly. Submitted by: mmel (original version) MFC after: 2 weeks MFC With: r351187 Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c ============================================================================== --- head/sys/arm64/rockchip/rk_pinctrl.c Tue Aug 27 16:41:06 2019 (r351550) +++ head/sys/arm64/rockchip/rk_pinctrl.c Tue Aug 27 17:59:09 2019 (r351551) @@ -384,6 +384,13 @@ struct rk_pinctrl_conf rk3288_conf = { .get_syscon = rk3288_get_syscon, }; +static struct rk_pinctrl_gpio rk3328_gpio_bank[] = { + RK_GPIO(0, "gpio0"), + RK_GPIO(1, "gpio1"), + RK_GPIO(2, "gpio2"), + RK_GPIO(3, "gpio3"), +}; + static struct rk_pinctrl_bank rk3328_iomux_bank[] = { /* bank sub offs nbits */ RK_IOMUX(0, 0, 0x0000, 2), @@ -394,18 +401,14 @@ static struct rk_pinctrl_bank rk3328_iomux_bank[] = { RK_IOMUX(1, 1, 0x0014, 2), RK_IOMUX(1, 2, 0x0018, 2), RK_IOMUX(1, 3, 0x001C, 2), - RK_IOMUX(2, 0, 0xE000, 2), - RK_IOMUX(2, 1, 0xE004, 2), - RK_IOMUX(2, 2, 0xE008, 2), - RK_IOMUX(2, 3, 0xE00C, 2), - RK_IOMUX(3, 0, 0xE010, 2), - RK_IOMUX(3, 1, 0xE014, 2), - RK_IOMUX(3, 2, 0xE018, 2), - RK_IOMUX(3, 3, 0xE01C, 2), - RK_IOMUX(4, 0, 0xE020, 2), - RK_IOMUX(4, 1, 0xE024, 2), - RK_IOMUX(4, 2, 0xE028, 2), - RK_IOMUX(4, 3, 0xE02C, 2), + RK_IOMUX(2, 0, 0x0020, 2), + RK_IOMUX(2, 1, 0x0024, 3), + RK_IOMUX(2, 2, 0x002c, 3), + RK_IOMUX(2, 3, 0x0034, 2), + RK_IOMUX(3, 0, 0x0038, 3), + RK_IOMUX(3, 1, 0x0040, 3), + RK_IOMUX(3, 2, 0x0048, 2), + RK_IOMUX(3, 3, 0x004c, 2), }; static struct rk_pinctrl_pin_fixup rk3328_pin_fixup[] = { @@ -518,6 +521,8 @@ struct rk_pinctrl_conf rk3328_conf = { .npin_fixup = nitems(rk3328_pin_fixup), .pin_drive = rk3328_pin_drive, .npin_drive = nitems(rk3328_pin_drive), + .gpio_bank = rk3328_gpio_bank, + .ngpio_bank = nitems(rk3328_gpio_bank), .get_pd_offset = rk3328_get_pd_offset, .get_syscon = rk3328_get_syscon, }; From owner-svn-src-all@freebsd.org Tue Aug 27 18:00:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E556EDB707; Tue, 27 Aug 2019 18:00:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HxV95g1vz48kj; Tue, 27 Aug 2019 18:00:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A55A322700; Tue, 27 Aug 2019 18:00:01 +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 x7RI01bX021692; Tue, 27 Aug 2019 18:00:01 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RI01mx021691; Tue, 27 Aug 2019 18:00:01 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201908271800.x7RI01mx021691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 27 Aug 2019 18:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351552 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 351552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 18:00:02 -0000 Author: manu Date: Tue Aug 27 18:00:01 2019 New Revision: 351552 URL: https://svnweb.freebsd.org/changeset/base/351552 Log: arm64: rk3399: pinctrl: Add gpio banks and fix iomux Since r351187 the pinctrl driver need to know the gpio bank as it directly attach the gpio driver to handle some setup that might be present in the dts, add the gpio banks table for rk3399. While here fix some IOMUX definition that prevented to boot on RK3399 as pinctrl wasn't configured correctly. Submitted by: mmel (original version) MFC after: 2 weeks MFC With: r351187 Modified: head/sys/arm64/rockchip/rk_pinctrl.c Modified: head/sys/arm64/rockchip/rk_pinctrl.c ============================================================================== --- head/sys/arm64/rockchip/rk_pinctrl.c Tue Aug 27 17:59:09 2019 (r351551) +++ head/sys/arm64/rockchip/rk_pinctrl.c Tue Aug 27 18:00:01 2019 (r351552) @@ -527,6 +527,14 @@ struct rk_pinctrl_conf rk3328_conf = { .get_syscon = rk3328_get_syscon, }; +static struct rk_pinctrl_gpio rk3399_gpio_bank[] = { + RK_GPIO(0, "gpio0"), + RK_GPIO(1, "gpio1"), + RK_GPIO(2, "gpio2"), + RK_GPIO(3, "gpio3"), + RK_GPIO(4, "gpio4"), +}; + static struct rk_pinctrl_bank rk3399_iomux_bank[] = { /* bank sub offs nbits */ RK_IOMUX(0, 0, 0x0000, 2), @@ -536,7 +544,7 @@ static struct rk_pinctrl_bank rk3399_iomux_bank[] = { RK_IOMUX(1, 0, 0x0010, 2), RK_IOMUX(1, 1, 0x0014, 2), RK_IOMUX(1, 2, 0x0018, 2), - RK_IOMUX(1, 3, 0x000C, 2), + RK_IOMUX(1, 3, 0x001C, 2), RK_IOMUX(2, 0, 0xE000, 2), RK_IOMUX(2, 1, 0xE004, 2), RK_IOMUX(2, 2, 0xE008, 2), @@ -617,6 +625,8 @@ struct rk_pinctrl_conf rk3399_conf = { .npin_fixup = nitems(rk3399_pin_fixup), .pin_drive = rk3399_pin_drive, .npin_drive = nitems(rk3399_pin_drive), + .gpio_bank = rk3399_gpio_bank, + .ngpio_bank = nitems(rk3399_gpio_bank), .get_pd_offset = rk3399_get_pd_offset, .get_syscon = rk3399_get_syscon, }; From owner-svn-src-all@freebsd.org Tue Aug 27 19:16:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0CD8DCCAE; Tue, 27 Aug 2019 19:16:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HzBZ65VBz4DMv; Tue, 27 Aug 2019 19:16:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 35BDD83F5; Tue, 27 Aug 2019 19:16:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... To: Peter Holm Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827143953.GA5092@x8.osted.lan> <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> <20190827170527.GA7111@x8.osted.lan> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <1bfccef6-8cc2-328b-f97f-66d8aa5437a3@FreeBSD.org> Date: Tue, 27 Aug 2019 12:16:33 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190827170527.GA7111@x8.osted.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 19:16:39 -0000 On 8/27/19 10:05 AM, Peter Holm wrote: > On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote: >> On 8/27/19 7:39 AM, Peter Holm wrote: >>> On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: >>>> Author: jhb >>>> Date: Tue Aug 27 00:01:56 2019 >>>> New Revision: 351522 >>>> URL: https://svnweb.freebsd.org/changeset/base/351522 >>>> >>>> Log: >>>> Add kernel-side support for in-kernel TLS. >>>> >>> >>> Could this be yours? >>> >>> 20190827 15:55:34 all (496/668): sendfile12.sh >>> Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out of swap space >>> panic: non-ext_pgs mbuf with TLS session >> >> Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it >> would trip over this assertion for any use-after-free. I see in gdb that you >> couldn't see sfio because of clang's poor debug info. It would be really good >> to try to find the contents of sfio to debug this further. >> >> You should be able to find it via 'bp->b_caller1' in frame 14: >> >> 'p *(struct sf_io *)bp->b_caller1' >> > > Here's a repeat where the involved files are compiled with "-O0": > https://people.freebsd.org/~pho/stress/log/jhb009.txt Ok, it looks like sfio->tls is just not being initialized to NULL in the !KERN_TLS case and the malloc junk is leaking through (my fault): (kgdb) p *(struct sf_io *)bp->b_caller1 $5 = {nios = 0x0, error = 0x0, npages = 0x1, so = 0xfffff808898d0000, m = 0xfffff808a3512200, tls = 0xdeadc0dedeadc0de, pa = 0xfffff804e6cdfc68} Initially I thought about using M_ZERO, but we can just axe the 'tls' member of 'sfio' entirely in the !KERN_TLS case since it's a private structure. Try this (untested) change): Index: kern_sendfile.c =================================================================== --- kern_sendfile.c (revision 351522) +++ kern_sendfile.c (working copy) @@ -88,7 +88,9 @@ struct sf_io { int npages; struct socket *so; struct mbuf *m; +#ifdef KERN_TLS struct ktls_session *tls; +#endif vm_page_t pa[]; }; @@ -266,7 +268,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int coun if (!refcount_release(&sfio->nios)) return; -#ifdef INVARIANTS +#if defined(KERN_TLS) && defined(INVARIANTS) if ((sfio->m->m_flags & M_EXT) != 0 && sfio->m->m_ext.ext_type == EXT_PGS) KASSERT(sfio->tls == sfio->m->m_ext.ext_pgs->tls, -- John Baldwin From owner-svn-src-all@freebsd.org Tue Aug 27 19:37:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 327C0DD3F6; Tue, 27 Aug 2019 19:37:20 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46HzfS0YP0z4FRP; Tue, 27 Aug 2019 19:37:20 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E51DB2397D; Tue, 27 Aug 2019 19:37:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RJbJKu080185; Tue, 27 Aug 2019 19:37:19 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RJbJh0080184; Tue, 27 Aug 2019 19:37:19 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201908271937.x7RJbJh0080184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Tue, 27 Aug 2019 19:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351553 - vendor/sendmail/dist/src X-SVN-Group: vendor X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: vendor/sendmail/dist/src X-SVN-Commit-Revision: 351553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 19:37:20 -0000 Author: hrs Date: Tue Aug 27 19:37:19 2019 New Revision: 351553 URL: https://svnweb.freebsd.org/changeset/base/351553 Log: Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions specified in the command-line option from working. This patch has been accepted by the upstream. Reviewed by and discussed with: gshapiro Modified: vendor/sendmail/dist/src/conf.c vendor/sendmail/dist/src/readcf.c Modified: vendor/sendmail/dist/src/conf.c ============================================================================== --- vendor/sendmail/dist/src/conf.c Tue Aug 27 18:00:01 2019 (r351552) +++ vendor/sendmail/dist/src/conf.c Tue Aug 27 19:37:19 2019 (r351553) @@ -365,6 +365,20 @@ setdefaults(e) TLS_Srv_Opts = TLS_I_SRV; if (NULL == EVP_digest) EVP_digest = EVP_md5(); + Srv_SSL_Options = SSL_OP_ALL; + Clt_SSL_Options = SSL_OP_ALL +# ifdef SSL_OP_NO_SSLv2 + | SSL_OP_NO_SSLv2 +# endif +# ifdef SSL_OP_NO_TICKET + | SSL_OP_NO_TICKET +# endif + ; +# ifdef SSL_OP_TLSEXT_PADDING + /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ + Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; + Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; +# endif /* SSL_OP_TLSEXT_PADDING */ #endif /* STARTTLS */ #ifdef HESIOD_INIT HesiodContext = NULL; Modified: vendor/sendmail/dist/src/readcf.c ============================================================================== --- vendor/sendmail/dist/src/readcf.c Tue Aug 27 18:00:01 2019 (r351552) +++ vendor/sendmail/dist/src/readcf.c Tue Aug 27 19:37:19 2019 (r351553) @@ -159,22 +159,6 @@ readcf(cfname, safe, e) FileName = cfname; LineNumber = 0; -#if STARTTLS - Srv_SSL_Options = SSL_OP_ALL; - Clt_SSL_Options = SSL_OP_ALL -# ifdef SSL_OP_NO_SSLv2 - | SSL_OP_NO_SSLv2 -# endif -# ifdef SSL_OP_NO_TICKET - | SSL_OP_NO_TICKET -# endif - ; -# ifdef SSL_OP_TLSEXT_PADDING - /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ - Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; - Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; -# endif /* SSL_OP_TLSEXT_PADDING */ -#endif /* STARTTLS */ if (DontLockReadFiles) sff |= SFF_NOLOCK; cf = safefopen(cfname, O_RDONLY, 0444, sff); From owner-svn-src-all@freebsd.org Tue Aug 27 20:11:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13596DE666; Tue, 27 Aug 2019 20:11:46 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J0Q96ndbz4HYQ; Tue, 27 Aug 2019 20:11:45 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAEF823F61; Tue, 27 Aug 2019 20:11:45 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RKBjbZ003184; Tue, 27 Aug 2019 20:11:45 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RKBjpu003182; Tue, 27 Aug 2019 20:11:45 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201908272011.x7RKBjpu003182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Tue, 27 Aug 2019 20:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351554 - head/contrib/sendmail/src X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/contrib/sendmail/src X-SVN-Commit-Revision: 351554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:11:46 -0000 Author: hrs Date: Tue Aug 27 20:11:45 2019 New Revision: 351554 URL: https://svnweb.freebsd.org/changeset/base/351554 Log: MFV r351553: Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions specified in the command-line option from working. This patch has been accepted by the upstream. Reviewed by and discussed with: gshapiro Modified: head/contrib/sendmail/src/conf.c head/contrib/sendmail/src/readcf.c Directory Properties: head/contrib/sendmail/ (props changed) Modified: head/contrib/sendmail/src/conf.c ============================================================================== --- head/contrib/sendmail/src/conf.c Tue Aug 27 19:37:19 2019 (r351553) +++ head/contrib/sendmail/src/conf.c Tue Aug 27 20:11:45 2019 (r351554) @@ -365,6 +365,20 @@ setdefaults(e) TLS_Srv_Opts = TLS_I_SRV; if (NULL == EVP_digest) EVP_digest = EVP_md5(); + Srv_SSL_Options = SSL_OP_ALL; + Clt_SSL_Options = SSL_OP_ALL +# ifdef SSL_OP_NO_SSLv2 + | SSL_OP_NO_SSLv2 +# endif +# ifdef SSL_OP_NO_TICKET + | SSL_OP_NO_TICKET +# endif + ; +# ifdef SSL_OP_TLSEXT_PADDING + /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ + Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; + Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; +# endif /* SSL_OP_TLSEXT_PADDING */ #endif /* STARTTLS */ #ifdef HESIOD_INIT HesiodContext = NULL; Modified: head/contrib/sendmail/src/readcf.c ============================================================================== --- head/contrib/sendmail/src/readcf.c Tue Aug 27 19:37:19 2019 (r351553) +++ head/contrib/sendmail/src/readcf.c Tue Aug 27 20:11:45 2019 (r351554) @@ -159,22 +159,6 @@ readcf(cfname, safe, e) FileName = cfname; LineNumber = 0; -#if STARTTLS - Srv_SSL_Options = SSL_OP_ALL; - Clt_SSL_Options = SSL_OP_ALL -# ifdef SSL_OP_NO_SSLv2 - | SSL_OP_NO_SSLv2 -# endif -# ifdef SSL_OP_NO_TICKET - | SSL_OP_NO_TICKET -# endif - ; -# ifdef SSL_OP_TLSEXT_PADDING - /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ - Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; - Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; -# endif /* SSL_OP_TLSEXT_PADDING */ -#endif /* STARTTLS */ if (DontLockReadFiles) sff |= SFF_NOLOCK; cf = safefopen(cfname, O_RDONLY, 0444, sff); From owner-svn-src-all@freebsd.org Tue Aug 27 20:23:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 204EFDEB92; Tue, 27 Aug 2019 20:23:57 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46J0hF02fnz4JDB; Tue, 27 Aug 2019 20:23:56 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 28302220B8; Tue, 27 Aug 2019 16:23:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 27 Aug 2019 16:23:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=x WwYn6YEZZ6gaNQ2dwJ23nHquINdR+zRTYu71NGz7Bw=; b=RSmd299KLBS4YaTSi 7AoPb9k1emk8F8FTXSgW/ZksjeXG1SpiggC/jtwPLdm9BecK0eLg+rh6XAGTtXd5 dXQvAzK8TOr709sguXr0z2FsJ51B7Yg76yMvUhL469MBGNNg6F2y/FQZl3qGdMvT AxCkR5hAj539/QbYUi1pcbgVuXozHYnf/TzpVIiWGKuRwGdWMxZiXR9jgN6J1RbA BDZCHviBeo82bgodmC+AQrlzq+vJN87qBDBG22Zvb9nDaUsJ97MV3Jh35DuD68rJ qNLGRbLmwntS4NZOyhbtHwRyAsqGP0WjNbLNuGQpKkaH7m09loRJskSuMNIKVNmD SRWQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=xWwYn6YEZZ6gaNQ2dwJ23nHquINdR+zRTYu71NGz7 Bw=; b=GgYmu65bG2/RUT+STIfrm5uv/7oIf6sh87+ofvU42762qFdWe+tLf5R90 j4zSgV9bL6WNJj4evv1HlCZkrxB9eJlNN3u6ujIOsfCv7fu3Wg/BwwouMCoBazqV 7Z5f9eJO2CBwVG4WGTQ2rMbMxljNqPc4OMM/WzFaZ9c/jT6P3PNUs2uuIccAYoPl YCgtqwBUgIOwOiqPr1QtAg938ZQbLwQPcW5pjVKhgRkTlPW2zdoF1SxszEj8l1hF wSFrHfnFnZNJo+vI3yvJduBXfye6E20A8v04xp4n3HNlJxkvDofEUfMjJqgWj7Cy i0CESdW6iYk38crCE/qsorZushttw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudehkedgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegtggfuhfgjfffgkfhfvffosehtqh hmtdhhtdejnecuhfhrohhmpefutghothhtucfnohhnghcuoehstghothhtlhesshgrmhhs tghordhorhhgqeenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepkedrge eirdekledrvddufeenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehsrghm shgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 42706D60057; Tue, 27 Aug 2019 16:23:55 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351550 - head/sys/cam/scsi From: Scott Long In-Reply-To: <201908271641.x7RGf6LC075849@repo.freebsd.org> Date: Tue, 27 Aug 2019 14:23:54 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <99271565-F168-48C8-90E0-749417C7C974@samsco.org> References: <201908271641.x7RGf6LC075849@repo.freebsd.org> To: Alexander Motin X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46J0hF02fnz4JDB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.948,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:23:57 -0000 This is very concerning, and I wonder if it=E2=80=99s the cause of the = mystery use-after-free / double-complete that I=E2=80=99ve seen for = years and have never been able to catch. Can you say more about how you = found it? Scott > On Aug 27, 2019, at 10:41 AM, Alexander Motin wrote: >=20 > Author: mav > Date: Tue Aug 27 16:41:06 2019 > New Revision: 351550 > URL: https://svnweb.freebsd.org/changeset/base/351550 >=20 > Log: > Always check cam_periph_error() status for ERESTART. >=20 > Even if we do not expect retries, we better be sure, since otherwise = it > may result in use after free kernel panic. I've noticed that it = retries > SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY. >=20 > MFC after: 1 week > Sponsored by: iXsystems, Inc. >=20 > Modified: > head/sys/cam/scsi/scsi_xpt.c >=20 > Modified: head/sys/cam/scsi/scsi_xpt.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 15:42:08 2019 = (r351549) > +++ head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 16:41:06 2019 = (r351550) > @@ -1684,8 +1684,9 @@ probe_device_check: > case PROBE_TUR_FOR_NEGOTIATION: > case PROBE_DV_EXIT: > if (cam_ccb_status(done_ccb) !=3D CAM_REQ_CMP) { > - cam_periph_error(done_ccb, 0, > - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); > + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | > + SF_NO_RECOVERY | SF_NO_RETRY) =3D=3D = ERESTART) > + goto outr; > } > if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) !=3D 0) { > /* Don't wedge the queue */ > @@ -1735,8 +1736,9 @@ probe_device_check: > struct ccb_scsiio *csio; >=20 > if (cam_ccb_status(done_ccb) !=3D CAM_REQ_CMP) { > - cam_periph_error(done_ccb, 0, > - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); > + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | > + SF_NO_RECOVERY | SF_NO_RETRY) =3D=3D = ERESTART) > + goto outr; > } > if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) !=3D 0) { > /* Don't wedge the queue */ >=20 From owner-svn-src-all@freebsd.org Tue Aug 27 20:30:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FFA1DED89; Tue, 27 Aug 2019 20:30:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J0rK3lhHz4JQ5; Tue, 27 Aug 2019 20:30:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63B94242B9; Tue, 27 Aug 2019 20:30:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RKUvvn010750; Tue, 27 Aug 2019 20:30:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RKUvuU010749; Tue, 27 Aug 2019 20:30:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908272030.x7RKUvuU010749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 27 Aug 2019 20:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351555 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:30:57 -0000 Author: mjg Date: Tue Aug 27 20:30:56 2019 New Revision: 351555 URL: https://svnweb.freebsd.org/changeset/base/351555 Log: vfs: stop passing LK_INTERLOCK to VOP_UNLOCK The plan is to drop the flags argument. There is also a temporary bug now that nullfs ignores the flag. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21252 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Aug 27 20:11:45 2019 (r351554) +++ head/sys/kern/vfs_subr.c Tue Aug 27 20:30:56 2019 (r351555) @@ -1034,8 +1034,8 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int (vp->v_iflag & VI_FREE) != 0 || (vp->v_object != NULL && vp->v_object->resident_page_count > trigger)) { - VOP_UNLOCK(vp, LK_INTERLOCK); - vdrop(vp); + VOP_UNLOCK(vp, 0); + vdropl(vp); goto next_iter_mntunlocked; } KASSERT((vp->v_iflag & VI_DOOMED) == 0, @@ -1398,7 +1398,8 @@ vtryrecycle(struct vnode *vp) */ VI_LOCK(vp); if (vp->v_usecount) { - VOP_UNLOCK(vp, LK_INTERLOCK); + VOP_UNLOCK(vp, 0); + VI_UNLOCK(vp); vn_finished_write(vnmp); CTR2(KTR_VFS, "%s: impossible to recycle, %p is already referenced", @@ -1409,7 +1410,8 @@ vtryrecycle(struct vnode *vp) counter_u64_add(recycles_count, 1); vgonel(vp); } - VOP_UNLOCK(vp, LK_INTERLOCK); + VOP_UNLOCK(vp, 0); + VI_UNLOCK(vp); vn_finished_write(vnmp); return (0); } From owner-svn-src-all@freebsd.org Tue Aug 27 20:51:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24F8BDF441; Tue, 27 Aug 2019 20:51:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J1Hp089zz4KQq; Tue, 27 Aug 2019 20:51:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAE89247A7; Tue, 27 Aug 2019 20:51:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7RKpHIH026461; Tue, 27 Aug 2019 20:51:17 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RKpHMf026460; Tue, 27 Aug 2019 20:51:17 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908272051.x7RKpHMf026460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 27 Aug 2019 20:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351556 - head/sys/fs/unionfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/unionfs X-SVN-Commit-Revision: 351556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:51:18 -0000 Author: mjg Date: Tue Aug 27 20:51:17 2019 New Revision: 351556 URL: https://svnweb.freebsd.org/changeset/base/351556 Log: unionfs: stop passing LK_INTERLOCK to VOP_UNLOCK This is part of the preparation to remove flags argument from VOP_UNLOCK. Also has a side effect of fixing stacking on top of nullfs broken by r351472. Reported by: cy Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/unionfs/union_vnops.c Modified: head/sys/fs/unionfs/union_vnops.c ============================================================================== --- head/sys/fs/unionfs/union_vnops.c Tue Aug 27 20:30:56 2019 (r351555) +++ head/sys/fs/unionfs/union_vnops.c Tue Aug 27 20:51:17 2019 (r351556) @@ -1882,12 +1882,9 @@ unionfs_lock(struct vop_lock1_args *ap) if (lvp != NULLVP) { if (uvp != NULLVP && flags & LK_UPGRADE) { /* Share Lock is once released and a deadlock is avoided. */ - VI_LOCK_FLAGS(uvp, MTX_DUPOK); - vholdl(uvp); + vholdnz(uvp); uhold = 1; - VI_UNLOCK(vp); - VOP_UNLOCK(uvp, LK_RELEASE | LK_INTERLOCK); - VI_LOCK(vp); + VOP_UNLOCK(uvp, LK_RELEASE); unp = VTOUNIONFS(vp); if (unp == NULL) { /* vnode is released. */ @@ -1978,7 +1975,6 @@ unionfs_unlock(struct vop_unlock_args *ap) { int error; int flags; - int mtxlkflag; int uhold; struct vnode *vp; struct vnode *lvp; @@ -1988,18 +1984,10 @@ unionfs_unlock(struct vop_unlock_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); error = 0; - mtxlkflag = 0; uhold = 0; flags = ap->a_flags | LK_RELEASE; vp = ap->a_vp; - if ((flags & LK_INTERLOCK) != 0) - mtxlkflag = 1; - else if (mtx_owned(VI_MTX(vp)) == 0) { - VI_LOCK(vp); - mtxlkflag = 2; - } - unp = VTOUNIONFS(vp); if (unp == NULL) goto unionfs_unlock_null_vnode; @@ -2007,45 +1995,24 @@ unionfs_unlock(struct vop_unlock_args *ap) uvp = unp->un_uppervp; if (lvp != NULLVP) { - VI_LOCK_FLAGS(lvp, MTX_DUPOK); - flags |= LK_INTERLOCK; - vholdl(lvp); - - VI_UNLOCK(vp); - ap->a_flags &= ~LK_INTERLOCK; - + vholdnz(lvp); error = VOP_UNLOCK(lvp, flags); - - VI_LOCK(vp); } if (error == 0 && uvp != NULLVP) { - VI_LOCK_FLAGS(uvp, MTX_DUPOK); - flags |= LK_INTERLOCK; - vholdl(uvp); + vholdnz(uvp); uhold = 1; - - VI_UNLOCK(vp); - ap->a_flags &= ~LK_INTERLOCK; - error = VOP_UNLOCK(uvp, flags); - - VI_LOCK(vp); } - VI_UNLOCK(vp); if (lvp != NULLVP) vdrop(lvp); if (uhold != 0) vdrop(uvp); - if (mtxlkflag == 0) - VI_LOCK(vp); return error; unionfs_unlock_null_vnode: - if (mtxlkflag == 2) - VI_UNLOCK(vp); return (vop_stdunlock(ap)); } From owner-svn-src-all@freebsd.org Tue Aug 27 20:52:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D102BDF4D9; Tue, 27 Aug 2019 20:52:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J1K60Gptz4KlS; Tue, 27 Aug 2019 20:52:25 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x244.google.com with SMTP id n1so368409oic.3; Tue, 27 Aug 2019 13:52:25 -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; bh=QF4+lV8v3y4nxPFIiwTZhp88PFS8EiaULbV0A6vPNpY=; b=Km2ov92QD3o3kal4GhR5Mxa3gvoHldCLsm+yBC0urDWDYnbMmUNrHU8fLvOrspaneI /ezSOuet+1EkYbNf4wkAR/n3EpzXNC3lPtD5l/0SkEjeR8GiT6OjU8otma+GCzkUdgVD 1WT4ksWgPKTEK+DoEmOhDW4DE0gZE3vLYE3bsBq+8AII660nBs+rLPEBwjLvNLtdXh/C D+EeFLyQ1UgEoln/cXqSG2VwVTBJHxC15bSHmWLRf0fzMueMcOcqvddFUqg6dF1T8tUO Mydwciie/fbay3lmbfRuq/bAnLHxIzIuJ3NIsWZJQ8GVz/tfWfmwx/n6Cous8B5zWG2R xYJQ== 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; bh=QF4+lV8v3y4nxPFIiwTZhp88PFS8EiaULbV0A6vPNpY=; b=LC40ryVTDh/lqzMCmWkgch6Pv5nQ1HfMnTdeCF8zj8Hy7SOIA3Z2XXcmabR/+Ezehg 43Jmo7QobUh6QT9+tlQOF+BAYhaKBV4/jJ0ecqk4cH6b/ZKwwT1tYEeglrP2BD6gMmx2 +bOd0k9IWviY4MIRfoGZaIydXA1eFuU1I9avVc5UTbhEY9Rk5cIC0Hp8wSMAT0XgMgv8 dJjEeWNuqkKUmwY/hD5eUDs6GN4Mgs7Ss1/tnU3IJPwiPJj/7IZFyWab4xBapfQygctJ TcPYWcHzfr8NeKadQpuIAxVx98BWITAngDEYgqhe8SWlQcqHKsW7ET9y5jhtNwn6bTr8 8KKg== X-Gm-Message-State: APjAAAW4t7CNjo+0OmGmgD7a3tFyvdtS/3YERIWagg8CtCAA2OZwjQ2v 2Lk0Ctv/pXVPNG8WVwHJDaVyA489fJDlF7N7jXwu6w== X-Google-Smtp-Source: APXvYqwoPcPQIZ4JpvywE/FVBKqRFwofGx15biQjdZVVCqBMjaaVcwTpn6v6QuOor1Fp5gVyP747JQWcKRzDlNja+KQ= X-Received: by 2002:aca:4b86:: with SMTP id y128mr453056oia.163.1566939144092; Tue, 27 Aug 2019 13:52:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Tue, 27 Aug 2019 13:52:23 -0700 (PDT) In-Reply-To: <201908272030.x7RKUvuU010749@repo.freebsd.org> References: <201908272030.x7RKUvuU010749@repo.freebsd.org> From: Mateusz Guzik Date: Tue, 27 Aug 2019 22:52:23 +0200 Message-ID: Subject: Re: svn commit: r351555 - head/sys/kern To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46J1K60Gptz4KlS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Km2ov92Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::244 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(0.00)[ip: (2.32), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[4.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:52:26 -0000 On 8/27/19, Mateusz Guzik wrote: > Author: mjg > Date: Tue Aug 27 20:30:56 2019 > New Revision: 351555 > URL: https://svnweb.freebsd.org/changeset/base/351555 > > Log: > vfs: stop passing LK_INTERLOCK to VOP_UNLOCK > > The plan is to drop the flags argument. There is also a temporary bug > now that nullfs ignores the flag. > > Reviewed by: kib > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21252 > Ops. That's of course https://reviews.freebsd.org/D21426 > Modified: > head/sys/kern/vfs_subr.c > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Tue Aug 27 20:11:45 2019 (r351554) > +++ head/sys/kern/vfs_subr.c Tue Aug 27 20:30:56 2019 (r351555) > @@ -1034,8 +1034,8 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, > int > (vp->v_iflag & VI_FREE) != 0 || > (vp->v_object != NULL && > vp->v_object->resident_page_count > trigger)) { > - VOP_UNLOCK(vp, LK_INTERLOCK); > - vdrop(vp); > + VOP_UNLOCK(vp, 0); > + vdropl(vp); > goto next_iter_mntunlocked; > } > KASSERT((vp->v_iflag & VI_DOOMED) == 0, > @@ -1398,7 +1398,8 @@ vtryrecycle(struct vnode *vp) > */ > VI_LOCK(vp); > if (vp->v_usecount) { > - VOP_UNLOCK(vp, LK_INTERLOCK); > + VOP_UNLOCK(vp, 0); > + VI_UNLOCK(vp); > vn_finished_write(vnmp); > CTR2(KTR_VFS, > "%s: impossible to recycle, %p is already referenced", > @@ -1409,7 +1410,8 @@ vtryrecycle(struct vnode *vp) > counter_u64_add(recycles_count, 1); > vgonel(vp); > } > - VOP_UNLOCK(vp, LK_INTERLOCK); > + VOP_UNLOCK(vp, 0); > + VI_UNLOCK(vp); > vn_finished_write(vnmp); > return (0); > } > _______________________________________________ > 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" > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 27 20:57:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43758DF73C; Tue, 27 Aug 2019 20:57:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J1RS1kRwz4L2N; Tue, 27 Aug 2019 20:57:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb29.google.com with SMTP id o82so42920ybg.10; Tue, 27 Aug 2019 13:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qh9Ia3lhy4FNxr2uqNDgPQoDs2Vy+2zJVJUCTvN+gu0=; b=d1kTYW8Gvd5fEJkF8HKnWmFaVfR++WwZRYUtdBzXewnHih+Us31e5stwreWHQ2kkF0 l6VQL3BKgdUDc3bWOHMMVmkWBiGX5OV+QYjg/ozVGuDSdRCxO1FmJRxV9PcshR+SfWIG irYaH8DVyJ/NJvudTZUQPDEoLohnXFH8VgJ9TjT53WM697klEPK/dXSCvawCbRtLxEU2 cWla63jLrhqVAQqoao8CwpHXD+peT5cEzfcBkzG5JUiTaOmwH4AjXdFh7axYDXlaTx21 L+M925+cR6fznhAuW2Yei+ut/piZsKKOY0OigB607iJxAEGRn9a6DppEEduNZKu2Q4tK NZGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qh9Ia3lhy4FNxr2uqNDgPQoDs2Vy+2zJVJUCTvN+gu0=; b=gdu3pdRVHx2hGB0TAAOEQWcM9ZY8mstC7ahYrmG6crUeLcGMvlTY61FYI4u6Xn/dgy 0f6SWoww895peR2nFb///gie61z+eXgWqUyvcXxKs+YyqrW1WE0UA7upCfetUcox3Jry CqRTEr+syG3nVECdVXCZknGk3ZU3GDOxpfMTTUs3/lOh1l+RdWQ/FGDVf1ss+GiQsfLS bHakYyNrvfhKWOodcPA7WF+XHs30I3UcifF4qApi64kSNjajpbP74I676HvqxorD+hQl jxY8shAQyUD8d4yHRjo03+cOEQ4ne50n9YjWrOV5ihwkwyiaWUYl8Q0PicF55nuF9Ev6 a9eQ== X-Gm-Message-State: APjAAAVwTSOTO6sq8isuy8of6SVpm/pIU5ru8eQweqA/N/9YCBVryr9u NOM6lnD183ajCkR5TjsU00yg78ERxw8= X-Google-Smtp-Source: APXvYqxtbTY22dgDumRU9LEophnn9TIO2b9Wntgf3NoYLbZxMj7kwUTdUcnXUCG0jBbgm99K0pbUhg== X-Received: by 2002:a5b:b4d:: with SMTP id b13mr590679ybr.308.1566939474661; Tue, 27 Aug 2019 13:57:54 -0700 (PDT) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id 199sm135160ywo.95.2019.08.27.13.57.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Aug 2019 13:57:54 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r351550 - head/sys/cam/scsi To: Scott Long Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908271641.x7RGf6LC075849@repo.freebsd.org> <99271565-F168-48C8-90E0-749417C7C974@samsco.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <3c2aa0be-3d42-881e-87e1-675499a7bc5f@FreeBSD.org> Date: Tue, 27 Aug 2019 16:57:52 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: <99271565-F168-48C8-90E0-749417C7C974@samsco.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46J1RS1kRwz4L2N X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=d1kTYW8G; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b29 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-6.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; RCVD_IN_DNSWL_NONE(0.00)[9.2.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.92)[ip: (-9.34), ipnet: 2607:f8b0::/32(-2.86), asn: 15169(-2.33), country: US(-0.05)]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 20:57:57 -0000 Some FreeNAS user reported panic after updating to newer version. On the screenshot provided were several BUSY statuses for SATA disk on mps(4), followed by panic "Attempt to remove out-of-bounds index -1 from queue ...". In his case I blame ancient LSI firmware or some broken hardware, but I was able to reproduce the panic on FreeBSD head debug kernel by hacking mps(4) driver to always report BUSY (appeared except IDENTIFY and REPORT LUNS). To diagnose it I inserted assertion into xpt_free_ccb(), checking ccb->ccb_h.pinfo.index for values used for requests still in send queue. Not sure it is to be persistent, but in this case it lead me directly to this place. On 27.08.2019 16:23, Scott Long wrote: > This is very concerning, and I wonder if it’s the cause of the mystery use-after-free / double-complete that I’ve seen for years and have never been able to catch. Can you say more about how you found it? > > Scott > > >> On Aug 27, 2019, at 10:41 AM, Alexander Motin wrote: >> >> Author: mav >> Date: Tue Aug 27 16:41:06 2019 >> New Revision: 351550 >> URL: https://svnweb.freebsd.org/changeset/base/351550 >> >> Log: >> Always check cam_periph_error() status for ERESTART. >> >> Even if we do not expect retries, we better be sure, since otherwise it >> may result in use after free kernel panic. I've noticed that it retries >> SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY. >> >> MFC after: 1 week >> Sponsored by: iXsystems, Inc. >> >> Modified: >> head/sys/cam/scsi/scsi_xpt.c >> >> Modified: head/sys/cam/scsi/scsi_xpt.c >> ============================================================================== >> --- head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 15:42:08 2019 (r351549) >> +++ head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 16:41:06 2019 (r351550) >> @@ -1684,8 +1684,9 @@ probe_device_check: >> case PROBE_TUR_FOR_NEGOTIATION: >> case PROBE_DV_EXIT: >> if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { >> - cam_periph_error(done_ccb, 0, >> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); >> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | >> + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART) >> + goto outr; >> } >> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { >> /* Don't wedge the queue */ >> @@ -1735,8 +1736,9 @@ probe_device_check: >> struct ccb_scsiio *csio; >> >> if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { >> - cam_periph_error(done_ccb, 0, >> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); >> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | >> + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART) >> + goto outr; >> } >> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { >> /* Don't wedge the queue */ >> > -- Alexander Motin From owner-svn-src-all@freebsd.org Tue Aug 27 21:10:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25260DFBF8; Tue, 27 Aug 2019 21:10:40 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J1k62W0cz4Ldr; Tue, 27 Aug 2019 21:10:37 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id x7RLARX8019384 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Aug 2019 07:10:33 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id x7RLAMju051644 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 28 Aug 2019 07:10:22 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id x7RLAMgu051643; Wed, 28 Aug 2019 07:10:22 +1000 (AEST) (envelope-from peter) Date: Wed, 28 Aug 2019 07:10:21 +1000 From: Peter Jeremy To: mmel@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351187 - head/sys/arm64/rockchip Message-ID: <20190827211021.GA51500@server.rulingia.com> References: <201908180919.x7I9JXGj021325@repo.freebsd.org> <20190825072844.GA4799@server.rulingia.com> <6da78585-2bc7-0228-e443-799643d08783@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <6da78585-2bc7-0228-e443-799643d08783@freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46J1k62W0cz4Ldr X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-6.44 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.11)[ipnet: 2001:19f0:5800::/38(-4.94), asn: 20473(-0.53), country: US(-0.05)]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 21:10:40 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-Aug-27 11:56:38 +0200, Michal Meloun wrot= e: > > >On 25.08.2019 9:28, Peter Jeremy wrote: >> On 2019-Aug-18 09:19:33 +0000, Michal Meloun >> wrote: >>> Improve rk_pinctrl driver: >>=20 >> Sorry for the late notice but this breaks my Rock64 (RK3328). >>=20 >Sorry for late response. >Seems like this is caused by unnoticed dependency between patches in >my worktree, sorry for this. I hope that r351543 solves it. >Can you, please, try r351543 on Rock64 because I haven't any rk3328 >based board for real test? r351543 + r351551 fixes it for me. Thanks for that. --=20 Peter Jeremy --AhhlLboLdkugWU4S Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl1lnDhfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzSiug/+JxERaNmaki8T7RvJfAUWq3kjGldZhi43+4cpOj/K3tp6ZJzHu5idw+YC HalXa3HqrVBfPDFyFMG2MDGdxAPMDcunHGX3OHHef8ycEzDholi7W8aSyKO9P4uP ycvhc3GAZNo+1WDPa+z8oQ6gEIHeqegj/uwHrgL1xqHiZKFALsSG8osVaXWSCc+O bfXkFYKqhz4xLe29a/QNxNY525dCQjWNIKrZ5YRoMaqKC9mvuFCZwkV8o1tk0e+t OW08oOvzCtZw6VzsdGtMGcrjAw9WVse/tDFjVm6xaybxW7kYzd/Iqzb/04GHG75Q d79G2RFOlNubTuP5oDpOEzfAmuHU2g48thwft+BKea30XT+d35oxYq37fmnFBe3h KuzM4EpV5X1TJULF1XIZMGx4vVwnMdJ5B/x3IVy/LCdGNlV0tQpwoqjB93aHnuqS bfWx2ojTt/kqx7tDR9F5kdqw7VRgkFrDgzXRJQuSY+jDViUqJ9L8TB2V5pGQyBId SoCO/zLetmJKLTo98sZPUPT+na9et6qlpv2uEj2mzf7uVKPhjtOOX61cwfJLUXy1 MIBeT4xQCHcQLIAl9r1zJzHHBBn0U4UZT0XrQoqRPkhZaNOEcTcQl5sewF7vQDJw SW3oy5B4jwpZ5U0NsSKHjp4pAufg/NfsOU4g8JL6L0qA4OXM0kU= =1QbA -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S-- From owner-svn-src-all@freebsd.org Tue Aug 27 21:27:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93F8FC835F; Tue, 27 Aug 2019 21:27:18 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46J25L3BW6z4MdP; Tue, 27 Aug 2019 21:27:17 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 56D82220A7; Tue, 27 Aug 2019 17:27:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 27 Aug 2019 17:27:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=U XcEkHr1ApfNEEzlOWdbaPubBAY0CQVg6uoL2durN6w=; b=KbkNkQ1fTk6hdw4qO ICmk4VPbXQB4SJilMEmiBIx91UcfvQPL6DfHZ/7LPu4k16zUqL8SF4UXOy+k2Hkr jKuZ357em8LwAyZZOTdUiAo6r0MAnR2f45C7I3Ewuv4OrzrXXkusqeU4tIv7eYlO l6LbuYyH32SaMX9UpcOWCpiSDkJRF0K4DUoBjIpZW9UBuWctplslb5pi+Kug2iHY e/xwxwhD/+SUf+TeqlNATLlsZAMsUcdfxuvrhoOgGMJGrEf3IEtfT9zjVfXA/o52 hauyY92J6a+enxlczdC5eEx0caJPRkkhf9UV4nrMplK6m8tg0bv3kvfd9FKTGgiD iQHJQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=UXcEkHr1ApfNEEzlOWdbaPubBAY0CQVg6uoL2durN 6w=; b=ZX8GmmZ7aOLOdgVEN6heVWBXKW8GEk3LZEEkkH+NnrFlwJXmtLej5C2Sq glDAe7AZYajG7tr9BztlTfN/FTXbgLPoV+X4s/I5mpXC+rTcodjQIBBtP+s93b4O p/6WehUIELnbQIhsNFP4nJZBPO06cGEEx2aFdKco4Lc2ZdldcgZFE/0D3OlDnW9Q 0LOKPV9V9aXZ8y4T0C60CF3SDn/BPQgXMcbGKjcl0Um+LAjmuE3J+VQCEJVri5Pr XR82XRBbpwjECDSDpUhAQ1IvUqukJp7hoYkihXSSkB15EqkBnq1m1eGgjQwuA2lv f5emxRXcaBLbDLG4w8NdEpcvaQDkQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudehkedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesth hqmhdthhdtjeenucfhrhhomhepufgtohhtthcunfhonhhguceoshgtohhtthhlsehsrghm shgtohdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrd egiedrkeelrddvudefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehstghothhtlhesshgr mhhstghordhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D5F980059; Tue, 27 Aug 2019 17:27:16 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r351550 - head/sys/cam/scsi From: Scott Long In-Reply-To: <3c2aa0be-3d42-881e-87e1-675499a7bc5f@FreeBSD.org> Date: Tue, 27 Aug 2019 15:27:15 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201908271641.x7RGf6LC075849@repo.freebsd.org> <99271565-F168-48C8-90E0-749417C7C974@samsco.org> <3c2aa0be-3d42-881e-87e1-675499a7bc5f@FreeBSD.org> To: Alexander Motin X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46J25L3BW6z4MdP X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.948,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 21:27:18 -0000 Excellent work, thank you! Scott > On Aug 27, 2019, at 2:57 PM, Alexander Motin wrote: >=20 > Some FreeNAS user reported panic after updating to newer version. On > the screenshot provided were several BUSY statuses for SATA disk on > mps(4), followed by panic "Attempt to remove out-of-bounds index -1 = from > queue ...". In his case I blame ancient LSI firmware or some broken > hardware, but I was able to reproduce the panic on FreeBSD head debug > kernel by hacking mps(4) driver to always report BUSY (appeared except > IDENTIFY and REPORT LUNS). To diagnose it I inserted assertion into > xpt_free_ccb(), checking ccb->ccb_h.pinfo.index for values used for > requests still in send queue. Not sure it is to be persistent, but in > this case it lead me directly to this place. >=20 > On 27.08.2019 16:23, Scott Long wrote: >> This is very concerning, and I wonder if it=E2=80=99s the cause of = the mystery use-after-free / double-complete that I=E2=80=99ve seen for = years and have never been able to catch. Can you say more about how you = found it? >>=20 >> Scott >>=20 >>=20 >>> On Aug 27, 2019, at 10:41 AM, Alexander Motin = wrote: >>>=20 >>> Author: mav >>> Date: Tue Aug 27 16:41:06 2019 >>> New Revision: 351550 >>> URL: https://svnweb.freebsd.org/changeset/base/351550 >>>=20 >>> Log: >>> Always check cam_periph_error() status for ERESTART. >>>=20 >>> Even if we do not expect retries, we better be sure, since otherwise = it >>> may result in use after free kernel panic. I've noticed that it = retries >>> SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY. >>>=20 >>> MFC after: 1 week >>> Sponsored by: iXsystems, Inc. >>>=20 >>> Modified: >>> head/sys/cam/scsi/scsi_xpt.c >>>=20 >>> Modified: head/sys/cam/scsi/scsi_xpt.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 15:42:08 2019 = (r351549) >>> +++ head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 16:41:06 2019 = (r351550) >>> @@ -1684,8 +1684,9 @@ probe_device_check: >>> case PROBE_TUR_FOR_NEGOTIATION: >>> case PROBE_DV_EXIT: >>> if (cam_ccb_status(done_ccb) !=3D CAM_REQ_CMP) { >>> - cam_periph_error(done_ccb, 0, >>> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); >>> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | >>> + SF_NO_RECOVERY | SF_NO_RETRY) =3D=3D = ERESTART) >>> + goto outr; >>> } >>> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) !=3D 0) { >>> /* Don't wedge the queue */ >>> @@ -1735,8 +1736,9 @@ probe_device_check: >>> struct ccb_scsiio *csio; >>>=20 >>> if (cam_ccb_status(done_ccb) !=3D CAM_REQ_CMP) { >>> - cam_periph_error(done_ccb, 0, >>> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY); >>> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT | >>> + SF_NO_RECOVERY | SF_NO_RETRY) =3D=3D = ERESTART) >>> + goto outr; >>> } >>> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) !=3D 0) { >>> /* Don't wedge the queue */ >>>=20 >>=20 >=20 > --=20 > Alexander Motin >=20 From owner-svn-src-all@freebsd.org Tue Aug 27 21:29:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64C74C8434; Tue, 27 Aug 2019 21:29:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J28223cjz4Mnm; Tue, 27 Aug 2019 21:29:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2863524DEC; Tue, 27 Aug 2019 21:29:38 +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 x7RLTcuI045350; Tue, 27 Aug 2019 21:29:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RLTcT6045349; Tue, 27 Aug 2019 21:29:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908272129.x7RLTcT6045349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Aug 2019 21:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351557 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 351557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 21:29:38 -0000 Author: jhb Date: Tue Aug 27 21:29:37 2019 New Revision: 351557 URL: https://svnweb.freebsd.org/changeset/base/351557 Log: Adjust the deprecated warnings for /dev/crypto to be less noisy. Warn when actual operations are performed instead of when sessions are created. The /dev/crypto engine in OpenSSL 1.0.x tries to create sessions for all possible algorithms each time it is initialized resulting in spurious warnings. Reported by: Mike Tancsa MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Aug 27 20:51:17 2019 (r351556) +++ head/sys/opencrypto/cryptodev.c Tue Aug 27 21:29:37 2019 (r351557) @@ -391,8 +391,6 @@ cryptof_ioctl( struct crypt_op copc; struct crypt_kop kopc; #endif - static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn; - static struct timeval skipwarn, tdeswarn; switch (cmd) { case CIOCGSESSION: @@ -413,28 +411,18 @@ cryptof_ioctl( case 0: break; case CRYPTO_DES_CBC: - if (ratecheck(&deswarn, &warninterval)) - gone_in(13, "DES cipher via /dev/crypto"); txform = &enc_xform_des; break; case CRYPTO_3DES_CBC: - if (ratecheck(&tdeswarn, &warninterval)) - gone_in(13, "3DES cipher via /dev/crypto"); txform = &enc_xform_3des; break; case CRYPTO_BLF_CBC: - if (ratecheck(&blfwarn, &warninterval)) - gone_in(13, "Blowfish cipher via /dev/crypto"); txform = &enc_xform_blf; break; case CRYPTO_CAST_CBC: - if (ratecheck(&castwarn, &warninterval)) - gone_in(13, "CAST128 cipher via /dev/crypto"); txform = &enc_xform_cast5; break; case CRYPTO_SKIPJACK_CBC: - if (ratecheck(&skipwarn, &warninterval)) - gone_in(13, "Skipjack cipher via /dev/crypto"); txform = &enc_xform_skipjack; break; case CRYPTO_AES_CBC: @@ -447,8 +435,6 @@ cryptof_ioctl( txform = &enc_xform_null; break; case CRYPTO_ARC4: - if (ratecheck(&arc4warn, &warninterval)) - gone_in(13, "ARC4 cipher via /dev/crypto"); txform = &enc_xform_arc4; break; case CRYPTO_CAMELLIA_CBC: @@ -477,9 +463,6 @@ cryptof_ioctl( case 0: break; case CRYPTO_MD5_HMAC: - if (ratecheck(&md5warn, &warninterval)) - gone_in(13, - "MD5-HMAC authenticator via /dev/crypto"); thash = &auth_hash_hmac_md5; break; case CRYPTO_POLY1305: @@ -815,6 +798,47 @@ cod_free(struct cryptop_data *cod) free(cod, M_XDATA); } +static void +cryptodev_warn(struct csession *cse) +{ + static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn; + static struct timeval skipwarn, tdeswarn; + + switch (cse->cipher) { + case CRYPTO_DES_CBC: + if (ratecheck(&deswarn, &warninterval)) + gone_in(13, "DES cipher via /dev/crypto"); + break; + case CRYPTO_3DES_CBC: + if (ratecheck(&tdeswarn, &warninterval)) + gone_in(13, "3DES cipher via /dev/crypto"); + break; + case CRYPTO_BLF_CBC: + if (ratecheck(&blfwarn, &warninterval)) + gone_in(13, "Blowfish cipher via /dev/crypto"); + break; + case CRYPTO_CAST_CBC: + if (ratecheck(&castwarn, &warninterval)) + gone_in(13, "CAST128 cipher via /dev/crypto"); + break; + case CRYPTO_SKIPJACK_CBC: + if (ratecheck(&skipwarn, &warninterval)) + gone_in(13, "Skipjack cipher via /dev/crypto"); + break; + case CRYPTO_ARC4: + if (ratecheck(&arc4warn, &warninterval)) + gone_in(13, "ARC4 cipher via /dev/crypto"); + break; + } + + switch (cse->mac) { + case CRYPTO_MD5_HMAC: + if (ratecheck(&md5warn, &warninterval)) + gone_in(13, "MD5-HMAC authenticator via /dev/crypto"); + break; + } +} + static int cryptodev_op( struct csession *cse, @@ -937,6 +961,7 @@ cryptodev_op( error = EINVAL; goto bail; } + cryptodev_warn(cse); again: /* @@ -1106,6 +1131,7 @@ cryptodev_aead( SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } + cryptodev_warn(cse); again: /* * Let the dispatch run unlocked, then, interlock against the From owner-svn-src-all@freebsd.org Tue Aug 27 22:21:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFA6AC9B38; Tue, 27 Aug 2019 22:21:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J3Hg47gkz4Qf0; Tue, 27 Aug 2019 22:21:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7064E25846; Tue, 27 Aug 2019 22:21:19 +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 x7RMLJoY078993; Tue, 27 Aug 2019 22:21:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7RMLJi0078992; Tue, 27 Aug 2019 22:21:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908272221.x7RMLJi0078992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 27 Aug 2019 22:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351558 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 22:21:19 -0000 Author: jhb Date: Tue Aug 27 22:21:18 2019 New Revision: 351558 URL: https://svnweb.freebsd.org/changeset/base/351558 Log: Only define the 'tls' member of sfio in KERN_TLS is defined. This field was not initialized in the !KERN_TLS case triggering an assertion failure when using sendfile(2). Reported by: pho, asomers Sponsored by: Netflix Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Tue Aug 27 21:29:37 2019 (r351557) +++ head/sys/kern/kern_sendfile.c Tue Aug 27 22:21:18 2019 (r351558) @@ -88,7 +88,9 @@ struct sf_io { int npages; struct socket *so; struct mbuf *m; +#ifdef KERN_TLS struct ktls_session *tls; +#endif vm_page_t pa[]; }; @@ -266,7 +268,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i if (!refcount_release(&sfio->nios)) return; -#ifdef INVARIANTS +#if defined(KERN_TLS) && defined(INVARIANTS) if ((sfio->m->m_flags & M_EXT) != 0 && sfio->m->m_ext.ext_type == EXT_PGS) KASSERT(sfio->tls == sfio->m->m_ext.ext_pgs->tls, From owner-svn-src-all@freebsd.org Tue Aug 27 22:21:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EE28C9BA7; Tue, 27 Aug 2019 22:21:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J3JB0zvtz4Qnd; Tue, 27 Aug 2019 22:21:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 8642D9952; Tue, 27 Aug 2019 22:21:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/t... From: John Baldwin To: Peter Holm Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201908270001.x7R01vUB052426@repo.freebsd.org> <20190827143953.GA5092@x8.osted.lan> <6f06637f-6486-bd2c-eebe-f14924e11e38@FreeBSD.org> <20190827170527.GA7111@x8.osted.lan> <1bfccef6-8cc2-328b-f97f-66d8aa5437a3@FreeBSD.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <90c539c5-ef5b-581c-ce2e-039657769e51@FreeBSD.org> Date: Tue, 27 Aug 2019 15:21:44 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1bfccef6-8cc2-328b-f97f-66d8aa5437a3@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2019 22:21:46 -0000 On 8/27/19 12:16 PM, John Baldwin wrote: > On 8/27/19 10:05 AM, Peter Holm wrote: >> On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote: >>> On 8/27/19 7:39 AM, Peter Holm wrote: >>>> On Tue, Aug 27, 2019 at 12:01:57AM +0000, John Baldwin wrote: >>>>> Author: jhb >>>>> Date: Tue Aug 27 00:01:56 2019 >>>>> New Revision: 351522 >>>>> URL: https://svnweb.freebsd.org/changeset/base/351522 >>>>> >>>>> Log: >>>>> Add kernel-side support for in-kernel TLS. >>>>> >>>> >>>> Could this be yours? >>>> >>>> 20190827 15:55:34 all (496/668): sendfile12.sh >>>> Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out of swap space >>>> panic: non-ext_pgs mbuf with TLS session >>> >>> Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it >>> would trip over this assertion for any use-after-free. I see in gdb that you >>> couldn't see sfio because of clang's poor debug info. It would be really good >>> to try to find the contents of sfio to debug this further. >>> >>> You should be able to find it via 'bp->b_caller1' in frame 14: >>> >>> 'p *(struct sf_io *)bp->b_caller1' >>> >> >> Here's a repeat where the involved files are compiled with "-O0": >> https://people.freebsd.org/~pho/stress/log/jhb009.txt > > Ok, it looks like sfio->tls is just not being initialized to NULL in the > !KERN_TLS case and the malloc junk is leaking through (my fault): > > (kgdb) p *(struct sf_io *)bp->b_caller1 > $5 = {nios = 0x0, error = 0x0, npages = 0x1, so = 0xfffff808898d0000, m = 0xfffff808a3512200, tls = 0xdeadc0dedeadc0de, pa = 0xfffff804e6cdfc68} > > Initially I thought about using M_ZERO, but we can just axe the 'tls' > member of 'sfio' entirely in the !KERN_TLS case since it's a private > structure. > > Try this (untested) change): I was able to verify this via Alan's test and have committed it. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Aug 28 01:22:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03472CCD15; Wed, 28 Aug 2019 01:22:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46J7JY6FpQz4Ylj; Wed, 28 Aug 2019 01:22:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B862427923; Wed, 28 Aug 2019 01:22:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S1MLeH089013; Wed, 28 Aug 2019 01:22:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S1MLjT089011; Wed, 28 Aug 2019 01:22:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908280122.x7S1MLjT089011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 01:22:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351559 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 351559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 01:22:22 -0000 Author: mjg Date: Wed Aug 28 01:22:21 2019 New Revision: 351559 URL: https://svnweb.freebsd.org/changeset/base/351559 Log: proc: remove zpfind It is not used by anything. If someone wants it back it should be reimplemented to use the proc hash. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_proc.c head/sys/sys/proc.h Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Aug 27 22:21:18 2019 (r351558) +++ head/sys/kern/kern_proc.c Wed Aug 28 01:22:21 2019 (r351559) @@ -1294,25 +1294,6 @@ pstats_free(struct pstats *ps) free(ps, M_SUBPROC); } -/* - * Locate a zombie process by number - */ -struct proc * -zpfind(pid_t pid) -{ - struct proc *p; - - sx_slock(&zombproc_lock); - LIST_FOREACH(p, &zombproc, p_list) { - if (p->p_pid == pid) { - PROC_LOCK(p); - break; - } - } - sx_sunlock(&zombproc_lock); - return (p); -} - #ifdef COMPAT_FREEBSD32 /* Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Aug 27 22:21:18 2019 (r351558) +++ head/sys/sys/proc.h Wed Aug 28 01:22:21 2019 (r351559) @@ -994,7 +994,6 @@ struct proc *pfind(pid_t); /* Find process by id. */ struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */ struct proc *pfind_any_locked(pid_t pid); /* Find process by id, locked. */ struct pgrp *pgfind(pid_t); /* Find process group by id. */ -struct proc *zpfind(pid_t); /* Find zombie process by id. */ void pidhash_slockall(void); /* Shared lock all pid hash lists. */ void pidhash_sunlockall(void); /* Shared unlock all pid hash lists. */ From owner-svn-src-all@freebsd.org Wed Aug 28 04:19:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23C1BD0919; Wed, 28 Aug 2019 04:19:38 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JCF574gyz3DG2; Wed, 28 Aug 2019 04:19:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0E418DF; Wed, 28 Aug 2019 04:19:37 +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 x7S4JbNG095817; Wed, 28 Aug 2019 04:19:37 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S4JbW5095814; Wed, 28 Aug 2019 04:19:37 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908280419.x7S4JbW5095814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 28 Aug 2019 04:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351560 - in head: sys/fs/fuse tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: sys/fs/fuse tests/sys/fs/fusefs X-SVN-Commit-Revision: 351560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 04:19:38 -0000 Author: asomers Date: Wed Aug 28 04:19:37 2019 New Revision: 351560 URL: https://svnweb.freebsd.org/changeset/base/351560 Log: fusefs: Fix some bugs regarding the size of the LISTXATTR list * A small error in r338152 let to the returned size always being exactly eight bytes too large. * The FUSE_LISTXATTR operation works like Linux's listxattr(2): if the caller does not provide enough space, then the server should return ERANGE rather than return a truncated list. That's true even though in FUSE's case the kernel doesn't provide space to the client at all; it simply requests a maximum size for the list. We previously weren't handling the case where the server returns ERANGE even though the kernel requested as much size as the server had told us it needs; that can happen due to a race. * We also need to ensure that a pathological server that always returns ERANGE no matter what size we request in FUSE_LISTXATTR won't cause an infinite loop in the kernel. As of this commit, it will instead cause an infinite loop that exits and enters the kernel on each iteration, allowing signals to be processed. Reviewed by: cem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21287 Modified: head/sys/fs/fuse/fuse_vnops.c head/tests/sys/fs/fusefs/mockfs.cc head/tests/sys/fs/fusefs/xattr.cc Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Wed Aug 28 01:22:21 2019 (r351559) +++ head/sys/fs/fuse/fuse_vnops.c Wed Aug 28 04:19:37 2019 (r351560) @@ -2225,6 +2225,20 @@ fuse_xattrlist_convert(char *prefix, const char *list, } /* + * List extended attributes + * + * The FUSE_LISTXATTR operation is based on Linux's listxattr(2) syscall, which + * has a number of differences compared to its FreeBSD equivalent, + * extattr_list_file: + * + * - FUSE_LISTXATTR returns all extended attributes across all namespaces, + * whereas listxattr(2) only returns attributes for a single namespace + * - FUSE_LISTXATTR prepends each attribute name with "namespace." + * - If the provided buffer is not large enough to hold the result, + * FUSE_LISTXATTR should return ERANGE, whereas listxattr is expected to + * return as many results as will fit. + */ +/* struct vop_listextattr_args { struct vop_generic_args a_gen; struct vnode *a_vp; @@ -2303,14 +2317,31 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap) */ fdisp_refresh_vp(&fdi, FUSE_LISTXATTR, vp, td, cred); list_xattr_in = fdi.indata; - list_xattr_in->size = linux_list_len + sizeof(*list_xattr_out); + list_xattr_in->size = linux_list_len; err = fdisp_wait_answ(&fdi); - if (err != 0) + if (err == ERANGE) { + /* + * Race detected. The attribute list must've grown since the + * first FUSE_LISTXATTR call. Start over. Go all the way back + * to userland so we can process signals, if necessary, before + * restarting. + */ + err = ERESTART; goto out; + } else if (err != 0) + goto out; linux_list = fdi.answ; - linux_list_len = fdi.iosize; + /* FUSE doesn't allow the server to return more data than requested */ + if (fdi.iosize > linux_list_len) { + printf("WARNING: FUSE protocol violation. Server returned " + "more extended attribute data than requested; " + "should've returned ERANGE instead"); + } else { + /* But returning less data is fine */ + linux_list_len = fdi.iosize; + } /* * Retrieve the BSD compatible list values. Modified: head/tests/sys/fs/fusefs/mockfs.cc ============================================================================== --- head/tests/sys/fs/fusefs/mockfs.cc Wed Aug 28 01:22:21 2019 (r351559) +++ head/tests/sys/fs/fusefs/mockfs.cc Wed Aug 28 04:19:37 2019 (r351560) @@ -204,6 +204,9 @@ void MockFS::debug_request(const mockfs_buf_in &in) case FUSE_LINK: printf(" oldnodeid=%" PRIu64, in.body.link.oldnodeid); break; + case FUSE_LISTXATTR: + printf(" size=%" PRIu32, in.body.listxattr.size); + break; case FUSE_LOOKUP: printf(" %s", in.body.lookup); break; Modified: head/tests/sys/fs/fusefs/xattr.cc ============================================================================== --- head/tests/sys/fs/fusefs/xattr.cc Wed Aug 28 01:22:21 2019 (r351559) +++ head/tests/sys/fs/fusefs/xattr.cc Wed Aug 28 04:19:37 2019 (r351560) @@ -35,6 +35,9 @@ extern "C" { #include #include +#include +#include +#include #include } @@ -45,7 +48,18 @@ using namespace testing; const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; +static sem_t killer_semaphore; +void* killer(void* target) { + pid_t pid = *(pid_t*)target; + sem_wait(&killer_semaphore); + if (verbosity > 1) + printf("Killing! pid %d\n", pid); + kill(pid, SIGINT); + + return(NULL); +} + class Xattr: public FuseTest { public: void expect_getxattr(uint64_t ino, const char *attr, ProcessMockerT r) @@ -62,17 +76,31 @@ void expect_getxattr(uint64_t ino, const char *attr, P ).WillOnce(Invoke(r)); } -void expect_listxattr(uint64_t ino, uint32_t size, ProcessMockerT r) +void expect_listxattr(uint64_t ino, uint32_t size, ProcessMockerT r, + Sequence *seq = NULL) { - EXPECT_CALL(*m_mock, process( - ResultOf([=](auto in) { - return (in.header.opcode == FUSE_LISTXATTR && - in.header.nodeid == ino && - in.body.listxattr.size == size); - }, Eq(true)), - _) - ).WillOnce(Invoke(r)) - .RetiresOnSaturation(); + if (seq == NULL) { + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_LISTXATTR && + in.header.nodeid == ino && + in.body.listxattr.size == size); + }, Eq(true)), + _) + ).WillOnce(Invoke(r)) + .RetiresOnSaturation(); + } else { + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_LISTXATTR && + in.header.nodeid == ino && + in.body.listxattr.size == size); + }, Eq(true)), + _) + ).InSequence(*seq) + .WillOnce(Invoke(r)) + .RetiresOnSaturation(); + } } void expect_removexattr(uint64_t ino, const char *attr, int error) @@ -108,7 +136,37 @@ void expect_setxattr(uint64_t ino, const char *attr, c }; class Getxattr: public Xattr {}; + class Listxattr: public Xattr {}; + +/* Listxattr tests that need to use a signal */ +class ListxattrSig: public Listxattr { +public: +pthread_t m_killer_th; +pid_t m_child; + +void SetUp() { + /* + * Mount with -o nointr so the mount can't get interrupted while + * waiting for a response from the server + */ + m_nointr = true; + FuseTest::SetUp(); + + ASSERT_EQ(0, sem_init(&killer_semaphore, 0, 0)) << strerror(errno); +} + +void TearDown() { + if (m_killer_th != NULL) { + pthread_join(m_killer_th, NULL); + } + + sem_destroy(&killer_semaphore); + + FuseTest::TearDown(); +} +}; + class Removexattr: public Xattr {}; class Setxattr: public Xattr {}; class RofsXattr: public Xattr { @@ -175,6 +233,7 @@ TEST_F(Getxattr, enosys) * behavior. * * This test case covers a filesystem that uses the Linux behavior + * TODO: require FreeBSD Behavior. */ TEST_F(Getxattr, erange) { @@ -300,29 +359,111 @@ TEST_F(Listxattr, enotsup) } /* - * On FreeBSD, if the user passes an insufficiently large buffer then the - * filesystem is supposed to copy as much of the attribute's value as will fit. + * On FreeBSD, if the user passes an insufficiently large buffer to + * extattr_list_file(2) or VOP_LISTEXTATTR(9), then the file system is supposed + * to copy as much of the attribute's value as will fit. * - * On Linux, however, the filesystem is supposed to return ERANGE. + * On Linux, however, the file system is supposed to return ERANGE if an + * insufficiently large buffer is passed to listxattr(2). * - * libfuse specifies the Linux behavior. However, that's probably an error. - * It would probably be correct for the filesystem to use platform-dependent - * behavior. - * - * This test case covers a filesystem that uses the Linux behavior + * fusefs(5) must guarantee the usual FreeBSD behavior. */ TEST_F(Listxattr, erange) { uint64_t ino = 42; int ns = EXTATTR_NAMESPACE_USER; + char attrs[9] = "user.foo"; + char expected[3] = {3, 'f', 'o'}; + char buf[3]; expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); - expect_listxattr(ino, 0, ReturnErrno(ERANGE)); + expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) + { + out.body.listxattr.size = sizeof(attrs); + SET_OUT_HEADER_LEN(out, listxattr); + })); + expect_listxattr(ino, sizeof(attrs), + ReturnImmediate([&](auto in __unused, auto& out) { + memcpy((void*)out.body.bytes, attrs, sizeof(attrs)); + out.header.len = sizeof(fuse_out_header) + sizeof(attrs); + })); - ASSERT_EQ(-1, extattr_list_file(FULLPATH, ns, NULL, 0)); - ASSERT_EQ(ERANGE, errno); + + ASSERT_EQ(static_cast(sizeof(buf)), + extattr_list_file(FULLPATH, ns, buf, sizeof(buf))); + ASSERT_EQ(0, memcmp(expected, buf, sizeof(buf))); } +/* + * A buggy or malicious file system always returns ERANGE, even if we pass an + * appropriately sized buffer. That will send the kernel into an infinite + * loop. This test will ensure that the loop is interruptible by killing the + * blocked process with SIGINT. + */ +TEST_F(ListxattrSig, erange_forever) +{ + uint64_t ino = 42; + uint32_t lie_size = 10; + int status; + + fork(false, &status, [&] { + EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) + .WillRepeatedly(Invoke( + ReturnImmediate([=](auto in __unused, auto& out) { + SET_OUT_HEADER_LEN(out, entry); + out.body.entry.attr.mode = S_IFREG | 0644; + out.body.entry.nodeid = ino; + out.body.entry.attr.nlink = 1; + out.body.entry.attr_valid = UINT64_MAX; + out.body.entry.entry_valid = UINT64_MAX; + }))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_LISTXATTR && + in.header.nodeid == ino && + in.body.listxattr.size == 0); + }, Eq(true)), + _) + ).WillRepeatedly(ReturnImmediate([=](auto i __unused, auto& out) + { + /* The file system requests 10 bytes, but it's a lie */ + out.body.listxattr.size = lie_size; + SET_OUT_HEADER_LEN(out, listxattr); + /* + * We can send the signal any time after fusefs enters + * VOP_LISTEXTATTR + */ + sem_post(&killer_semaphore); + })); + /* + * Even though the kernel faithfully respects our size request, + * we'll return ERANGE anyway. + */ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_LISTXATTR && + in.header.nodeid == ino && + in.body.listxattr.size == lie_size); + }, Eq(true)), + _) + ).WillRepeatedly(ReturnErrno(ERANGE)); + + ASSERT_EQ(0, pthread_create(&m_killer_th, NULL, killer, + &m_mock->m_child_pid)) + << strerror(errno); + + }, [] { + /* Child process will block until it gets signaled */ + int ns = EXTATTR_NAMESPACE_USER; + char buf[3]; + extattr_list_file(FULLPATH, ns, buf, sizeof(buf)); + return 0; + } + ); + + ASSERT_TRUE(WIFSIGNALED(status)); +} + /* * Get the size of the list that it would take to list no extended attributes */ @@ -351,21 +492,20 @@ TEST_F(Listxattr, size_only_nonempty) { uint64_t ino = 42; int ns = EXTATTR_NAMESPACE_USER; + char attrs[9] = "user.foo"; expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); - expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) { - out.body.listxattr.size = 45; + expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) + { + out.body.listxattr.size = sizeof(attrs); SET_OUT_HEADER_LEN(out, listxattr); })); - // TODO: fix the expected size after fixing the size calculation bug in - // fuse_vnop_listextattr. It should be exactly 45. - expect_listxattr(ino, 53, - ReturnImmediate([](auto in __unused, auto& out) { - const char l[] = "user.foo"; - strlcpy((char*)out.body.bytes, l, - sizeof(out.body.bytes)); - out.header.len = sizeof(fuse_out_header) + sizeof(l); + expect_listxattr(ino, sizeof(attrs), + ReturnImmediate([=](auto in __unused, auto& out) { + size_t l = sizeof(attrs); + strlcpy((char*)out.body.bytes, attrs, l); + out.header.len = sizeof(fuse_out_header) + l; }) ); @@ -373,6 +513,88 @@ TEST_F(Listxattr, size_only_nonempty) << strerror(errno); } +/* + * The list of extended attributes grows in between the server's two calls to + * FUSE_LISTXATTR. + */ +TEST_F(Listxattr, size_only_race_bigger) +{ + uint64_t ino = 42; + int ns = EXTATTR_NAMESPACE_USER; + char attrs0[9] = "user.foo"; + char attrs1[18] = "user.foo\0user.bar"; + Sequence seq; + + EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) + .WillRepeatedly(Invoke( + ReturnImmediate([=](auto in __unused, auto& out) { + SET_OUT_HEADER_LEN(out, entry); + out.body.entry.attr.mode = S_IFREG | 0644; + out.body.entry.nodeid = ino; + out.body.entry.attr.nlink = 1; + out.body.entry.attr_valid = UINT64_MAX; + out.body.entry.entry_valid = UINT64_MAX; + }))); + expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) + { + out.body.listxattr.size = sizeof(attrs0); + SET_OUT_HEADER_LEN(out, listxattr); + }), &seq); + + /* + * After the first FUSE_LISTXATTR the list grew, so the second + * operation returns ERANGE. + */ + expect_listxattr(ino, sizeof(attrs0), ReturnErrno(ERANGE), &seq); + + /* And now the kernel retries */ + expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) + { + out.body.listxattr.size = sizeof(attrs1); + SET_OUT_HEADER_LEN(out, listxattr); + }), &seq); + expect_listxattr(ino, sizeof(attrs1), + ReturnImmediate([&](auto in __unused, auto& out) { + memcpy((char*)out.body.bytes, attrs1, sizeof(attrs1)); + out.header.len = sizeof(fuse_out_header) + + sizeof(attrs1); + }), &seq + ); + + /* Userspace should never know about the retry */ + ASSERT_EQ(8, extattr_list_file(FULLPATH, ns, NULL, 0)) + << strerror(errno); +} + +/* + * The list of extended attributes shrinks in between the server's two calls to + * FUSE_LISTXATTR + */ +TEST_F(Listxattr, size_only_race_smaller) +{ + uint64_t ino = 42; + int ns = EXTATTR_NAMESPACE_USER; + char attrs0[18] = "user.foo\0user.bar"; + char attrs1[9] = "user.foo"; + + expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); + expect_listxattr(ino, 0, ReturnImmediate([](auto i __unused, auto& out) + { + out.body.listxattr.size = sizeof(attrs0); + SET_OUT_HEADER_LEN(out, listxattr); + })); + expect_listxattr(ino, sizeof(attrs0), + ReturnImmediate([&](auto in __unused, auto& out) { + strlcpy((char*)out.body.bytes, attrs1, sizeof(attrs1)); + out.header.len = sizeof(fuse_out_header) + + sizeof(attrs1); + }) + ); + + ASSERT_EQ(4, extattr_list_file(FULLPATH, ns, NULL, 0)) + << strerror(errno); +} + TEST_F(Listxattr, size_only_really_big) { uint64_t ino = 42; @@ -384,9 +606,7 @@ TEST_F(Listxattr, size_only_really_big) SET_OUT_HEADER_LEN(out, listxattr); })); - // TODO: fix the expected size after fixing the size calculation bug in - // fuse_vnop_listextattr. It should be exactly 16000. - expect_listxattr(ino, 16008, + expect_listxattr(ino, 16000, ReturnImmediate([](auto in __unused, auto& out) { const char l[16] = "user.foobarbang"; for (int i=0; i < 1000; i++) { @@ -420,9 +640,7 @@ TEST_F(Listxattr, user) }) ); - // TODO: fix the expected size after fixing the size calculation bug in - // fuse_vnop_listextattr. - expect_listxattr(ino, sizeof(attrs) + 8, + expect_listxattr(ino, sizeof(attrs), ReturnImmediate([&](auto in __unused, auto& out) { memcpy((void*)out.body.bytes, attrs, sizeof(attrs)); out.header.len = sizeof(fuse_out_header) + sizeof(attrs); @@ -454,9 +672,7 @@ TEST_F(Listxattr, system) }) ); - // TODO: fix the expected size after fixing the size calculation bug in - // fuse_vnop_listextattr. - expect_listxattr(ino, sizeof(attrs) + 8, + expect_listxattr(ino, sizeof(attrs), ReturnImmediate([&](auto in __unused, auto& out) { memcpy((void*)out.body.bytes, attrs, sizeof(attrs)); out.header.len = sizeof(fuse_out_header) + sizeof(attrs); From owner-svn-src-all@freebsd.org Wed Aug 28 04:54:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5F92D14A5; Wed, 28 Aug 2019 04:54:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JD1G51LDz3Fkg; Wed, 28 Aug 2019 04:54:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 887CA2000; Wed, 28 Aug 2019 04:54:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S4sQ2n019049; Wed, 28 Aug 2019 04:54:26 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S4sQn2019048; Wed, 28 Aug 2019 04:54:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908280454.x7S4sQn2019048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 28 Aug 2019 04:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351561 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 04:54:26 -0000 Author: cy Date: Wed Aug 28 04:54:26 2019 New Revision: 351561 URL: https://svnweb.freebsd.org/changeset/base/351561 Log: Fixup typo in comment. Obtained from: NetBSD ip_nat.c r1.7 MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:19:37 2019 (r351560) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:54:26 2019 (r351561) @@ -3073,7 +3073,7 @@ ipf_nat_newrdr(fin, nat, ni) /* Attempts to create a new NAT entry. Does not actually change the packet */ /* in any way. */ /* */ -/* This fucntion is in three main parts: (1) deal with creating a new NAT */ +/* This function is in three main parts: (1) deal with creating a new NAT */ /* structure for a "MAP" rule (outgoing NAT translation); (2) deal with */ /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ From owner-svn-src-all@freebsd.org Wed Aug 28 04:55:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78D86D151C; Wed, 28 Aug 2019 04:55:04 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JD202ZgNz3Fsd; Wed, 28 Aug 2019 04:55:04 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A4CB2001; Wed, 28 Aug 2019 04:55:04 +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 x7S4t4xK019153; Wed, 28 Aug 2019 04:55:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S4t4JC019152; Wed, 28 Aug 2019 04:55:04 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908280455.x7S4t4JC019152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 28 Aug 2019 04:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351562 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 04:55:04 -0000 Author: cy Date: Wed Aug 28 04:55:03 2019 New Revision: 351562 URL: https://svnweb.freebsd.org/changeset/base/351562 Log: Destroy the mutex in case of error. Obtained from: NetBSD ip_nat.c r1.7 MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:54:26 2019 (r351561) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:55:03 2019 (r351562) @@ -3078,7 +3078,7 @@ ipf_nat_newrdr(fin, nat, ni) /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ /* */ -/* NOTE: natsave should NOT be used top point back to an ipstate_t struct */ +/* NOTE: natsave should NOT be used to point back to an ipstate_t struct */ /* as it can result in memory being corrupted. */ /* ------------------------------------------------------------------------ */ nat_t * @@ -3406,6 +3406,7 @@ ipf_nat_insert(softc, softn, nat) u_int hv0, hv1; u_int sp, dp; ipnat_t *in; + int ret; /* * Try and return an error as early as possible, so calculate the hash @@ -3488,7 +3489,10 @@ ipf_nat_insert(softc, softn, nat) nat->nat_mtu[1] = GETIFMTU_4(nat->nat_ifps[1]); } - return ipf_nat_hashtab_add(softc, softn, nat); + ret = ipf_nat_hashtab_add(softc, softn, nat); + if (ret == -1) + MUTEX_DESTROY(&nat->nat_lock); + return ret; } From owner-svn-src-all@freebsd.org Wed Aug 28 04:55:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B9E8D1580; Wed, 28 Aug 2019 04:55:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JD2G2hwBz3G1B; Wed, 28 Aug 2019 04:55:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F9382002; Wed, 28 Aug 2019 04:55:18 +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 x7S4tIa8019207; Wed, 28 Aug 2019 04:55:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S4tIYk019206; Wed, 28 Aug 2019 04:55:18 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908280455.x7S4tIYk019206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 28 Aug 2019 04:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351563 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 04:55:18 -0000 Author: cy Date: Wed Aug 28 04:55:17 2019 New Revision: 351563 URL: https://svnweb.freebsd.org/changeset/base/351563 Log: Document ipf_nat_hashtab_add() return codes. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:55:03 2019 (r351562) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Wed Aug 28 04:55:17 2019 (r351563) @@ -3498,6 +3498,7 @@ ipf_nat_insert(softc, softn, nat) /* ------------------------------------------------------------------------ */ /* Function: ipf_nat_hashtab_add */ +/* Returns: int - 0 == sucess, -1 == failure */ /* Parameters: softc(I) - pointer to soft context main structure */ /* softn(I) - pointer to NAT context structure */ /* nat(I) - pointer to NAT structure */ From owner-svn-src-all@freebsd.org Wed Aug 28 07:37:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F08BED3F31; Wed, 28 Aug 2019 07:37:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JHdV63FGz3N4H; Wed, 28 Aug 2019 07:37:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0E4F3F2B; Wed, 28 Aug 2019 07:37:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S7bYiF013165; Wed, 28 Aug 2019 07:37:34 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S7bYud013164; Wed, 28 Aug 2019 07:37:34 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908280737.x7S7bYud013164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 28 Aug 2019 07:37:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351564 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 351564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 07:37:35 -0000 Author: brooks Date: Wed Aug 28 07:37:34 2019 New Revision: 351564 URL: https://svnweb.freebsd.org/changeset/base/351564 Log: MFC r339624: Remove the need for backslashes in syscalls.master. Join non-special lines together until we hit a line containing a '}' character. This allows the function declaration body to be split across multiple lines without backslash continuation characters. Continue to join lines ending with backslashes to allow gradual migration and to support out-of-tree syscall vectors Reviewed by: emaste, kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17488 Modified: stable/12/sys/kern/makesyscalls.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/makesyscalls.sh ============================================================================== --- stable/12/sys/kern/makesyscalls.sh Wed Aug 28 04:55:17 2019 (r351563) +++ stable/12/sys/kern/makesyscalls.sh Wed Aug 28 07:37:34 2019 (r351564) @@ -68,13 +68,33 @@ if [ -n "$2" ]; then fi sed -e ' -:join + # FreeBSD ID, includes, comments, and blank lines + /.*\$FreeBSD/b done_joining + /^[#;]/b done_joining + /^$/b done_joining + + # Join lines ending in backslash +:joining /\\$/{a\ N s/\\\n// - b join + b joining } + + # OBSOL, etc lines without function signatures + /^[0-9][^{]*$/b done_joining + + # Join incomplete signatures. The { must appear on the first line + # and the } must appear on the last line (modulo lines joined by + # backslashes). + /^[^}]*$/{a\ + + N + s/\n// + b joining + } +:done_joining 2,${ /^#/!s/\([{}()*,]\)/ \1 /g } From owner-svn-src-all@freebsd.org Wed Aug 28 07:43:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4193BD41D8; Wed, 28 Aug 2019 07:43:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JHmW1kRgz3NS0; Wed, 28 Aug 2019 07:43:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CBA2412C; Wed, 28 Aug 2019 07:43:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S7hcqq018749; Wed, 28 Aug 2019 07:43:38 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S7hV7U018712; Wed, 28 Aug 2019 07:43:31 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908280743.x7S7hV7U018712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 28 Aug 2019 07:43:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351565 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/ibcs2 i386/linux kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/ibcs2 i386/linux kern sys X-SVN-Commit-Revision: 351565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 07:43:39 -0000 Author: brooks Date: Wed Aug 28 07:43:31 2019 New Revision: 351565 URL: https://svnweb.freebsd.org/changeset/base/351565 Log: Regenerate to add @generated tag in generated files. This is a manual merge of r347230. Modified: stable/12/sys/amd64/linux/linux_proto.h stable/12/sys/amd64/linux/linux_syscall.h stable/12/sys/amd64/linux/linux_syscalls.c stable/12/sys/amd64/linux/linux_sysent.c stable/12/sys/amd64/linux/linux_systrace_args.c stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_syscall.h stable/12/sys/amd64/linux32/linux32_syscalls.c stable/12/sys/amd64/linux32/linux32_sysent.c stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/arm64/linux/linux_proto.h stable/12/sys/arm64/linux/linux_syscall.h stable/12/sys/arm64/linux/linux_syscalls.c stable/12/sys/arm64/linux/linux_sysent.c stable/12/sys/arm64/linux/linux_systrace_args.c stable/12/sys/compat/freebsd32/freebsd32_proto.h stable/12/sys/compat/freebsd32/freebsd32_syscall.h stable/12/sys/compat/freebsd32/freebsd32_syscalls.c stable/12/sys/compat/freebsd32/freebsd32_sysent.c stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c stable/12/sys/i386/ibcs2/ibcs2_proto.h stable/12/sys/i386/ibcs2/ibcs2_syscall.h stable/12/sys/i386/ibcs2/ibcs2_sysent.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_syscall.h stable/12/sys/i386/linux/linux_syscalls.c stable/12/sys/i386/linux/linux_sysent.c stable/12/sys/i386/linux/linux_systrace_args.c stable/12/sys/kern/init_sysent.c stable/12/sys/kern/syscalls.c stable/12/sys/kern/systrace_args.c stable/12/sys/sys/syscall.h stable/12/sys/sys/syscall.mk stable/12/sys/sys/sysproto.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_proto.h ============================================================================== --- stable/12/sys/amd64/linux/linux_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux/linux_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux/linux_syscall.h ============================================================================== --- stable/12/sys/amd64/linux/linux_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux/linux_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/amd64/linux/linux_syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux/linux_syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux/linux_sysent.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux/linux_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux/linux_systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux/linux_systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux32/linux32_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux32/linux32_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux32/linux32_syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux32/linux32_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/amd64/linux32/linux32_systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/arm64/linux/linux_proto.h ============================================================================== --- stable/12/sys/arm64/linux/linux_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/arm64/linux/linux_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/arm64/linux/linux_syscall.h ============================================================================== --- stable/12/sys/arm64/linux/linux_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/arm64/linux/linux_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/arm64/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/arm64/linux/linux_syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/arm64/linux/linux_syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/arm64/linux/linux_sysent.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/arm64/linux/linux_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/arm64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/arm64/linux/linux_systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/arm64/linux/linux_systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/compat/freebsd32/freebsd32_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/i386/ibcs2/ibcs2_proto.h ============================================================================== --- stable/12/sys/i386/ibcs2/ibcs2_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/ibcs2/ibcs2_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/ibcs2/ibcs2_syscall.h ============================================================================== --- stable/12/sys/i386/ibcs2/ibcs2_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/ibcs2/ibcs2_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/ibcs2/ibcs2_sysent.c ============================================================================== --- stable/12/sys/i386/ibcs2/ibcs2_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/ibcs2/ibcs2_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/linux/linux_proto.h ============================================================================== --- stable/12/sys/i386/linux/linux_proto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/linux/linux_proto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/linux/linux_syscall.h ============================================================================== --- stable/12/sys/i386/linux/linux_syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/linux/linux_syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/i386/linux/linux_syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/linux/linux_syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/linux/linux_sysent.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/linux/linux_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/i386/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/i386/linux/linux_systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/i386/linux/linux_systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/kern/init_sysent.c ============================================================================== --- stable/12/sys/kern/init_sysent.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/kern/init_sysent.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/kern/syscalls.c ============================================================================== --- stable/12/sys/kern/syscalls.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/kern/syscalls.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/kern/systrace_args.c ============================================================================== --- stable/12/sys/kern/systrace_args.c Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/kern/systrace_args.c Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: stable/12/sys/sys/syscall.h ============================================================================== --- stable/12/sys/sys/syscall.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/sys/syscall.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: stable/12/sys/sys/syscall.mk ============================================================================== --- stable/12/sys/sys/syscall.mk Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/sys/syscall.mk Wed Aug 28 07:43:31 2019 (r351565) @@ -1,5 +1,5 @@ # FreeBSD system call object files. -# DO NOT EDIT-- this file is automatically generated. +# DO NOT EDIT-- this file is automatically @generated. # $FreeBSD$ MIASM = \ syscall.o \ Modified: stable/12/sys/sys/sysproto.h ============================================================================== --- stable/12/sys/sys/sysproto.h Wed Aug 28 07:37:34 2019 (r351564) +++ stable/12/sys/sys/sysproto.h Wed Aug 28 07:43:31 2019 (r351565) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ From owner-svn-src-all@freebsd.org Wed Aug 28 07:53:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9F77D45CE; Wed, 28 Aug 2019 07:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JHzW5BpKz3Nyd; Wed, 28 Aug 2019 07:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9374942FD; Wed, 28 Aug 2019 07:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S7rBg9024836; Wed, 28 Aug 2019 07:53:11 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S7rB29024833; Wed, 28 Aug 2019 07:53:11 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908280753.x7S7rB29024833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 28 Aug 2019 07:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351566 - in stable/12/sys: compat/freebsd32 kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 351566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 07:53:11 -0000 Author: brooks Date: Wed Aug 28 07:53:10 2019 New Revision: 351566 URL: https://svnweb.freebsd.org/changeset/base/351566 Log: MFC r340424: Use the main capabilities.conf for freebsd32. Allow the location of capabilities.conf to be configured. Also allow a per-abi syscall prefix to be configured with the abi_func_prefix syscalls.conf variable and check syscalls against entries in capabilities.conf with and without the prefix amended. Take advantage of these two features to allow use shared capabilities.conf between the default syscall vector and the freebsd32 compatability layer. We've been inconsistent about keeping the two in sync as evidenced by the bugs fixed in r340294. This eliminates that problem going forward. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17932 Deleted: stable/12/sys/compat/freebsd32/capabilities.conf Modified: stable/12/sys/compat/freebsd32/Makefile stable/12/sys/compat/freebsd32/syscalls.conf stable/12/sys/kern/makesyscalls.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/freebsd32/Makefile ============================================================================== --- stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 07:43:31 2019 (r351565) +++ stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 07:53:10 2019 (r351566) @@ -11,7 +11,7 @@ all: sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \ - ../../kern/makesyscalls.sh syscalls.master syscalls.conf capabilities.conf + ../../kern/makesyscalls.sh syscalls.master syscalls.conf ../../kern/capabilities.conf sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf clean: Modified: stable/12/sys/compat/freebsd32/syscalls.conf ============================================================================== --- stable/12/sys/compat/freebsd32/syscalls.conf Wed Aug 28 07:43:31 2019 (r351565) +++ stable/12/sys/compat/freebsd32/syscalls.conf Wed Aug 28 07:53:10 2019 (r351566) @@ -9,3 +9,5 @@ syscallprefix="FREEBSD32_SYS_" switchname="freebsd32_sysent" namesname="freebsd32_syscallnames" systrace="freebsd32_systrace_args.c" +abi_func_prefix="freebsd32_" +capabilities_conf="../../kern/capabilities.conf" Modified: stable/12/sys/kern/makesyscalls.sh ============================================================================== --- stable/12/sys/kern/makesyscalls.sh Wed Aug 28 07:43:31 2019 (r351565) +++ stable/12/sys/kern/makesyscalls.sh Wed Aug 28 07:53:10 2019 (r351566) @@ -45,14 +45,8 @@ sysarg="sysarg.switch.$$" sysprotoend="sysprotoend.$$" systracetmp="systrace.$$" systraceret="systraceret.$$" +capabilities_conf="capabilities.conf" -if [ -r capabilities.conf ]; then - capenabled=`egrep -v '^#|^$' capabilities.conf` - capenabled=`echo $capenabled | sed 's/ /,/g'` -else - capenabled="" -fi - trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret" 0 touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret @@ -67,6 +61,13 @@ if [ -n "$2" ]; then . $2 fi +if [ -r $capabilities_conf ]; then + capenabled=`egrep -v '^#|^$' $capabilities_conf` + capenabled=`echo $capenabled | sed 's/ /,/g'` +else + capenabled="" +fi + sed -e ' # FreeBSD ID, includes, comments, and blank lines /.*\$FreeBSD/b done_joining @@ -137,6 +138,7 @@ sed -e ' switchname = \"$switchname\" namesname = \"$namesname\" infile = \"$1\" + abi_func_prefix = \"$abi_func_prefix\" capenabled_string = \"$capenabled\" "' @@ -375,7 +377,8 @@ sed -e ' # from it. # for (cap in capenabled) { - if (funcname == capenabled[cap]) { + if (funcname == capenabled[cap] || + funcname == abi_func_prefix capenabled[cap]) { flags = "SYF_CAPENABLED"; break; } From owner-svn-src-all@freebsd.org Wed Aug 28 08:05:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96411D5272; Wed, 28 Aug 2019 08:05:18 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JJFV3K4Bz3PXg; Wed, 28 Aug 2019 08:05:18 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5012844D5; Wed, 28 Aug 2019 08:05:18 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S85IcC030853; Wed, 28 Aug 2019 08:05:18 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S85Gii030846; Wed, 28 Aug 2019 08:05:16 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908280805.x7S85Gii030846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 28 Aug 2019 08:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351567 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern X-SVN-Commit-Revision: 351567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 08:05:18 -0000 Author: brooks Date: Wed Aug 28 08:05:16 2019 New Revision: 351567 URL: https://svnweb.freebsd.org/changeset/base/351567 Log: MFC r348446: makesyscalls.sh: always use absolute path for syscalls.conf syscalls.conf is included using "." which per the Open Group: If file does not contain a , the shell shall use the search path specified by PATH to find the directory containing file. POSIX shells don't fall back to the current working directory. Submitted by: Nathaniel Wesley Filardo Reviewed by: bdrewery Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D20476 Modified: stable/12/sys/amd64/linux/Makefile stable/12/sys/amd64/linux32/Makefile stable/12/sys/arm64/linux/Makefile stable/12/sys/compat/cloudabi32/Makefile stable/12/sys/compat/cloudabi64/Makefile stable/12/sys/compat/freebsd32/Makefile stable/12/sys/i386/linux/Makefile stable/12/sys/kern/makesyscalls.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/Makefile ============================================================================== --- stable/12/sys/amd64/linux/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/amd64/linux/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -11,5 +11,5 @@ all: sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf + ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf Modified: stable/12/sys/amd64/linux32/Makefile ============================================================================== --- stable/12/sys/amd64/linux32/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/amd64/linux32/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -11,5 +11,5 @@ all: sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../kern/makesyscalls.sh \ - syscalls.master syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf + syscalls.master ${.CURDIR}/syscalls.conf + sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf Modified: stable/12/sys/arm64/linux/Makefile ============================================================================== --- stable/12/sys/arm64/linux/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/arm64/linux/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -11,5 +11,5 @@ all: sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf + ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf Modified: stable/12/sys/compat/cloudabi32/Makefile ============================================================================== --- stable/12/sys/compat/cloudabi32/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/compat/cloudabi32/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -12,6 +12,6 @@ sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloud cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \ cloudabi32_syscalls.c cloudabi32_systrace_args.c: \ ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \ - syscalls.conf + ${.CURDIR}/syscalls.conf sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \ - syscalls.conf + ${.CURDIR}/syscalls.conf Modified: stable/12/sys/compat/cloudabi64/Makefile ============================================================================== --- stable/12/sys/compat/cloudabi64/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/compat/cloudabi64/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -12,6 +12,6 @@ sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloud cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ cloudabi64_syscalls.c cloudabi64_systrace_args.c: \ ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ - syscalls.conf + ${.CURDIR}/syscalls.conf sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ - syscalls.conf + ${.CURDIR}/syscalls.conf Modified: stable/12/sys/compat/freebsd32/Makefile ============================================================================== --- stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -11,8 +11,8 @@ all: sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \ - ../../kern/makesyscalls.sh syscalls.master syscalls.conf ../../kern/capabilities.conf - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf + ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf ../../kern/capabilities.conf + sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf clean: rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h Modified: stable/12/sys/i386/linux/Makefile ============================================================================== --- stable/12/sys/i386/linux/Makefile Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/i386/linux/Makefile Wed Aug 28 08:05:16 2019 (r351567) @@ -11,5 +11,5 @@ all: sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf + ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf Modified: stable/12/sys/kern/makesyscalls.sh ============================================================================== --- stable/12/sys/kern/makesyscalls.sh Wed Aug 28 07:53:10 2019 (r351566) +++ stable/12/sys/kern/makesyscalls.sh Wed Aug 28 08:05:16 2019 (r351567) @@ -58,7 +58,7 @@ case $# in esac if [ -n "$2" ]; then - . $2 + . "$2" fi if [ -r $capabilities_conf ]; then From owner-svn-src-all@freebsd.org Wed Aug 28 08:09:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B59A1D5422; Wed, 28 Aug 2019 08:09:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JJKz426Dz3Ppc; Wed, 28 Aug 2019 08:09:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BD1944D8; Wed, 28 Aug 2019 08:09:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7S89BRM031066; Wed, 28 Aug 2019 08:09:11 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7S89BWL031065; Wed, 28 Aug 2019 08:09:11 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908280809.x7S89BWL031065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 28 Aug 2019 08:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351568 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 351568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 08:09:11 -0000 Author: brooks Date: Wed Aug 28 08:09:10 2019 New Revision: 351568 URL: https://svnweb.freebsd.org/changeset/base/351568 Log: MFC r351389: Reorganise conditionals to reduce duplication. No functional change. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/12/sys/kern/makesyscalls.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/makesyscalls.sh ============================================================================== --- stable/12/sys/kern/makesyscalls.sh Wed Aug 28 08:05:16 2019 (r351567) +++ stable/12/sys/kern/makesyscalls.sh Wed Aug 28 08:09:10 2019 (r351568) @@ -503,20 +503,20 @@ sed -e ' } printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace printf("\t\tbreak;\n") > systracetmp - if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ - !flag("NODEF")) { - printf("struct %s {\n", argalias) > sysarg - for (i = 1; i <= argc; i++) - printf("\tchar %s_l_[PADL_(%s)]; " \ - "%s %s; char %s_r_[PADR_(%s)];\n", - argname[i], argtype[i], - argtype[i], argname[i], - argname[i], argtype[i]) > sysarg - printf("};\n") > sysarg + if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) { + if (argc != 0) { + printf("struct %s {\n", argalias) > sysarg + for (i = 1; i <= argc; i++) + printf("\tchar %s_l_[PADL_(%s)]; " \ + "%s %s; char %s_r_[PADR_(%s)];\n", + argname[i], argtype[i], + argtype[i], argname[i], + argname[i], argtype[i]) > sysarg + printf("};\n") > sysarg + } else + printf("struct %s {\n\tregister_t dummy;\n};\n", + argalias) > sysarg } - else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) - printf("struct %s {\n\tregister_t dummy;\n};\n", - argalias) > sysarg if (!flag("NOPROTO") && !flag("NODEF")) { if (funcname == "nosys" || funcname == "lkmnosys" || funcname == "sysarch" || funcname ~ /^freebsd/ || From owner-svn-src-all@freebsd.org Wed Aug 28 16:08:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A9A3E04C8; Wed, 28 Aug 2019 16:08:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JVyb3Wg0z4NDs; Wed, 28 Aug 2019 16:08:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F8619C64; Wed, 28 Aug 2019 16:08:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SG87WH014600; Wed, 28 Aug 2019 16:08:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SG86Q3014596; Wed, 28 Aug 2019 16:08:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908281608.x7SG86Q3014596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 16:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351569 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 351569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 16:08:07 -0000 Author: markj Date: Wed Aug 28 16:08:06 2019 New Revision: 351569 URL: https://svnweb.freebsd.org/changeset/base/351569 Log: Wire pages in vm_page_grab() when appropriate. uiomove_object_page() and exec_map_first_page() would previously wire a page after having grabbed it. Ask vm_page_grab() to perform the wiring instead: this removes some redundant code, and is cheaper in the case where the requested page is not resident since the page allocator can be asked to initialize the page as wired, whereas a separate vm_page_wire() call requires the page lock. In vm_imgact_hold_page(), use vm_page_unwire_noq() instead of vm_page_unwire(PQ_NONE). The latter ensures that the page is dequeued before returning, but this is unnecessary since vm_page_free() will trigger a batched dequeue of the page. Reviewed by: alc, kib Tested by: pho (part of a larger patch) MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21440 Modified: head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/vm/vm_glue.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Wed Aug 28 08:09:10 2019 (r351568) +++ head/sys/kern/kern_exec.c Wed Aug 28 16:08:06 2019 (r351569) @@ -972,11 +972,13 @@ exec_map_first_page(struct image_params *imgp) #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif - ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (ma[0]->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(ma[0]); if (!vm_pager_has_page(object, 0, NULL, &after)) { vm_page_lock(ma[0]); + vm_page_unwire_noq(ma[0]); vm_page_free(ma[0]); vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); @@ -1004,6 +1006,8 @@ exec_map_first_page(struct image_params *imgp) if (rv != VM_PAGER_OK) { for (i = 0; i < initial_pagein; i++) { vm_page_lock(ma[i]); + if (i == 0) + vm_page_unwire_noq(ma[i]); vm_page_free(ma[i]); vm_page_unlock(ma[i]); } @@ -1014,9 +1018,6 @@ exec_map_first_page(struct image_params *imgp) for (i = 1; i < initial_pagein; i++) vm_page_readahead_finish(ma[i]); } - vm_page_lock(ma[0]); - vm_page_wire(ma[0]); - vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); imgp->firstpage = sf_buf_alloc(ma[0], 0); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Aug 28 08:09:10 2019 (r351568) +++ head/sys/kern/uipc_shm.c Wed Aug 28 16:08:06 2019 (r351569) @@ -188,7 +188,8 @@ uiomove_object_page(vm_object_t obj, size_t len, struc * lock to page out tobj's pages because tobj is a OBJT_SWAP * type object. */ - m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (m->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(m); if (vm_pager_has_page(obj, idx, NULL, NULL)) { @@ -198,6 +199,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc "uiomove_object: vm_obj %p idx %jd valid %x pager error %d\n", obj, idx, m->valid, rv); vm_page_lock(m); + vm_page_unwire_noq(m); vm_page_free(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); @@ -207,9 +209,6 @@ uiomove_object_page(vm_object_t obj, size_t len, struc vm_page_zero_invalid(m, TRUE); vm_page_xunbusy(m); } - vm_page_lock(m); - vm_page_wire(m); - vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); error = uiomove_fromphys(&m, offset, tlen, uio); if (uio->uio_rw == UIO_WRITE && error == 0) { Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Aug 28 08:09:10 2019 (r351568) +++ head/sys/vm/vm_glue.c Wed Aug 28 16:08:06 2019 (r351569) @@ -230,7 +230,7 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o rv = vm_pager_get_pages(object, &m, 1, NULL, NULL); if (rv != VM_PAGER_OK) { vm_page_lock(m); - vm_page_unwire(m, PQ_NONE); + vm_page_unwire_noq(m); vm_page_free(m); vm_page_unlock(m); m = NULL; From owner-svn-src-all@freebsd.org Wed Aug 28 16:16:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CF8FE07B3; Wed, 28 Aug 2019 16:16:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JW7z2knJz4NlR; Wed, 28 Aug 2019 16:16:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B59C9E47; Wed, 28 Aug 2019 16:16:15 +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 x7SGGE2P020595; Wed, 28 Aug 2019 16:16:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SGGEmB020592; Wed, 28 Aug 2019 16:16:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908281616.x7SGGEmB020592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 16:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351570 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 351570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 16:16:15 -0000 Author: markj Date: Wed Aug 28 16:16:14 2019 New Revision: 351570 URL: https://svnweb.freebsd.org/changeset/base/351570 Log: MFC r351333: Simplify vm_page_dequeue() and fix an assertion. Modified: stable/12/sys/vm/vm_page.c stable/12/sys/vm/vm_page.h stable/12/sys/vm/vm_pagequeue.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Wed Aug 28 16:08:06 2019 (r351569) +++ stable/12/sys/vm/vm_page.c Wed Aug 28 16:16:14 2019 (r351570) @@ -3079,21 +3079,15 @@ vm_waitpfault(struct domainset *dset) mtx_unlock(&vm_domainset_lock); } -struct vm_pagequeue * +static struct vm_pagequeue * vm_page_pagequeue(vm_page_t m) { - return (&vm_pagequeue_domain(m)->vmd_pagequeues[m->queue]); -} - -static struct mtx * -vm_page_pagequeue_lockptr(vm_page_t m) -{ uint8_t queue; if ((queue = atomic_load_8(&m->queue)) == PQ_NONE) return (NULL); - return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue].pq_mutex); + return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); } static inline void @@ -3116,10 +3110,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa m, pq, qflags)); if ((qflags & PGA_DEQUEUE) != 0) { - if (__predict_true((qflags & PGA_ENQUEUED) != 0)) { - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - vm_pagequeue_cnt_dec(pq); - } + if (__predict_true((qflags & PGA_ENQUEUED) != 0)) + vm_pagequeue_remove(pq, m); vm_page_dequeue_complete(m); } else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { if ((qflags & PGA_ENQUEUED) != 0) @@ -3293,16 +3285,14 @@ vm_page_dequeue_deferred(vm_page_t m) void vm_page_dequeue(vm_page_t m) { - struct mtx *lock, *lock1; - struct vm_pagequeue *pq; + struct vm_pagequeue *pq, *pq1; uint8_t aflags; - KASSERT(mtx_owned(vm_page_lockptr(m)) || m->order == VM_NFREEORDER, + KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL, ("page %p is allocated and unlocked", m)); - for (;;) { - lock = vm_page_pagequeue_lockptr(m); - if (lock == NULL) { + for (pq = vm_page_pagequeue(m);; pq = pq1) { + if (pq == NULL) { /* * A thread may be concurrently executing * vm_page_dequeue_complete(). Ensure that all queue @@ -3321,27 +3311,24 @@ vm_page_dequeue(vm_page_t m) * critical section. */ cpu_spinwait(); + pq1 = vm_page_pagequeue(m); continue; } - mtx_lock(lock); - if ((lock1 = vm_page_pagequeue_lockptr(m)) == lock) + vm_pagequeue_lock(pq); + if ((pq1 = vm_page_pagequeue(m)) == pq) break; - mtx_unlock(lock); - lock = lock1; + vm_pagequeue_unlock(pq); } - KASSERT(lock == vm_page_pagequeue_lockptr(m), + KASSERT(pq == vm_page_pagequeue(m), ("%s: page %p migrated directly between queues", __func__, m)); KASSERT((m->aflags & PGA_DEQUEUE) != 0 || mtx_owned(vm_page_lockptr(m)), ("%s: queued unlocked page %p", __func__, m)); - if ((m->aflags & PGA_ENQUEUED) != 0) { - pq = vm_page_pagequeue(m); - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - vm_pagequeue_cnt_dec(pq); - } + if ((m->aflags & PGA_ENQUEUED) != 0) + vm_pagequeue_remove(pq, m); vm_page_dequeue_complete(m); - mtx_unlock(lock); + vm_pagequeue_unlock(pq); } /* Modified: stable/12/sys/vm/vm_page.h ============================================================================== --- stable/12/sys/vm/vm_page.h Wed Aug 28 16:08:06 2019 (r351569) +++ stable/12/sys/vm/vm_page.h Wed Aug 28 16:16:14 2019 (r351570) @@ -554,7 +554,6 @@ void vm_page_launder(vm_page_t m); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); -struct vm_pagequeue *vm_page_pagequeue(vm_page_t m); vm_page_t vm_page_prev(vm_page_t m); bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); Modified: stable/12/sys/vm/vm_pagequeue.h ============================================================================== --- stable/12/sys/vm/vm_pagequeue.h Wed Aug 28 16:08:06 2019 (r351569) +++ stable/12/sys/vm/vm_pagequeue.h Wed Aug 28 16:16:14 2019 (r351570) @@ -199,6 +199,14 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, int adde #define vm_pagequeue_cnt_dec(pq) vm_pagequeue_cnt_add((pq), -1) static inline void +vm_pagequeue_remove(struct vm_pagequeue *pq, vm_page_t m) +{ + + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + vm_pagequeue_cnt_dec(pq); +} + +static inline void vm_batchqueue_init(struct vm_batchqueue *bq) { From owner-svn-src-all@freebsd.org Wed Aug 28 16:16:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04972E081D; Wed, 28 Aug 2019 16:16:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JW8M5qkqz4NsT; Wed, 28 Aug 2019 16:16:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A98999E48; Wed, 28 Aug 2019 16:16:35 +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 x7SGGZoV020657; Wed, 28 Aug 2019 16:16:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SGGZ0o020656; Wed, 28 Aug 2019 16:16:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908281616.x7SGGZ0o020656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 16:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351571 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 351571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 16:16:36 -0000 Author: markj Date: Wed Aug 28 16:16:35 2019 New Revision: 351571 URL: https://svnweb.freebsd.org/changeset/base/351571 Log: MFC r351331: Don't requeue active pages in vm_swapout_object_deactivate_pages(). Modified: stable/12/sys/vm/vm_swapout.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_swapout.c ============================================================================== --- stable/12/sys/vm/vm_swapout.c Wed Aug 28 16:16:14 2019 (r351570) +++ stable/12/sys/vm/vm_swapout.c Wed Aug 28 16:16:35 2019 (r351571) @@ -227,20 +227,22 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj vm_page_activate(p); p->act_count += act_delta; } else if (vm_page_active(p)) { + /* + * The page daemon does not requeue pages + * after modifying their activation count. + */ if (act_delta == 0) { p->act_count -= min(p->act_count, ACT_DECLINE); if (!remove_mode && p->act_count == 0) { pmap_remove_all(p); vm_page_deactivate(p); - } else - vm_page_requeue(p); + } } else { vm_page_activate(p); if (p->act_count < ACT_MAX - ACT_ADVANCE) p->act_count += ACT_ADVANCE; - vm_page_requeue(p); } } else if (vm_page_inactive(p)) pmap_remove_all(p); From owner-svn-src-all@freebsd.org Wed Aug 28 16:18:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27043E08AB; Wed, 28 Aug 2019 16:18:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JWBT09vWz4P25; Wed, 28 Aug 2019 16:18:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC8FD9E51; Wed, 28 Aug 2019 16:18:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SGIO27020778; Wed, 28 Aug 2019 16:18:24 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SGINF8020773; Wed, 28 Aug 2019 16:18:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908281618.x7SGINF8020773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 16:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351572 - in head/sys: ddb kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: ddb kern sys X-SVN-Commit-Revision: 351572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 16:18:25 -0000 Author: mjg Date: Wed Aug 28 16:18:23 2019 New Revision: 351572 URL: https://svnweb.freebsd.org/changeset/base/351572 Log: proc: eliminate the zombproc list It is not needed by anything in the kernel and it slightly drives up contention on both proctree and allproc locks. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21447 Modified: head/sys/ddb/db_ps.c head/sys/ddb/db_thread.c head/sys/kern/kern_exit.c head/sys/kern/kern_proc.c head/sys/kern/kern_racct.c head/sys/sys/proc.h Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/ddb/db_ps.c Wed Aug 28 16:18:23 2019 (r351572) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); static void dumpthread(volatile struct proc *p, volatile struct thread *td, int all); +static void db_ps_proc(struct proc *p); static int ps_mode; /* @@ -105,146 +106,157 @@ dump_args(volatile struct proc *p) void db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, char *modif) { - volatile struct proc *p, *pp; - volatile struct thread *td; - struct ucred *cred; - struct pgrp *pgrp; - char state[9]; - int np, rflag, sflag, dflag, lflag, wflag; + struct proc *p; + int i, j; ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE; - np = nprocs; - if (!LIST_EMPTY(&allproc)) - p = LIST_FIRST(&allproc); - else - p = &proc0; - #ifdef __LP64__ db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #else db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #endif - while (--np >= 0 && !db_pager_quit) { - if (p == NULL) { - db_printf("oops, ran out of processes early!\n"); - break; + + if (!LIST_EMPTY(&allproc)) + p = LIST_FIRST(&allproc); + else + p = &proc0; + for (; p != NULL && !db_pager_quit; p = LIST_NEXT(p, p_list)) + db_ps_proc(p); + + /* + * Do zombies. + */ + for (i = 0; i < pidhashlock + 1 && !db_pager_quit; i++) { + for (j = i; j <= pidhash && !db_pager_quit; j += pidhashlock + 1) { + LIST_FOREACH(p, &pidhashtbl[j], p_hash) { + if (p->p_state == PRS_ZOMBIE) + db_ps_proc(p); + } } - pp = p->p_pptr; - if (pp == NULL) - pp = p; + } +} - cred = p->p_ucred; - pgrp = p->p_pgrp; - db_printf("%5d %5d %5d %5d ", p->p_pid, pp->p_pid, - pgrp != NULL ? pgrp->pg_id : 0, - cred != NULL ? cred->cr_ruid : 0); +static void +db_ps_proc(struct proc *p) +{ + volatile struct proc *pp; + volatile struct thread *td; + struct ucred *cred; + struct pgrp *pgrp; + char state[9]; + int rflag, sflag, dflag, lflag, wflag; - /* Determine our primary process state. */ - switch (p->p_state) { - case PRS_NORMAL: - if (P_SHOULDSTOP(p)) - state[0] = 'T'; - else { - /* - * One of D, L, R, S, W. For a - * multithreaded process we will use - * the state of the thread with the - * highest precedence. The - * precendence order from high to low - * is R, L, D, S, W. If no thread is - * in a sane state we use '?' for our - * primary state. - */ - rflag = sflag = dflag = lflag = wflag = 0; - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_state == TDS_RUNNING || - td->td_state == TDS_RUNQ || - td->td_state == TDS_CAN_RUN) - rflag++; - if (TD_ON_LOCK(td)) - lflag++; - if (TD_IS_SLEEPING(td)) { - if (!(td->td_flags & TDF_SINTR)) - dflag++; - else - sflag++; - } - if (TD_AWAITING_INTR(td)) - wflag++; + pp = p->p_pptr; + if (pp == NULL) + pp = p; + + cred = p->p_ucred; + pgrp = p->p_pgrp; + db_printf("%5d %5d %5d %5d ", p->p_pid, pp->p_pid, + pgrp != NULL ? pgrp->pg_id : 0, + cred != NULL ? cred->cr_ruid : 0); + + /* Determine our primary process state. */ + switch (p->p_state) { + case PRS_NORMAL: + if (P_SHOULDSTOP(p)) + state[0] = 'T'; + else { + /* + * One of D, L, R, S, W. For a + * multithreaded process we will use + * the state of the thread with the + * highest precedence. The + * precendence order from high to low + * is R, L, D, S, W. If no thread is + * in a sane state we use '?' for our + * primary state. + */ + rflag = sflag = dflag = lflag = wflag = 0; + FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_state == TDS_RUNNING || + td->td_state == TDS_RUNQ || + td->td_state == TDS_CAN_RUN) + rflag++; + if (TD_ON_LOCK(td)) + lflag++; + if (TD_IS_SLEEPING(td)) { + if (!(td->td_flags & TDF_SINTR)) + dflag++; + else + sflag++; } - if (rflag) - state[0] = 'R'; - else if (lflag) - state[0] = 'L'; - else if (dflag) - state[0] = 'D'; - else if (sflag) - state[0] = 'S'; - else if (wflag) - state[0] = 'W'; - else - state[0] = '?'; + if (TD_AWAITING_INTR(td)) + wflag++; } - break; - case PRS_NEW: - state[0] = 'N'; - break; - case PRS_ZOMBIE: - state[0] = 'Z'; - break; - default: - state[0] = 'U'; - break; + if (rflag) + state[0] = 'R'; + else if (lflag) + state[0] = 'L'; + else if (dflag) + state[0] = 'D'; + else if (sflag) + state[0] = 'S'; + else if (wflag) + state[0] = 'W'; + else + state[0] = '?'; } - state[1] = '\0'; + break; + case PRS_NEW: + state[0] = 'N'; + break; + case PRS_ZOMBIE: + state[0] = 'Z'; + break; + default: + state[0] = 'U'; + break; + } + state[1] = '\0'; - /* Additional process state flags. */ - if (!(p->p_flag & P_INMEM)) - strlcat(state, "W", sizeof(state)); - if (p->p_flag & P_TRACED) - strlcat(state, "X", sizeof(state)); - if (p->p_flag & P_WEXIT && p->p_state != PRS_ZOMBIE) - strlcat(state, "E", sizeof(state)); - if (p->p_flag & P_PPWAIT) - strlcat(state, "V", sizeof(state)); - if (p->p_flag & P_SYSTEM || p->p_lock > 0) - strlcat(state, "L", sizeof(state)); - if (p->p_pgrp != NULL && p->p_session != NULL && - SESS_LEADER(p)) - strlcat(state, "s", sizeof(state)); - /* Cheated here and didn't compare pgid's. */ - if (p->p_flag & P_CONTROLT) - strlcat(state, "+", sizeof(state)); - if (cred != NULL && jailed(cred)) - strlcat(state, "J", sizeof(state)); - db_printf(" %-6.6s ", state); - if (p->p_flag & P_HADTHREADS) { + /* Additional process state flags. */ + if (!(p->p_flag & P_INMEM)) + strlcat(state, "W", sizeof(state)); + if (p->p_flag & P_TRACED) + strlcat(state, "X", sizeof(state)); + if (p->p_flag & P_WEXIT && p->p_state != PRS_ZOMBIE) + strlcat(state, "E", sizeof(state)); + if (p->p_flag & P_PPWAIT) + strlcat(state, "V", sizeof(state)); + if (p->p_flag & P_SYSTEM || p->p_lock > 0) + strlcat(state, "L", sizeof(state)); + if (p->p_pgrp != NULL && p->p_session != NULL && + SESS_LEADER(p)) + strlcat(state, "s", sizeof(state)); + /* Cheated here and didn't compare pgid's. */ + if (p->p_flag & P_CONTROLT) + strlcat(state, "+", sizeof(state)); + if (cred != NULL && jailed(cred)) + strlcat(state, "J", sizeof(state)); + db_printf(" %-6.6s ", state); + if (p->p_flag & P_HADTHREADS) { #ifdef __LP64__ - db_printf(" (threaded) "); + db_printf(" (threaded) "); #else - db_printf(" (threaded) "); + db_printf(" (threaded) "); #endif - if (p->p_flag & P_SYSTEM) - db_printf("["); - db_printf("%s", p->p_comm); - if (p->p_flag & P_SYSTEM) - db_printf("]"); - if (ps_mode == PRINT_ARGS) { - db_printf(" "); - dump_args(p); - } - db_printf("\n"); + if (p->p_flag & P_SYSTEM) + db_printf("["); + db_printf("%s", p->p_comm); + if (p->p_flag & P_SYSTEM) + db_printf("]"); + if (ps_mode == PRINT_ARGS) { + db_printf(" "); + dump_args(p); } - FOREACH_THREAD_IN_PROC(p, td) { - dumpthread(p, td, p->p_flag & P_HADTHREADS); - if (db_pager_quit) - break; - } - - p = LIST_NEXT(p, p_list); - if (p == NULL && np > 0) - p = LIST_FIRST(&zombproc); + db_printf("\n"); + } + FOREACH_THREAD_IN_PROC(p, td) { + dumpthread(p, td, p->p_flag & P_HADTHREADS); + if (db_pager_quit) + break; } } Modified: head/sys/ddb/db_thread.c ============================================================================== --- head/sys/ddb/db_thread.c Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/ddb/db_thread.c Wed Aug 28 16:18:23 2019 (r351572) @@ -125,14 +125,10 @@ db_lookup_thread(db_expr_t addr, bool check_pid) if (td != NULL) return (td); if (check_pid) { - FOREACH_PROC_IN_SYSTEM(p) { + LIST_FOREACH(p, PIDHASH(decaddr), p_hash) { if (p->p_pid == decaddr) return (FIRST_THREAD_IN_PROC(p)); } - LIST_FOREACH(p, &zombproc, p_list) { - if (p->p_pid == decaddr) - return (FIRST_THREAD_IN_PROC(p)); - } } return ((struct thread *)addr); } @@ -151,11 +147,7 @@ db_lookup_proc(db_expr_t addr) decaddr = db_hex2dec(addr); if (decaddr != -1) { - FOREACH_PROC_IN_SYSTEM(p) { - if (p->p_pid == decaddr) - return (p); - } - LIST_FOREACH(p, &zombproc, p_list) { + LIST_FOREACH(p, PIDHASH(decaddr), p_hash) { if (p->p_pid == decaddr) return (p); } Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/kern/kern_exit.c Wed Aug 28 16:18:23 2019 (r351572) @@ -447,13 +447,10 @@ exit1(struct thread *td, int rval, int signo) WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); /* - * Move proc from allproc queue to zombproc. + * Remove from allproc. It still sits in the hash. */ sx_xlock(&allproc_lock); - sx_xlock(&zombproc_lock); LIST_REMOVE(p, p_list); - LIST_INSERT_HEAD(&zombproc, p, p_list); - sx_xunlock(&zombproc_lock); sx_xunlock(&allproc_lock); sx_xlock(&proctree_lock); @@ -903,9 +900,6 @@ proc_reap(struct thread *td, struct proc *p, int *stat * Remove other references to this process to ensure we have an * exclusive reference. */ - sx_xlock(&zombproc_lock); - LIST_REMOVE(p, p_list); /* off zombproc */ - sx_xunlock(&zombproc_lock); sx_xlock(PIDHASHLOCK(p->p_pid)); LIST_REMOVE(p, p_hash); sx_xunlock(PIDHASHLOCK(p->p_pid)); Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/kern/kern_proc.c Wed Aug 28 16:18:23 2019 (r351572) @@ -124,9 +124,7 @@ u_long pidhashlock; struct pgrphashhead *pgrphashtbl; u_long pgrphash; struct proclist allproc; -struct proclist zombproc; struct sx __exclusive_cache_line allproc_lock; -struct sx __exclusive_cache_line zombproc_lock; struct sx __exclusive_cache_line proctree_lock; struct mtx __exclusive_cache_line ppeers_lock; struct mtx __exclusive_cache_line procid_lock; @@ -177,12 +175,10 @@ procinit(void) u_long i; sx_init(&allproc_lock, "allproc"); - sx_init(&zombproc_lock, "zombproc"); sx_init(&proctree_lock, "proctree"); mtx_init(&ppeers_lock, "p_peers", NULL, MTX_DEF); mtx_init(&procid_lock, "procid", NULL, MTX_DEF); LIST_INIT(&allproc); - LIST_INIT(&zombproc); pidhashtbl = hashinit(maxproc / 4, M_PROC, &pidhash); pidhashlock = (pidhash + 1) / 64; if (pidhashlock > 0) Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/kern/kern_racct.c Wed Aug 28 16:18:23 2019 (r351572) @@ -1256,17 +1256,11 @@ racctd(void) sx_slock(&allproc_lock); - sx_slock(&zombproc_lock); - LIST_FOREACH(p, &zombproc, p_list) { - PROC_LOCK(p); - racct_set(p, RACCT_PCTCPU, 0); - PROC_UNLOCK(p); - } - sx_sunlock(&zombproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); if (p->p_state != PRS_NORMAL) { + if (p->p_state == PRS_ZOMBIE) + racct_set(p, RACCT_PCTCPU, 0); PROC_UNLOCK(p); continue; } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Aug 28 16:16:35 2019 (r351571) +++ head/sys/sys/proc.h Wed Aug 28 16:18:23 2019 (r351572) @@ -967,7 +967,6 @@ extern u_long pgrphash; extern struct sx allproc_lock; extern int allproc_gen; -extern struct sx zombproc_lock; extern struct sx proctree_lock; extern struct mtx ppeers_lock; extern struct mtx procid_lock; @@ -985,7 +984,6 @@ LIST_HEAD(proclist, proc); TAILQ_HEAD(procqueue, proc); TAILQ_HEAD(threadqueue, thread); extern struct proclist allproc; /* List of all processes. */ -extern struct proclist zombproc; /* List of zombie processes. */ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ extern struct uma_zone *proc_zone; From owner-svn-src-all@freebsd.org Wed Aug 28 17:01:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97FAAE1916; Wed, 28 Aug 2019 17:01:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JX893ZBZz4RPC; Wed, 28 Aug 2019 17:01:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C86EA6F9; Wed, 28 Aug 2019 17:01:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SH1T5s050529; Wed, 28 Aug 2019 17:01:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SH1SPn050508; Wed, 28 Aug 2019 17:01:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908281701.x7SH1SPn050508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 17:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351573 - head/lib/libfetch X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libfetch X-SVN-Commit-Revision: 351573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 17:01:29 -0000 Author: markj Date: Wed Aug 28 17:01:28 2019 New Revision: 351573 URL: https://svnweb.freebsd.org/changeset/base/351573 Log: Document fetchReqHTTP(). Submitted by: Farhan Khan Reviewed by: 0mp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18788 Modified: head/lib/libfetch/Makefile head/lib/libfetch/fetch.3 head/lib/libfetch/http.c Modified: head/lib/libfetch/Makefile ============================================================================== --- head/lib/libfetch/Makefile Wed Aug 28 16:18:23 2019 (r351572) +++ head/lib/libfetch/Makefile Wed Aug 28 17:01:28 2019 (r351573) @@ -68,6 +68,7 @@ MLINKS+= fetch.3 fetchPutFTP.3 MLINKS+= fetch.3 fetchPutFile.3 MLINKS+= fetch.3 fetchPutHTTP.3 MLINKS+= fetch.3 fetchPutURL.3 +MLINKS+= fetch.3 fetchReqHTTP.3 MLINKS+= fetch.3 fetchStat.3 MLINKS+= fetch.3 fetchStatFTP.3 MLINKS+= fetch.3 fetchStatFile.3 Modified: head/lib/libfetch/fetch.3 ============================================================================== --- head/lib/libfetch/fetch.3 Wed Aug 28 16:18:23 2019 (r351572) +++ head/lib/libfetch/fetch.3 Wed Aug 28 17:01:28 2019 (r351573) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2016 +.Dd August 28, 2019 .Dt FETCH 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm fetchPutHTTP , .Nm fetchStatHTTP , .Nm fetchListHTTP , +.Nm fetchReqHTTP , .Nm fetchXGetFTP , .Nm fetchGetFTP , .Nm fetchPutFTP , @@ -112,6 +113,8 @@ .Ft struct url_ent * .Fn fetchListHTTP "struct url *u" "const char *flags" .Ft FILE * +.Fn fetchReqHTTP "struct url *u" "const char *method" "const char *flags" "const char *content_type" "const char *body" +.Ft FILE * .Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags" .Ft FILE * .Fn fetchGetFTP "struct url *u" "const char *flags" @@ -355,9 +358,10 @@ and password "anonymous@". .Sh HTTP SCHEME The .Fn fetchXGetHTTP , -.Fn fetchGetHTTP -and +.Fn fetchGetHTTP , .Fn fetchPutHTTP +and +.Fn fetchReqHTTP functions implement the HTTP/1.1 protocol. With a little luck, there is even a chance that they comply with RFC2616 and RFC2617. @@ -386,6 +390,18 @@ will send a conditional .Li If-Modified-Since HTTP header to only fetch the content if it is newer than .Va ims_time . +.Pp +The function +.Fn fetchReqHTTP +can be used to make requests with an arbitrary HTTP verb, +including POST, DELETE, CONNECT, OPTIONS, TRACE or PATCH. +This can be done by setting the argument +.Fa method +to the intended verb, such as +.Ql POST , +and +.Fa body +to the content. .Pp Since there seems to be no good way of implementing the HTTP PUT method in a manner consistent with the rest of the Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Wed Aug 28 16:18:23 2019 (r351572) +++ head/lib/libfetch/http.c Wed Aug 28 17:01:28 2019 (r351573) @@ -2093,6 +2093,9 @@ fetchListHTTP(struct url *url __unused, const char *fl return (NULL); } +/* + * Arbitrary HTTP verb and content requests + */ FILE * fetchReqHTTP(struct url *URL, const char *method, const char *flags, const char *content_type, const char *body) From owner-svn-src-all@freebsd.org Wed Aug 28 17:39:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36537E2848; Wed, 28 Aug 2019 17:39:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JY0M0g1zz4Tnl; Wed, 28 Aug 2019 17:39:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E83B7AD32; Wed, 28 Aug 2019 17:39:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SHdk1P069268; Wed, 28 Aug 2019 17:39:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SHdk4r069267; Wed, 28 Aug 2019 17:39:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908281739.x7SHdk4r069267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 17:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351574 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 351574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 17:39:47 -0000 Author: mav Date: Wed Aug 28 17:39:46 2019 New Revision: 351574 URL: https://svnweb.freebsd.org/changeset/base/351574 Log: MFV/ZoL: Fix wrong assertion in libzfs diff error handling In compare(), all error cases set the error code to EPIPE, so when an error is set, the correct assertion to make is that the error is EPIPE, not EINVAL. Reviewed-by: Richard Elling Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #8743 zfsonlinux/zfs@9dc41a769df164875d974c2431b2453e70e16c41 Submitted by: Ryan Moeller MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D20118 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Aug 28 17:01:28 2019 (r351573) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Aug 28 17:39:46 2019 (r351574) @@ -472,7 +472,7 @@ differ(void *arg) if (err) return ((void *)-1); if (di->zerr) { - ASSERT(di->zerr == EINVAL); + ASSERT(di->zerr == EPIPE); (void) snprintf(di->errbuf, sizeof (di->errbuf), dgettext(TEXT_DOMAIN, "Internal error: bad data from diff IOCTL")); From owner-svn-src-all@freebsd.org Wed Aug 28 18:01:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03203E2F80; Wed, 28 Aug 2019 18:01:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JYTt65JDz4VwC; Wed, 28 Aug 2019 18:01:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2BB1B169; Wed, 28 Aug 2019 18:01:54 +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 x7SI1ss9086406; Wed, 28 Aug 2019 18:01:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SI1srq086405; Wed, 28 Aug 2019 18:01:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908281801.x7SI1srq086405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 18:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351575 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern X-SVN-Commit-Revision: 351575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 18:01:55 -0000 Author: markj Date: Wed Aug 28 18:01:54 2019 New Revision: 351575 URL: https://svnweb.freebsd.org/changeset/base/351575 Log: Avoid direct accesses of the vm_page wire_count field. No functional change intended. Sponsored by: Netflix Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/kern/vfs_bio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 28 17:39:46 2019 (r351574) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 28 18:01:54 2019 (r351575) @@ -593,7 +593,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) vm_page_sunbusy(pp); vm_page_lock(pp); if (error) { - if (pp->wire_count == 0 && pp->valid == 0 && + if (!vm_page_wired(pp) && pp->valid == 0 && !vm_page_busied(pp)) vm_page_free(pp); } else { Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Aug 28 17:39:46 2019 (r351574) +++ head/sys/kern/vfs_bio.c Wed Aug 28 18:01:54 2019 (r351575) @@ -4881,10 +4881,9 @@ vm_hold_free_pages(struct buf *bp, int newbsize) for (index = newnpages; index < bp->b_npages; index++) { p = bp->b_pages[index]; bp->b_pages[index] = NULL; - p->wire_count--; + vm_page_unwire_noq(p); vm_page_free(p); } - vm_wire_sub(bp->b_npages - newnpages); bp->b_npages = newnpages; } From owner-svn-src-all@freebsd.org Wed Aug 28 19:28:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85DA9E45EC; Wed, 28 Aug 2019 19:28:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JbPm2zGTz4b9B; Wed, 28 Aug 2019 19:28:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4796EC359; Wed, 28 Aug 2019 19:28:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SJSSLP034796; Wed, 28 Aug 2019 19:28:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SJSSpg034795; Wed, 28 Aug 2019 19:28:28 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908281928.x7SJSSpg034795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 19:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351576 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 351576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 19:28:28 -0000 Author: mjg Date: Wed Aug 28 19:28:27 2019 New Revision: 351576 URL: https://svnweb.freebsd.org/changeset/base/351576 Log: vm: only lock tmpfs vnode shared in vm_object_deallocate Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21455 Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Aug 28 18:01:54 2019 (r351575) +++ head/sys/vm/vm_object.c Wed Aug 28 19:28:27 2019 (r351576) @@ -536,7 +536,7 @@ vm_object_deallocate(vm_object_t object) vp = object->un_pager.swp.swp_tmpfs; vhold(vp); VM_OBJECT_WUNLOCK(object); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); VM_OBJECT_WLOCK(object); if (object->type == OBJT_DEAD || object->ref_count != 1) { From owner-svn-src-all@freebsd.org Wed Aug 28 19:40:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8A31E49F5; Wed, 28 Aug 2019 19:40:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jbh94T9Lz4bqK; Wed, 28 Aug 2019 19:40:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B4F4C559; Wed, 28 Aug 2019 19:40:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SJevXp041849; Wed, 28 Aug 2019 19:40:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SJevd4041816; Wed, 28 Aug 2019 19:40:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908281940.x7SJevd4041816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 19:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351577 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 351577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 19:40:57 -0000 Author: mjg Date: Wed Aug 28 19:40:57 2019 New Revision: 351577 URL: https://svnweb.freebsd.org/changeset/base/351577 Log: amd64: clean up cpu_switch.S - LK macro (conditional on SMP for the lock prefix) is unused - SETLK unnecessarily performs xchg. obtained value is never used and the implicit lock prefix adds avoidable cost. Barrier provided by it does not appear to be of any use. - the lock waited for is almost never blocked, yet the loop starts with a pause. Move it out of the common case. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19563 Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Aug 28 19:28:27 2019 (r351576) +++ head/sys/amd64/amd64/cpu_switch.S Wed Aug 28 19:40:57 2019 (r351577) @@ -45,18 +45,6 @@ .text -#ifdef SMP -#define LK lock ; -#else -#define LK -#endif - -#if defined(SCHED_ULE) && defined(SMP) -#define SETLK xchgq -#else -#define SETLK movq -#endif - /* * cpu_throw() * @@ -150,17 +138,15 @@ ctx_switch_xsave: movq %rdx,%r15 movq %rsi,%rdi callq pmap_activate_sw - SETLK %r15,TD_LOCK(%r13) /* Release the old thread */ + movq %r15,TD_LOCK(%r13) /* Release the old thread */ sw1: movq TD_PCB(%r12),%r8 #if defined(SCHED_ULE) && defined(SMP) - /* Wait for the new thread to become unblocked */ movq $blocked_lock, %rdx -1: movq TD_LOCK(%r12),%rcx cmpq %rcx, %rdx - pause - je 1b + je sw1wait +sw1cont: #endif /* * At this point, we've switched address spaces and are ready @@ -496,3 +482,14 @@ ENTRY(resumectx) xorl %eax,%eax ret END(resumectx) + +/* Wait for the new thread to become unblocked */ +#if defined(SCHED_ULE) && defined(SMP) +sw1wait: +1: + pause + movq TD_LOCK(%r12),%rcx + cmpq %rcx, %rdx + je 1b + jmp sw1cont +#endif From owner-svn-src-all@freebsd.org Wed Aug 28 20:20:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F18B1E55E1; Wed, 28 Aug 2019 20:20:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JcYy69THz4f03; Wed, 28 Aug 2019 20:20:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B57D5CD5B; Wed, 28 Aug 2019 20:20:38 +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 x7SKKc4A064618; Wed, 28 Aug 2019 20:20:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKKcE0064616; Wed, 28 Aug 2019 20:20:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282020.x7SKKcE0064616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:20: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: r351579 - in stable/11: sbin/camcontrol sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/camcontrol sys/sys X-SVN-Commit-Revision: 351579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:20:39 -0000 Author: mav Date: Wed Aug 28 20:20:38 2019 New Revision: 351579 URL: https://svnweb.freebsd.org/changeset/base/351579 Log: MFC r350393: Decode some more IDENTIFY DEVICE bits. Modified: stable/11/sbin/camcontrol/camcontrol.c stable/11/sys/sys/ata.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:05:55 2019 (r351578) +++ stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:20:38 2019 (r351579) @@ -1373,6 +1373,7 @@ atacapprint(struct ata_params *parm) printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } + printf("additional product id %.8s\n", parm->product_id); if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { printf("media serial number %.30s\n", parm->media_serial); @@ -1502,35 +1503,39 @@ atacapprint(struct ata_params *parm) } else printf("\n"); printf("Native Command Queuing (NCQ) "); - if (parm->satacapabilities != 0xffff && - (parm->satacapabilities & ATA_SUPPORT_NCQ)) { + if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) { printf("yes %d tags\n", ATA_QUEUE_LEN(parm->queue) + 1); + printf("NCQ Priority Information %s\n", + parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ? + "yes" : "no"); + printf("NCQ Non-Data Command %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ? + "yes" : "no"); + printf("NCQ Streaming %s\n", + parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? + "yes" : "no"); + printf("Receive & Send FPDMA Queued %s\n", + parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? + "yes" : "no"); + printf("NCQ Autosense %s\n", + parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ? + "yes" : "no"); } else printf("no\n"); - printf("NCQ Queue Management %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ? - "yes" : "no"); - printf("NCQ Streaming %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ? - "yes" : "no"); - printf("Receive & Send FPDMA Queued %s\n", atasata(parm) && - parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ? - "yes" : "no"); - printf("SMART %s %s\n", parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); - printf("microcode download %s %s\n", - parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("security %s %s\n", parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no"); printf("power management %s %s\n", parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); + printf("microcode download %s %s\n", + parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); printf("advanced power management %s %s", parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no"); @@ -1573,6 +1578,15 @@ atacapprint(struct ata_params *parm) printf("free-fall %s %s\n", parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no", parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no"); + printf("sense data reporting %s %s\n", + parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no"); + printf("extended power conditions %s %s\n", + parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no"); + printf("device statistics notification %s %s\n", + parm->support2 & ATA_SUPPORT_DSN ? "yes" : "no", + parm->enabled2 & ATA_SUPPORT_DSN ? "yes" : "no"); printf("Data Set Management (DSM/TRIM) "); if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) { printf("yes\n"); @@ -1595,6 +1609,8 @@ atacapprint(struct ata_params *parm) } else { printf("no\n"); } + printf("encrypts all user data %s\n", + parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no"); printf("Sanitize "); if (parm->multi & ATA_SUPPORT_SANITIZE) { printf("yes\t\t%s%s%s\n", Modified: stable/11/sys/sys/ata.h ============================================================================== --- stable/11/sys/sys/ata.h Wed Aug 28 20:05:55 2019 (r351578) +++ stable/11/sys/sys/ata.h Wed Aug 28 20:20:38 2019 (r351579) @@ -141,7 +141,8 @@ struct ata_params { /*77*/ u_int16_t satacapabilities2; #define ATA_SATA_CURR_GEN_MASK 0x0006 #define ATA_SUPPORT_NCQ_STREAM 0x0010 -#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020 +#define ATA_SUPPORT_NCQ_NON_DATA 0x0020 +#define ATA_SUPPORT_NCQ_QMANAGEMENT ATA_SUPPORT_NCQ_NON_DATA #define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040 /*78*/ u_int16_t satasupport; #define ATA_SUPPORT_NONZERO 0x0002 @@ -150,6 +151,7 @@ struct ata_params { #define ATA_SUPPORT_INORDERDATA 0x0010 #define ATA_SUPPORT_ASYNCNOTIF 0x0020 #define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 +#define ATA_SUPPORT_NCQ_AUTOSENSE 0x0080 /*79*/ u_int16_t sataenabled; #define ATA_ENABLED_DAPST 0x0080 @@ -283,7 +285,8 @@ struct ata_params { #define ATA_FORM_FACTOR_C_FAST 0x0009 /*169*/ u_int16_t support_dsm; #define ATA_SUPPORT_DSM_TRIM 0x0001 - u_int16_t reserved170[6]; +/*170*/ u_int8_t product_id[8]; /* Additional Product Identifier */ + u_int16_t reserved174[2]; /*176*/ u_int8_t media_serial[60]; /*206*/ u_int16_t sct; u_int16_t reserved207[2]; From owner-svn-src-all@freebsd.org Wed Aug 28 20:21:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F3EBE5663; Wed, 28 Aug 2019 20:21:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcb33hHjz4fGh; Wed, 28 Aug 2019 20:21: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61508CEB8; Wed, 28 Aug 2019 20:21: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 x7SKLZt3066123; Wed, 28 Aug 2019 20:21:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKLZhH066122; Wed, 28 Aug 2019 20:21:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282021.x7SKLZhH066122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351580 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 351580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:21:35 -0000 Author: mav Date: Wed Aug 28 20:21:34 2019 New Revision: 351580 URL: https://svnweb.freebsd.org/changeset/base/351580 Log: MFC r350424: Use present now scsi_mode_sense_subpage(). Modified: stable/11/sbin/camcontrol/timestamp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/timestamp.c ============================================================================== --- stable/11/sbin/camcontrol/timestamp.c Wed Aug 28 20:20:38 2019 (r351579) +++ stable/11/sbin/camcontrol/timestamp.c Wed Aug 28 20:21:34 2019 (r351580) @@ -79,7 +79,6 @@ set_restore_flags(struct cam_device *device, uint8_t * int error = 0; struct scsi_control_ext_page *control_page = NULL; struct scsi_mode_header_10 *mode_hdr = NULL; - struct scsi_mode_sense_10 *cdb = NULL; union ccb *ccb = NULL; unsigned long mode_buf_size = sizeof(struct scsi_mode_header_10) + sizeof(struct scsi_mode_blk_desc) + @@ -96,25 +95,19 @@ set_restore_flags(struct cam_device *device, uint8_t * * Get the control extension subpage, we'll send it back modified to * enable SCSI control over the tape drive's timestamp */ - scsi_mode_sense_len(&ccb->csio, + scsi_mode_sense_subpage(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, /*tag_action*/ task_attr, /*dbd*/ 0, /*page_control*/ SMS_PAGE_CTRL_CURRENT, /*page*/ SCEP_PAGE_CODE, + /*subpage*/ SCEP_SUBPAGE_CODE, /*param_buf*/ &mode_buf[0], /*param_len*/ mode_buf_size, /*minimum_cmd_size*/ 10, /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ timeout ? timeout : 5000); - /* - * scsi_mode_sense_len does not have a subpage argument at the moment, - * so we have to manually set the subpage code before calling - * cam_send_ccb(). - */ - cdb = (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes; - cdb->subpage = SCEP_SUBPAGE_CODE; ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; if (retry_count > 0) From owner-svn-src-all@freebsd.org Wed Aug 28 20:22:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90F30E572A; Wed, 28 Aug 2019 20:22:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcbq2zXtz4fVk; Wed, 28 Aug 2019 20:22:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47A3BCEEE; Wed, 28 Aug 2019 20:22:15 +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 x7SKMFYG070144; Wed, 28 Aug 2019 20:22:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKMEKx070077; Wed, 28 Aug 2019 20:22:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282022.x7SKMEKx070077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:22: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: r351581 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 351581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:22:15 -0000 Author: mav Date: Wed Aug 28 20:22:14 2019 New Revision: 351581 URL: https://svnweb.freebsd.org/changeset/base/351581 Log: MFC r350457: Make `camcontrol modepage` to use 10 byte commands. While old devices may not support 10 byte MODE SENSE/MODE SELECT commands, new ones may not be able to report all mode pages with 6 byte commands. This patch makes camcontrol by default start with 10 byte commands and fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced. Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/camcontrol.c stable/11/sbin/camcontrol/camcontrol.h stable/11/sbin/camcontrol/modeedit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.8 Wed Aug 28 20:21:34 2019 (r351580) +++ stable/11/sbin/camcontrol/camcontrol.8 Wed Aug 28 20:22:14 2019 (r351581) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2019 +.Dd July 30, 2019 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -122,6 +122,7 @@ .Ic modepage .Op device id .Op generic args +.Op Fl 6 .Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl .Op Fl b | Fl e @@ -723,6 +724,13 @@ The .Ic modepage command takes several arguments: .Bl -tag -width 12n +.It Fl 6 +Use 6 byte MODE commands instead of default 10 byte. +Old devices may not support 10 byte MODE commands, while new devices may +not be able to report all mode pages with 6 byte commands. +If not specified, +.Nm +starts with 10 byte commands and falls back to 6 byte on error. .It Fl d Disable block descriptors for mode sense. .It Fl b Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:21:34 2019 (r351580) +++ stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:22:14 2019 (r351581) @@ -224,7 +224,7 @@ static struct camcontrol_opts option_table[] = { {"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""}, #ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, - {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"}, + {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, @@ -4430,18 +4430,25 @@ reassignblocks(struct cam_device *device, u_int32_t *b #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, - int task_attr, int retry_count, int timeout, u_int8_t *data, - int datalen) +mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page, + int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, + int datalen) { union ccb *ccb; - int retval; + int error_code, sense_key, asc, ascq; ccb = cam_getccb(device); - if (ccb == NULL) errx(1, "mode_sense: couldn't allocate CCB"); +retry: + /* + * MODE SENSE(6) can't handle more then 255 bytes. If there are more, + * device must return error, so we should not get trucated data. + */ + if (*cdb_len == 6 && datalen > 255) + datalen = 255; + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); scsi_mode_sense_subpage(&ccb->csio, @@ -4454,36 +4461,47 @@ mode_sense(struct cam_device *device, int dbd, int pc, /* subpage */ subpage, /* param_buf */ data, /* param_len */ datalen, - /* minimum_cmd_size */ 0, + /* minimum_cmd_size */ *cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); + /* Record what CDB size the above function really set. */ + *cdb_len = ccb->csio.cdb_len; + if (arglist & CAM_ARG_ERR_RECOVER) ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; - if (((retval = cam_send_ccb(device, ccb)) < 0) - || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + if (cam_send_ccb(device, ccb) < 0) + err(1, "error sending mode sense command"); + + /* In case of ILLEGEL REQUEST try to fall back to 6-byte command. */ + if (*cdb_len != 6 && + ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID || + (scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq) + && sense_key == SSD_KEY_ILLEGAL_REQUEST))) { + *cdb_len = 6; + goto retry; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } cam_freeccb(ccb); cam_close_device(device); - if (retval < 0) - err(1, "error sending mode sense command"); - else - errx(1, "error sending mode sense command"); + errx(1, "mode sense command returned error"); } cam_freeccb(ccb); } void -mode_select(struct cam_device *device, int save_pages, int task_attr, - int retry_count, int timeout, u_int8_t *data, int datalen) +mode_select(struct cam_device *device, int cdb_len, int save_pages, + int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen) { union ccb *ccb; int retval; @@ -4495,7 +4513,7 @@ mode_select(struct cam_device *device, int save_pages, CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - scsi_mode_select(&ccb->csio, + scsi_mode_select_len(&ccb->csio, /* retries */ retry_count, /* cbfcnp */ NULL, /* tag_action */ task_attr, @@ -4503,6 +4521,7 @@ mode_select(struct cam_device *device, int save_pages, /* save_pages */ save_pages, /* param_buf */ data, /* param_len */ datalen, + /* minimum_cmd_size */ cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); @@ -4537,10 +4556,13 @@ modepage(struct cam_device *device, int argc, char **a { char *str_subpage; int c, page = -1, subpage = -1, pc = 0; - int binary = 0, dbd = 0, edit = 0, list = 0; + int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { + case '6': + cdb_len = 6; + break; case 'b': binary = 1; break; @@ -4580,11 +4602,11 @@ modepage(struct cam_device *device, int argc, char **a errx(1, "you must specify a mode page!"); if (list != 0) { - mode_list(device, dbd, pc, list > 1, task_attr, retry_count, - timeout); + mode_list(device, cdb_len, dbd, pc, list > 1, task_attr, + retry_count, timeout); } else { - mode_edit(device, dbd, pc, page, subpage, edit, binary, - task_attr, retry_count, timeout); + mode_edit(device, cdb_len, dbd, pc, page, subpage, edit, + binary, task_attr, retry_count, timeout); } } Modified: stable/11/sbin/camcontrol/camcontrol.h ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.h Wed Aug 28 20:21:34 2019 (r351580) +++ stable/11/sbin/camcontrol/camcontrol.h Wed Aug 28 20:22:14 2019 (r351581) @@ -88,16 +88,17 @@ int epc(struct cam_device *device, int argc, char **ar int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); -void mode_sense(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retry_count, int timeout, - uint8_t *data, int datalen); -void mode_select(struct cam_device *device, int save_pages, int task_attr, - int retry_count, int timeout, u_int8_t *data, int datalen); -void mode_edit(struct cam_device *device, int dbd, int pc, int page, - int subpage, int edit, int binary, int task_attr, +void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retry_count, + int timeout, uint8_t *data, int datalen); +void mode_select(struct cam_device *device, int cdb_len, int save_pages, + int task_attr, int retry_count, int timeout, u_int8_t *data, + int datalen); +void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int edit, int binary, int task_attr, int retry_count, int timeout); -void mode_list(struct cam_device *device, int dbd, int pc, int subpages, - int task_attr, int retry_count, int timeout); +void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, + int subpages, int task_attr, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout); Modified: stable/11/sbin/camcontrol/modeedit.c ============================================================================== --- stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:21:34 2019 (r351580) +++ stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:22:14 2019 (r351581) @@ -60,15 +60,9 @@ __FBSDID("$FreeBSD$"); #define PAGENAME_START '"' /* Page name delimiter. */ #define PAGENAME_END '"' /* Page name delimiter. */ #define PAGEENTRY_END ';' /* Page entry terminator (optional). */ -#define MAX_COMMAND_SIZE 255 /* Mode/Log sense data buffer size. */ +#define MAX_DATA_SIZE 4096 /* Mode/Log sense data buffer size. */ #define PAGE_CTRL_SHIFT 6 /* Bit offset to page control field. */ - -/* Macros for working with mode pages. */ -#define MODE_PAGE_HEADER(mh) \ - (struct scsi_mode_page_header *)find_mode_page_6(mh) - - struct editentry { STAILQ_ENTRY(editentry) link; char *name; @@ -106,13 +100,12 @@ static int editentry_save(void *hook, char *name); static struct editentry *editentry_lookup(char *name); static int editentry_set(char *name, char *newvalue, int editonly); -static void editlist_populate(struct cam_device *device, int dbd, - int pc, int page, int subpage, - int task_attr, int retries, - int timeout); -static void editlist_save(struct cam_device *device, int dbd, - int pc, int page, int subpage, - int task_attr, int retries, int timeout); +static void editlist_populate(struct cam_device *device, + int cdb_len, int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); +static void editlist_save(struct cam_device *device, int cdb_len, + int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void nameentry_create(int page, int subpage, char *name); static struct pagename *nameentry_lookup(int page, int subpage); static int load_format(const char *pagedb_path, int lpage, @@ -120,9 +113,9 @@ static int load_format(const char *pagedb_path, int static int modepage_write(FILE *file, int editonly); static int modepage_read(FILE *file); static void modepage_edit(void); -static void modepage_dump(struct cam_device *device, int dbd, - int pc, int page, int subpage, int task_attr, - int retries, int timeout); +static void modepage_dump(struct cam_device *device, int cdb_len, + int dbd, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void cleanup_editfile(void); @@ -552,12 +545,11 @@ load_format(const char *pagedb_path, int lpage, int ls } static void -editlist_populate(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retries, int timeout) +editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t len; @@ -565,11 +557,18 @@ editlist_populate(struct cam_device *device, int dbd, STAILQ_INIT(&editlist); /* Fetch changeable values; use to build initial editlist. */ - mode_sense(device, dbd, 1, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries, + timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; @@ -584,40 +583,80 @@ editlist_populate(struct cam_device *device, int dbd, buff_decode_visit(mode_pars, len, format, editentry_create, 0); /* Fetch the current/saved values; use to set editentry values. */ - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); buff_decode_visit(mode_pars, len, format, editentry_update, 0); } static void -editlist_save(struct cam_device *device, int dbd, int pc, int page, - int subpage, int task_attr, int retries, int timeout) +editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - size_t len, hlen; + size_t len, hlen, mphlen; /* Make sure that something changed before continuing. */ if (! editlist_changed) return; /* Preload the CDB buffer with the current mode page data. */ - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); /* Initial headers & offsets. */ - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + /* + * Tape drives include write protect (WP), Buffered Mode and Speed + * settings in the device-specific parameter. Clearing this + * parameter on a mode select can have the effect of turning off + * write protect or buffered mode, or changing the speed setting of + * the tape drive. + * + * Disks report DPO/FUA support via the device specific parameter + * for MODE SENSE, but the bit is reserved for MODE SELECT. So we + * clear this for disks (and other non-tape devices) to avoid + * potential errors from the target device. + */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + hlen = sizeof(*mh); + /* Eliminate block descriptors. */ + if (mh->blk_desc_len > 0) { + bcopy(find_mode_page_6(mh), mh + 1, + mh->data_length + 1 - hlen - + mh->blk_desc_len); + mh->blk_desc_len = 0; + } + mh->data_length = 0; /* Reserved for MODE SELECT command. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + hlen = sizeof(*mh); + /* Eliminate block descriptors. */ + if (scsi_2btoul(mh->blk_desc_len) > 0) { + bcopy(find_mode_page_10(mh), mh + 1, + scsi_2btoul(mh->data_length) + 1 - hlen - + scsi_2btoul(mh->blk_desc_len)); + scsi_ulto2b(0, mh->blk_desc_len); + } + scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { - hlen = sizeof(*mph); + mphlen = sizeof(*mph); mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; } else { mphsp = (struct scsi_mode_page_header_sp *)mph; - hlen = sizeof(*mphsp); + mphlen = sizeof(*mphsp); mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } @@ -626,27 +665,6 @@ editlist_save(struct cam_device *device, int dbd, int /* Encode the value data to be passed back to the device. */ buff_encode_visit(mode_pars, len, format, editentry_save, 0); - /* Eliminate block descriptors. */ - bcopy(mph, mh + 1, hlen + len); - - /* Recalculate headers & offsets. */ - mh->data_length = 0; /* Reserved for MODE SELECT command. */ - mh->blk_desc_len = 0; /* No block descriptors. */ - /* - * Tape drives include write protect (WP), Buffered Mode and Speed - * settings in the device-specific parameter. Clearing this - * parameter on a mode select can have the effect of turning off - * write protect or buffered mode, or changing the speed setting of - * the tape drive. - * - * Disks report DPO/FUA support via the device specific parameter - * for MODE SENSE, but the bit is reserved for MODE SELECT. So we - * clear this for disks (and other non-tape devices) to avoid - * potential errors from the target device. - */ - if (device->pd_type != T_SEQUENTIAL) - mh->dev_spec = 0; - mph = MODE_PAGE_HEADER(mh); mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */ /* @@ -654,9 +672,8 @@ editlist_save(struct cam_device *device, int dbd, int * page 3 (saved values) then request the changes be permanently * recorded. */ - mode_select(device, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), - task_attr, retries, timeout, (u_int8_t *)mh, - sizeof(*mh) + hlen + len); + mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), + task_attr, retries, timeout, data, hlen + mphlen + len); } static int @@ -825,21 +842,27 @@ modepage_edit(void) } static void -modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage, - int task_attr, int retries, int timeout) +modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, + int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t indx, len; - mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout, - data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - mph = MODE_PAGE_HEADER(mh); + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + mph = find_mode_page_6(mh); + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + mph = find_mode_page_10(mh); + } if ((mph->page_code & SMPH_SPF) == 0) { mode_pars = (uint8_t *)(mph + 1); len = mph->page_length; @@ -869,8 +892,9 @@ cleanup_editfile(void) } void -mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage, - int edit, int binary, int task_attr, int retry_count, int timeout) +mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page, + int subpage, int edit, int binary, int task_attr, int retry_count, + int timeout) { const char *pagedb_path; /* Path to modepage database. */ @@ -901,8 +925,8 @@ mode_edit(struct cam_device *device, int dbd, int pc, exit(EX_OSFILE); } - editlist_populate(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + editlist_populate(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } if (edit) { @@ -911,12 +935,12 @@ mode_edit(struct cam_device *device, int dbd, int pc, errx(EX_USAGE, "it only makes sense to edit page 0 " "(current) or page 3 (saved values)"); modepage_edit(); - editlist_save(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + editlist_save(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } else if (binary || STAILQ_EMPTY(&editlist)) { /* Display without formatting information. */ - modepage_dump(device, dbd, pc, page, subpage, task_attr, - retry_count, timeout); + modepage_dump(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); } else { /* Display with format. */ modepage_write(stdout, 0); @@ -924,16 +948,15 @@ mode_edit(struct cam_device *device, int dbd, int pc, } void -mode_list(struct cam_device *device, int dbd, int pc, int subpages, +mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout) { - u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ - struct scsi_mode_header_6 *mh; /* Location of mode header. */ + u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; struct pagename *nameentry; const char *pagedb_path; - int len, page, subpage; + int len, off, page, subpage; if ((pagedb_path = getenv("SCSI_MODES")) == NULL) pagedb_path = DEFAULT_SCSI_MODE_DB; @@ -944,26 +967,36 @@ mode_list(struct cam_device *device, int dbd, int pc, } /* Build the list of all mode pages by querying the "all pages" page. */ - mode_sense(device, dbd, pc, SMS_ALL_PAGES_PAGE, + mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE, subpages ? SMS_SUBPAGE_ALL : 0, task_attr, retry_count, timeout, data, sizeof(data)); - mh = (struct scsi_mode_header_6 *)data; - len = sizeof(*mh) + mh->blk_desc_len; /* Skip block descriptors. */ + /* Skip block descriptors. */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + len = mh->data_length; + off = sizeof(*mh) + mh->blk_desc_len; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + len = scsi_2btoul(mh->data_length); + off = sizeof(*mh) + scsi_2btoul(mh->blk_desc_len); + } /* Iterate through the pages in the reply. */ - while (len < mh->data_length) { + while (off < len) { /* Locate the next mode page header. */ - mph = (struct scsi_mode_page_header *)((intptr_t)mh + len); + mph = (struct scsi_mode_page_header *)(data + off); if ((mph->page_code & SMPH_SPF) == 0) { page = mph->page_code & SMS_PAGE_CODE; subpage = 0; - len += sizeof(*mph) + mph->page_length; + off += sizeof(*mph) + mph->page_length; } else { mphsp = (struct scsi_mode_page_header_sp *)mph; page = mphsp->page_code & SMS_PAGE_CODE; subpage = mphsp->subpage; - len += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length); + off += sizeof(*mphsp) + scsi_2btoul(mphsp->page_length); } nameentry = nameentry_lookup(page, subpage); From owner-svn-src-all@freebsd.org Wed Aug 28 20:23:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11893E58E0; Wed, 28 Aug 2019 20:23:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcct05dXz4ffD; Wed, 28 Aug 2019 20:23:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8E80CF12; Wed, 28 Aug 2019 20:23:09 +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 x7SKN94T070242; Wed, 28 Aug 2019 20:23:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKN8RL070234; Wed, 28 Aug 2019 20:23:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282023.x7SKN8RL070234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351582 - in stable/11: sbin/camcontrol sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/camcontrol sys/cam/scsi X-SVN-Commit-Revision: 351582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:23:10 -0000 Author: mav Date: Wed Aug 28 20:23:08 2019 New Revision: 351582 URL: https://svnweb.freebsd.org/changeset/base/351582 Log: MFC r350676: Make `camcontrol modepage` support block descriptors. It allows to read and write block descriptors alike to mode page parameters. It allows to change block size or short-stroke HDDs or overprovision SSDs. Depenting on -P parameter the change can be either persistent or till reset. In case of block size change device may need reformat after the setting. In case of SSD overprovisioning format or sanitize may be needed to really free the flash. During implementation appeared that csio_encode_visit() can not handle integers of more then 4 bytes, that makes 8-byte LBA handling awkward. I had to split it into two 4-byte halves now. Relnotes: yes Sponsored by: iXsystems, Inc. Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/camcontrol.c stable/11/sbin/camcontrol/camcontrol.h stable/11/sbin/camcontrol/modeedit.c stable/11/sys/cam/scsi/scsi_all.c stable/11/sys/cam/scsi/scsi_all.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.8 Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sbin/camcontrol/camcontrol.8 Wed Aug 28 20:23:08 2019 (r351582) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 2019 +.Dd August 6, 2019 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -125,6 +125,8 @@ .Op Fl 6 .Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl +.Op Fl D +.Op Fl L .Op Fl b | Fl e .Op Fl d .Nm @@ -733,6 +735,11 @@ If not specified, starts with 10 byte commands and falls back to 6 byte on error. .It Fl d Disable block descriptors for mode sense. +.It Fl D +Display/edit block descriptors instead of mode page. +.It Fl L +Use long LBA block descriptors. +Allows number of LBAs bigger then 2^^32. .It Fl b Displays mode page data in binary format. .It Fl e Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sbin/camcontrol/camcontrol.c Wed Aug 28 20:23:08 2019 (r351582) @@ -224,7 +224,7 @@ static struct camcontrol_opts option_table[] = { {"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""}, #ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, - {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"}, + {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:DLP:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, {"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, @@ -4430,9 +4430,9 @@ reassignblocks(struct cam_device *device, u_int32_t *b #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page, - int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, - int datalen) +mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc, + int page, int subpage, int task_attr, int retry_count, int timeout, + u_int8_t *data, int datalen) { union ccb *ccb; int error_code, sense_key, asc, ascq; @@ -4464,6 +4464,11 @@ retry: /* minimum_cmd_size */ *cdb_len, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); + if (llbaa && ccb->csio.cdb_len == 10) { + struct scsi_mode_sense_10 *cdb = + (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes; + cdb->byte2 |= SMS10_LLBAA; + } /* Record what CDB size the above function really set. */ *cdb_len = ccb->csio.cdb_len; @@ -4555,8 +4560,8 @@ modepage(struct cam_device *device, int argc, char **a int task_attr, int retry_count, int timeout) { char *str_subpage; - int c, page = -1, subpage = -1, pc = 0; - int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0; + int c, page = -1, subpage = -1, pc = 0, llbaa = 0; + int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4588,6 +4593,12 @@ modepage(struct cam_device *device, int argc, char **a if (subpage < 0) errx(1, "invalid mode subpage %d", subpage); break; + case 'D': + desc = 1; + break; + case 'L': + llbaa = 1; + break; case 'P': pc = strtol(optarg, NULL, 0); if ((pc < 0) || (pc > 3)) @@ -4598,15 +4609,21 @@ modepage(struct cam_device *device, int argc, char **a } } - if (page == -1 && list == 0) + if (page == -1 && desc == 0 && list == 0) errx(1, "you must specify a mode page!"); + if (dbd && desc) + errx(1, "-d and -D are incompatible!"); + + if (llbaa && cdb_len != 10) + errx(1, "LLBAA bit is not present in MODE SENSE(6)!"); + if (list != 0) { mode_list(device, cdb_len, dbd, pc, list > 1, task_attr, retry_count, timeout); } else { - mode_edit(device, cdb_len, dbd, pc, page, subpage, edit, - binary, task_attr, retry_count, timeout); + mode_edit(device, cdb_len, desc, dbd, llbaa, pc, page, subpage, + edit, binary, task_attr, retry_count, timeout); } } Modified: stable/11/sbin/camcontrol/camcontrol.h ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.h Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sbin/camcontrol/camcontrol.h Wed Aug 28 20:23:08 2019 (r351582) @@ -88,15 +88,15 @@ int epc(struct cam_device *device, int argc, char **ar int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); -void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, - int page, int subpage, int task_attr, int retry_count, +void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, + int pc, int page, int subpage, int task_attr, int retry_count, int timeout, uint8_t *data, int datalen); void mode_select(struct cam_device *device, int cdb_len, int save_pages, int task_attr, int retry_count, int timeout, u_int8_t *data, int datalen); -void mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, - int page, int subpage, int edit, int binary, int task_attr, - int retry_count, int timeout); +void mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, + int llbaa, int pc, int page, int subpage, int edit, int binary, + int task_attr, int retry_count, int timeout); void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout); int scsidoinquiry(struct cam_device *device, int argc, char **argv, Modified: stable/11/sbin/camcontrol/modeedit.c ============================================================================== --- stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:23:08 2019 (r351582) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -96,6 +97,8 @@ static void editentry_create(void *hook, int letter, int count, char *name); static void editentry_update(void *hook, int letter, void *arg, int count, char *name); +static void editentry_create_desc(void *hook, int letter, void *arg, + int count, char *name); static int editentry_save(void *hook, char *name); static struct editentry *editentry_lookup(char *name); static int editentry_set(char *name, char *newvalue, @@ -103,9 +106,16 @@ static int editentry_set(char *name, char *newvalue, static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_populate_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void editlist_save_desc(struct cam_device *device, int cdb_len, + int llbaa, int pc, int page, int subpage, + int task_attr, int retries, int timeout); static void nameentry_create(int page, int subpage, char *name); static struct pagename *nameentry_lookup(int page, int subpage); static int load_format(const char *pagedb_path, int lpage, @@ -116,6 +126,10 @@ static void modepage_edit(void); static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout); +static void modepage_dump_desc(struct cam_device *device, + int cdb_len, int llbaa, int pc, int page, + int subpage, int task_attr, int retries, + int timeout); static void cleanup_editfile(void); @@ -182,6 +196,43 @@ editentry_update(void *hook __unused, int letter, void } } +static void +editentry_create_desc(void *hook __unused, int letter, void *arg, int count, + char *name) +{ + struct editentry *newentry; /* Buffer to hold new entry. */ + + /* Allocate memory for the new entry and a copy of the entry name. */ + if ((newentry = malloc(sizeof(struct editentry))) == NULL || + (newentry->name = strdup(name)) == NULL) + err(EX_OSERR, NULL); + + /* Trim any trailing whitespace for the entry name. */ + RTRIM(newentry->name); + + newentry->editable = 1; + newentry->type = letter; + newentry->size = count; + newentry->value.svalue = NULL; + + STAILQ_INSERT_TAIL(&editlist, newentry, link); + + switch (letter) { + case 'i': /* Byte-sized integral type. */ + case 'b': /* Bit-sized integral types. */ + case 't': + newentry->value.ivalue = (intptr_t)arg; + break; + + case 'c': /* Character array. */ + case 'z': /* Null-padded string. */ + editentry_set(name, (char *)arg, 0); + break; + default: + ; /* NOTREACHED */ + } +} + static int editentry_save(void *hook __unused, char *name) { @@ -238,7 +289,7 @@ editentry_set(char *name, char *newvalue, int editonly struct editentry *dest; /* Modepage entry to update. */ char *cval; /* Pointer to new string value. */ char *convertend; /* End-of-conversion pointer. */ - int ival; /* New integral value. */ + long long ival, newival; /* New integral value. */ int resolution; /* Resolution in bits for integer conversion. */ /* @@ -248,7 +299,7 @@ editentry_set(char *name, char *newvalue, int editonly * currently workaround it (even for int64's), so we have to kludge it. */ #define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \ - INT_MAX: (1 << (resolution * (size))) - 1) + UINT_MAX: (1 << (resolution * (size))) - 1) assert(newvalue != NULL); if (*newvalue == '\0') @@ -265,13 +316,13 @@ editentry_set(char *name, char *newvalue, int editonly case 't': /* Convert the value string to an integer. */ resolution = (dest->type == 'i')? 8: 1; - ival = (int)strtol(newvalue, &convertend, 0); + ival = strtoll(newvalue, &convertend, 0); if (*convertend != '\0') returnerr(EINVAL); if (ival > RESOLUTION_MAX(dest->size) || ival < 0) { - int newival = (ival < 0)? 0: RESOLUTION_MAX(dest->size); - warnx("value %d is out of range for entry %s; clipping " - "to %d", ival, name, newival); + newival = (ival < 0) ? 0 : RESOLUTION_MAX(dest->size); + warnx("value %lld is out of range for entry %s; " + "clipping to %lld", ival, name, newival); ival = newival; } if (dest->value.ivalue != ival) @@ -548,7 +599,7 @@ static void editlist_populate(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -557,8 +608,8 @@ editlist_populate(struct cam_device *device, int cdb_l STAILQ_INIT(&editlist); /* Fetch changeable values; use to build initial editlist. */ - mode_sense(device, &cdb_len, dbd, 1, page, subpage, task_attr, retries, - timeout, data, sizeof(data)); + mode_sense(device, &cdb_len, dbd, 0, 1, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); if (cdb_len == 6) { struct scsi_mode_header_6 *mh = @@ -583,16 +634,77 @@ editlist_populate(struct cam_device *device, int cdb_l buff_decode_visit(mode_pars, len, format, editentry_create, 0); /* Fetch the current/saved values; use to set editentry values. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); buff_decode_visit(mode_pars, len, format, editentry_update, 0); } static void +editlist_populate_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + char num[8]; + struct sbuf sb; + size_t len; + u_int longlba, dlen, i; + + STAILQ_INIT(&editlist); + + /* Fetch the current/saved values. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + longlba = 0; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + longlba = (mh->flags & SMH_LONGLBA) != 0; + } + dlen = longlba ? 16 : 8; + len = MIN(len, sizeof(data) - (desc - data)); + + sbuf_new(&sb, format, sizeof(format), SBUF_FIXEDLEN); + num[0] = 0; + for (i = 0; i * dlen < len; i++) { + if (i > 0) + snprintf(num, sizeof(num), " %d", i + 1); + if (longlba) { + sbuf_printf(&sb, "{Number of Logical Blocks%s High} i4\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i4\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i4\n", num); + } else if (device->pd_type == T_DIRECT) { + sbuf_printf(&sb, "{Number of Logical Blocks%s} i4\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } else { + sbuf_printf(&sb, "{Density Code%s} i1\n", num); + sbuf_printf(&sb, "{Number of Logical Blocks%s} i3\n", num); + sbuf_cat(&sb, "{Reserved} *i1\n"); + sbuf_printf(&sb, "{Logical Block Length%s} i3\n", num); + } + } + sbuf_finish(&sb); + sbuf_delete(&sb); + + /* Decode the value data, creating edit_entries for each value. */ + buff_decode_visit(desc, len, format, editentry_create_desc, 0); +} + +static void editlist_save(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; @@ -603,7 +715,7 @@ editlist_save(struct cam_device *device, int cdb_len, return; /* Preload the CDB buffer with the current mode page data. */ - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); /* Initial headers & offsets. */ @@ -676,6 +788,56 @@ editlist_save(struct cam_device *device, int cdb_len, task_attr, retries, timeout, data, hlen + mphlen + len); } +static void +editlist_save_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t len, hlen; + + /* Make sure that something changed before continuing. */ + if (! editlist_changed) + return; + + /* Preload the CDB buffer with the current mode page data. */ + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + /* Initial headers & offsets. */ + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + mh->data_length = 0; /* Reserved for MODE SELECT command. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + hlen = sizeof(*mh); + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + scsi_ulto2b(0, mh->data_length); /* Reserved for MODE SELECT. */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; /* See comment above */ + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Encode the value data to be passed back to the device. */ + buff_encode_visit(desc, len, format, editentry_save, 0); + + /* + * Write the changes back to the device. If the user editted control + * page 3 (saved values) then request the changes be permanently + * recorded. + */ + mode_select(device, cdb_len, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED), + task_attr, retries, timeout, data, hlen + len); +} + static int modepage_write(FILE *file, int editonly) { @@ -689,7 +851,7 @@ modepage_write(FILE *file, int editonly) fprintf(file, "%s: %s\n", scan->name, scan->value.svalue); } else { - fprintf(file, "%s: %d\n", scan->name, + fprintf(file, "%s: %u\n", scan->name, scan->value.ivalue); } } @@ -845,13 +1007,13 @@ static void modepage_dump(struct cam_device *device, int cdb_len, int dbd, int pc, int page, int subpage, int task_attr, int retries, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ u_int8_t *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; size_t indx, len; - mode_sense(device, &cdb_len, dbd, pc, page, subpage, task_attr, + mode_sense(device, &cdb_len, dbd, 0, pc, page, subpage, task_attr, retries, timeout, data, sizeof(data)); if (cdb_len == 6) { @@ -880,7 +1042,38 @@ modepage_dump(struct cam_device *device, int cdb_len, } putchar('\n'); } +static void +modepage_dump_desc(struct cam_device *device, int cdb_len, int llbaa, int pc, + int page, int subpage, int task_attr, int retries, int timeout) +{ + uint8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ + uint8_t *desc; /* Pointer to block descriptor. */ + size_t indx, len; + mode_sense(device, &cdb_len, 0, llbaa, pc, page, subpage, task_attr, + retries, timeout, data, sizeof(data)); + + if (cdb_len == 6) { + struct scsi_mode_header_6 *mh = + (struct scsi_mode_header_6 *)data; + desc = (uint8_t *)(mh + 1); + len = mh->blk_desc_len; + } else { + struct scsi_mode_header_10 *mh = + (struct scsi_mode_header_10 *)data; + desc = (uint8_t *)(mh + 1); + len = scsi_2btoul(mh->blk_desc_len); + } + len = MIN(len, sizeof(data) - (desc - data)); + + /* Print the raw mode page data with newlines each 8 bytes. */ + for (indx = 0; indx < len; indx++) { + printf("%02x%c", desc[indx], + (((indx + 1) % 8) == 0) ? '\n' : ' '); + } + putchar('\n'); +} + static void cleanup_editfile(void) { @@ -892,16 +1085,19 @@ cleanup_editfile(void) } void -mode_edit(struct cam_device *device, int cdb_len, int dbd, int pc, int page, - int subpage, int edit, int binary, int task_attr, int retry_count, - int timeout) +mode_edit(struct cam_device *device, int cdb_len, int desc, int dbd, int llbaa, + int pc, int page, int subpage, int edit, int binary, int task_attr, + int retry_count, int timeout) { const char *pagedb_path; /* Path to modepage database. */ - if (edit && binary) - errx(EX_USAGE, "cannot edit in binary mode."); - - if (! binary) { + if (binary) { + if (edit) + errx(EX_USAGE, "cannot edit in binary mode."); + } else if (desc) { + editlist_populate_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { if ((pagedb_path = getenv("SCSI_MODES")) == NULL) pagedb_path = DEFAULT_SCSI_MODE_DB; @@ -935,12 +1131,22 @@ mode_edit(struct cam_device *device, int cdb_len, int errx(EX_USAGE, "it only makes sense to edit page 0 " "(current) or page 3 (saved values)"); modepage_edit(); - editlist_save(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + editlist_save_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + editlist_save(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else if (binary || STAILQ_EMPTY(&editlist)) { /* Display without formatting information. */ - modepage_dump(device, cdb_len, dbd, pc, page, subpage, - task_attr, retry_count, timeout); + if (desc) { + modepage_dump_desc(device, cdb_len, llbaa, pc, page, + subpage, task_attr, retry_count, timeout); + } else { + modepage_dump(device, cdb_len, dbd, pc, page, subpage, + task_attr, retry_count, timeout); + } } else { /* Display with format. */ modepage_write(stdout, 0); @@ -951,7 +1157,7 @@ void mode_list(struct cam_device *device, int cdb_len, int dbd, int pc, int subpages, int task_attr, int retry_count, int timeout) { - u_int8_t data[MAX_DATA_SIZE];/* Buffer to hold sense data. */ + u_int8_t data[MAX_DATA_SIZE]; /* Buffer to hold mode parameters. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; struct pagename *nameentry; @@ -967,7 +1173,7 @@ mode_list(struct cam_device *device, int cdb_len, int } /* Build the list of all mode pages by querying the "all pages" page. */ - mode_sense(device, &cdb_len, dbd, pc, SMS_ALL_PAGES_PAGE, + mode_sense(device, &cdb_len, dbd, 0, pc, SMS_ALL_PAGES_PAGE, subpages ? SMS_SUBPAGE_ALL : 0, task_attr, retry_count, timeout, data, sizeof(data)); Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sys/cam/scsi/scsi_all.c Wed Aug 28 20:23:08 2019 (r351582) @@ -2054,7 +2054,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x30, 0x13, SS_RDEF, /* XXX TBD */ "Cleaning volume expired") }, /* DT WRO BK */ - { SST(0x31, 0x00, SS_RDEF, + { SST(0x31, 0x00, SS_FATAL | ENXIO, "Medium format corrupted") }, /* D L RO B */ { SST(0x31, 0x01, SS_RDEF, Modified: stable/11/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.h Wed Aug 28 20:22:14 2019 (r351581) +++ stable/11/sys/cam/scsi/scsi_all.h Wed Aug 28 20:23:08 2019 (r351582) @@ -3574,7 +3574,9 @@ struct scsi_mode_header_10 u_int8_t data_length[2];/* Sense data length */ u_int8_t medium_type; u_int8_t dev_spec; - u_int8_t unused[2]; + u_int8_t flags; +#define SMH_LONGLBA 0x01 + u_int8_t unused; u_int8_t blk_desc_len[2]; }; From owner-svn-src-all@freebsd.org Wed Aug 28 20:23:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1A43E5996; Wed, 28 Aug 2019 20:23:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcdd68MSz4fn8; Wed, 28 Aug 2019 20:23:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4CABCF14; Wed, 28 Aug 2019 20:23:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SKNnsh070322; Wed, 28 Aug 2019 20:23:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKNnaS070321; Wed, 28 Aug 2019 20:23:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282023.x7SKNnaS070321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:23: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: r351583 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 351583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:23:50 -0000 Author: mav Date: Wed Aug 28 20:23:49 2019 New Revision: 351583 URL: https://svnweb.freebsd.org/changeset/base/351583 Log: MFC r350677: Make GCC happy about math in r350676. Modified: stable/11/sbin/camcontrol/modeedit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/modeedit.c ============================================================================== --- stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:23:08 2019 (r351582) +++ stable/11/sbin/camcontrol/modeedit.c Wed Aug 28 20:23:49 2019 (r351583) @@ -295,11 +295,8 @@ editentry_set(char *name, char *newvalue, int editonly /* * Macro to determine the maximum value of the given size for the current * resolution. - * XXX Lovely x86's optimize out the case of shifting by 32 and gcc doesn't - * currently workaround it (even for int64's), so we have to kludge it. */ -#define RESOLUTION_MAX(size) ((resolution * (size) == 32)? \ - UINT_MAX: (1 << (resolution * (size))) - 1) +#define RESOLUTION_MAX(size) ((1LL << (resolution * (size))) - 1) assert(newvalue != NULL); if (*newvalue == '\0') From owner-svn-src-all@freebsd.org Wed Aug 28 20:34:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 837C9E5C8D; Wed, 28 Aug 2019 20:34:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcst2mvSz3Blh; Wed, 28 Aug 2019 20:34:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CD31D0EA; Wed, 28 Aug 2019 20:34:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SKYQl2076968; Wed, 28 Aug 2019 20:34:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKYPZQ076957; Wed, 28 Aug 2019 20:34:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908282034.x7SKYPZQ076957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 20:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: fs/nullfs fs/unionfs kern sys X-SVN-Commit-Revision: 351584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:34:26 -0000 Author: mjg Date: Wed Aug 28 20:34:24 2019 New Revision: 351584 URL: https://svnweb.freebsd.org/changeset/base/351584 Log: vfs: add VOP_NEED_INACTIVE vnode usecount drops to 0 all the time (e.g. for directories during path lookup). When that happens the kernel would always lock the exclusive lock for the vnode in order to call vinactive(). This blocks other threads who want to use the vnode for looukp. vinactive is very rarely needed and can be tested for without the vnode lock held. This patch gives filesytems an opportunity to do it, sample total wait time for tmpfs over 500 minutes of poudriere -j 104: before: 557563641706 (lockmgr:tmpfs) after: 46309603301 (lockmgr:tmpfs) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21371 Modified: head/sys/fs/nullfs/null_vnops.c head/sys/fs/unionfs/union_vnops.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:34:24 2019 (r351584) @@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = { .vop_getattr = null_getattr, .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, + .vop_need_inactive = vop_stdneed_inactive, .vop_islocked = vop_stdislocked, .vop_lock1 = null_lock, .vop_lookup = null_lookup, Modified: head/sys/fs/unionfs/union_vnops.c ============================================================================== --- head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:34:24 2019 (r351584) @@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = { .vop_getextattr = unionfs_getextattr, .vop_getwritemount = unionfs_getwritemount, .vop_inactive = unionfs_inactive, + .vop_need_inactive = vop_stdneed_inactive, .vop_islocked = unionfs_islocked, .vop_ioctl = unionfs_ioctl, .vop_link = unionfs_link, Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/kern/vfs_default.c Wed Aug 28 20:34:24 2019 (r351584) @@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = { .vop_getpages_async = vop_stdgetpages_async, .vop_getwritemount = vop_stdgetwritemount, .vop_inactive = VOP_NULL, + .vop_need_inactive = vop_stdneed_inactive, .vop_ioctl = vop_stdioctl, .vop_kqfilter = vop_stdkqfilter, .vop_islocked = vop_stdislocked, @@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args * } VI_UNLOCK(vp); return (error); +} + +int +vop_stdneed_inactive(struct vop_need_inactive_args *ap) +{ + + return (1); } static int Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/kern/vfs_subr.c Wed Aug 28 20:34:24 2019 (r351584) @@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func) CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); /* + * Check if the fs wants to perform inactive processing. Note we + * may be only holding the interlock, in which case it is possible + * someone else called vgone on the vnode and ->v_data is now NULL. + * Since vgone performs inactive on its own there is nothing to do + * here but to drop our hold count. + */ + if (__predict_false(vp->v_iflag & VI_DOOMED) || + VOP_NEED_INACTIVE(vp) == 0) { + if (func == VPUTX_VPUT) + VOP_UNLOCK(vp, 0); + vdropl(vp); + return; + } + + /* * We must call VOP_INACTIVE with the node locked. Mark * as VI_DOINGINACT to avoid recursion. */ @@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = { .vop_close = sync_close, /* close */ .vop_fsync = sync_fsync, /* fsync */ .vop_inactive = sync_inactive, /* inactive */ + .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */ .vop_reclaim = sync_reclaim, /* reclaim */ .vop_lock1 = vop_stdlock, /* lock */ .vop_unlock = vop_stdunlock, /* unlock */ @@ -4514,6 +4530,20 @@ sync_reclaim(struct vop_reclaim_args *ap) return (0); } +int +vn_need_pageq_flush(struct vnode *vp) +{ + struct vm_object *obj; + int need; + + MPASS(mtx_owned(VI_MTX(vp))); + need = 0; + if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && + (obj->flags & OBJ_MIGHTBEDIRTY) != 0) + need = 1; + return (need); +} + /* * Check if vnode represents a disk device */ @@ -4893,6 +4923,22 @@ vop_unlock_post(void *ap, int rc) if (a->a_flags & LK_INTERLOCK) ASSERT_VI_UNLOCKED(a->a_vp, "VOP_UNLOCK"); +} + +void +vop_need_inactive_pre(void *ap) +{ + struct vop_need_inactive_args *a = ap; + + ASSERT_VI_LOCKED(a->a_vp, "VOP_NEED_INACTIVE"); +} + +void +vop_need_inactive_post(void *ap, int rc) +{ + struct vop_need_inactive_args *a = ap; + + ASSERT_VI_LOCKED(a->a_vp, "VOP_NEED_INACTIVE"); } #endif Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/kern/vnode_if.src Wed Aug 28 20:34:24 2019 (r351584) @@ -358,6 +358,12 @@ vop_inactive { IN struct thread *td; }; +%! need_inactive pre vop_need_inactive_pre +%! need_inactive post vop_need_inactive_post + +vop_need_inactive { + IN struct vnode *vp; +}; %% reclaim vp E E E %! reclaim post vop_reclaim_post Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/sys/vnode.h Wed Aug 28 20:34:24 2019 (r351584) @@ -682,6 +682,7 @@ int vn_generic_copy_file_range(struct vnode *invp, off struct vnode *outvp, off_t *outoffp, size_t *lenp, unsigned int flags, struct ucred *incred, struct ucred *outcred, struct thread *fsize_td); +int vn_need_pageq_flush(struct vnode *vp); int vn_isdisk(struct vnode *vp, int *errp); int _vn_lock(struct vnode *vp, int flags, char *file, int line); #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) @@ -753,6 +754,7 @@ int vop_stdfsync(struct vop_fsync_args *); int vop_stdgetwritemount(struct vop_getwritemount_args *); int vop_stdgetpages(struct vop_getpages_args *); int vop_stdinactive(struct vop_inactive_args *); +int vop_stdneed_inactive(struct vop_need_inactive_args *); int vop_stdislocked(struct vop_islocked_args *); int vop_stdkqfilter(struct vop_kqfilter_args *); int vop_stdlock(struct vop_lock1_args *); @@ -813,12 +815,16 @@ void vop_lock_pre(void *a); void vop_lock_post(void *a, int rc); void vop_unlock_pre(void *a); void vop_unlock_post(void *a, int rc); +void vop_need_inactive_pre(void *a); +void vop_need_inactive_post(void *a, int rc); #else #define vop_strategy_pre(x) do { } while (0) #define vop_lock_pre(x) do { } while (0) #define vop_lock_post(x, y) do { } while (0) #define vop_unlock_pre(x) do { } while (0) #define vop_unlock_post(x, y) do { } while (0) +#define vop_need_inactive_pre(x) do { } while (0) +#define vop_need_inactive_post(x, y) do { } while (0) #endif void vop_rename_fail(struct vop_rename_args *ap); From owner-svn-src-all@freebsd.org Wed Aug 28 20:35:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23CC3E5D13; Wed, 28 Aug 2019 20:35:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jctz6Y76z3Bv1; Wed, 28 Aug 2019 20:35:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C16C1D0EE; Wed, 28 Aug 2019 20:35:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7SKZNj2077188; Wed, 28 Aug 2019 20:35:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKZN5A077187; Wed, 28 Aug 2019 20:35:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908282035.x7SKZN5A077187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 28 Aug 2019 20:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351585 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 351585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:35:24 -0000 Author: mjg Date: Wed Aug 28 20:35:23 2019 New Revision: 351585 URL: https://svnweb.freebsd.org/changeset/base/351585 Log: tmpfs: use VOP_NEED_INACTIVE Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21371 Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:34:24 2019 (r351584) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:35:23 2019 (r351585) @@ -1283,6 +1283,27 @@ tmpfs_inactive(struct vop_inactive_args *v) return (0); } +static int +tmpfs_need_inactive(struct vop_need_inactive_args *ap) +{ + struct vnode *vp; + struct tmpfs_node *node; + struct vm_object *obj; + + vp = ap->a_vp; + node = VP_TO_TMPFS_NODE(vp); + if (node->tn_links == 0) + goto need; + if (vp->v_type == VREG) { + obj = vp->v_object; + if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) + goto need; + } + return (0); +need: + return (1); +} + int tmpfs_reclaim(struct vop_reclaim_args *v) { @@ -1584,6 +1605,7 @@ struct vop_vector tmpfs_vnodeop_entries = { .vop_readdir = tmpfs_readdir, .vop_readlink = tmpfs_readlink, .vop_inactive = tmpfs_inactive, + .vop_need_inactive = tmpfs_need_inactive, .vop_reclaim = tmpfs_reclaim, .vop_print = tmpfs_print, .vop_pathconf = tmpfs_pathconf, From owner-svn-src-all@freebsd.org Wed Aug 28 20:35:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A844CE5DC5; Wed, 28 Aug 2019 20:35:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jcvf2S4Gz3C4S; Wed, 28 Aug 2019 20:35:57 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x243.google.com with SMTP id p127so771719oic.8; Wed, 28 Aug 2019 13:35:57 -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; bh=sljmqSZ98jq12DH/9Ke3gQrg25EBkYnpzZsTztDpSGE=; b=fwvojlwhy/NGmrpAdEIv9/JEHuDn4wjZUfJEWxR1PeIbjazNA1p8C+vtBK13veTp1L y1jG+QCsyKv6JtVxO9SU2DambU6GemrjQNRnGReXA6fODCCKLb2V4FtmkdByEgQxgNKU Qv1owmHDS+2twGDmTnpHbfL5hnuLNVkCcY2ZkN7SzF8HIvU/glWvdenn+3ZpbO34IKzk A9OYD68lk0MuHmhedxxCxv0ZL9B2pz10ZVEdSuoKmbM36yDl9m9F8WLsfqYf8JevyuVh lQfamPlTtFlZr6IExXKOxYi56OuZA4Snn+d+J5HlvYc6vGXnkzFhg7/OVtrOmNyKE7+R BfwQ== 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; bh=sljmqSZ98jq12DH/9Ke3gQrg25EBkYnpzZsTztDpSGE=; b=PTgPeIvwHIodgqLJfndZdh38pVyc7Wx3oll34264m+dL/kQC08yzCvC9c0J5Eexf04 Vx3LlCfq020O3BelJqqf6oa9MAn35QKQ6cac6Oq3FbXiEtE5heEVRTBhLo1sP3w8KOcQ 56/vW3oPHDbtw9sapsuzXDiykJk1hPb6z7hcjxkO+g2M5ml7eOnc+YaC9c9JAdzhH/0G dBlcNzuTzRY2qiPIMv3zyZZhtPVvytqzE5iCQPpJq3LAuTlPyOVxVXH1eaRdQORTTaWW 4LUzBbr/WSsMdB66tJS93RiBIl5X/WoWvOfIuPGFFrBV1+xQAWjO6Ha8iSjWgtLvyl4D mFZw== X-Gm-Message-State: APjAAAWXiobnhdyf/2TZ8jrqsiTRm61KjZNMgRPUTIJLdmFyUsMUyXdw XREzKrWNt8Y7Gj3ndgAV7q5xf6cwMDVrDXneXX1XhA== X-Google-Smtp-Source: APXvYqwn10n+LC2apQWGj9MGLQ5Fqow0o/QXRKdqdN9wYo8eMnd1TmiQX9TU/APDUeHBDmnoTFT25eTZ9RLbC2aJKUU= X-Received: by 2002:aca:1313:: with SMTP id e19mr4056922oii.5.1567024555982; Wed, 28 Aug 2019 13:35:55 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2516:0:0:0:0:0 with HTTP; Wed, 28 Aug 2019 13:35:55 -0700 (PDT) In-Reply-To: <201908282034.x7SKYPZQ076957@repo.freebsd.org> References: <201908282034.x7SKYPZQ076957@repo.freebsd.org> From: Mateusz Guzik Date: Wed, 28 Aug 2019 22:35:55 +0200 Message-ID: Subject: Re: svn commit: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46Jcvf2S4Gz3C4S X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=fwvojlwh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::243 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(0.00)[ip: (2.28), ipnet: 2607:f8b0::/32(-2.85), asn: 15169(-2.32), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[3.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:35:59 -0000 On 8/28/19, Mateusz Guzik wrote: > Author: mjg > Date: Wed Aug 28 20:34:24 2019 > New Revision: 351584 > URL: https://svnweb.freebsd.org/changeset/base/351584 > > Log: > vfs: add VOP_NEED_INACTIVE > > vnode usecount drops to 0 all the time (e.g. for directories during path > lookup). > When that happens the kernel would always lock the exclusive lock for the > vnode > in order to call vinactive(). This blocks other threads who want to use > the vnode > for looukp. > > vinactive is very rarely needed and can be tested for without the vnode > lock held. > > This patch gives filesytems an opportunity to do it, sample total wait > time for > tmpfs over 500 minutes of poudriere -j 104: > > before: 557563641706 (lockmgr:tmpfs) > after: 46309603301 (lockmgr:tmpfs) > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21371 > Reviewed by: kib Tested by: pho > Modified: > head/sys/fs/nullfs/null_vnops.c > head/sys/fs/unionfs/union_vnops.c > head/sys/kern/vfs_default.c > head/sys/kern/vfs_subr.c > head/sys/kern/vnode_if.src > head/sys/sys/vnode.h > > Modified: head/sys/fs/nullfs/null_vnops.c > ============================================================================== > --- head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:34:24 2019 (r351584) > @@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = { > .vop_getattr = null_getattr, > .vop_getwritemount = null_getwritemount, > .vop_inactive = null_inactive, > + .vop_need_inactive = vop_stdneed_inactive, > .vop_islocked = vop_stdislocked, > .vop_lock1 = null_lock, > .vop_lookup = null_lookup, > > Modified: head/sys/fs/unionfs/union_vnops.c > ============================================================================== > --- head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:34:24 2019 (r351584) > @@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = { > .vop_getextattr = unionfs_getextattr, > .vop_getwritemount = unionfs_getwritemount, > .vop_inactive = unionfs_inactive, > + .vop_need_inactive = vop_stdneed_inactive, > .vop_islocked = unionfs_islocked, > .vop_ioctl = unionfs_ioctl, > .vop_link = unionfs_link, > > Modified: head/sys/kern/vfs_default.c > ============================================================================== > --- head/sys/kern/vfs_default.c Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/kern/vfs_default.c Wed Aug 28 20:34:24 2019 (r351584) > @@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = { > .vop_getpages_async = vop_stdgetpages_async, > .vop_getwritemount = vop_stdgetwritemount, > .vop_inactive = VOP_NULL, > + .vop_need_inactive = vop_stdneed_inactive, > .vop_ioctl = vop_stdioctl, > .vop_kqfilter = vop_stdkqfilter, > .vop_islocked = vop_stdislocked, > @@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args > * > } > VI_UNLOCK(vp); > return (error); > +} > + > +int > +vop_stdneed_inactive(struct vop_need_inactive_args *ap) > +{ > + > + return (1); > } > > static int > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/kern/vfs_subr.c Wed Aug 28 20:34:24 2019 (r351584) > @@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func) > CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); > > /* > + * Check if the fs wants to perform inactive processing. Note we > + * may be only holding the interlock, in which case it is possible > + * someone else called vgone on the vnode and ->v_data is now NULL. > + * Since vgone performs inactive on its own there is nothing to do > + * here but to drop our hold count. > + */ > + if (__predict_false(vp->v_iflag & VI_DOOMED) || > + VOP_NEED_INACTIVE(vp) == 0) { > + if (func == VPUTX_VPUT) > + VOP_UNLOCK(vp, 0); > + vdropl(vp); > + return; > + } > + > + /* > * We must call VOP_INACTIVE with the node locked. Mark > * as VI_DOINGINACT to avoid recursion. > */ > @@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = { > .vop_close = sync_close, /* close */ > .vop_fsync = sync_fsync, /* fsync */ > .vop_inactive = sync_inactive, /* inactive */ > + .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */ > .vop_reclaim = sync_reclaim, /* reclaim */ > .vop_lock1 = vop_stdlock, /* lock */ > .vop_unlock = vop_stdunlock, /* unlock */ > @@ -4514,6 +4530,20 @@ sync_reclaim(struct vop_reclaim_args *ap) > return (0); > } > > +int > +vn_need_pageq_flush(struct vnode *vp) > +{ > + struct vm_object *obj; > + int need; > + > + MPASS(mtx_owned(VI_MTX(vp))); > + need = 0; > + if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 && > + (obj->flags & OBJ_MIGHTBEDIRTY) != 0) > + need = 1; > + return (need); > +} > + > /* > * Check if vnode represents a disk device > */ > @@ -4893,6 +4923,22 @@ vop_unlock_post(void *ap, int rc) > > if (a->a_flags & LK_INTERLOCK) > ASSERT_VI_UNLOCKED(a->a_vp, "VOP_UNLOCK"); > +} > + > +void > +vop_need_inactive_pre(void *ap) > +{ > + struct vop_need_inactive_args *a = ap; > + > + ASSERT_VI_LOCKED(a->a_vp, "VOP_NEED_INACTIVE"); > +} > + > +void > +vop_need_inactive_post(void *ap, int rc) > +{ > + struct vop_need_inactive_args *a = ap; > + > + ASSERT_VI_LOCKED(a->a_vp, "VOP_NEED_INACTIVE"); > } > #endif > > > Modified: head/sys/kern/vnode_if.src > ============================================================================== > --- head/sys/kern/vnode_if.src Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/kern/vnode_if.src Wed Aug 28 20:34:24 2019 (r351584) > @@ -358,6 +358,12 @@ vop_inactive { > IN struct thread *td; > }; > > +%! need_inactive pre vop_need_inactive_pre > +%! need_inactive post vop_need_inactive_post > + > +vop_need_inactive { > + IN struct vnode *vp; > +}; > > %% reclaim vp E E E > %! reclaim post vop_reclaim_post > > Modified: head/sys/sys/vnode.h > ============================================================================== > --- head/sys/sys/vnode.h Wed Aug 28 20:23:49 2019 (r351583) > +++ head/sys/sys/vnode.h Wed Aug 28 20:34:24 2019 (r351584) > @@ -682,6 +682,7 @@ int vn_generic_copy_file_range(struct vnode *invp, off > struct vnode *outvp, off_t *outoffp, size_t *lenp, > unsigned int flags, struct ucred *incred, struct ucred *outcred, > struct thread *fsize_td); > +int vn_need_pageq_flush(struct vnode *vp); > int vn_isdisk(struct vnode *vp, int *errp); > int _vn_lock(struct vnode *vp, int flags, char *file, int line); > #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) > @@ -753,6 +754,7 @@ int vop_stdfsync(struct vop_fsync_args *); > int vop_stdgetwritemount(struct vop_getwritemount_args *); > int vop_stdgetpages(struct vop_getpages_args *); > int vop_stdinactive(struct vop_inactive_args *); > +int vop_stdneed_inactive(struct vop_need_inactive_args *); > int vop_stdislocked(struct vop_islocked_args *); > int vop_stdkqfilter(struct vop_kqfilter_args *); > int vop_stdlock(struct vop_lock1_args *); > @@ -813,12 +815,16 @@ void vop_lock_pre(void *a); > void vop_lock_post(void *a, int rc); > void vop_unlock_pre(void *a); > void vop_unlock_post(void *a, int rc); > +void vop_need_inactive_pre(void *a); > +void vop_need_inactive_post(void *a, int rc); > #else > #define vop_strategy_pre(x) do { } while (0) > #define vop_lock_pre(x) do { } while (0) > #define vop_lock_post(x, y) do { } while (0) > #define vop_unlock_pre(x) do { } while (0) > #define vop_unlock_post(x, y) do { } while (0) > +#define vop_need_inactive_pre(x) do { } while (0) > +#define vop_need_inactive_post(x, y) do { } while (0) > #endif > > void vop_rename_fail(struct vop_rename_args *ap); > > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Wed Aug 28 20:54:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7E1BE639D; Wed, 28 Aug 2019 20:54:26 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JdJx6Stpz3D9R; Wed, 28 Aug 2019 20:54:25 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-ed1-f67.google.com with SMTP id m44so1490740edd.9; Wed, 28 Aug 2019 13:54:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RG+DqBVHDUZHUTin03wT60qGHtW2g/WK3fG5arRiLZI=; b=K0rn0/EKc0eWVbNWYorfbbxMTFFRs4M4jr7hzI8nq50jWrIkrGbvuWRB3pN/CwFpac 7hgmIzYkV7yLA2dXw1CzHeF+7gDcJwcYSdsZrBv8weo53NRd1sGxcMbbdaMARyzjs1WN QXrhJfiA3vZQ4KlgRPPFxkRPrAYkxgac4h8+o/KUuXbkTyRdAXSIhvS+09EbJI2pT7YF q931qqf7zX85/eJ2X8HbJqIiFjeCcUSGM4XlHVKtHVEgItZZqoEKEQ994gsJ7yfJ/hNa ILGhnp1DhwisHI9EaCjCOxVuqU0cW11qj9Zx7oFqeEiU88sbANsN9NKwPBET1cjh8Xus Ag8g== X-Gm-Message-State: APjAAAUZp8/h6NuKgOPVTETIWXfo+Yv0vzPAN/ZtO1WormlwGe37NZg1 P9oQ/zMmjcud1P0yo5bJhZRsHSjhE6F9atOfBrnB+g== X-Google-Smtp-Source: APXvYqzk4iaY03TbmwxrVAFsrAmC3newvK0PQhZe7wlK1GBH0nI06xXYPtcIylyjSZs0LS944UIZYyeVwTh2N0ftqXw= X-Received: by 2002:a17:906:d9d1:: with SMTP id qk17mr5115449ejb.20.1567025664148; Wed, 28 Aug 2019 13:54:24 -0700 (PDT) MIME-Version: 1.0 References: <201908022209.x72M9vlg070949@repo.freebsd.org> In-Reply-To: <201908022209.x72M9vlg070949@repo.freebsd.org> From: Antoine Brodin Date: Wed, 28 Aug 2019 22:54:13 +0200 Message-ID: Subject: Re: svn commit: r350544 - head/usr.bin/bzip2recover To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46JdJx6Stpz3D9R X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.208.67 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-5.15 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.16)[ip: (-5.07), ipnet: 209.85.128.0/17(-3.34), asn: 15169(-2.32), country: US(-0.05)]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; RCVD_IN_DNSWL_NONE(0.00)[67.208.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[67.208.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:54:27 -0000 On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston wrote: > > Author: markj > Date: Fri Aug 2 22:09:56 2019 > New Revision: 350544 > URL: https://svnweb.freebsd.org/changeset/base/350544 > > Log: > Add bzip2recover.1. > > MFC after: 3 days > Sponsored by: The FreeBSD Foundation > > Modified: > head/usr.bin/bzip2recover/Makefile Hi, It seems that this breaks parrallel installworld. Cheers, Antoine From owner-svn-src-all@freebsd.org Wed Aug 28 20:58:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3A7EE6438; Wed, 28 Aug 2019 20:58:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JdPY3mVwz3DLF; Wed, 28 Aug 2019 20:58:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FC9AD482; Wed, 28 Aug 2019 20:58:25 +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 x7SKwP6j088801; Wed, 28 Aug 2019 20:58:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SKwPuG088800; Wed, 28 Aug 2019 20:58:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282058.x7SKwPuG088800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 20:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351586 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 351586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 20:58:25 -0000 Author: mav Date: Wed Aug 28 20:58:24 2019 New Revision: 351586 URL: https://svnweb.freebsd.org/changeset/base/351586 Log: MFC r351320: Formalize NVMe controller consumer life cycle. This fixes possible double call of fail_fn, for example on hot removal. It also allows ctrlr_fn to safely return NULL cookie in case of failure and not get useless ns_fn or fail_fn call with NULL cookie later. Modified: stable/11/sys/dev/nvme/nvme.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme.c ============================================================================== --- stable/11/sys/dev/nvme/nvme.c Wed Aug 28 20:35:23 2019 (r351585) +++ stable/11/sys/dev/nvme/nvme.c Wed Aug 28 20:58:24 2019 (r351586) @@ -316,16 +316,21 @@ nvme_notify(struct nvme_consumer *cons, return; cmpset = atomic_cmpset_32(&ctrlr->notification_sent, 0, 1); - if (cmpset == 0) return; if (cons->ctrlr_fn != NULL) ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr); else - ctrlr_cookie = NULL; + ctrlr_cookie = (void *)(uintptr_t)0xdeadc0dedeadc0de; ctrlr->cons_cookie[cons->id] = ctrlr_cookie; + + /* ctrlr_fn has failed. Nothing to notify here any more. */ + if (ctrlr_cookie == NULL) + return; + if (ctrlr->is_failed) { + ctrlr->cons_cookie[cons->id] = NULL; if (cons->fail_fn != NULL) (*cons->fail_fn)(ctrlr_cookie); /* @@ -381,13 +386,16 @@ nvme_notify_async_consumers(struct nvme_controller *ct uint32_t log_page_size) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL) - (*cons->async_fn)(ctrlr->cons_cookie[i], async_cpl, + if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + (*cons->async_fn)(ctrlr_cookie, async_cpl, log_page_id, log_page_buffer, log_page_size); + } } } @@ -395,6 +403,7 @@ void nvme_notify_fail_consumers(struct nvme_controller *ctrlr) { struct nvme_consumer *cons; + void *ctrlr_cookie; uint32_t i; /* @@ -408,8 +417,12 @@ nvme_notify_fail_consumers(struct nvme_controller *ctr for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; - if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != NULL) - cons->fail_fn(ctrlr->cons_cookie[i]); + if (cons->id != INVALID_CONSUMER_ID && + (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) { + ctrlr->cons_cookie[i] = NULL; + if (cons->fail_fn != NULL) + cons->fail_fn(ctrlr_cookie); + } } } From owner-svn-src-all@freebsd.org Wed Aug 28 21:01:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69C30E64CE; Wed, 28 Aug 2019 21:01:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JdTX26Ggz3DgQ; Wed, 28 Aug 2019 21:01:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 433A9D609; Wed, 28 Aug 2019 21:01:52 +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 x7SL1q3E094398; Wed, 28 Aug 2019 21:01:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SL1pYs094396; Wed, 28 Aug 2019 21:01:51 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908282101.x7SL1pYs094396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 28 Aug 2019 21:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351587 - in head/usr.bin: bzip2 bzip2recover X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/usr.bin: bzip2 bzip2recover X-SVN-Commit-Revision: 351587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 21:01:52 -0000 Author: markj Date: Wed Aug 28 21:01:51 2019 New Revision: 351587 URL: https://svnweb.freebsd.org/changeset/base/351587 Log: Install all bzip2.1 MLINKs from the same place. Reported by: antoine MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/bzip2/Makefile head/usr.bin/bzip2recover/Makefile Modified: head/usr.bin/bzip2/Makefile ============================================================================== --- head/usr.bin/bzip2/Makefile Wed Aug 28 20:58:24 2019 (r351586) +++ head/usr.bin/bzip2/Makefile Wed Aug 28 21:01:51 2019 (r351587) @@ -12,7 +12,9 @@ LIBADD= bz2 LINKS= ${BINDIR}/bzip2 ${BINDIR}/bunzip2 LINKS+= ${BINDIR}/bzip2 ${BINDIR}/bzcat -MLINKS= bzip2.1 bunzip2.1 bzip2.1 bzcat.1 +MLINKS= bzip2.1 bunzip2.1 \ + bzip2.1 bzcat.1 \ + bzip2.1 bzip2recover.1 REFFILES= sample1.ref sample2.ref sample3.ref DREFFILES= sample1.bz2 sample2.bz2 sample3.bz2 Modified: head/usr.bin/bzip2recover/Makefile ============================================================================== --- head/usr.bin/bzip2recover/Makefile Wed Aug 28 20:58:24 2019 (r351586) +++ head/usr.bin/bzip2recover/Makefile Wed Aug 28 21:01:51 2019 (r351587) @@ -6,8 +6,6 @@ BZ2DIR= ${SRCTOP}/contrib/bzip2 PROG= bzip2recover MAN= -MLINKS+=bzip2.1 bzip2recover.1 - NO_WMISSING_VARIABLE_DECLARATIONS= .include From owner-svn-src-all@freebsd.org Wed Aug 28 21:03:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5A42E6683; Wed, 28 Aug 2019 21:03:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JdWz3vB3z3DrJ; Wed, 28 Aug 2019 21:03:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io1-xd2b.google.com with SMTP id b10so2488403ioj.2; Wed, 28 Aug 2019 14:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=H02gTWHnIIOKA/nBQaeBhib3HKkb17tFmXSjXBFMa3I=; b=D6mlNXia0qs7W7MSQnxs9l8+CJ5JF8TO6N2plmkCWKSa1T2QOWY1eAot5Qjdu449AM W0HO7ZK2rhDHV6ZwmLYFFHaZSmt/w5n8zMY/dh17DGXJREuStLxO+ASV46gQg/VbX3A9 uqHUt8Y2eh1SSh9vER7YJ1dcNv4EKeo2BxqqUc7P0UqWMxDKlJAU0vbAoiHlykcgQiel ZdtKQog/koyLdq6hz2WaDykSpzWqYu+BJIAyXbJRVQFDtojPrYgrt70mkF8RADg8Wpli 0tsuMl6UBQCk2x4CW8Vi6lY1kU9Vm25/Lpgq7663aX2ZCwm15rRqq+BLcsIgp/DsqZIR F7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=H02gTWHnIIOKA/nBQaeBhib3HKkb17tFmXSjXBFMa3I=; b=sfsJO0fASGnIEs2qOcrE6qSUR7z5thYRXFBaXZJj5wx7vGevZHezif67XjvNqWtEki kNnG1y1Vi5MsPQwJYZoIS3Hhmn9i/n38QM854dKSRAaB2Fb4Ejd0Tq7sj/mGBI3UqXF6 toW1Zi/910VNQtOEVuLXUSAttIkTkQrchGviWAJUGjzUCIL+7YabplTB3AYIkXBc6pdE 3phDYWznYkhxT0lqppxk7uI1aBO9gK8Fp9QjsNTuof3Vy2zUigbZeRu0FDIn8mduk7WZ pB+YXbkY6rBeXWIImJ5k/JgwMEplt4n7V89WVkgBeC8WJpwWDb7dl2A8s4m1QXmj9wfD +lcg== X-Gm-Message-State: APjAAAVJWOjfUE2lGXfQTZAm2tcA/Xf56WpaI0cEACQSu/vz5anaakCB rVa+lcnl0tvSF1RUGqNKYD67nz2r X-Google-Smtp-Source: APXvYqzInbp6ZDhmM2p4tVrmz7chEaaobiDF6M/9S7h8Fg/nnPB1E//QED2JevB4TR9/NjaB5YoGUg== X-Received: by 2002:a02:a518:: with SMTP id e24mr6683797jam.44.1567026237701; Wed, 28 Aug 2019 14:03:57 -0700 (PDT) Received: from raichu (toroon0560w-lp140-03-184-148-66-213.dsl.bell.ca. [184.148.66.213]) by smtp.gmail.com with ESMTPSA id w17sm222358ior.23.2019.08.28.14.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 14:03:56 -0700 (PDT) Sender: Mark Johnston Date: Wed, 28 Aug 2019 17:03:52 -0400 From: Mark Johnston To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350544 - head/usr.bin/bzip2recover Message-ID: <20190828210352.GA19405@raichu> References: <201908022209.x72M9vlg070949@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46JdWz3vB3z3DrJ X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 21:03:59 -0000 On Wed, Aug 28, 2019 at 10:54:13PM +0200, Antoine Brodin wrote: > On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston wrote: > > > > Author: markj > > Date: Fri Aug 2 22:09:56 2019 > > New Revision: 350544 > > URL: https://svnweb.freebsd.org/changeset/base/350544 > > > > Log: > > Add bzip2recover.1. > > > > MFC after: 3 days > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/usr.bin/bzip2recover/Makefile > > Hi, > > It seems that this breaks parrallel installworld. > > Cheers, > > Antoine This should be fixed by r351587, thanks. From owner-svn-src-all@freebsd.org Wed Aug 28 21:13:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D0C0E6A76; Wed, 28 Aug 2019 21:13:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jdkx3CX9z3FXB; Wed, 28 Aug 2019 21:13:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FFA3D80D; Wed, 28 Aug 2019 21:13:29 +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 x7SLDTPW000859; Wed, 28 Aug 2019 21:13:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SLDS8Q000857; Wed, 28 Aug 2019 21:13:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282113.x7SLDS8Q000857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 21:13: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: r351588 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 351588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 21:13:29 -0000 Author: mav Date: Wed Aug 28 21:13:28 2019 New Revision: 351588 URL: https://svnweb.freebsd.org/changeset/base/351588 Log: MFC r351352: Improve NVMe hot unplug handling. If device is unplugged from the system (CSTS register reads return 0xffffffff), it makes no sense to send any more recovery requests or expect any responses back. If there is a detach call in such state, just stop all activity and free resources. If there is no detach call (hot-plug is not supported), rely on normal timeout handling, but when it trigger controller reset, do not wait for impossible and quickly report failure. Sponsored by: iXsystems, Inc. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_qpair.c Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Wed Aug 28 21:01:51 2019 (r351587) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Wed Aug 28 21:13:28 2019 (r351588) @@ -202,10 +202,13 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr) int i; ctrlr->is_failed = TRUE; + nvme_admin_qpair_disable(&ctrlr->adminq); nvme_qpair_fail(&ctrlr->adminq); if (ctrlr->ioq != NULL) { - for (i = 0; i < ctrlr->num_io_queues; i++) + for (i = 0; i < ctrlr->num_io_queues; i++) { + nvme_io_qpair_disable(&ctrlr->ioq[i]); nvme_qpair_fail(&ctrlr->ioq[i]); + } } nvme_notify_fail_consumers(ctrlr); } @@ -244,17 +247,19 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrl int ms_waited; union csts_register csts; - csts.raw = nvme_mmio_read_4(ctrlr, csts); - ms_waited = 0; - while (csts.bits.rdy != desired_val) { + while (1) { + csts.raw = nvme_mmio_read_4(ctrlr, csts); + if (csts.raw == 0xffffffff) /* Hot unplug. */ + return (ENXIO); + if (csts.bits.rdy == desired_val) + break; if (ms_waited++ > ctrlr->ready_timeout_in_ms) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } DELAY(1000); - csts.raw = nvme_mmio_read_4(ctrlr, csts); } return (0); @@ -1229,12 +1234,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { - int i; + int gone, i; if (ctrlr->resource == NULL) goto nores; - nvme_notify_fail_consumers(ctrlr); + /* + * Check whether it is a hot unplug or a clean driver detach. + * If device is not there any more, skip any shutdown commands. + */ + gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + if (gone) + nvme_ctrlr_fail(ctrlr); + else + nvme_notify_fail_consumers(ctrlr); for (i = 0; i < NVME_MAX_NAMESPACES; i++) nvme_ns_destruct(&ctrlr->ns[i]); @@ -1243,11 +1256,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev destroy_dev(ctrlr->cdev); for (i = 0; i < ctrlr->num_io_queues; i++) { - nvme_ctrlr_destroy_qpair(ctrlr, &ctrlr->ioq[i]); + if (!gone) + nvme_ctrlr_destroy_qpair(ctrlr, &ctrlr->ioq[i]); nvme_io_qpair_destroy(&ctrlr->ioq[i]); } free(ctrlr->ioq, M_NVME); - nvme_admin_qpair_destroy(&ctrlr->adminq); /* @@ -1257,9 +1270,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev * shutdown notification in case the system is shutdown before * reloading the driver. */ - nvme_ctrlr_shutdown(ctrlr); + if (!gone) + nvme_ctrlr_shutdown(ctrlr); - nvme_ctrlr_disable(ctrlr); + if (!gone) + nvme_ctrlr_disable(ctrlr); if (ctrlr->taskqueue) taskqueue_free(ctrlr->taskqueue); @@ -1296,14 +1311,19 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) cc.raw = nvme_mmio_read_4(ctrlr, cc); cc.bits.shn = NVME_SHN_NORMAL; nvme_mmio_write_4(ctrlr, cc, cc.raw); - csts.raw = nvme_mmio_read_4(ctrlr, csts); - while ((csts.bits.shst != NVME_SHST_COMPLETE) && (ticks++ < 5*hz)) { - pause("nvme shn", 1); + while (1) { csts.raw = nvme_mmio_read_4(ctrlr, csts); + if (csts.raw == 0xffffffff) /* Hot unplug. */ + break; + if (csts.bits.shst == NVME_SHST_COMPLETE) + break; + if (ticks++ > 5*hz) { + nvme_printf(ctrlr, "did not complete shutdown within" + " 5 seconds of notification\n"); + break; + } + pause("nvme shn", 1); } - if (csts.bits.shst != NVME_SHST_COMPLETE) - nvme_printf(ctrlr, "did not complete shutdown within 5 seconds " - "of notification\n"); } void Modified: stable/11/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_qpair.c Wed Aug 28 21:01:51 2019 (r351587) +++ stable/11/sys/dev/nvme/nvme_qpair.c Wed Aug 28 21:13:28 2019 (r351588) @@ -788,7 +788,8 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - csts.bits.cfs ? " and fatal error status" : ""); + (csts.raw == 0xffffffff) ? " and possible hot unplug" : + (csts.bits.cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); } } From owner-svn-src-all@freebsd.org Wed Aug 28 22:04:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DA4BE7A68; Wed, 28 Aug 2019 22:04:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JfsK16NCz3Hxn; Wed, 28 Aug 2019 22:04:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07C0BE105; Wed, 28 Aug 2019 22:04:05 +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 x7SM44PG029926; Wed, 28 Aug 2019 22:04:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SM44j5029924; Wed, 28 Aug 2019 22:04:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908282204.x7SM44j5029924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 28 Aug 2019 22:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351589 - head/sys/dev/ahci X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ahci X-SVN-Commit-Revision: 351589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 22:04:05 -0000 Author: mav Date: Wed Aug 28 22:04:04 2019 New Revision: 351589 URL: https://svnweb.freebsd.org/changeset/base/351589 Log: Fix AHCI Enclosure Management, broken by r351356. ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Aug 28 21:13:28 2019 (r351588) +++ head/sys/dev/ahci/ahci.c Wed Aug 28 22:04:04 2019 (r351589) @@ -362,7 +362,7 @@ ahci_attach(device_t dev) if (child == NULL) device_printf(dev, "failed to add enclosure device\n"); else - device_set_ivars(child, (void *)(intptr_t)-1); + device_set_ivars(child, (void *)(intptr_t)AHCI_EM_UNIT); } bus_generic_attach(dev); return (0); @@ -562,23 +562,25 @@ ahci_alloc_resource(device_t dev, device_t child, int struct resource *res; rman_res_t st; int offset, size, unit; - bool is_remapped; + bool is_em, is_remapped; unit = (intptr_t)device_get_ivars(child); + is_em = is_remapped = false; if (unit & AHCI_REMAPPED_UNIT) { - unit &= ~AHCI_REMAPPED_UNIT; + unit &= AHCI_UNIT; unit -= ctlr->channels; is_remapped = true; - } else - is_remapped = false; + } else if (unit & AHCI_EM_UNIT) { + unit &= AHCI_UNIT; + is_em = true; + } res = NULL; switch (type) { case SYS_RES_MEMORY: if (is_remapped) { offset = ctlr->remap_offset + unit * ctlr->remap_size; size = ctlr->remap_size; - } - else if (unit >= 0) { + } else if (!is_em) { offset = AHCI_OFFSET + (unit << 7); size = 128; } else if (*rid == 0) { @@ -639,7 +641,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r void *argument, void **cookiep) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; if (filter != NULL) { printf("ahci.c: we cannot use a filter here\n"); @@ -655,7 +657,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc void *cookie) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; ctlr->interrupt[unit].function = NULL; ctlr->interrupt[unit].argument = NULL; @@ -665,12 +667,13 @@ ahci_teardown_intr(device_t dev, device_t child, struc int ahci_print_child(device_t dev, device_t child) { - int retval, channel; + intptr_t ivars; + int retval; retval = bus_print_child_header(dev, child); - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - retval += printf(" at channel %d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); retval += bus_print_child_footer(dev, child); return (retval); } @@ -679,11 +682,11 @@ int ahci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { - int channel; + intptr_t ivars; - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - snprintf(buf, buflen, "channel=%d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); return (0); } Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Aug 28 21:13:28 2019 (r351588) +++ head/sys/dev/ahci/ahci.h Wed Aug 28 22:04:04 2019 (r351589) @@ -319,9 +319,10 @@ /* Total main work area. */ #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) - -/* NVMe remapped device */ -#define AHCI_REMAPPED_UNIT (1 << 31) +/* ivars value fields */ +#define AHCI_REMAPPED_UNIT (1 << 31) /* NVMe remapped device. */ +#define AHCI_EM_UNIT (1 << 30) /* Enclosure Mgmt device. */ +#define AHCI_UNIT 0xff /* Channel number. */ struct ahci_dma_prd { u_int64_t dba; From owner-svn-src-all@freebsd.org Wed Aug 28 23:31:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D0C9E9484; Wed, 28 Aug 2019 23:31:59 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jhpl2Fkfz3MvK; Wed, 28 Aug 2019 23:31:59 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F1DDF130; Wed, 28 Aug 2019 23:31:59 +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 x7SNVxWZ081239; Wed, 28 Aug 2019 23:31:59 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SNVxqW081238; Wed, 28 Aug 2019 23:31:59 GMT (envelope-from np@FreeBSD.org) Message-Id: <201908282331.x7SNVxqW081238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 28 Aug 2019 23:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351590 - 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: 351590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 23:31:59 -0000 Author: np Date: Wed Aug 28 23:31:58 2019 New Revision: 351590 URL: https://svnweb.freebsd.org/changeset/base/351590 Log: cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx. This should have been part of r351540. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Aug 28 22:04:04 2019 (r351589) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Aug 28 23:31:58 2019 (r351590) @@ -2023,7 +2023,6 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) static void t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job) { - struct adapter *sc; struct sockbuf *sb; struct file *fp; struct inpcb *inp; @@ -2032,7 +2031,6 @@ t4_aiotx_process_job(struct toepcb *toep, struct socke int error, len; bool moretocome, sendmore; - sc = td_adapter(toep->td); sb = &so->so_snd; SOCKBUF_UNLOCK(sb); fp = job->fd_file; @@ -2104,8 +2102,8 @@ sendanother: moretocome = false; } else moretocome = true; - if (len > sc->tt.sndbuf) { - len = sc->tt.sndbuf; + if (len > toep->params.sndbuf) { + len = toep->params.sndbuf; sendmore = true; } else sendmore = false; From owner-svn-src-all@freebsd.org Wed Aug 28 23:40:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61390E95A4; Wed, 28 Aug 2019 23:40:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jj161qB7z3NBS; Wed, 28 Aug 2019 23:40:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 202CCF192; Wed, 28 Aug 2019 23:40:58 +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 x7SNewoG082422; Wed, 28 Aug 2019 23:40:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7SNevUY082420; Wed, 28 Aug 2019 23:40:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908282340.x7SNevUY082420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 28 Aug 2019 23:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351591 - in head/sys/amd64/vmm: . amd X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/amd64/vmm: . amd X-SVN-Commit-Revision: 351591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2019 23:40:58 -0000 Author: jhb Date: Wed Aug 28 23:40:57 2019 New Revision: 351591 URL: https://svnweb.freebsd.org/changeset/base/351591 Log: Use get_pcpu() to fetch the current CPU's pcpu pointer. This avoids encoding knowledge about how pcpu objects are allocated and is also a few instructions shorter. MFC after: 2 weeks Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/vmm_host.h Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Wed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/amd/svm.c Wed Aug 28 23:40:57 2019 (r351591) @@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_ static MALLOC_DEFINE(M_SVM, "svm", "svm"); static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); -/* Per-CPU context area. */ -extern struct pcpu __pcpu[]; - static uint32_t svm_feature = ~0U; /* AMD SVM features. */ SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, &svm_feature, 0, "SVM features advertised by CPUID.8000000AH:EDX"); @@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t /* Launch Virtual Machine. */ VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip); svm_dr_enter_guest(gctx); - svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]); + svm_launch(vmcb_pa, gctx, get_pcpu()); svm_dr_leave_guest(gctx); CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); Modified: head/sys/amd64/vmm/vmm_host.h ============================================================================== --- head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:40:57 2019 (r351591) @@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void) return ((uint64_t)&gdt[NGDT * curcpu]); } -struct pcpu; -extern struct pcpu __pcpu[]; - static __inline uint64_t vmm_get_host_gsbase(void) { - return ((uint64_t)&__pcpu[curcpu]); + return ((uint64_t)get_pcpu()); } #endif From owner-svn-src-all@freebsd.org Thu Aug 29 02:44:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E664EDD42; Thu, 29 Aug 2019 02:44:19 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jn4g3h6Yz4408; Thu, 29 Aug 2019 02:44:19 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60E16193FA; Thu, 29 Aug 2019 02:44:19 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T2iJjF096396; Thu, 29 Aug 2019 02:44:19 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T2iJeJ096395; Thu, 29 Aug 2019 02:44:19 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201908290244.x7T2iJeJ096395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Thu, 29 Aug 2019 02:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351592 - head/usr.bin/w X-SVN-Group: head X-SVN-Commit-Author: karels X-SVN-Commit-Paths: head/usr.bin/w X-SVN-Commit-Revision: 351592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 02:44:19 -0000 Author: karels Date: Thu Aug 29 02:44:18 2019 New Revision: 351592 URL: https://svnweb.freebsd.org/changeset/base/351592 Log: Fix address annotation in xml output from w The libxo xml feature of adding an annotation with the "original" address from the utmpx file if it is different than the final "from" field was broken by r351379. This was pointed out by the gcc error that save_p might be used uninitialized. Save the original address as needed in each entry, don't just use the last one from the previous loop. Reviewed by: marcel@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21390 Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Wed Aug 28 23:40:57 2019 (r351591) +++ head/usr.bin/w/w.c Thu Aug 29 02:44:18 2019 (r351592) @@ -118,6 +118,7 @@ static struct entry { char *args; /* arg list of interesting process */ struct kinfo_proc *dkp; /* debug option proc list */ char *from; /* "from": name or addr */ + char *save_from; /* original "from": name or addr */ } *ep, *ehead = NULL, **nextp = &ehead; #define debugproc(p) *(&((struct kinfo_proc *)p)->ki_udata) @@ -209,7 +210,6 @@ main(int argc, char *argv[]) if (*argv) sel_users = argv; - save_p = NULL; setutxent(); for (nusers = 0; (utmp = getutxent()) != NULL;) { struct addrinfo hints, *res; @@ -312,6 +312,8 @@ main(int argc, char *argv[]) ep->from = strdup(p); if ((i = strlen(p)) > fromwidth) fromwidth = i; + if (save_p != p) + ep->save_from = strdup(save_p); } endutxent(); @@ -451,8 +453,8 @@ main(int argc, char *argv[]) strncmp(ep->utmp.ut_line, "cua", 3) ? ep->utmp.ut_line : ep->utmp.ut_line + 3) : "-"); - if (save_p && save_p != p) - xo_attr("address", "%s", save_p); + if (ep->save_from) + xo_attr("address", "%s", ep->save_from); xo_emit("{:from/%-*.*s/%@**@s} ", fromwidth, fromwidth, ep->from); t = ep->utmp.ut_tv.tv_sec; From owner-svn-src-all@freebsd.org Thu Aug 29 07:19:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9E77CC841; Thu, 29 Aug 2019 07:19:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jv9l51rYz4K2V; Thu, 29 Aug 2019 07:19:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AF361C5C0; Thu, 29 Aug 2019 07:19:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T7J7Gi057873; Thu, 29 Aug 2019 07:19:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7J7dN057872; Thu, 29 Aug 2019 07:19:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908290719.x7T7J7dN057872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 29 Aug 2019 07:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351593 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 351593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:19:07 -0000 Author: avg Date: Thu Aug 29 07:19:06 2019 New Revision: 351593 URL: https://svnweb.freebsd.org/changeset/base/351593 Log: zfs_ioc_snapshot: check user-prop permissions on snapshotted datasets Previously, the permissions were checked on the pool which was obviously incorrect. After this change, zfs_check_userprops() only validates the properties without any permission checks. The permissions are checked individually for each snapshotted dataset. This was also committed to ZoL: zfsonlinux/zfs@e6203d2 Reported by: CyberSecure MFC after: 1 week Sponsored by: CyberSecure Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Aug 29 02:44:18 2019 (r351592) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Aug 29 07:19:06 2019 (r351593) @@ -2747,10 +2747,9 @@ retry: * Check that all the properties are valid user properties. */ static int -zfs_check_userprops(const char *fsname, nvlist_t *nvl) +zfs_check_userprops(nvlist_t *nvl) { nvpair_t *pair = NULL; - int error = 0; while ((pair = nvlist_next_nvpair(nvl, pair)) != NULL) { const char *propname = nvpair_name(pair); @@ -2759,10 +2758,6 @@ zfs_check_userprops(const char *fsname, nvlist_t *nvl) nvpair_type(pair) != DATA_TYPE_STRING) return (SET_ERROR(EINVAL)); - if (error = zfs_secpolicy_write_perms(fsname, - ZFS_DELEG_PERM_USERPROP, CRED())) - return (error); - if (strlen(propname) >= ZAP_MAXNAMELEN) return (SET_ERROR(ENAMETOOLONG)); @@ -3429,12 +3424,11 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl nvpair_t *pair; (void) nvlist_lookup_nvlist(innvl, "props", &props); - if ((error = zfs_check_userprops(poolname, props)) != 0) - return (error); - if (!nvlist_empty(props) && zfs_earlier_version(poolname, SPA_VERSION_SNAP_PROPS)) return (SET_ERROR(ENOTSUP)); + if ((error = zfs_check_userprops(props)) != 0) + return (error); if (nvlist_lookup_nvlist(innvl, "snaps", &snaps) != 0) return (SET_ERROR(EINVAL)); @@ -3442,7 +3436,7 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL; pair = nvlist_next_nvpair(snaps, pair)) { const char *name = nvpair_name(pair); - const char *cp = strchr(name, '@'); + char *cp = strchr(name, '@'); /* * The snap name must contain an @, and the part after it must @@ -3458,6 +3452,18 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl if (strncmp(name, poolname, poollen) != 0 || (name[poollen] != '/' && name[poollen] != '@')) return (SET_ERROR(EXDEV)); + + /* + * Check for permission to set the properties on the fs. + */ + if (!nvlist_empty(props)) { + *cp = '\0'; + error = zfs_secpolicy_write_perms(name, + ZFS_DELEG_PERM_USERPROP, CRED()); + *cp = '@'; + if (error != 0) + return (error); + } /* This must be the only snap of this fs. */ for (nvpair_t *pair2 = nvlist_next_nvpair(snaps, pair); From owner-svn-src-all@freebsd.org Thu Aug 29 07:25:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B230CCCD1; Thu, 29 Aug 2019 07:25:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JvK93SYSz4KZn; Thu, 29 Aug 2019 07:25: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58FC11C782; Thu, 29 Aug 2019 07:25:33 +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 x7T7PXrc063581; Thu, 29 Aug 2019 07:25:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7PS3X063551; Thu, 29 Aug 2019 07:25:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908290725.x7T7PS3X063551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Aug 2019 07:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351594 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/arm64 arm64/include i386/i386 i386/include mips/include powerpc/include powerpc/powerpc riscv/include riscv/ri... X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/arm64 arm64/include i386/i386 i386/include mips/include powerpc/include powerpc/powerpc riscv/include riscv/riscv sparc64/include sys X-SVN-Commit-Revision: 351594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:25:33 -0000 Author: kib Date: Thu Aug 29 07:25:27 2019 New Revision: 351594 URL: https://svnweb.freebsd.org/changeset/base/351594 Log: Centralize __pcpu definitions. Many extern struct pcpu __pcpu declarations were copied/pasted in sources. The issue is that the definition is MD, but it cannot be provided by machine/pcpu.h due to actual struct pcpu defined in sys/pcpu.h later than the inclusion of machine/pcpu.h. This forced the copying when other code needed direct access to __pcpu. There is no way around it, due to machine/pcpu.h supplying part of struct pcpu fields. To work around the problem, add a new machine/pcpu_aux.h header, which should fill any needed MD definitions after struct pcpu definition is completed. This allows to remove copies of __pcpu spread around the source. Also on x86 it makes it possible to remove work arounds like OFFSETOF_CURTHREAD or clang specific warnings supressions. Reported and tested by: lwhsu, bcran Reviewed by: imp, markj (previous version) Discussed with: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21418 Added: head/sys/amd64/include/pcpu_aux.h (contents, props changed) head/sys/arm/include/pcpu_aux.h (contents, props changed) head/sys/arm64/include/pcpu_aux.h (contents, props changed) head/sys/i386/include/pcpu_aux.h (contents, props changed) head/sys/mips/include/pcpu_aux.h (contents, props changed) head/sys/powerpc/include/pcpu_aux.h (contents, props changed) head/sys/riscv/include/pcpu_aux.h (contents, props changed) head/sys/sparc64/include/pcpu_aux.h (contents, props changed) Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/counter.h head/sys/amd64/include/pcpu.h head/sys/arm/arm/mp_machdep.c head/sys/arm/include/counter.h head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/counter.h head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/vm_machdep.c head/sys/i386/include/counter.h head/sys/i386/include/pcpu.h head/sys/powerpc/include/counter.h head/sys/powerpc/powerpc/mp_machdep.c head/sys/riscv/include/counter.h head/sys/riscv/riscv/mp_machdep.c head/sys/sys/pcpu.h Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/amd64/amd64/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$"); #define AP_BOOTPT_SZ (PAGE_SIZE * 3) -extern struct pcpu *__pcpu; - /* Temporary variables for init_secondary() */ char *doublefault_stack; char *mce_stack; Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/amd64/amd64/pmap.c Thu Aug 29 07:25:27 2019 (r351594) @@ -443,10 +443,6 @@ static pml4_entry_t *pti_pml4; static vm_pindex_t pti_pg_idx; static bool pti_finalized; -extern struct pcpu *__pcpu; -extern struct pcpu temp_bsp_pcpu; -extern pt_entry_t *pcpu_pte; - struct pmap_pkru_range { struct rs_el pkru_rs_el; u_int pkru_keyidx; Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/amd64/amd64/vm_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -84,10 +84,6 @@ __FBSDID("$FreeBSD$"); #include #include -_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), - "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); -_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), - "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); Modified: head/sys/amd64/include/counter.h ============================================================================== --- head/sys/amd64/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/amd64/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -33,9 +33,6 @@ #include -extern struct pcpu *__pcpu; -extern struct pcpu temp_bsp_pcpu; - #define EARLY_COUNTER &temp_bsp_pcpu.pc_early_dummy_counter #define counter_enter() do {} while (0) Modified: head/sys/amd64/include/pcpu.h ============================================================================== --- head/sys/amd64/include/pcpu.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/amd64/include/pcpu.h Thu Aug 29 07:25:27 2019 (r351594) @@ -233,35 +233,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) -#define OFFSETOF_CURTHREAD 0 -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnull-dereference" -#endif -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (OFFSETOF_CURTHREAD)); - return (td); -} -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#define curthread (__curthread()) - -#define OFFSETOF_CURPCB 32 -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (OFFSETOF_CURPCB)); - return (pcb); -} -#define curpcb (__curpcb()) - #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* !__GNUCLIKE_ASM || !__GNUCLIKE___TYPEOF */ Added: head/sys/amd64/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* Required for counters(9) to work on x86. */ +_Static_assert(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE, "fix pcpu size"); + +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; + +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; + + __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, + pc_curthread))); + return (td); +} +#define curthread (__curthread()) + +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu, + pc_curpcb))); + return (pcb); +} +#define curpcb (__curpcb()) + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/arm/arm/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #endif -extern struct pcpu __pcpu[]; /* used to hold the AP's until we are ready to release them */ struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; Modified: head/sys/arm/include/counter.h ============================================================================== --- head/sys/arm/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/arm/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -34,8 +34,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do {} while (0) Added: head/sys/arm/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/arm64/arm64/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -111,8 +112,6 @@ static struct intr_ipi ipi_sources[INTR_IPI_COUNT]; static struct intr_ipi *intr_ipi_lookup(u_int); static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *, void *); - -extern struct pcpu __pcpu[]; static void ipi_ast(void *); static void ipi_hardclock(void *); Modified: head/sys/arm64/include/counter.h ============================================================================== --- head/sys/arm64/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/arm64/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -32,8 +32,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do {} while (0) Added: head/sys/arm64/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/i386/i386/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -130,8 +130,6 @@ __FBSDID("$FreeBSD$"); #endif /* CHECK_POINTS */ -extern struct pcpu __pcpu[]; - /* * Local data and functions. */ Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/i386/i386/vm_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -90,10 +90,6 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif -_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), - "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); -_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), - "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); _Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "__OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); Modified: head/sys/i386/include/counter.h ============================================================================== --- head/sys/i386/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/i386/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -38,8 +38,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do { \ Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/i386/include/pcpu.h Thu Aug 29 07:25:27 2019 (r351594) @@ -228,36 +228,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) -#define OFFSETOF_CURTHREAD 0 -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnull-dereference" -#endif -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("movl %%fs:%1,%0" : "=r" (td) - : "m" (*(char *)OFFSETOF_CURTHREAD)); - return (td); -} -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#define curthread (__curthread()) - -#define OFFSETOF_CURPCB 16 -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movl %%fs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); - return (pcb); -} -#define curpcb (__curpcb()) - #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ Added: head/sys/i386/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,71 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* Required for counters(9) to work on x86. */ +_Static_assert(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; + + __asm("movl %%fs:%1,%0" : "=r" (td) + : "m" (*(char *)offsetof(struct pcpu, pc_curthread))); + return (td); +} +#define curthread (__curthread()) + +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movl %%fs:%1,%0" : "=r" (pcb) + : "m" (*(char *)offsetof(struct pcpu, pc_curpcb))); + return (pcb); +} +#define curpcb (__curpcb()) + +#endif /* _MACHINE_PCPU_AUX_H_ */ Added: head/sys/mips/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/powerpc/include/counter.h ============================================================================== --- head/sys/powerpc/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/powerpc/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -36,8 +36,6 @@ #include #endif -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #ifdef __powerpc64__ Added: head/sys/powerpc/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/powerpc/powerpc/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #include "pic_if.h" -extern struct pcpu __pcpu[MAXCPU]; - volatile static int ap_awake; volatile static u_int ap_letgo; volatile static u_quad_t ap_timebase; Modified: head/sys/riscv/include/counter.h ============================================================================== --- head/sys/riscv/include/counter.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/riscv/include/counter.h Thu Aug 29 07:25:27 2019 (r351594) @@ -34,8 +34,6 @@ #include #endif -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() critical_enter() Added: head/sys/riscv/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/riscv/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/riscv/riscv/mp_machdep.c Thu Aug 29 07:25:27 2019 (r351594) @@ -72,8 +72,6 @@ __FBSDID("$FreeBSD$"); boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *); -extern struct pcpu __pcpu[]; - uint32_t __riscv_boot_ap[MAXCPU]; static enum { Added: head/sys/sparc64/include/pcpu_aux.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/include/pcpu_aux.h Thu Aug 29 07:25:27 2019 (r351594) @@ -0,0 +1,50 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Thu Aug 29 07:19:06 2019 (r351593) +++ head/sys/sys/pcpu.h Thu Aug 29 07:25:27 2019 (r351594) @@ -216,26 +216,16 @@ extern struct cpuhead cpuhead; extern struct pcpu *cpuid_to_pcpu[]; #define curcpu PCPU_GET(cpuid) -#define curproc (curthread->td_proc) -#ifndef curthread -#define curthread PCPU_GET(curthread) -#endif #define curvidata PCPU_GET(vidata) #define UMA_PCPU_ALLOC_SIZE PAGE_SIZE -#ifdef CTASSERT -#if defined(__i386__) || defined(__amd64__) -/* Required for counters(9) to work on x86. */ -CTASSERT(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE); -#else -/* - * To minimize memory waste in per-cpu UMA zones, size of struct pcpu - * should be denominator of PAGE_SIZE. - */ -CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE); -#endif /* UMA_PCPU_ALLOC_SIZE && x86 */ -#endif /* CTASSERT */ +#include + +#ifndef curthread +#define curthread PCPU_GET(curthread) +#endif +#define curproc (curthread->td_proc) /* Accessor to elements allocated via UMA_ZONE_PCPU zone. */ static inline void * From owner-svn-src-all@freebsd.org Thu Aug 29 07:34:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA9F7CD038; Thu, 29 Aug 2019 07:34:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JvWB4x9wz4L6X; Thu, 29 Aug 2019 07:34:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A45FA1C979; Thu, 29 Aug 2019 07:34:14 +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 x7T7YEMK069555; Thu, 29 Aug 2019 07:34:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7YEdw069554; Thu, 29 Aug 2019 07:34:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908290734.x7T7YEdw069554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Aug 2019 07:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351595 - 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: 351595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:34:14 -0000 Author: kib Date: Thu Aug 29 07:34:14 2019 New Revision: 351595 URL: https://svnweb.freebsd.org/changeset/base/351595 Log: Remove useless redefinition of NSFBUFS in i386/vm_machdep.c. Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/i386/vm_machdep.c Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Thu Aug 29 07:25:27 2019 (r351594) +++ head/sys/i386/i386/vm_machdep.c Thu Aug 29 07:34:14 2019 (r351595) @@ -86,10 +86,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifndef NSFBUFS -#define NSFBUFS (512 + maxusers * 16) -#endif - _Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "__OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); From owner-svn-src-all@freebsd.org Thu Aug 29 07:39:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63307CD168; Thu, 29 Aug 2019 07:39:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JvdJ1l44z4LHl; Thu, 29 Aug 2019 07:39:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18F411C97C; Thu, 29 Aug 2019 07:39:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T7dVe5069825; Thu, 29 Aug 2019 07:39:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7dVkJ069824; Thu, 29 Aug 2019 07:39:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201908290739.x7T7dVkJ069824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 29 Aug 2019 07:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351596 - in head: sys/sys tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: sys/sys tests/sys/sys X-SVN-Commit-Revision: 351596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:39:32 -0000 Author: trasz Date: Thu Aug 29 07:39:31 2019 New Revision: 351596 URL: https://svnweb.freebsd.org/changeset/base/351596 Log: Fix qmath(3) build problems with GCC 8. Discussed with: asomers Sponsored by: Klara Systems Differential Revision: https://reviews.freebsd.org/D21442 Modified: head/sys/sys/qmath.h head/tests/sys/sys/qmath_test.c Modified: head/sys/sys/qmath.h ============================================================================== --- head/sys/sys/qmath.h Thu Aug 29 07:34:14 2019 (r351595) +++ head/sys/sys/qmath.h Thu Aug 29 07:39:31 2019 (r351596) @@ -267,7 +267,7 @@ typedef u64q_t umaxq_t; /* Left shift an integral value to align with the int bits of 'q'. */ #define Q_SHL(q, iv) \ - (Q_LTZ(iv) ? -(Q_ABS(iv) << Q_NFBITS(q)) : \ + (Q_LTZ(iv) ? -(int64_t)(Q_ABS(iv) << Q_NFBITS(q)) : \ Q_TC(q, iv) << Q_NFBITS(q)) /* Calculate the relative fractional precision between 'a' and 'b' in bits. */ Modified: head/tests/sys/sys/qmath_test.c ============================================================================== --- head/tests/sys/sys/qmath_test.c Thu Aug 29 07:34:14 2019 (r351595) +++ head/tests/sys/sys/qmath_test.c Thu Aug 29 07:39:31 2019 (r351596) @@ -208,7 +208,9 @@ ATF_TC_BODY(qmulq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; +#ifdef notyet int64_t a_int, b_int; +#endif int error; srandomdev(); @@ -231,8 +233,6 @@ ATF_TC_BODY(qmulq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -247,6 +247,9 @@ ATF_TC_BODY(qmulq_s64q, tc) r_dbl = a_dbl * b_dbl; #ifdef notyet + a_int = Q_GIVAL(a_s64q); + b_int = Q_GIVAL(b_s64q); + maxe_dbl = fabs(((1.0 / Q_NFBITS(a_s64q)) * (double)b_int) + ((1.0 / Q_NFBITS(b_s64q)) * (double)a_int)); #else @@ -270,7 +273,6 @@ ATF_TC_BODY(qdivq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -283,8 +285,6 @@ ATF_TC_BODY(qdivq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -318,7 +318,6 @@ ATF_TC_BODY(qaddq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -331,8 +330,6 @@ ATF_TC_BODY(qaddq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -369,7 +366,6 @@ ATF_TC_BODY(qsubq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -382,8 +378,6 @@ ATF_TC_BODY(qsubq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); From owner-svn-src-all@freebsd.org Thu Aug 29 07:45:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40F67CD538; Thu, 29 Aug 2019 07:45:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jvm46jv0z4Lk8; Thu, 29 Aug 2019 07:45:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9C661CB4A; Thu, 29 Aug 2019 07:45: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 x7T7jOPO075409; Thu, 29 Aug 2019 07:45:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7jOav075406; Thu, 29 Aug 2019 07:45:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908290745.x7T7jOav075406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Aug 2019 07:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351597 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 351597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:45:25 -0000 Author: kib Date: Thu Aug 29 07:45:23 2019 New Revision: 351597 URL: https://svnweb.freebsd.org/changeset/base/351597 Log: UFS: stop reusing the vnode for reallocated inode. In ffs_valloc(), force reclaim existing vnode on inode reuse, instead of trying to re-initialize the same vnode for new purposes. This is done in preparation of changes to the vp->v_object lifecycle handling. A new FFSV_REPLACE flag to ffs_vgetf() directs the function to vgone(9) the vnode if found in vfs hash, instead of returning it. Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21412 Modified: head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Thu Aug 29 07:39:31 2019 (r351596) +++ head/sys/ufs/ffs/ffs_alloc.c Thu Aug 29 07:45:23 2019 (r351597) @@ -1137,10 +1137,15 @@ retry: (allocfcn_t *)ffs_nodealloccg); if (ino == 0) goto noinodes; - error = ffs_vget(pvp->v_mount, ino, LK_EXCLUSIVE, vpp); + + /* + * Get rid of the cached old vnode, force allocation of a new vnode + * for this inode. + */ + error = ffs_vgetf(pvp->v_mount, ino, LK_EXCLUSIVE, vpp, FFSV_REPLACE); if (error) { error1 = ffs_vgetf(pvp->v_mount, ino, LK_EXCLUSIVE, vpp, - FFSV_FORCEINSMQ); + FFSV_FORCEINSMQ | FFSV_REPLACE); ffs_vfree(pvp, ino, mode); if (error1 == 0) { ip = VTOI(*vpp); @@ -1176,7 +1181,6 @@ dup_alloc: ip->i_din2->di_birthtime = ts.tv_sec; ip->i_din2->di_birthnsec = ts.tv_nsec; } - ufs_prepare_reclaim(*vpp); ip->i_flag = 0; (*vpp)->v_vflag = 0; (*vpp)->v_type = VNON; Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Thu Aug 29 07:39:31 2019 (r351596) +++ head/sys/ufs/ffs/ffs_extern.h Thu Aug 29 07:45:23 2019 (r351597) @@ -121,6 +121,7 @@ void process_deferred_inactive(struct mount *mp); * Flags to ffs_vgetf */ #define FFSV_FORCEINSMQ 0x0001 +#define FFSV_REPLACE 0x0002 /* * Flags to ffs_reload Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Thu Aug 29 07:39:31 2019 (r351596) +++ head/sys/ufs/ffs/ffs_vfsops.c Thu Aug 29 07:45:23 2019 (r351597) @@ -1671,9 +1671,17 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) struct vnode *vp; int error; + MPASS((ffs_flags & FFSV_REPLACE) == 0 || (flags & LK_EXCLUSIVE) != 0); + error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL); - if (error || *vpp != NULL) + if (error != 0) return (error); + if (*vpp != NULL) { + if ((ffs_flags & FFSV_REPLACE) == 0) + return (0); + vgone(*vpp); + vput(*vpp); + } /* * We must promote to an exclusive lock for vnode creation. This @@ -1735,8 +1743,19 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) } vp->v_vflag &= ~VV_FORCEINSMQ; error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL); - if (error || *vpp != NULL) + if (error != 0) return (error); + if (*vpp != NULL) { + /* + * Calls from ffs_valloc() (i.e. FFSV_REPLACE set) + * operate on empty inode, which must not be found by + * other threads until fully filled. Vnode for empty + * inode must be not re-inserted on the hash by other + * thread, after removal by us at the beginning. + */ + MPASS((ffs_flags & FFSV_REPLACE) == 0); + return (0); + } /* Read in the disk contents for the inode, copy into the inode. */ error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)), From owner-svn-src-all@freebsd.org Thu Aug 29 07:50:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33FE5CD643; Thu, 29 Aug 2019 07:50:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jvsx1Jnrz4LvV; Thu, 29 Aug 2019 07:50:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1009A1CB5E; Thu, 29 Aug 2019 07:50:29 +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 x7T7oSxI075725; Thu, 29 Aug 2019 07:50:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7oPce075709; Thu, 29 Aug 2019 07:50:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908290750.x7T7oPce075709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Aug 2019 07:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351598 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fuse fs/msdosfs fs/nfsclient fs/smbfs fs/tmpfs fs/udf kern ufs/ufs vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fuse fs/msdosfs fs/nfsclient fs/smbfs fs/tmpfs fs/udf kern ufs/ufs vm X-SVN-Commit-Revision: 351598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:50:29 -0000 Author: kib Date: Thu Aug 29 07:50:25 2019 New Revision: 351598 URL: https://svnweb.freebsd.org/changeset/base/351598 Log: Rework v_object lifecycle for vnodes. Current implementation of vnode_create_vobject() and vnode_destroy_vobject() is written so that it prepared to handle the vm object destruction for live vnode. Practically, no filesystems use this, except for some remnants that were present in UFS till today. One of the consequences of that model is that each filesystem must call vnode_destroy_vobject() in VOP_RECLAIM() or earlier, as result all of them get rid of the v_object in reclaim. Move the call to vnode_destroy_vobject() to vgonel() before VOP_RECLAIM(). This makes v_object stable: either the object is NULL, or it is valid vm object till the vnode reclamation. Remove code from vnode_create_vobject() to handle races with the parallel destruction. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21412 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/cd9660/cd9660_node.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/fuse/fuse_vnops.c head/sys/fs/msdosfs/msdosfs_denode.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/smbfs/smbfs_node.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/fs/udf/udf_vnops.c head/sys/kern/vfs_subr.c head/sys/ufs/ufs/ufs_extern.h head/sys/ufs/ufs/ufs_inode.c head/sys/vm/vm_object.h head/sys/vm/vnode_pager.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 29 07:50:25 2019 (r351598) @@ -5375,9 +5375,6 @@ zfs_freebsd_reclaim(ap) ASSERT(zp != NULL); - /* Destroy the vm object and flush associated pages. */ - vnode_destroy_vobject(vp); - /* * z_teardown_inactive_lock protects from a race with * zfs_znode_dmu_fini in zfsvfs_teardown during Modified: head/sys/fs/cd9660/cd9660_node.c ============================================================================== --- head/sys/fs/cd9660/cd9660_node.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/cd9660/cd9660_node.c Thu Aug 29 07:50:25 2019 (r351598) @@ -92,10 +92,6 @@ cd9660_reclaim(ap) struct vnode *vp = ap->a_vp; /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); - /* * Remove the inode from its hash chain. */ vfs_hash_remove(vp); Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/devfs/devfs_vnops.c Thu Aug 29 07:50:25 2019 (r351598) @@ -1428,7 +1428,6 @@ devfs_reclaim(struct vop_reclaim_args *ap) vp->v_data = NULL; } mtx_unlock(&devfs_de_interlock); - vnode_destroy_vobject(vp); return (0); } Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/ext2fs/ext2_inode.c Thu Aug 29 07:50:25 2019 (r351598) @@ -639,6 +639,5 @@ ext2_reclaim(struct vop_reclaim_args *ap) vfs_hash_remove(vp); free(vp->v_data, M_EXT2NODE); vp->v_data = 0; - vnode_destroy_vobject(vp); return (0); } Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/fuse/fuse_vnops.c Thu Aug 29 07:50:25 2019 (r351598) @@ -1537,7 +1537,6 @@ fuse_vnop_reclaim(struct vop_reclaim_args *ap) fuse_vnode_setparent(vp, NULL); cache_purge(vp); vfs_hash_remove(vp); - vnode_destroy_vobject(vp); fuse_vnode_destroy(vp); return 0; Modified: head/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_denode.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/msdosfs/msdosfs_denode.c Thu Aug 29 07:50:25 2019 (r351598) @@ -552,10 +552,6 @@ msdosfs_reclaim(struct vop_reclaim_args *ap) #endif /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); - /* * Remove the denode from its hash chain. */ vfs_hash_remove(vp); Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/nfsclient/nfs_clnode.c Thu Aug 29 07:50:25 2019 (r351598) @@ -296,11 +296,6 @@ ncl_reclaim(struct vop_reclaim_args *ap) ncl_releasesillyrename(vp, ap->a_td); mtx_unlock(&np->n_mtx); - /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); - if (NFS_ISV4(vp) && vp->v_type == VREG) /* * We can now safely close any remaining NFSv4 Opens for Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/smbfs/smbfs_node.c Thu Aug 29 07:50:25 2019 (r351598) @@ -272,10 +272,6 @@ smbfs_reclaim(ap) KASSERT((np->n_flag & NOPEN) == 0, ("file not closed before reclaim")); - /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ? np->n_parent : NULL; Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Thu Aug 29 07:50:25 2019 (r351598) @@ -1317,8 +1317,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v) if (vp->v_type == VREG) tmpfs_destroy_vobject(vp, node->tn_reg.tn_aobj); - else - vnode_destroy_vobject(vp); vp->v_object = NULL; if (tmpfs_use_nc(vp)) cache_purge(vp); Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/fs/udf/udf_vnops.c Thu Aug 29 07:50:25 2019 (r351598) @@ -1266,11 +1266,6 @@ udf_reclaim(struct vop_reclaim_args *a) vp = a->a_vp; unode = VTON(vp); - /* - * Destroy the vm object and flush associated pages. - */ - vnode_destroy_vobject(vp); - if (unode != NULL) { vfs_hash_remove(vp); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/kern/vfs_subr.c Thu Aug 29 07:50:25 2019 (r351598) @@ -3481,9 +3481,9 @@ static void vgonel(struct vnode *vp) { struct thread *td; - int oweinact; - int active; struct mount *mp; + vm_object_t object; + bool active, oweinact; ASSERT_VOP_ELOCKED(vp, "vgonel"); ASSERT_VI_LOCKED(vp, "vgonel"); @@ -3503,8 +3503,8 @@ vgonel(struct vnode *vp) * Check to see if the vnode is in use. If so, we have to call * VOP_CLOSE() and VOP_INACTIVE(). */ - active = vp->v_usecount; - oweinact = (vp->v_iflag & VI_OWEINACT); + active = vp->v_usecount > 0; + oweinact = (vp->v_iflag & VI_OWEINACT) != 0; VI_UNLOCK(vp); vfs_notify_upper(vp, VFS_NOTIFY_UPPER_RECLAIM); @@ -3543,12 +3543,24 @@ vgonel(struct vnode *vp) ("vp %p bufobj not invalidated", vp)); /* - * For VMIO bufobj, BO_DEAD is set in vm_object_terminate() - * after the object's page queue is flushed. + * For VMIO bufobj, BO_DEAD is set later, or in + * vm_object_terminate() after the object's page queue is + * flushed. */ - if (vp->v_bufobj.bo_object == NULL) + object = vp->v_bufobj.bo_object; + if (object == NULL) vp->v_bufobj.bo_flag |= BO_DEAD; BO_UNLOCK(&vp->v_bufobj); + + /* + * Handle the VM part. Tmpfs handles v_object on its own (the + * OBJT_VNODE check). Nullfs or other bypassing filesystems + * should not touch the object borrowed from the lower vnode + * (the handle check). + */ + if (object != NULL && object->type == OBJT_VNODE && + object->handle == vp) + vnode_destroy_vobject(vp); /* * Reclaim the vnode. Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/ufs/ufs/ufs_extern.h Thu Aug 29 07:50:25 2019 (r351598) @@ -79,7 +79,6 @@ int ufs_inactive(struct vop_inactive_args *); int ufs_init(struct vfsconf *); void ufs_itimes(struct vnode *vp); int ufs_lookup(struct vop_cachedlookup_args *); -void ufs_prepare_reclaim(struct vnode *vp); int ufs_readdir(struct vop_readdir_args *); int ufs_reclaim(struct vop_reclaim_args *); void ffs_snapgone(struct inode *); Modified: head/sys/ufs/ufs/ufs_inode.c ============================================================================== --- head/sys/ufs/ufs/ufs_inode.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/ufs/ufs/ufs_inode.c Thu Aug 29 07:50:25 2019 (r351598) @@ -179,18 +179,21 @@ out: return (error); } -void -ufs_prepare_reclaim(struct vnode *vp) +/* + * Reclaim an inode so that it can be used for other purposes. + */ +int +ufs_reclaim(ap) + struct vop_reclaim_args /* { + struct vnode *a_vp; + struct thread *a_td; + } */ *ap; { - struct inode *ip; + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); #ifdef QUOTA int i; -#endif - ip = VTOI(vp); - - vnode_destroy_vobject(vp); -#ifdef QUOTA for (i = 0; i < MAXQUOTAS; i++) { if (ip->i_dquot[i] != NODQUOT) { dqrele(vp, ip->i_dquot[i]); @@ -202,22 +205,6 @@ ufs_prepare_reclaim(struct vnode *vp) if (ip->i_dirhash != NULL) ufsdirhash_free(ip); #endif -} - -/* - * Reclaim an inode so that it can be used for other purposes. - */ -int -ufs_reclaim(ap) - struct vop_reclaim_args /* { - struct vnode *a_vp; - struct thread *a_td; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - struct inode *ip = VTOI(vp); - - ufs_prepare_reclaim(vp); if (ip->i_flag & IN_LAZYMOD) ip->i_flag |= IN_MODIFIED; Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/vm/vm_object.h Thu Aug 29 07:50:25 2019 (r351598) @@ -189,7 +189,6 @@ struct vm_object { #define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ -#define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */ #define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ /* Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Thu Aug 29 07:45:23 2019 (r351597) +++ head/sys/vm/vnode_pager.c Thu Aug 29 07:50:25 2019 (r351598) @@ -147,17 +147,9 @@ vnode_create_vobject(struct vnode *vp, off_t isize, st if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE) return (0); - while ((object = vp->v_object) != NULL) { - VM_OBJECT_WLOCK(object); - if (!(object->flags & OBJ_DEAD)) { - VM_OBJECT_WUNLOCK(object); - return (0); - } - VOP_UNLOCK(vp, 0); - vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead", 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - } + object = vp->v_object; + if (object != NULL) + return (0); if (size == 0) { if (vn_isdisk(vp, NULL)) { @@ -190,10 +182,11 @@ vnode_destroy_vobject(struct vnode *vp) struct vm_object *obj; obj = vp->v_object; - if (obj == NULL) + if (obj == NULL || obj->handle != vp) return; ASSERT_VOP_ELOCKED(vp, "vnode_destroy_vobject"); VM_OBJECT_WLOCK(obj); + MPASS(obj->type == OBJT_VNODE); umtx_shm_object_terminated(obj); if (obj->ref_count == 0) { /* @@ -223,9 +216,6 @@ vnode_destroy_vobject(struct vnode *vp) * prevented new waiters from referencing the dying * object. */ - KASSERT((obj->flags & OBJ_DISCONNECTWNT) == 0, - ("OBJ_DISCONNECTWNT set obj %p flags %x", - obj, obj->flags)); vp->v_object = NULL; VM_OBJECT_WUNLOCK(obj); } @@ -243,8 +233,6 @@ vnode_destroy_vobject(struct vnode *vp) /* * Allocate (or lookup) pager for a vnode. * Handle is a vnode pointer. - * - * MPSAFE */ vm_object_t vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, @@ -259,28 +247,18 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_ if (handle == NULL) return (NULL); - vp = (struct vnode *) handle; - - /* - * If the object is being terminated, wait for it to - * go away. - */ + vp = (struct vnode *)handle; + ASSERT_VOP_LOCKED(vp, "vnode_pager_alloc"); + KASSERT(vp->v_usecount != 0, ("vnode_pager_alloc: no vnode reference")); retry: - while ((object = vp->v_object) != NULL) { - VM_OBJECT_WLOCK(object); - if ((object->flags & OBJ_DEAD) == 0) - break; - vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead", 0); - } + object = vp->v_object; - KASSERT(vp->v_usecount != 0, ("vnode_pager_alloc: no vnode reference")); - if (object == NULL) { /* * Add an object of the appropriate size */ - object = vm_object_allocate(OBJT_VNODE, OFF_TO_IDX(round_page(size))); + object = vm_object_allocate(OBJT_VNODE, + OFF_TO_IDX(round_page(size))); object->un_pager.vnp.vnp_size = size; object->un_pager.vnp.writemappings = 0; @@ -290,7 +268,7 @@ retry: VI_LOCK(vp); if (vp->v_object != NULL) { /* - * Object has been created while we were sleeping + * Object has been created while we were allocating. */ VI_UNLOCK(vp); VM_OBJECT_WLOCK(object); @@ -305,6 +283,7 @@ retry: vp->v_object = object; VI_UNLOCK(vp); } else { + VM_OBJECT_WLOCK(object); object->ref_count++; #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); @@ -334,10 +313,6 @@ vnode_pager_dealloc(vm_object_t object) object->handle = NULL; object->type = OBJT_DEAD; - if (object->flags & OBJ_DISCONNECTWNT) { - vm_object_clear_flag(object, OBJ_DISCONNECTWNT); - wakeup(object); - } ASSERT_VOP_ELOCKED(vp, "vnode_pager_dealloc"); if (object->un_pager.vnp.writemappings > 0) { object->un_pager.vnp.writemappings = 0; From owner-svn-src-all@freebsd.org Thu Aug 29 07:51:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D1C0CD810; Thu, 29 Aug 2019 07:51:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jvtm1ZZmz4M4d; Thu, 29 Aug 2019 07:51:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18A891CC9E; Thu, 29 Aug 2019 07:51:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T7pCVG077565; Thu, 29 Aug 2019 07:51:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T7pB2X077563; Thu, 29 Aug 2019 07:51:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908290751.x7T7pB2X077563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 29 Aug 2019 07:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351599 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 351599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 07:51:12 -0000 Author: avg Date: Thu Aug 29 07:51:11 2019 New Revision: 351599 URL: https://svnweb.freebsd.org/changeset/base/351599 Log: scsi_cd: make the media check asynchronous This makes the media check process asynchronous, so we no longer block in cdstrategy() to check for media. PR: 219857 Obtained from: ken MFC after: 3 weeks Modified: head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_cd.h Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Thu Aug 29 07:50:25 2019 (r351598) +++ head/sys/cam/scsi/scsi_cd.c Thu Aug 29 07:51:11 2019 (r351599) @@ -114,13 +114,21 @@ typedef enum { CD_FLAG_RETRY_UA = 0x0200, CD_FLAG_VALID_MEDIA = 0x0400, CD_FLAG_VALID_TOC = 0x0800, - CD_FLAG_SCTX_INIT = 0x1000 + CD_FLAG_SCTX_INIT = 0x1000, + CD_FLAG_MEDIA_WAIT = 0x2000, + CD_FLAG_MEDIA_SCAN_ACT = 0x4000 } cd_flags; typedef enum { CD_CCB_PROBE = 0x01, CD_CCB_BUFFER_IO = 0x02, - CD_CCB_TUR = 0x04, + CD_CCB_TUR = 0x03, + CD_CCB_MEDIA_PREVENT = 0x04, + CD_CCB_MEDIA_ALLOW = 0x05, + CD_CCB_MEDIA_SIZE = 0x06, + CD_CCB_MEDIA_TOC_HDR = 0x07, + CD_CCB_MEDIA_TOC_FULL = 0x08, + CD_CCB_MEDIA_TOC_LEAD = 0x09, CD_CCB_TYPE_MASK = 0x0F, CD_CCB_RETRY_UA = 0x10 } cd_ccb_state; @@ -140,7 +148,13 @@ struct cd_toc_single { typedef enum { CD_STATE_PROBE, - CD_STATE_NORMAL + CD_STATE_NORMAL, + CD_STATE_MEDIA_PREVENT, + CD_STATE_MEDIA_ALLOW, + CD_STATE_MEDIA_SIZE, + CD_STATE_MEDIA_TOC_HDR, + CD_STATE_MEDIA_TOC_FULL, + CD_STATE_MEDIA_TOC_LEAD } cd_state; struct cd_softc { @@ -161,6 +175,8 @@ struct cd_softc { struct sysctl_oid *sysctl_tree; STAILQ_HEAD(, cd_mode_params) mode_queue; struct cd_tocdata toc; + int toc_read_len; + struct cd_toc_single leadout; struct disk *disk; struct callout mediapoll_c; @@ -246,7 +262,8 @@ static void cddone(struct cam_periph *periph, static union cd_pages *cdgetpage(struct cd_mode_params *mode_params); static int cdgetpagesize(int page_num); static void cdprevent(struct cam_periph *periph, int action); -static int cdcheckmedia(struct cam_periph *periph); +static void cdmediaprobedone(struct cam_periph *periph); +static int cdcheckmedia(struct cam_periph *periph, int do_wait); static int cdsize(struct cam_periph *periph, u_int32_t *size); static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, @@ -755,7 +772,7 @@ cdopen(struct disk *dp) * if we don't have media, but then we don't allow anything but the * CDIOCEJECT/CDIOCCLOSE ioctls if there is no media. */ - cdcheckmedia(periph); + cdcheckmedia(periph, /*do_wait*/ 1); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); cam_periph_unhold(periph); @@ -851,27 +868,19 @@ cdstrategy(struct bio *bp) return; } - /* - * If we don't have valid media, look for it before trying to - * schedule the I/O. - */ - if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) { - int error; - - error = cdcheckmedia(periph); - if (error != 0) { - cam_periph_unlock(periph); - biofinish(bp, NULL, error); - return; - } - } - /* * Place it in the queue of disk activities for this disk */ bioq_disksort(&softc->bio_queue, bp); - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + /* + * If we don't know that we have valid media, schedule the media + * check first. The I/O will get executed after the media check. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + cdcheckmedia(periph, /*do_wait*/ 0); + else + xpt_schedule(periph, CAM_PRIORITY_NORMAL); cam_periph_unlock(periph); return; @@ -883,7 +892,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc struct cd_softc *softc; struct bio *bp; struct ccb_scsiio *csio; - struct scsi_read_capacity_data *rcap; softc = (struct cd_softc *)periph->softc; @@ -964,16 +972,40 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } case CD_STATE_PROBE: + case CD_STATE_MEDIA_SIZE: { + struct scsi_read_capacity_data *rcap; rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap == NULL) { xpt_print(periph->path, - "cdstart: Couldn't malloc read_capacity data\n"); - /* cd_free_periph??? */ + "%s: Couldn't malloc read_capacity data\n", + __func__); + xpt_release_ccb(start_ccb); + /* + * We can't probe because we can't allocate memory, + * so invalidate the peripheral. The system probably + * has larger problems at this stage. If we've + * already probed (and are re-probing capacity), we + * don't need to invalidate. + * + * XXX KDM need to reset probe state and kick out + * pending I/O. + */ + if (softc->state == CD_STATE_PROBE) + cam_periph_invalidate(periph); break; } + + /* + * Set the default capacity and sector size to something that + * GEOM can handle. This will get reset when a read capacity + * completes successfully. + */ + softc->disk->d_sectorsize = 2048; + softc->disk->d_mediasize = 0; + csio = &start_ccb->csio; scsi_read_capacity(csio, /*retries*/ cd_retry_count, @@ -983,11 +1015,112 @@ cdstart(struct cam_periph *periph, union ccb *start_cc SSD_FULL_SIZE, /*timeout*/20000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + if (softc->state == CD_STATE_PROBE) + start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_SIZE; xpt_action(start_ccb); break; } + case CD_STATE_MEDIA_ALLOW: + case CD_STATE_MEDIA_PREVENT: + { + /* + * If the CD is already locked, we don't need to do this. + * Move on to the capacity check. + */ + if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) { + softc->state = CD_STATE_MEDIA_SIZE; + xpt_release_ccb(start_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + break; + } + + scsi_prevent(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*action*/ (softc->state == CD_STATE_MEDIA_ALLOW) ? + PR_ALLOW : PR_PREVENT, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 60000); + + start_ccb->ccb_h.ccb_bp = NULL; + if (softc->state == CD_STATE_MEDIA_ALLOW) + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_ALLOW; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_PREVENT; + xpt_action(start_ccb); + break; } + case CD_STATE_MEDIA_TOC_HDR: { + struct ioc_toc_header *toch; + + bzero(&softc->toc, sizeof(softc->toc)); + + toch = &softc->toc.header; + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)toch, + /*dxfer_len*/ sizeof(*toch), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_HDR; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_FULL: { + + bzero(&softc->toc, sizeof(softc->toc)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)&softc->toc, + /*dxfer_len*/ softc->toc_read_len ? + softc->toc_read_len : + sizeof(softc->toc), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_FULL; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_LEAD: { + struct cd_toc_single *leadout; + + leadout = &softc->leadout; + bzero(leadout, sizeof(*leadout)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ CD_MSF, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ LEADOUT, + /*data_ptr*/ (uint8_t *)leadout, + /*dxfer_len*/ sizeof(*leadout), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_LEAD; + xpt_action(start_ccb); + break; + } + } } static void @@ -1251,6 +1384,293 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } + case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_PREVENT: + { + int error; + int is_prevent; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * Note that just like the original cdcheckmedia(), we do + * a prevent without failing the whole operation if the + * prevent fails. We try, but keep going if it doesn't + * work. + */ + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_PREVENT) + is_prevent = 1; + else + is_prevent = 0; + + xpt_release_ccb(done_ccb); + + if (is_prevent != 0) { + if (error == 0) + softc->flags |= CD_FLAG_DISC_LOCKED; + else + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_MEDIA_SIZE; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } else { + if (error == 0) + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_NORMAL; + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + return; + } + case CD_CCB_MEDIA_SIZE: + { + struct scsi_read_capacity_data *rdcap; + int error; + + error = 0; + if ((csio->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; + + if (error == 0) { + softc->params.disksize =scsi_4btoul(rdcap->addr) + 1; + softc->params.blksize = scsi_4btoul(rdcap->length); + + /* Make sure we got at least some block size. */ + if (softc->params.blksize == 0) + error = EIO; + /* + * SCSI-3 mandates that the reported blocksize shall be + * 2048. Older drives sometimes report funny values, + * trim it down to 2048, or other parts of the kernel + * will get confused. + * + * XXX we leave drives alone that might report 512 + * bytes, as well as drives reporting more weird + * sizes like perhaps 4K. + */ + if (softc->params.blksize > 2048 + && softc->params.blksize <= 2352) + softc->params.blksize = 2048; + } + free(rdcap, M_SCSICD); + + if (error == 0) { + softc->disk->d_sectorsize = softc->params.blksize; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + softc->flags |= CD_FLAG_SAW_MEDIA | CD_FLAG_VALID_MEDIA; + softc->state = CD_STATE_MEDIA_TOC_HDR; + } else { + softc->flags &= ~(CD_FLAG_VALID_MEDIA | + CD_FLAG_VALID_TOC); + bioq_flush(&softc->bio_queue, NULL, EINVAL); + softc->state = CD_STATE_MEDIA_ALLOW; + cdmediaprobedone(periph); + } + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + case CD_CCB_MEDIA_TOC_HDR: + case CD_CCB_MEDIA_TOC_FULL: + case CD_CCB_MEDIA_TOC_LEAD: + { + int error; + struct ioc_toc_header *toch; + int num_entries; + int cdindex; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * We will get errors here for media that doesn't have a table + * of contents. According to the MMC-3 spec: "When a Read + * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, + * where the first TOC has not been recorded (no complete + * session) and the Format codes 0000b, 0001b, or 0010b are + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an + * incomplete session on DDC/CD-R/RW media shall report + * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." + * + * So this isn't fatal if we can't read the table of contents, + * it just means that the user won't be able to issue the + * play tracks ioctl, and likely lots of other stuff won't + * work either. They need to burn the CD before we can do + * a whole lot with it. So we don't print anything here if + * we get an error back. + * + * We also bail out if the drive doesn't at least give us + * the full TOC header. + */ + if ((error != 0) + || ((csio->dxfer_len - csio->resid) < + sizeof(struct ioc_toc_header))) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if there is + * anything in the queue. It'll probably get + * kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + /* + * Note that this is NOT the storage location used for the + * leadout! + */ + toch = &softc->toc.header; + + if (softc->quirks & CD_Q_BCD_TRACKS) { + toch->starting_track = bcd2bin(toch->starting_track); + toch->ending_track = bcd2bin(toch->ending_track); + } + + /* Number of TOC entries, plus leadout */ + num_entries = (toch->ending_track - toch->starting_track) + 2; + cdindex = toch->starting_track + num_entries -1; + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_HDR) { + if (num_entries <= 0) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if + * there is anything in the queue. It'll + * probably get kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, + CAM_PRIORITY_NORMAL); + } else { + softc->toc_read_len = num_entries * + sizeof(struct cd_toc_entry); + softc->toc_read_len += sizeof(*toch); + + softc->state = CD_STATE_MEDIA_TOC_FULL; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + return; + } else if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_LEAD) { + struct cd_toc_single *leadout; + + leadout = (struct cd_toc_single *)csio->data_ptr; + softc->toc.entries[cdindex - toch->starting_track] = + leadout->entry; + } else if (((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_FULL) + && (cdindex == toch->ending_track + 1)) { + /* + * XXX KDM is this necessary? Probably only if the + * drive doesn't return leadout information with the + * table of contents. + */ + softc->state = CD_STATE_MEDIA_TOC_LEAD; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + if (softc->quirks & CD_Q_BCD_TRACKS) { + for (cdindex = 0; cdindex < num_entries - 1; cdindex++){ + softc->toc.entries[cdindex].track = + bcd2bin(softc->toc.entries[cdindex].track); + } + } + + softc->flags |= CD_FLAG_VALID_TOC; + /* If the first track is audio, correct sector size. */ + if ((softc->toc.entries[0].control & 4) == 0) { + softc->disk->d_sectorsize =softc->params.blksize = 2352; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + } + softc->state = CD_STATE_NORMAL; + + /* + * We unconditionally (re)set the blocksize each time the + * CD device is opened. This is because the CD can change, + * and therefore the blocksize might change. + * XXX problems here if some slice or partition is still + * open with the old size? + */ + if ((softc->disk->d_devstat->flags & DEVSTAT_BS_UNAVAILABLE)!=0) + softc->disk->d_devstat->flags &= + ~DEVSTAT_BS_UNAVAILABLE; + softc->disk->d_devstat->block_size = softc->params.blksize; + + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } default: break; } @@ -1343,7 +1763,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f && ((cmd != CDIOCCLOSE) && (cmd != CDIOCEJECT)) && (IOCGROUP(cmd) == 'c')) { - error = cdcheckmedia(periph); + error = cdcheckmedia(periph, /*do_wait*/ 1); if (error != 0) { cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -2227,11 +2647,66 @@ cdprevent(struct cam_periph *periph, int action) } } +static void +cdmediaprobedone(struct cam_periph *periph) +{ + struct cd_softc *softc; + + softc = (struct cd_softc *)periph->softc; + + softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT; + + if ((softc->flags & CD_FLAG_MEDIA_WAIT) != 0) { + softc->flags &= ~CD_FLAG_MEDIA_WAIT; + wakeup(&softc->toc); + } +} + /* * XXX: the disk media and sector size is only really able to change * XXX: while the device is closed. */ + static int +cdcheckmedia(struct cam_periph *periph, int do_wait) +{ + struct cd_softc *softc; + int error; + + softc = (struct cd_softc *)periph->softc; + error = 0; + + if ((do_wait != 0) + && ((softc->flags & CD_FLAG_MEDIA_WAIT) == 0)) { + softc->flags |= CD_FLAG_MEDIA_WAIT; + } + if ((softc->flags & CD_FLAG_MEDIA_SCAN_ACT) == 0) { + softc->state = CD_STATE_MEDIA_PREVENT; + softc->flags |= CD_FLAG_MEDIA_SCAN_ACT; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + if (do_wait == 0) + goto bailout; + + error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); + + if (error != 0) + goto bailout; + + /* + * Check to see whether we have a valid size from the media. We + * may or may not have a valid TOC. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + error = EINVAL; +bailout: + + return (error); +} + +#if 0 +static int cdcheckmedia(struct cam_periph *periph) { struct cd_softc *softc; @@ -2371,6 +2846,7 @@ bailout: return (error); } +#endif static int cdsize(struct cam_periph *periph, u_int32_t *size) @@ -2650,7 +3126,6 @@ static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { - struct scsi_read_toc *scsi_cmd; u_int32_t ntoc; struct ccb_scsiio *csio; union ccb *ccb; @@ -2663,29 +3138,18 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; - cam_fill_csio(csio, + scsi_read_toc(csio, /* retries */ cd_retry_count, /* cbfcnp */ NULL, - /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, + /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, + /* format */ SRTOC_FORMAT_TOC, + /* track*/ start, /* data_ptr */ data, /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, - sizeof(struct scsi_read_toc), - /* timeout */ 50000); + /* timeout */ 50000); - scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; - bzero (scsi_cmd, sizeof(*scsi_cmd)); - - if (mode == CD_MSF_FORMAT) - scsi_cmd->byte2 |= CD_MSF; - scsi_cmd->from_track = start; - /* scsi_ulto2b(ntoc, (u_int8_t *)scsi_cmd->data_len); */ - scsi_cmd->data_len[0] = (ntoc) >> 8; - scsi_cmd->data_len[1] = (ntoc) & 0xff; - - scsi_cmd->op_code = READ_TOC; - error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA | sense_flags); @@ -3742,4 +4206,39 @@ scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int sense_len, sizeof(*scsi_cmd), timeout); +} + +void +scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout) +{ + struct scsi_read_toc *scsi_cmd; + + scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; + bzero(scsi_cmd, sizeof(*scsi_cmd)); + scsi_cmd->op_code = READ_TOC; + + /* + * The structure is counting from 1, the function counting from 0. + * The spec counts from 0. In MMC-6, there is only one flag, the + * MSF flag. But we put the whole byte in for a bit a future-proofing. + */ + scsi_cmd->byte2 = byte1_flags; + scsi_cmd->format = format; + scsi_cmd->from_track = track; + scsi_ulto2b(dxfer_len, scsi_cmd->data_len); + + cam_fill_csio(csio, + /* retries */ retries, + /* cbfcnp */ cbfcnp, + /* flags */ CAM_DIR_IN, + /* tag_action */ tag_action, + /* data_ptr */ data_ptr, + /* dxfer_len */ dxfer_len, + /* sense_len */ sense_len, + sizeof(*scsi_cmd), + /* timeout */ timeout); } Modified: head/sys/cam/scsi/scsi_cd.h ============================================================================== --- head/sys/cam/scsi/scsi_cd.h Thu Aug 29 07:50:25 2019 (r351598) +++ head/sys/cam/scsi/scsi_cd.h Thu Aug 29 07:51:11 2019 (r351599) @@ -231,6 +231,12 @@ struct scsi_read_toc u_int8_t op_code; u_int8_t byte2; u_int8_t format; +#define SRTOC_FORMAT_TOC 0x00 +#define SRTOC_FORMAT_LAST_ADDR 0x01 +#define SRTOC_FORMAT_QSUB_TOC 0x02 +#define SRTOC_FORMAT_QSUB_PMA 0x03 +#define SRTOC_FORMAT_ATIP 0x04 +#define SRTOC_FORMAT_CD_TEXT 0x05 u_int8_t unused[3]; u_int8_t from_track; u_int8_t data_len[2]; @@ -870,6 +876,12 @@ void scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int8_t agid, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); + +void scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout); __END_DECLS From owner-svn-src-all@freebsd.org Thu Aug 29 08:19:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 057E4CEE30; Thu, 29 Aug 2019 08:19:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JwW36L80z4NVh; Thu, 29 Aug 2019 08:19:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBFCB1D0F2; Thu, 29 Aug 2019 08:19:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T8JBs0093434; Thu, 29 Aug 2019 08:19:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T8JBn4093433; Thu, 29 Aug 2019 08:19:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908290819.x7T8JBn4093433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 29 Aug 2019 08:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351600 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 351600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 08:19:12 -0000 Author: avg Date: Thu Aug 29 08:19:11 2019 New Revision: 351600 URL: https://svnweb.freebsd.org/changeset/base/351600 Log: scsi_cd: ifdef out cdsize() It was used only by the old cdcheckmedia(). MFC after: 3 weeks Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Thu Aug 29 07:51:11 2019 (r351599) +++ head/sys/cam/scsi/scsi_cd.c Thu Aug 29 08:19:11 2019 (r351600) @@ -264,7 +264,9 @@ static int cdgetpagesize(int page_num); static void cdprevent(struct cam_periph *periph, int action); static void cdmediaprobedone(struct cam_periph *periph); static int cdcheckmedia(struct cam_periph *periph, int do_wait); +#if 0 static int cdsize(struct cam_periph *periph, u_int32_t *size); +#endif static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); @@ -2846,7 +2848,6 @@ bailout: return (error); } -#endif static int cdsize(struct cam_periph *periph, u_int32_t *size) @@ -2903,6 +2904,7 @@ cdsize(struct cam_periph *periph, u_int32_t *size) return (error); } +#endif static int cd6byteworkaround(union ccb *ccb) From owner-svn-src-all@freebsd.org Thu Aug 29 08:26:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E349CF133; Thu, 29 Aug 2019 08:26:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Jwgh3RdCz4NwF; Thu, 29 Aug 2019 08:26:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 591E91D2B8; Thu, 29 Aug 2019 08:26:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7T8Qet8099195; Thu, 29 Aug 2019 08:26:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7T8Qe3C099193; Thu, 29 Aug 2019 08:26:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201908290826.x7T8Qe3C099193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 29 Aug 2019 08:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351601 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 351601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 08:26:40 -0000 Author: avg Date: Thu Aug 29 08:26:40 2019 New Revision: 351601 URL: https://svnweb.freebsd.org/changeset/base/351601 Log: scsi_cd: whitespace cleanup Remove trailing whitespace and fix mixed indentation. MFC after: 3 weeks Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Thu Aug 29 08:19:11 2019 (r351600) +++ head/sys/cam/scsi/scsi_cd.c Thu Aug 29 08:26:40 2019 (r351601) @@ -270,25 +270,25 @@ static int cdsize(struct cam_periph *periph, u_int32_ static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); -static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, - u_int32_t start, u_int8_t *data, +static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, + u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags); -static int cdgetmode(struct cam_periph *periph, +static int cdgetmode(struct cam_periph *periph, struct cd_mode_params *data, u_int32_t page); static int cdsetmode(struct cam_periph *periph, struct cd_mode_params *data); -static int cdplay(struct cam_periph *periph, u_int32_t blk, +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len); -static int cdreadsubchannel(struct cam_periph *periph, - u_int32_t mode, u_int32_t format, - int track, - struct cd_sub_channel_info *data, +static int cdreadsubchannel(struct cam_periph *periph, + u_int32_t mode, u_int32_t format, + int track, + struct cd_sub_channel_info *data, u_int32_t len); -static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, - u_int32_t starts, u_int32_t startf, - u_int32_t endm, u_int32_t ends, +static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, + u_int32_t starts, u_int32_t startf, + u_int32_t endm, u_int32_t ends, u_int32_t endf); -static int cdplaytracks(struct cam_periph *periph, +static int cdplaytracks(struct cam_periph *periph, u_int32_t strack, u_int32_t sindex, u_int32_t etrack, u_int32_t eindex); static int cdpause(struct cam_periph *periph, u_int32_t go); @@ -599,7 +599,7 @@ cdregister(struct cam_periph *periph, void *arg) M_NOWAIT | M_ZERO); if (softc == NULL) { printf("cdregister: Unable to probe new device. " - "Unable to allocate softc\n"); + "Unable to allocate softc\n"); return(CAM_REQ_CMP_ERR); } @@ -876,7 +876,7 @@ cdstrategy(struct bio *bp) bioq_disksort(&softc->bio_queue, bp); /* - * If we don't know that we have valid media, schedule the media + * If we don't know that we have valid media, schedule the media * check first. The I/O will get executed after the media check. */ if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) @@ -951,7 +951,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO; - LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); softc->outstanding_cmds++; @@ -1038,7 +1037,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } - scsi_prevent(&start_ccb->csio, + scsi_prevent(&start_ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/ cddone, /*tag_action*/ MSG_SIMPLE_Q_TAG, @@ -1057,7 +1056,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } case CD_STATE_MEDIA_TOC_HDR: { struct ioc_toc_header *toch; - + bzero(&softc->toc, sizeof(softc->toc)); toch = &softc->toc.header; @@ -1069,7 +1068,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ 0, /*format*/ SRTOC_FORMAT_TOC, /*track*/ 0, - /*data_ptr*/ (uint8_t *)toch, + /*data_ptr*/ (uint8_t *)toch, /*dxfer_len*/ sizeof(*toch), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1113,7 +1112,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ CD_MSF, /*format*/ SRTOC_FORMAT_TOC, /*track*/ LEADOUT, - /*data_ptr*/ (uint8_t *)leadout, + /*data_ptr*/ (uint8_t *)leadout, /*dxfer_len*/ sizeof(*leadout), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1127,7 +1126,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc static void cddone(struct cam_periph *periph, union ccb *done_ccb) -{ +{ struct cd_softc *softc; struct ccb_scsiio *csio; @@ -1182,7 +1181,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) bp->bio_error = 0; if (bp->bio_resid != 0) { /* - * Short transfer ??? + * Short transfer ??? * XXX: not sure this is correct for partial * transfers at EOM */ @@ -1208,7 +1207,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) bzero(announce_buf, CD_ANNOUNCETMP_SZ); rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; - + cdp->disksize = scsi_4btoul (rdcap->addr) + 1; cdp->blksize = scsi_4btoul (rdcap->length); @@ -1248,7 +1247,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) status = done_ccb->ccb_h.status; - xpt_setup_ccb(&cgd.ccb_h, + xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; @@ -1282,15 +1281,15 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) "size failed: %s, %s", sense_key_desc, asc_desc); - } else if ((have_sense == 0) - && ((status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (csio->scsi_status == - SCSI_STATUS_BUSY)) { - snprintf(announce_buf, + } else if ((have_sense == 0) + && ((status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) + && (csio->scsi_status == + SCSI_STATUS_BUSY)) { + snprintf(announce_buf, CD_ANNOUNCETMP_SZ, - "Attempt to query device " - "size failed: SCSI Status: %s", + "Attempt to query device " + "size failed: SCSI Status: %s", scsi_status_string(csio)); } else if (SID_TYPE(&cgd.inq_data) == T_CDROM) { /* @@ -1301,7 +1300,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) * don't support CDROM commands. * If we have sense information, go * ahead and print it out. - * Otherwise, just say that we + * Otherwise, just say that we * couldn't attach. */ @@ -1354,7 +1353,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) */ taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); } - softc->state = CD_STATE_NORMAL; + softc->state = CD_STATE_NORMAL; /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB @@ -1386,7 +1385,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } - case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_ALLOW: case CD_CCB_MEDIA_PREVENT: { int error; @@ -1526,12 +1525,12 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) /* * We will get errors here for media that doesn't have a table - * of contents. According to the MMC-3 spec: "When a Read + * of contents. According to the MMC-3 spec: "When a Read * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, * where the first TOC has not been recorded (no complete * session) and the Format codes 0000b, 0001b, or 0010b are - * specified, this command shall be rejected with an INVALID - * FIELD IN CDB. Devices that are not capable of reading an + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an * incomplete session on DDC/CD-R/RW media shall report * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." * @@ -1792,7 +1791,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYTRACKS\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1838,7 +1837,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f softc->toc.header.starting_track; if ((st < 0) || (et < 0) - || (st > (softc->toc.header.ending_track - + || (st > (softc->toc.header.ending_track - softc->toc.header.starting_track))) { error = EINVAL; cam_periph_unlock(periph); @@ -1888,7 +1887,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYMSF\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1929,7 +1928,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYBLOCKS\n")); @@ -1960,11 +1959,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f struct cd_sub_channel_info *data; u_int32_t len = args->data_len; - data = malloc(sizeof(struct cd_sub_channel_info), + data = malloc(sizeof(struct cd_sub_channel_info), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCREADSUBCHANNEL\n")); if ((len > sizeof(struct cd_sub_channel_info)) || @@ -1988,7 +1987,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f if (error) { free(data, M_SCSICD); cam_periph_unlock(periph); - break; + break; } if (softc->quirks & CD_Q_BCD_TRACKS) data->what.track_info.track_number = @@ -2010,10 +2009,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCHEADER\n")); - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/SF_NO_PRINT); if (error) { free(th, M_SCSICD); @@ -2024,7 +2023,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f /* we are going to have to convert the BCD * encoding on the cd to what is expected */ - th->starting_track = + th->starting_track = bcd2bin(th->starting_track); th->ending_track = bcd2bin(th->ending_track); } @@ -2051,7 +2050,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f lead = malloc(sizeof(*lead), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRYS\n")); if (te->data_len < sizeof(struct cd_toc_entry) @@ -2068,7 +2067,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } th = &data->header; - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { free(data, M_SCSICD); @@ -2152,7 +2151,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_unlock(periph); break; } - data->entries[idx - starting_track] = + data->entries[idx - starting_track] = lead->entry; } if (softc->quirks & CD_Q_BCD_TRACKS) { @@ -2180,7 +2179,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f data = malloc(sizeof(*data), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRY\n")); if (te->address_format != CD_MSF_FORMAT @@ -2249,11 +2248,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETPATCH\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2264,9 +2263,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = arg->patch[0]; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = arg->patch[1]; page->audio.port[2].channels = arg->patch[2]; page->audio.port[3].channels = arg->patch[3]; @@ -2282,11 +2281,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCGETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2297,9 +2296,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - arg->vol[LEFT_PORT] = + arg->vol[LEFT_PORT] = page->audio.port[LEFT_PORT].volume; - arg->vol[RIGHT_PORT] = + arg->vol[RIGHT_PORT] = page->audio.port[RIGHT_PORT].volume; arg->vol[2] = page->audio.port[2].volume; arg->vol[3] = page->audio.port[3].volume; @@ -2314,11 +2313,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2330,10 +2329,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f page = cdgetpage(¶ms); page->audio.port[LEFT_PORT].channels = CHANNEL_0; - page->audio.port[LEFT_PORT].volume = + page->audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT]; page->audio.port[RIGHT_PORT].channels = CHANNEL_1; - page->audio.port[RIGHT_PORT].volume = + page->audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT]; page->audio.port[2].volume = arg->vol[2]; page->audio.port[3].volume = arg->vol[3]; @@ -2352,7 +2351,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMONO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2363,9 +2362,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2384,7 +2383,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETSTEREO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2395,9 +2394,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2416,7 +2415,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMUTE\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2446,7 +2445,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETLEFT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2476,7 +2475,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETRIGHT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2598,7 +2597,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_lock(periph); cam_periph_unhold(periph); - + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdioctl\n")); if (error && bootverbose) { printf("scsi_cd.c::ioctl cmd=%08lx error=%d\n", cmd, error); @@ -2618,24 +2617,24 @@ cdprevent(struct cam_periph *periph, int action) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n")); softc = (struct cd_softc *)periph->softc; - + if (((action == PR_ALLOW) && (softc->flags & CD_FLAG_DISC_LOCKED) == 0) || ((action == PR_PREVENT) && (softc->flags & CD_FLAG_DISC_LOCKED) != 0)) { return; } - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); - scsi_prevent(&ccb->csio, + scsi_prevent(&ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/NULL, MSG_SIMPLE_Q_TAG, action, SSD_FULL_SIZE, /* timeout */60000); - + error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA|SF_NO_PRINT); @@ -2692,7 +2691,7 @@ cdcheckmedia(struct cam_periph *periph, int do_wait) goto bailout; error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); - + if (error != 0) goto bailout; @@ -2807,7 +2806,7 @@ cdcheckmedia(struct cam_periph *periph) cdindex = toch->starting_track + num_entries -1; if (cdindex == toch->ending_track + 1) { - error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, + error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, (u_int8_t *)&leadout, sizeof(leadout), SF_NO_PRINT); if (error != 0) { @@ -2860,16 +2859,16 @@ cdsize(struct cam_periph *periph, u_int32_t *size) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdsize\n")); softc = (struct cd_softc *)periph->softc; - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); /* XXX Should be M_WAITOK */ - rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), + rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap_buf == NULL) return (ENOMEM); - scsi_read_capacity(&ccb->csio, + scsi_read_capacity(&ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/NULL, MSG_SIMPLE_Q_TAG, @@ -2969,9 +2968,9 @@ cd6byteworkaround(union ccb *ccb) ms6 = (struct scsi_mode_sense_6 *)cdb; bzero(&ms10, sizeof(ms10)); - ms10.opcode = MODE_SENSE_10; - ms10.byte2 = ms6->byte2; - ms10.page = ms6->page; + ms10.opcode = MODE_SENSE_10; + ms10.byte2 = ms6->byte2; + ms10.page = ms6->page; /* * 10 byte mode header, block descriptor, @@ -3124,8 +3123,8 @@ cdmediapoll(void *arg) /* * Read table of contents */ -static int -cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, +static int +cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { u_int32_t ntoc; @@ -3141,7 +3140,7 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; scsi_read_toc(csio, - /* retries */ cd_retry_count, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* tag_action */ MSG_SIMPLE_Q_TAG, /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, @@ -3161,9 +3160,9 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u } static int -cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, - u_int32_t format, int track, - struct cd_sub_channel_info *data, u_int32_t len) +cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, + u_int32_t format, int track, + struct cd_sub_channel_info *data, u_int32_t len) { struct scsi_read_subchannel *scsi_cmd; struct ccb_scsiio *csio; @@ -3176,8 +3175,8 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3185,7 +3184,7 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_read_subchannel), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_read_subchannel *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3406,7 +3405,7 @@ cdsetmode(struct cam_periph *periph, struct cd_mode_pa } -static int +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len) { struct ccb_scsiio *csio; @@ -3476,8 +3475,8 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3485,7 +3484,7 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_msf), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_msf *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3496,11 +3495,11 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, scsi_cmd->start_f = startf; scsi_cmd->end_m = endm; scsi_cmd->end_s = ends; - scsi_cmd->end_f = endf; + scsi_cmd->end_f = endf; error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA); - + xpt_release_ccb(ccb); return(error); @@ -3522,8 +3521,8 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3531,7 +3530,7 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_track), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_track *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3564,8 +3563,8 @@ cdpause(struct cam_periph *periph, u_int32_t go) csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3573,7 +3572,7 @@ cdpause(struct cam_periph *periph, u_int32_t go) /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_pause), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_pause *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3672,7 +3671,7 @@ cdsetspeed(struct cam_periph *periph, u_int32_t rdspee /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_set_speed), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_set_speed *)&csio->cdb_io.cdb_bytes; bzero(scsi_cmd, sizeof(*scsi_cmd)); @@ -4095,7 +4094,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct d * Tell the user what the overall length is, no matter * what we can actually fit in the data buffer. */ - dvdstruct->length = length - ccb->csio.resid - + dvdstruct->length = length - ccb->csio.resid - sizeof(struct scsi_read_dvd_struct_data_header); /* @@ -4233,8 +4232,8 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie scsi_cmd->from_track = track; scsi_ulto2b(dxfer_len, scsi_cmd->data_len); - cam_fill_csio(csio, - /* retries */ retries, + cam_fill_csio(csio, + /* retries */ retries, /* cbfcnp */ cbfcnp, /* flags */ CAM_DIR_IN, /* tag_action */ tag_action, @@ -4242,5 +4241,5 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie /* dxfer_len */ dxfer_len, /* sense_len */ sense_len, sizeof(*scsi_cmd), - /* timeout */ timeout); + /* timeout */ timeout); } From owner-svn-src-all@freebsd.org Thu Aug 29 12:05:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E74F0D46E8; Thu, 29 Aug 2019 12:05:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K1Wk5rxVz4ZZ5; Thu, 29 Aug 2019 12:05:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA9A91FA72; Thu, 29 Aug 2019 12:05: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 x7TC56Sj028330; Thu, 29 Aug 2019 12:05:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TC56qJ028329; Thu, 29 Aug 2019 12:05:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908291205.x7TC56qJ028329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 29 Aug 2019 12:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351603 - head/sys/dev/vnic X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/vnic X-SVN-Commit-Revision: 351603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 12:05:07 -0000 Author: emaste Date: Thu Aug 29 12:05:06 2019 New Revision: 351603 URL: https://svnweb.freebsd.org/changeset/base/351603 Log: vnic: avoid NULL deref in error case Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vnic/thunder_bgx.c Modified: head/sys/dev/vnic/thunder_bgx.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx.c Thu Aug 29 09:29:39 2019 (r351602) +++ head/sys/dev/vnic/thunder_bgx.c Thu Aug 29 12:05:06 2019 (r351603) @@ -502,9 +502,8 @@ bgx_add_dmac_addr(uint64_t dmac, int node, int bgx_idx bgx_idx += node * MAX_BGX_PER_CN88XX; bgx = bgx_vnic[bgx_idx]; - if (!bgx) { - device_printf(bgx->dev, - "BGX%d not yet initialized, ignoring DMAC addition\n", + if (bgx == NULL) { + printf("BGX%d not yet initialized, ignoring DMAC addition\n", bgx_idx); return; } From owner-svn-src-all@freebsd.org Thu Aug 29 12:49:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54414D563A; Thu, 29 Aug 2019 12:49:22 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K2Vp1XlSz4d1p; Thu, 29 Aug 2019 12:49:22 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12750201A7; Thu, 29 Aug 2019 12:49:22 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7TCnLie052928; Thu, 29 Aug 2019 12:49:21 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TCnLMi052927; Thu, 29 Aug 2019 12:49:21 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201908291249.x7TCnLMi052927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Thu, 29 Aug 2019 12:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351604 - head/sys/dev/ichsmb X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/sys/dev/ichsmb X-SVN-Commit-Revision: 351604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 12:49:22 -0000 Author: yuripv Date: Thu Aug 29 12:49:21 2019 New Revision: 351604 URL: https://svnweb.freebsd.org/changeset/base/351604 Log: ichsmb: defer smbus attach until interrupts are available This fixes a "timed sleep before timers are working" panic seen while attaching jedec_dimm(4) instances too early in the boot. Submitted by: ian Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D21452 Modified: head/sys/dev/ichsmb/ichsmb.c Modified: head/sys/dev/ichsmb/ichsmb.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb.c Thu Aug 29 12:05:06 2019 (r351603) +++ head/sys/dev/ichsmb/ichsmb.c Thu Aug 29 12:49:21 2019 (r351604) @@ -131,11 +131,8 @@ ichsmb_attach(device_t dev) goto fail; } - /* Attach "smbus" child */ - if ((error = bus_generic_attach(dev)) != 0) { - device_printf(dev, "failed to attach child: %d\n", error); - goto fail; - } + /* Probe and attach the smbus when interrupts are available */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); return (0); From owner-svn-src-all@freebsd.org Thu Aug 29 13:46:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 570B6D67E6; Thu, 29 Aug 2019 13:46:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K3nD1XqYz3CLP; Thu, 29 Aug 2019 13:46:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1240E20C59; Thu, 29 Aug 2019 13:46:56 +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 x7TDktCQ088193; Thu, 29 Aug 2019 13:46:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TDkt1H088187; Thu, 29 Aug 2019 13:46:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908291346.x7TDkt1H088187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Aug 2019 13:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351605 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 351605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 13:46:56 -0000 Author: mav Date: Thu Aug 29 13:46:54 2019 New Revision: 351605 URL: https://svnweb.freebsd.org/changeset/base/351605 Log: Man page for AMD Non-Transparent Bridge (ntb_hw_amd) driver. Submitted by: Rajesh Kumar Reviewed by: bcr MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D21462 Added: head/share/man/man4/ntb_hw_amd.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/ntb.4 head/share/man/man4/ntb_transport.4 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Aug 29 12:49:21 2019 (r351604) +++ head/share/man/man4/Makefile Thu Aug 29 13:46:54 2019 (r351605) @@ -371,6 +371,7 @@ MAN= aac.4 \ ng_vlan.4 \ nmdm.4 \ ${_ntb.4} \ + ${_ntb_hw_amd.4} \ ${_ntb_hw_intel.4} \ ${_ntb_hw_plx.4} \ ${_ntb_transport.4} \ @@ -795,6 +796,7 @@ _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 _if_ntb.4= if_ntb.4 _ntb.4= ntb.4 +_ntb_hw_amd.4= ntb_hw_amd.4 _ntb_hw_intel.4= ntb_hw_intel.4 _ntb_hw_plx.4= ntb_hw_plx.4 _ntb_transport.4=ntb_transport.4 Modified: head/share/man/man4/ntb.4 ============================================================================== --- head/share/man/man4/ntb.4 Thu Aug 29 12:49:21 2019 (r351604) +++ head/share/man/man4/ntb.4 Thu Aug 29 13:46:54 2019 (r351605) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2017 +.Dd August 29, 2019 .Dt NTB 4 .Os .Sh NAME @@ -66,7 +66,7 @@ The default configuration is empty string, which means with all available resources, allowing any driver to attach. .El .Sh DESCRIPTION -Non-Transparent Bridges allow to connect two computer systems with PCIe +Non-Transparent Bridges connect two computer systems with PCIe link(s), providing each of them limited access to others memory space, scratchpad registers and interrupts. The @@ -76,9 +76,10 @@ and splits them between several functions, according t configuration. .Sh SEE ALSO .Xr if_ntb 4 , -.Xr ntb_transport 4 , +.Xr ntb_hw_amd 4 , .Xr ntb_hw_intel 4 , -.Xr ntb_hw_plx 4 +.Xr ntb_hw_plx 4 , +.Xr ntb_transport 4 .Sh AUTHORS .An -nosplit The Added: head/share/man/man4/ntb_hw_amd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ntb_hw_amd.4 Thu Aug 29 13:46:54 2019 (r351605) @@ -0,0 +1,94 @@ +.\" +.\" Copyright (c) 2019 Rajesh Kumar +.\" 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 29, 2019 +.Dt NTB_HW_AMD 4 +.Os +.Sh NAME +.Nm ntb_hw_amd +.Nd AMD Non-Transparent Bridge driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb" +.Cd "device ntb_hw_amd" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ntb_hw_amd_load="YES" +.Ed +.Pp +The following sysctls are supported in this driver +.Bl -ohang +.It Va dev.ntb_hw.X.info +Reading this sysctl will give the basic details like the number of memory +windows, scratchpads and doorbells exposed by the NTB on the local host to +access the devices beyond the bridge. +It also provides details about the masked doorbells, translation address and +size limit of each exposed memory window and link status information. +.El +.Sh DESCRIPTION +The +.Nm ntb_hw_amd +driver provides support for the Non-Transparent Bridge (NTB) hardware in +AMD EPYC processor family. +The Non-Transparent Bridge does not look as a regular PCI bridge, but as PCI +endpoint device, hiding the devices behind it. +The driver hides details of hardware on the other side, but exposes memory windows, +scratchpads and doorbells to access the other side via hardware independent +KPI to +.Xr ntb 4 +subsystem. +.Pp +The hardware provides 2 (both 64-bit) or 3 (one 32-bit and two 64-bit) memory +windows to the other system's memory, up to 16 scratchpad registers and 16 +doorbells to communicate with and interrupt the other system respectively. +.Sh CONFIGURATION +The NTB configuration should be set by BIOS. +This includes enabling NTB, choosing topology (only NTB-to-Root Port +mode is supported now), role of the host in the topology. +This needs to be done on both systems. +.Pp +The BAR size for memory windows is configured to 1 MiB by default. +.Sh SEE ALSO +.Xr if_ntb 4 , +.Xr ntb 4 , +.Xr ntb_transport 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by AMD and originally written by +.An Rajesh Kumar Aq Mt rajesh1.kumar@amd.com . +Reviewed by +.An Alexander Motin Aq Mt mav@FreeBSD.org , +.An Conrad E. Meyer Aq Mt cem@FreeBSD.org +and +.An Warner Losh Aq Mt imp@FreeBSD.org . Modified: head/share/man/man4/ntb_transport.4 ============================================================================== --- head/share/man/man4/ntb_transport.4 Thu Aug 29 12:49:21 2019 (r351604) +++ head/share/man/man4/ntb_transport.4 Thu Aug 29 13:46:54 2019 (r351605) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 15, 2019 +.Dd August 29, 2019 .Dt NTB_TRANSPORT 4 .Os .Sh NAME @@ -92,6 +92,7 @@ instance: .Sh SEE ALSO .Xr if_ntb 4 , .Xr ntb 4 , +.Xr ntb_hw_amd 4 , .Xr ntb_hw_intel 4 , .Xr ntb_hw_plx 4 .Sh AUTHORS From owner-svn-src-all@freebsd.org Thu Aug 29 17:02:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D10E0DB621; Thu, 29 Aug 2019 17:02:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K86M53YPz3R2p; Thu, 29 Aug 2019 17:02:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B59823024; Thu, 29 Aug 2019 17:02:03 +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 x7TH236m006563; Thu, 29 Aug 2019 17:02:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TH22xM006558; Thu, 29 Aug 2019 17:02:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908291702.x7TH22xM006558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Aug 2019 17:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351606 - in head/sys/cam: ata mmc nvme scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cam: ata mmc nvme scsi X-SVN-Commit-Revision: 351606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 17:02:03 -0000 Author: mav Date: Thu Aug 29 17:02:02 2019 New Revision: 351606 URL: https://svnweb.freebsd.org/changeset/base/351606 Log: Take proper lock in ses_setphyspath_callback(). XPT_DEV_ADVINFO call should be protected by the lock of the specific device it is addressed to, not the lock of SES device. In some weird case, probably with hardware violating standards, it sometimes caused NULL dereference due to race. To protect from it further, add lock assertion to *_dev_advinfo(). MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ata/ata_xpt.c head/sys/cam/mmc/mmc_xpt.c head/sys/cam/nvme/nvme_xpt.c head/sys/cam/scsi/scsi_enc_ses.c head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Thu Aug 29 13:46:54 2019 (r351605) +++ head/sys/cam/ata/ata_xpt.c Thu Aug 29 17:02:02 2019 (r351606) @@ -1726,8 +1726,9 @@ ata_dev_advinfo(union ccb *start_ccb) { struct cam_ed *device; struct ccb_dev_advinfo *cdai; - off_t amt; + off_t amt; + xpt_path_assert(start_ccb->ccb_h.path, MA_OWNED); start_ccb->ccb_h.status = CAM_REQ_INVALID; device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; Modified: head/sys/cam/mmc/mmc_xpt.c ============================================================================== --- head/sys/cam/mmc/mmc_xpt.c Thu Aug 29 13:46:54 2019 (r351605) +++ head/sys/cam/mmc/mmc_xpt.c Thu Aug 29 17:02:02 2019 (r351606) @@ -341,6 +341,7 @@ mmc_dev_advinfo(union ccb *start_ccb) struct ccb_dev_advinfo *cdai; off_t amt; + xpt_path_assert(start_ccb->ccb_h.path, MA_OWNED); start_ccb->ccb_h.status = CAM_REQ_INVALID; device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; Modified: head/sys/cam/nvme/nvme_xpt.c ============================================================================== --- head/sys/cam/nvme/nvme_xpt.c Thu Aug 29 13:46:54 2019 (r351605) +++ head/sys/cam/nvme/nvme_xpt.c Thu Aug 29 17:02:02 2019 (r351606) @@ -588,8 +588,9 @@ nvme_dev_advinfo(union ccb *start_ccb) { struct cam_ed *device; struct ccb_dev_advinfo *cdai; - off_t amt; + off_t amt; + xpt_path_assert(start_ccb->ccb_h.path, MA_OWNED); start_ccb->ccb_h.status = CAM_REQ_INVALID; device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Thu Aug 29 13:46:54 2019 (r351605) +++ head/sys/cam/scsi/scsi_enc_ses.c Thu Aug 29 17:02:02 2019 (r351606) @@ -1027,7 +1027,7 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element args = (ses_setphyspath_callback_args_t *)arg; old_physpath = malloc(MAXPATHLEN, M_SCSIENC, M_WAITOK|M_ZERO); - cam_periph_lock(enc->periph); + xpt_path_lock(path); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; @@ -1052,7 +1052,7 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element if (cdai.ccb_h.status == CAM_REQ_CMP) args->num_set++; } - cam_periph_unlock(enc->periph); + xpt_path_unlock(path); free(old_physpath, M_SCSIENC); } Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Thu Aug 29 13:46:54 2019 (r351605) +++ head/sys/cam/scsi/scsi_xpt.c Thu Aug 29 17:02:02 2019 (r351606) @@ -2515,6 +2515,7 @@ scsi_dev_advinfo(union ccb *start_ccb) struct ccb_dev_advinfo *cdai; off_t amt; + xpt_path_assert(start_ccb->ccb_h.path, MA_OWNED); start_ccb->ccb_h.status = CAM_REQ_INVALID; device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; From owner-svn-src-all@freebsd.org Thu Aug 29 17:17:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAC0FDBA19; Thu, 29 Aug 2019 17:17:39 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K8SM5Sghz3wp0; Thu, 29 Aug 2019 17:17:39 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98AD52322C; Thu, 29 Aug 2019 17:17:39 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7THHduN012463; Thu, 29 Aug 2019 17:17:39 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7THHddD012462; Thu, 29 Aug 2019 17:17:39 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201908291717.x7THHddD012462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Thu, 29 Aug 2019 17:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351607 - head X-SVN-Group: head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 17:17:39 -0000 Author: zeising (doc,ports committer) Date: Thu Aug 29 17:17:39 2019 New Revision: 351607 URL: https://svnweb.freebsd.org/changeset/base/351607 Log: pwm.9 symlink shouldn't be removed When the pwm.9 manual was removed, a symlink between pwmbus.9 and pwm.9 was created, but there's an entry in ObsoleteFiles.inc to remove pwn.9, meaning that on every installation pwm.9 is created, and make delete-old deletes it. Remove the entry from ObsoleteFiles.inc, the symlink is clearly intentional and shouldn't be removed. Reviewed by: imp, ian Approved by: imp (implicit, review OK) Differential Revision: https://reviews.freebsd.org/D21198 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Aug 29 17:02:02 2019 (r351606) +++ head/ObsoleteFiles.inc Thu Aug 29 17:17:39 2019 (r351607) @@ -57,8 +57,8 @@ OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz OLD_FILES+=usr/share/man/man9/vm_page_hold.9.gz # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h -# 20190615: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed -OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9.gz +# 20190615: sys/pwm.h renamed to dev/pwmc.h +OLD_FILES+=usr/include/sys/pwm.h # 20190612: new clang import which bumps version from 8.0.0 to 8.0.1. OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h From owner-svn-src-all@freebsd.org Thu Aug 29 17:25:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAD07DBCE0; Thu, 29 Aug 2019 17:25:51 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K8dq42xQz3xGS; Thu, 29 Aug 2019 17:25:51 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C7A6233F0; Thu, 29 Aug 2019 17:25:51 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7THPpOI018298; Thu, 29 Aug 2019 17:25:51 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7THPpKs018297; Thu, 29 Aug 2019 17:25:51 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201908291725.x7THPpKs018297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Thu, 29 Aug 2019 17:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351608 - head X-SVN-Group: head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 17:25:51 -0000 Author: zeising (doc,ports committer) Date: Thu Aug 29 17:25:50 2019 New Revision: 351608 URL: https://svnweb.freebsd.org/changeset/base/351608 Log: Use relative paths in ObsoleteFiles.inc Approved by: imp Differential Revision: https://reviews.freebsd.org/D21467 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Aug 29 17:17:39 2019 (r351607) +++ head/ObsoleteFiles.inc Thu Aug 29 17:25:50 2019 (r351608) @@ -39,8 +39,8 @@ # done # 20190825: zlib 1.0.4 removed from kernel -OLD_FILES+=/usr/include/sys/zlib.h -OLD_FILES+=/usr/include/sys/zutil.h +OLD_FILES+=usr/include/sys/zlib.h +OLD_FILES+=usr/include/sys/zutil.h # 20190817: pft_ping.py and sniffer.py moved to /usr/tests/sys/netpfil/common OLD_FILES+=usr/tests/sys/netpfil/pf/sniffer.py OLD_FILES+=usr/tests/sys/netpfil/pf/pft_ping.py From owner-svn-src-all@freebsd.org Thu Aug 29 18:23:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D782DCEFB; Thu, 29 Aug 2019 18:23:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46K9wW2cyBz41xP; Thu, 29 Aug 2019 18:23:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2155A23ED7; Thu, 29 Aug 2019 18:23:39 +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 x7TINdGM054020; Thu, 29 Aug 2019 18:23:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TINcJC054017; Thu, 29 Aug 2019 18:23:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908291823.x7TINcJC054017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 29 Aug 2019 18:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351609 - head/sys/amd64/vmm/io X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/amd64/vmm/io X-SVN-Commit-Revision: 351609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 18:23:39 -0000 Author: jhb Date: Thu Aug 29 18:23:38 2019 New Revision: 351609 URL: https://svnweb.freebsd.org/changeset/base/351609 Log: Simplify bhyve vlapic ESR logic. The bhyve virtual local APIC uses an instance-global flag to indicate when an error LVT is being delivered to prevent infinite recursion. Use a function argument instead to reduce the amount of instance-global state. This was inspired by reviewing the bhyve save/restore work, which saves a copy of the instance-global state for each vlapic. Smart OS bug: https://smartos.org/bugview/OS-7777 Submitted by: Patrick Mooney Reviewed by: markj, rgrimes Obtained from: SmartOS / Joyent Differential Revision: https://reviews.freebsd.org/D20365 Modified: head/sys/amd64/vmm/io/vlapic.c head/sys/amd64/vmm/io/vlapic.h head/sys/amd64/vmm/io/vlapic_priv.h Modified: head/sys/amd64/vmm/io/vlapic.c ============================================================================== --- head/sys/amd64/vmm/io/vlapic.c Thu Aug 29 17:25:50 2019 (r351608) +++ head/sys/amd64/vmm/io/vlapic.c Thu Aug 29 18:23:38 2019 (r351609) @@ -3,6 +3,7 @@ * * Copyright (c) 2011 NetApp, Inc. * All rights reserved. + * Copyright (c) 2019 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -78,6 +79,8 @@ __FBSDID("$FreeBSD$"); */ #define VLAPIC_BUS_FREQ (128 * 1024 * 1024) +static void vlapic_set_error(struct vlapic *, uint32_t, bool); + static __inline uint32_t vlapic_get_id(struct vlapic *vlapic) { @@ -275,7 +278,8 @@ vlapic_set_intr_ready(struct vlapic *vlapic, int vecto } if (vector < 16) { - vlapic_set_error(vlapic, APIC_ESR_RECEIVE_ILLEGAL_VECTOR); + vlapic_set_error(vlapic, APIC_ESR_RECEIVE_ILLEGAL_VECTOR, + false); VLAPIC_CTR1(vlapic, "vlapic ignoring interrupt to vector %d", vector); return (1); @@ -432,20 +436,22 @@ vlapic_mask_lvts(struct vlapic *vlapic) } static int -vlapic_fire_lvt(struct vlapic *vlapic, uint32_t lvt) +vlapic_fire_lvt(struct vlapic *vlapic, u_int lvt) { - uint32_t vec, mode; + uint32_t mode, reg, vec; - if (lvt & APIC_LVT_M) + reg = atomic_load_acq_32(&vlapic->lvt_last[lvt]); + + if (reg & APIC_LVT_M) return (0); + vec = reg & APIC_LVT_VECTOR; + mode = reg & APIC_LVT_DM; - vec = lvt & APIC_LVT_VECTOR; - mode = lvt & APIC_LVT_DM; - switch (mode) { case APIC_LVT_DM_FIXED: if (vec < 16) { - vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR); + vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR, + lvt == APIC_LVT_ERROR); return (0); } if (vlapic_set_intr_ready(vlapic, vec, false)) @@ -606,22 +612,22 @@ vlapic_periodic_timer(struct vlapic *vlapic) static VMM_STAT(VLAPIC_INTR_ERROR, "error interrupts generated by vlapic"); -void -vlapic_set_error(struct vlapic *vlapic, uint32_t mask) +static void +vlapic_set_error(struct vlapic *vlapic, uint32_t mask, bool lvt_error) { - uint32_t lvt; vlapic->esr_pending |= mask; - if (vlapic->esr_firing) + + /* + * Avoid infinite recursion if the error LVT itself is configured with + * an illegal vector. + */ + if (lvt_error) return; - vlapic->esr_firing = 1; - // The error LVT always uses the fixed delivery mode. - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_ERROR_LVT); - if (vlapic_fire_lvt(vlapic, lvt | APIC_LVT_DM_FIXED)) { + if (vlapic_fire_lvt(vlapic, APIC_LVT_ERROR)) { vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_INTR_ERROR, 1); } - vlapic->esr_firing = 0; } static VMM_STAT(VLAPIC_INTR_TIMER, "timer interrupts generated by vlapic"); @@ -629,13 +635,10 @@ static VMM_STAT(VLAPIC_INTR_TIMER, "timer interrupts g static void vlapic_fire_timer(struct vlapic *vlapic) { - uint32_t lvt; KASSERT(VLAPIC_TIMER_LOCKED(vlapic), ("vlapic_fire_timer not locked")); - - // The timer LVT always uses the fixed delivery mode. - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_TIMER_LVT); - if (vlapic_fire_lvt(vlapic, lvt | APIC_LVT_DM_FIXED)) { + + if (vlapic_fire_lvt(vlapic, APIC_LVT_TIMER)) { VLAPIC_CTR0(vlapic, "vlapic timer fired"); vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_INTR_TIMER, 1); } @@ -647,10 +650,8 @@ static VMM_STAT(VLAPIC_INTR_CMC, void vlapic_fire_cmci(struct vlapic *vlapic) { - uint32_t lvt; - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_CMCI_LVT); - if (vlapic_fire_lvt(vlapic, lvt)) { + if (vlapic_fire_lvt(vlapic, APIC_LVT_CMCI)) { vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_INTR_CMC, 1); } } @@ -661,7 +662,6 @@ static VMM_STAT_ARRAY(LVTS_TRIGGERRED, VLAPIC_MAXLVT_I int vlapic_trigger_lvt(struct vlapic *vlapic, int vector) { - uint32_t lvt; if (vlapic_enabled(vlapic) == false) { /* @@ -684,35 +684,20 @@ vlapic_trigger_lvt(struct vlapic *vlapic, int vector) switch (vector) { case APIC_LVT_LINT0: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_LINT0_LVT); - break; case APIC_LVT_LINT1: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_LINT1_LVT); - break; case APIC_LVT_TIMER: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_TIMER_LVT); - lvt |= APIC_LVT_DM_FIXED; - break; case APIC_LVT_ERROR: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_ERROR_LVT); - lvt |= APIC_LVT_DM_FIXED; - break; case APIC_LVT_PMC: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_PERF_LVT); - break; case APIC_LVT_THERMAL: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_THERM_LVT); - break; case APIC_LVT_CMCI: - lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_CMCI_LVT); + if (vlapic_fire_lvt(vlapic, vector)) { + vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, + LVTS_TRIGGERRED, vector, 1); + } break; default: return (EINVAL); } - if (vlapic_fire_lvt(vlapic, lvt)) { - vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, - LVTS_TRIGGERRED, vector, 1); - } return (0); } @@ -980,7 +965,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool mode = icrval & APIC_DELMODE_MASK; if (mode == APIC_DELMODE_FIXED && vec < 16) { - vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR); + vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR, false); VLAPIC_CTR1(vlapic, "Ignoring invalid IPI %d", vec); return (0); } Modified: head/sys/amd64/vmm/io/vlapic.h ============================================================================== --- head/sys/amd64/vmm/io/vlapic.h Thu Aug 29 17:25:50 2019 (r351608) +++ head/sys/amd64/vmm/io/vlapic.h Thu Aug 29 18:23:38 2019 (r351609) @@ -71,7 +71,6 @@ int vlapic_set_intr_ready(struct vlapic *vlapic, int v */ void vlapic_post_intr(struct vlapic *vlapic, int hostcpu, int ipinum); -void vlapic_set_error(struct vlapic *vlapic, uint32_t mask); void vlapic_fire_cmci(struct vlapic *vlapic); int vlapic_trigger_lvt(struct vlapic *vlapic, int vector); Modified: head/sys/amd64/vmm/io/vlapic_priv.h ============================================================================== --- head/sys/amd64/vmm/io/vlapic_priv.h Thu Aug 29 17:25:50 2019 (r351608) +++ head/sys/amd64/vmm/io/vlapic_priv.h Thu Aug 29 18:23:38 2019 (r351609) @@ -156,7 +156,6 @@ struct vlapic { struct vlapic_ops ops; uint32_t esr_pending; - int esr_firing; struct callout callout; /* vlapic timer */ struct bintime timer_fire_bt; /* callout expiry time */ From owner-svn-src-all@freebsd.org Thu Aug 29 19:13:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68D48DDED2; Thu, 29 Aug 2019 19:13:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KC252wcWz45Ck; Thu, 29 Aug 2019 19:13:33 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45E5C247F2; Thu, 29 Aug 2019 19:13:33 +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 x7TJDXwM083999; Thu, 29 Aug 2019 19:13:33 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TJDV5x083987; Thu, 29 Aug 2019 19:13:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908291913.x7TJDV5x083987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 29 Aug 2019 19:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351611 - in stable: 11/contrib/wpa/hostapd 11/contrib/wpa/hs20/client 11/contrib/wpa/src/ap 11/contrib/wpa/src/common 11/contrib/wpa/src/crypto 11/contrib/wpa/src/drivers 11/contrib/wp... X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/wpa/hostapd 11/contrib/wpa/hs20/client 11/contrib/wpa/src/ap 11/contrib/wpa/src/common 11/contrib/wpa/src/crypto 11/contrib/wpa/src/drivers 11/contrib/wpa/src/eap_common 11/contr... X-SVN-Commit-Revision: 351611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 19:13:33 -0000 Author: cy Date: Thu Aug 29 19:13:27 2019 New Revision: 351611 URL: https://svnweb.freebsd.org/changeset/base/351611 Log: MFC r351397: MFV r346563: Update wpa 2.8 --> 2.9 hostapd: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching * added configuration of airtime policy * fixed FILS to and RSNE into (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * added support for regulatory WMM limitation (for ETSI) * added support for MACsec Key Agreement using IEEE 802.1X/PSK * added experimental support for EAP-TEAP server (RFC 7170) * added experimental support for EAP-TLS server with TLS v1.3 * added support for two server certificates/keys (RSA/ECC) * added AKMSuiteSelector into "STA " control interface data to determine with AKM was used for an association * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and fast reauthentication use to be disabled * fixed an ECDH operation corner case with OpenSSL wpa_supplicant: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - allow the set of groups to be configured (eap_pwd_groups) - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching (disabled by default for backwards compatibility; can be enabled with ft_eap_pmksa_caching=1) * fixed a regression in OpenSSL 1.1+ engine loading * added validation of RSNE in (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * extended EAP-SIM/AKA fast re-authentication to allow use with FILS * extended ca_cert_blob to support PEM format * improved robustness of P2P Action frame scheduling * added support for EAP-SIM/AKA using anonymous@realm identity * fixed Hotspot 2.0 credential selection based on roaming consortium to ignore credentials without a specific EAP method * added experimental support for EAP-TEAP peer (RFC 7170) * added experimental support for EAP-TLS peer with TLS v1.3 * fixed a regression in WMM parameter configuration for a TDLS peer * fixed a regression in operation with drivers that offload 802.1X 4-way handshake * fixed an ECDH operation corner case with OpenSSL Security: https://w1.fi/security/2019-6/\ sae-eap-pwd-side-channel-attack-update.txt Added: stable/12/contrib/wpa/src/ap/airtime_policy.c - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.c stable/12/contrib/wpa/src/ap/airtime_policy.h - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.h stable/12/contrib/wpa/src/ap/wpa_auth_kay.c - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.c stable/12/contrib/wpa/src/ap/wpa_auth_kay.h - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.h stable/12/contrib/wpa/src/common/dragonfly.c - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.c stable/12/contrib/wpa/src/common/dragonfly.h - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.h stable/12/contrib/wpa/src/drivers/driver_atheros.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_atheros.c stable/12/contrib/wpa/src/drivers/driver_hostap.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_hostap.c stable/12/contrib/wpa/src/drivers/nl80211_copy.h - copied unchanged from r351397, head/contrib/wpa/src/drivers/nl80211_copy.h stable/12/contrib/wpa/src/eap_common/eap_teap_common.c - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.c stable/12/contrib/wpa/src/eap_common/eap_teap_common.h - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.h stable/12/contrib/wpa/src/eap_peer/eap_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap.c stable/12/contrib/wpa/src/eap_peer/eap_teap_pac.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.c stable/12/contrib/wpa/src/eap_peer/eap_teap_pac.h - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.h stable/12/contrib/wpa/src/eap_server/eap_server_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_server/eap_server_teap.c Modified: stable/12/contrib/wpa/hostapd/ChangeLog stable/12/contrib/wpa/hostapd/config_file.c stable/12/contrib/wpa/hostapd/ctrl_iface.c stable/12/contrib/wpa/hostapd/defconfig stable/12/contrib/wpa/hostapd/eap_register.c stable/12/contrib/wpa/hostapd/hostapd.conf stable/12/contrib/wpa/hostapd/hostapd_cli.c stable/12/contrib/wpa/hostapd/main.c stable/12/contrib/wpa/hs20/client/osu_client.c stable/12/contrib/wpa/src/ap/accounting.c stable/12/contrib/wpa/src/ap/acs.c stable/12/contrib/wpa/src/ap/ap_config.c stable/12/contrib/wpa/src/ap/ap_config.h stable/12/contrib/wpa/src/ap/ap_drv_ops.c stable/12/contrib/wpa/src/ap/ap_drv_ops.h stable/12/contrib/wpa/src/ap/authsrv.c stable/12/contrib/wpa/src/ap/beacon.c stable/12/contrib/wpa/src/ap/ctrl_iface_ap.c stable/12/contrib/wpa/src/ap/dfs.c stable/12/contrib/wpa/src/ap/dpp_hostapd.c stable/12/contrib/wpa/src/ap/dpp_hostapd.h stable/12/contrib/wpa/src/ap/drv_callbacks.c stable/12/contrib/wpa/src/ap/gas_serv.c stable/12/contrib/wpa/src/ap/gas_serv.h stable/12/contrib/wpa/src/ap/hostapd.c stable/12/contrib/wpa/src/ap/hostapd.h stable/12/contrib/wpa/src/ap/hw_features.c stable/12/contrib/wpa/src/ap/ieee802_11.c stable/12/contrib/wpa/src/ap/ieee802_11.h stable/12/contrib/wpa/src/ap/ieee802_11_he.c stable/12/contrib/wpa/src/ap/ieee802_11_vht.c stable/12/contrib/wpa/src/ap/ieee802_1x.c stable/12/contrib/wpa/src/ap/ieee802_1x.h stable/12/contrib/wpa/src/ap/neighbor_db.c stable/12/contrib/wpa/src/ap/sta_info.c stable/12/contrib/wpa/src/ap/sta_info.h stable/12/contrib/wpa/src/ap/wmm.c stable/12/contrib/wpa/src/ap/wpa_auth.c stable/12/contrib/wpa/src/ap/wpa_auth.h stable/12/contrib/wpa/src/ap/wpa_auth_ft.c stable/12/contrib/wpa/src/ap/wpa_auth_glue.c stable/12/contrib/wpa/src/ap/wpa_auth_ie.c stable/12/contrib/wpa/src/common/dpp.c stable/12/contrib/wpa/src/common/dpp.h stable/12/contrib/wpa/src/common/hw_features_common.c stable/12/contrib/wpa/src/common/hw_features_common.h stable/12/contrib/wpa/src/common/ieee802_11_common.c stable/12/contrib/wpa/src/common/ieee802_11_common.h stable/12/contrib/wpa/src/common/ieee802_11_defs.h stable/12/contrib/wpa/src/common/qca-vendor.h stable/12/contrib/wpa/src/common/sae.c stable/12/contrib/wpa/src/common/sae.h stable/12/contrib/wpa/src/common/version.h stable/12/contrib/wpa/src/common/wpa_common.c stable/12/contrib/wpa/src/common/wpa_ctrl.h stable/12/contrib/wpa/src/crypto/aes_i.h stable/12/contrib/wpa/src/crypto/crypto.h stable/12/contrib/wpa/src/crypto/crypto_openssl.c stable/12/contrib/wpa/src/crypto/crypto_wolfssl.c stable/12/contrib/wpa/src/crypto/sha1-internal.c stable/12/contrib/wpa/src/crypto/sha1-prf.c stable/12/contrib/wpa/src/crypto/sha1-tlsprf.c stable/12/contrib/wpa/src/crypto/sha1-tprf.c stable/12/contrib/wpa/src/crypto/sha1.c stable/12/contrib/wpa/src/crypto/sha256-kdf.c stable/12/contrib/wpa/src/crypto/sha256-prf.c stable/12/contrib/wpa/src/crypto/sha256-tlsprf.c stable/12/contrib/wpa/src/crypto/sha256.h stable/12/contrib/wpa/src/crypto/sha384-kdf.c stable/12/contrib/wpa/src/crypto/sha384-prf.c stable/12/contrib/wpa/src/crypto/sha512-kdf.c stable/12/contrib/wpa/src/crypto/sha512-prf.c stable/12/contrib/wpa/src/crypto/tls.h stable/12/contrib/wpa/src/crypto/tls_openssl.c stable/12/contrib/wpa/src/crypto/tls_wolfssl.c stable/12/contrib/wpa/src/drivers/driver.h stable/12/contrib/wpa/src/drivers/driver_bsd.c stable/12/contrib/wpa/src/drivers/driver_common.c stable/12/contrib/wpa/src/drivers/driver_macsec_linux.c stable/12/contrib/wpa/src/drivers/driver_macsec_qca.c stable/12/contrib/wpa/src/drivers/driver_ndis.c stable/12/contrib/wpa/src/drivers/driver_nl80211.h stable/12/contrib/wpa/src/drivers/driver_nl80211_capa.c stable/12/contrib/wpa/src/drivers/driver_nl80211_event.c stable/12/contrib/wpa/src/drivers/driver_privsep.c stable/12/contrib/wpa/src/eap_common/eap_defs.h stable/12/contrib/wpa/src/eap_common/eap_pwd_common.c stable/12/contrib/wpa/src/eap_common/eap_sim_common.c stable/12/contrib/wpa/src/eap_common/eap_sim_common.h stable/12/contrib/wpa/src/eap_peer/eap.c stable/12/contrib/wpa/src/eap_peer/eap.h stable/12/contrib/wpa/src/eap_peer/eap_aka.c stable/12/contrib/wpa/src/eap_peer/eap_config.h stable/12/contrib/wpa/src/eap_peer/eap_eke.c stable/12/contrib/wpa/src/eap_peer/eap_leap.c stable/12/contrib/wpa/src/eap_peer/eap_methods.h stable/12/contrib/wpa/src/eap_peer/eap_peap.c stable/12/contrib/wpa/src/eap_peer/eap_pwd.c stable/12/contrib/wpa/src/eap_peer/eap_sim.c stable/12/contrib/wpa/src/eap_peer/eap_tls.c stable/12/contrib/wpa/src/eap_peer/eap_tls_common.c stable/12/contrib/wpa/src/eap_peer/eap_tls_common.h stable/12/contrib/wpa/src/eap_server/eap.h stable/12/contrib/wpa/src/eap_server/eap_i.h stable/12/contrib/wpa/src/eap_server/eap_methods.h stable/12/contrib/wpa/src/eap_server/eap_server.c stable/12/contrib/wpa/src/eap_server/eap_server_aka.c stable/12/contrib/wpa/src/eap_server/eap_server_pax.c stable/12/contrib/wpa/src/eap_server/eap_server_peap.c stable/12/contrib/wpa/src/eap_server/eap_server_pwd.c stable/12/contrib/wpa/src/eap_server/eap_server_sim.c stable/12/contrib/wpa/src/eap_server/eap_server_tls.c stable/12/contrib/wpa/src/eap_server/eap_server_tls_common.c stable/12/contrib/wpa/src/eap_server/eap_tls_common.h stable/12/contrib/wpa/src/eapol_auth/eapol_auth_sm.c stable/12/contrib/wpa/src/eapol_auth/eapol_auth_sm.h stable/12/contrib/wpa/src/eapol_supp/eapol_supp_sm.c stable/12/contrib/wpa/src/eapol_supp/eapol_supp_sm.h stable/12/contrib/wpa/src/p2p/p2p.c stable/12/contrib/wpa/src/p2p/p2p_go_neg.c stable/12/contrib/wpa/src/p2p/p2p_i.h stable/12/contrib/wpa/src/pae/ieee802_1x_kay.c stable/12/contrib/wpa/src/radius/radius_server.c stable/12/contrib/wpa/src/radius/radius_server.h stable/12/contrib/wpa/src/rsn_supp/wpa.c stable/12/contrib/wpa/src/rsn_supp/wpa.h stable/12/contrib/wpa/src/rsn_supp/wpa_ft.c stable/12/contrib/wpa/src/rsn_supp/wpa_i.h stable/12/contrib/wpa/src/tls/asn1.c stable/12/contrib/wpa/src/tls/libtommath.c stable/12/contrib/wpa/src/tls/x509v3.c stable/12/contrib/wpa/src/utils/common.c stable/12/contrib/wpa/src/utils/common.h stable/12/contrib/wpa/src/utils/trace.c stable/12/contrib/wpa/src/utils/wpa_debug.c stable/12/contrib/wpa/src/wps/wps.h stable/12/contrib/wpa/wpa_supplicant/Android.mk stable/12/contrib/wpa/wpa_supplicant/ChangeLog stable/12/contrib/wpa/wpa_supplicant/README-DPP stable/12/contrib/wpa/wpa_supplicant/ap.c stable/12/contrib/wpa/wpa_supplicant/ap.h stable/12/contrib/wpa/wpa_supplicant/bss.c stable/12/contrib/wpa/wpa_supplicant/config.c stable/12/contrib/wpa/wpa_supplicant/config.h stable/12/contrib/wpa/wpa_supplicant/config_file.c stable/12/contrib/wpa/wpa_supplicant/config_ssid.h stable/12/contrib/wpa/wpa_supplicant/ctrl_iface.c stable/12/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c stable/12/contrib/wpa/wpa_supplicant/defconfig stable/12/contrib/wpa/wpa_supplicant/dpp_supplicant.c stable/12/contrib/wpa/wpa_supplicant/dpp_supplicant.h stable/12/contrib/wpa/wpa_supplicant/driver_i.h stable/12/contrib/wpa/wpa_supplicant/eap_register.c stable/12/contrib/wpa/wpa_supplicant/eapol_test.c stable/12/contrib/wpa/wpa_supplicant/events.c stable/12/contrib/wpa/wpa_supplicant/ibss_rsn.c stable/12/contrib/wpa/wpa_supplicant/interworking.c stable/12/contrib/wpa/wpa_supplicant/mesh.c stable/12/contrib/wpa/wpa_supplicant/mesh_mpm.c stable/12/contrib/wpa/wpa_supplicant/notify.c stable/12/contrib/wpa/wpa_supplicant/notify.h stable/12/contrib/wpa/wpa_supplicant/op_classes.c stable/12/contrib/wpa/wpa_supplicant/p2p_supplicant.c stable/12/contrib/wpa/wpa_supplicant/preauth_test.c stable/12/contrib/wpa/wpa_supplicant/rrm.c stable/12/contrib/wpa/wpa_supplicant/sme.c stable/12/contrib/wpa/wpa_supplicant/wnm_sta.c stable/12/contrib/wpa/wpa_supplicant/wpa_cli.c stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant.c stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant.conf stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h stable/12/contrib/wpa/wpa_supplicant/wpas_glue.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/contrib/wpa/src/ap/airtime_policy.c - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.c stable/11/contrib/wpa/src/ap/airtime_policy.h - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.h stable/11/contrib/wpa/src/ap/wpa_auth_kay.c - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.c stable/11/contrib/wpa/src/ap/wpa_auth_kay.h - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.h stable/11/contrib/wpa/src/common/dragonfly.c - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.c stable/11/contrib/wpa/src/common/dragonfly.h - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.h stable/11/contrib/wpa/src/drivers/driver_atheros.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_atheros.c stable/11/contrib/wpa/src/drivers/driver_hostap.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_hostap.c stable/11/contrib/wpa/src/drivers/nl80211_copy.h - copied unchanged from r351397, head/contrib/wpa/src/drivers/nl80211_copy.h stable/11/contrib/wpa/src/eap_common/eap_teap_common.c - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.c stable/11/contrib/wpa/src/eap_common/eap_teap_common.h - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.h stable/11/contrib/wpa/src/eap_peer/eap_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap.c stable/11/contrib/wpa/src/eap_peer/eap_teap_pac.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.c stable/11/contrib/wpa/src/eap_peer/eap_teap_pac.h - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.h stable/11/contrib/wpa/src/eap_server/eap_server_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_server/eap_server_teap.c Modified: stable/11/contrib/wpa/hostapd/ChangeLog stable/11/contrib/wpa/hostapd/config_file.c stable/11/contrib/wpa/hostapd/ctrl_iface.c stable/11/contrib/wpa/hostapd/defconfig stable/11/contrib/wpa/hostapd/eap_register.c stable/11/contrib/wpa/hostapd/hostapd.conf stable/11/contrib/wpa/hostapd/hostapd_cli.c stable/11/contrib/wpa/hostapd/main.c stable/11/contrib/wpa/hs20/client/osu_client.c stable/11/contrib/wpa/src/ap/accounting.c stable/11/contrib/wpa/src/ap/acs.c stable/11/contrib/wpa/src/ap/ap_config.c stable/11/contrib/wpa/src/ap/ap_config.h stable/11/contrib/wpa/src/ap/ap_drv_ops.c stable/11/contrib/wpa/src/ap/ap_drv_ops.h stable/11/contrib/wpa/src/ap/authsrv.c stable/11/contrib/wpa/src/ap/beacon.c stable/11/contrib/wpa/src/ap/ctrl_iface_ap.c stable/11/contrib/wpa/src/ap/dfs.c stable/11/contrib/wpa/src/ap/dpp_hostapd.c stable/11/contrib/wpa/src/ap/dpp_hostapd.h stable/11/contrib/wpa/src/ap/drv_callbacks.c stable/11/contrib/wpa/src/ap/gas_serv.c stable/11/contrib/wpa/src/ap/gas_serv.h stable/11/contrib/wpa/src/ap/hostapd.c stable/11/contrib/wpa/src/ap/hostapd.h stable/11/contrib/wpa/src/ap/hw_features.c stable/11/contrib/wpa/src/ap/ieee802_11.c stable/11/contrib/wpa/src/ap/ieee802_11.h stable/11/contrib/wpa/src/ap/ieee802_11_he.c stable/11/contrib/wpa/src/ap/ieee802_11_vht.c stable/11/contrib/wpa/src/ap/ieee802_1x.c stable/11/contrib/wpa/src/ap/ieee802_1x.h stable/11/contrib/wpa/src/ap/neighbor_db.c stable/11/contrib/wpa/src/ap/sta_info.c stable/11/contrib/wpa/src/ap/sta_info.h stable/11/contrib/wpa/src/ap/wmm.c stable/11/contrib/wpa/src/ap/wpa_auth.c stable/11/contrib/wpa/src/ap/wpa_auth.h stable/11/contrib/wpa/src/ap/wpa_auth_ft.c stable/11/contrib/wpa/src/ap/wpa_auth_glue.c stable/11/contrib/wpa/src/ap/wpa_auth_ie.c stable/11/contrib/wpa/src/common/dpp.c stable/11/contrib/wpa/src/common/dpp.h stable/11/contrib/wpa/src/common/hw_features_common.c stable/11/contrib/wpa/src/common/hw_features_common.h stable/11/contrib/wpa/src/common/ieee802_11_common.c stable/11/contrib/wpa/src/common/ieee802_11_common.h stable/11/contrib/wpa/src/common/ieee802_11_defs.h stable/11/contrib/wpa/src/common/qca-vendor.h stable/11/contrib/wpa/src/common/sae.c stable/11/contrib/wpa/src/common/sae.h stable/11/contrib/wpa/src/common/version.h stable/11/contrib/wpa/src/common/wpa_common.c stable/11/contrib/wpa/src/common/wpa_ctrl.h stable/11/contrib/wpa/src/crypto/aes_i.h stable/11/contrib/wpa/src/crypto/crypto.h stable/11/contrib/wpa/src/crypto/crypto_openssl.c stable/11/contrib/wpa/src/crypto/crypto_wolfssl.c stable/11/contrib/wpa/src/crypto/sha1-internal.c stable/11/contrib/wpa/src/crypto/sha1-prf.c stable/11/contrib/wpa/src/crypto/sha1-tlsprf.c stable/11/contrib/wpa/src/crypto/sha1-tprf.c stable/11/contrib/wpa/src/crypto/sha1.c stable/11/contrib/wpa/src/crypto/sha256-kdf.c stable/11/contrib/wpa/src/crypto/sha256-prf.c stable/11/contrib/wpa/src/crypto/sha256-tlsprf.c stable/11/contrib/wpa/src/crypto/sha256.h stable/11/contrib/wpa/src/crypto/sha384-kdf.c stable/11/contrib/wpa/src/crypto/sha384-prf.c stable/11/contrib/wpa/src/crypto/sha512-kdf.c stable/11/contrib/wpa/src/crypto/sha512-prf.c stable/11/contrib/wpa/src/crypto/tls.h stable/11/contrib/wpa/src/crypto/tls_openssl.c stable/11/contrib/wpa/src/crypto/tls_wolfssl.c stable/11/contrib/wpa/src/drivers/driver.h stable/11/contrib/wpa/src/drivers/driver_bsd.c stable/11/contrib/wpa/src/drivers/driver_common.c stable/11/contrib/wpa/src/drivers/driver_macsec_linux.c stable/11/contrib/wpa/src/drivers/driver_macsec_qca.c stable/11/contrib/wpa/src/drivers/driver_ndis.c stable/11/contrib/wpa/src/drivers/driver_nl80211.h stable/11/contrib/wpa/src/drivers/driver_nl80211_capa.c stable/11/contrib/wpa/src/drivers/driver_nl80211_event.c stable/11/contrib/wpa/src/drivers/driver_privsep.c stable/11/contrib/wpa/src/eap_common/eap_defs.h stable/11/contrib/wpa/src/eap_common/eap_pwd_common.c stable/11/contrib/wpa/src/eap_common/eap_sim_common.c stable/11/contrib/wpa/src/eap_common/eap_sim_common.h stable/11/contrib/wpa/src/eap_peer/eap.c stable/11/contrib/wpa/src/eap_peer/eap.h stable/11/contrib/wpa/src/eap_peer/eap_aka.c stable/11/contrib/wpa/src/eap_peer/eap_config.h stable/11/contrib/wpa/src/eap_peer/eap_eke.c stable/11/contrib/wpa/src/eap_peer/eap_leap.c stable/11/contrib/wpa/src/eap_peer/eap_methods.h stable/11/contrib/wpa/src/eap_peer/eap_peap.c stable/11/contrib/wpa/src/eap_peer/eap_pwd.c stable/11/contrib/wpa/src/eap_peer/eap_sim.c stable/11/contrib/wpa/src/eap_peer/eap_tls.c stable/11/contrib/wpa/src/eap_peer/eap_tls_common.c stable/11/contrib/wpa/src/eap_peer/eap_tls_common.h stable/11/contrib/wpa/src/eap_server/eap.h stable/11/contrib/wpa/src/eap_server/eap_i.h stable/11/contrib/wpa/src/eap_server/eap_methods.h stable/11/contrib/wpa/src/eap_server/eap_server.c stable/11/contrib/wpa/src/eap_server/eap_server_aka.c stable/11/contrib/wpa/src/eap_server/eap_server_pax.c stable/11/contrib/wpa/src/eap_server/eap_server_peap.c stable/11/contrib/wpa/src/eap_server/eap_server_pwd.c stable/11/contrib/wpa/src/eap_server/eap_server_sim.c stable/11/contrib/wpa/src/eap_server/eap_server_tls.c stable/11/contrib/wpa/src/eap_server/eap_server_tls_common.c stable/11/contrib/wpa/src/eap_server/eap_tls_common.h stable/11/contrib/wpa/src/eapol_auth/eapol_auth_sm.c stable/11/contrib/wpa/src/eapol_auth/eapol_auth_sm.h stable/11/contrib/wpa/src/eapol_supp/eapol_supp_sm.c stable/11/contrib/wpa/src/eapol_supp/eapol_supp_sm.h stable/11/contrib/wpa/src/p2p/p2p.c stable/11/contrib/wpa/src/p2p/p2p_go_neg.c stable/11/contrib/wpa/src/p2p/p2p_i.h stable/11/contrib/wpa/src/pae/ieee802_1x_kay.c stable/11/contrib/wpa/src/radius/radius_server.c stable/11/contrib/wpa/src/radius/radius_server.h stable/11/contrib/wpa/src/rsn_supp/wpa.c stable/11/contrib/wpa/src/rsn_supp/wpa.h stable/11/contrib/wpa/src/rsn_supp/wpa_ft.c stable/11/contrib/wpa/src/rsn_supp/wpa_i.h stable/11/contrib/wpa/src/tls/asn1.c stable/11/contrib/wpa/src/tls/libtommath.c stable/11/contrib/wpa/src/tls/x509v3.c stable/11/contrib/wpa/src/utils/common.c stable/11/contrib/wpa/src/utils/common.h stable/11/contrib/wpa/src/utils/trace.c stable/11/contrib/wpa/src/utils/wpa_debug.c stable/11/contrib/wpa/src/wps/wps.h stable/11/contrib/wpa/wpa_supplicant/Android.mk stable/11/contrib/wpa/wpa_supplicant/ChangeLog stable/11/contrib/wpa/wpa_supplicant/README-DPP stable/11/contrib/wpa/wpa_supplicant/ap.c stable/11/contrib/wpa/wpa_supplicant/ap.h stable/11/contrib/wpa/wpa_supplicant/bss.c stable/11/contrib/wpa/wpa_supplicant/config.c stable/11/contrib/wpa/wpa_supplicant/config.h stable/11/contrib/wpa/wpa_supplicant/config_file.c stable/11/contrib/wpa/wpa_supplicant/config_ssid.h stable/11/contrib/wpa/wpa_supplicant/ctrl_iface.c stable/11/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c stable/11/contrib/wpa/wpa_supplicant/defconfig stable/11/contrib/wpa/wpa_supplicant/dpp_supplicant.c stable/11/contrib/wpa/wpa_supplicant/dpp_supplicant.h stable/11/contrib/wpa/wpa_supplicant/driver_i.h stable/11/contrib/wpa/wpa_supplicant/eap_register.c stable/11/contrib/wpa/wpa_supplicant/eapol_test.c stable/11/contrib/wpa/wpa_supplicant/events.c stable/11/contrib/wpa/wpa_supplicant/ibss_rsn.c stable/11/contrib/wpa/wpa_supplicant/interworking.c stable/11/contrib/wpa/wpa_supplicant/mesh.c stable/11/contrib/wpa/wpa_supplicant/mesh_mpm.c stable/11/contrib/wpa/wpa_supplicant/notify.c stable/11/contrib/wpa/wpa_supplicant/notify.h stable/11/contrib/wpa/wpa_supplicant/op_classes.c stable/11/contrib/wpa/wpa_supplicant/p2p_supplicant.c stable/11/contrib/wpa/wpa_supplicant/preauth_test.c stable/11/contrib/wpa/wpa_supplicant/rrm.c stable/11/contrib/wpa/wpa_supplicant/sme.c stable/11/contrib/wpa/wpa_supplicant/wnm_sta.c stable/11/contrib/wpa/wpa_supplicant/wpa_cli.c stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant.c stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant.conf stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h stable/11/contrib/wpa/wpa_supplicant/wpas_glue.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/wpa/hostapd/ChangeLog ============================================================================== --- stable/12/contrib/wpa/hostapd/ChangeLog Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/ChangeLog Thu Aug 29 19:13:27 2019 (r351611) @@ -1,5 +1,29 @@ ChangeLog for hostapd +2019-08-07 - v2.9 + * SAE changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * EAP-pwd changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * fixed FT-EAP initial mobility domain association using PMKSA caching + * added configuration of airtime policy + * fixed FILS to and RSNE into (Re)Association Response frames + * fixed DPP bootstrapping URI parser of channel list + * added support for regulatory WMM limitation (for ETSI) + * added support for MACsec Key Agreement using IEEE 802.1X/PSK + * added experimental support for EAP-TEAP server (RFC 7170) + * added experimental support for EAP-TLS server with TLS v1.3 + * added support for two server certificates/keys (RSA/ECC) + * added AKMSuiteSelector into "STA " control interface data to + determine with AKM was used for an association + * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and + fast reauthentication use to be disabled + * fixed an ECDH operation corner case with OpenSSL + 2019-04-21 - v2.8 * SAE changes - added support for SAE Password Identifier Modified: stable/12/contrib/wpa/hostapd/config_file.c ============================================================================== --- stable/12/contrib/wpa/hostapd/config_file.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/config_file.c Thu Aug 29 19:13:27 2019 (r351611) @@ -24,14 +24,6 @@ #include "config_file.h" -#ifndef CONFIG_NO_RADIUS -#ifdef EAP_SERVER -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value); -#endif /* EAP_SERVER */ -#endif /* CONFIG_NO_RADIUS */ - - #ifndef CONFIG_NO_VLAN static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss, const char *fname) @@ -660,76 +652,7 @@ hostapd_config_read_radius_addr(struct hostapd_radius_ } -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value) -{ - const char *pos; - char syntax; - struct hostapd_radius_attr *attr; - size_t len; - attr = os_zalloc(sizeof(*attr)); - if (attr == NULL) - return NULL; - - attr->type = atoi(value); - - pos = os_strchr(value, ':'); - if (pos == NULL) { - attr->val = wpabuf_alloc(1); - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - wpabuf_put_u8(attr->val, 0); - return attr; - } - - pos++; - if (pos[0] == '\0' || pos[1] != ':') { - os_free(attr); - return NULL; - } - syntax = *pos++; - pos++; - - switch (syntax) { - case 's': - attr->val = wpabuf_alloc_copy(pos, os_strlen(pos)); - break; - case 'x': - len = os_strlen(pos); - if (len & 1) - break; - len /= 2; - attr->val = wpabuf_alloc(len); - if (attr->val == NULL) - break; - if (hexstr2bin(pos, wpabuf_put(attr->val, len), len) < 0) { - wpabuf_free(attr->val); - os_free(attr); - return NULL; - } - break; - case 'd': - attr->val = wpabuf_alloc(4); - if (attr->val) - wpabuf_put_be32(attr->val, atoi(pos)); - break; - default: - os_free(attr); - return NULL; - } - - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - - return attr; -} - - static int hostapd_parse_das_client(struct hostapd_bss_config *bss, char *val) { char *secret; @@ -2313,6 +2236,42 @@ static unsigned int parse_tls_flags(const char *val) #endif /* EAP_SERVER */ +#ifdef CONFIG_AIRTIME_POLICY +static int add_airtime_weight(struct hostapd_bss_config *bss, char *value) +{ + struct airtime_sta_weight *wt; + char *pos, *next; + + wt = os_zalloc(sizeof(*wt)); + if (!wt) + return -1; + + /* 02:01:02:03:04:05 10 */ + pos = value; + next = os_strchr(pos, ' '); + if (next) + *next++ = '\0'; + if (!next || hwaddr_aton(pos, wt->addr)) { + wpa_printf(MSG_ERROR, "Invalid station address: '%s'", pos); + os_free(wt); + return -1; + } + + pos = next; + wt->weight = atoi(pos); + if (!wt->weight) { + wpa_printf(MSG_ERROR, "Invalid weight: '%s'", pos); + os_free(wt); + return -1; + } + + wt->next = bss->airtime_weight_list; + bss->airtime_weight_list = wt; + return 0; +} +#endif /* CONFIG_AIRTIME_POLICY */ + + #ifdef CONFIG_SAE static int parse_sae_password(struct hostapd_bss_config *bss, const char *val) { @@ -2376,6 +2335,36 @@ fail: #endif /* CONFIG_SAE */ +#ifdef CONFIG_DPP2 +static int hostapd_dpp_controller_parse(struct hostapd_bss_config *bss, + const char *pos) +{ + struct dpp_controller_conf *conf; + char *val; + + conf = os_zalloc(sizeof(*conf)); + if (!conf) + return -1; + val = get_param(pos, "ipaddr="); + if (!val || hostapd_parse_ip_addr(val, &conf->ipaddr)) + goto fail; + os_free(val); + val = get_param(pos, "pkhash="); + if (!val || os_strlen(val) != 2 * SHA256_MAC_LEN || + hexstr2bin(val, conf->pkhash, SHA256_MAC_LEN) < 0) + goto fail; + os_free(val); + conf->next = bss->dpp_controller; + bss->dpp_controller = conf; + return 0; +fail: + os_free(val); + os_free(conf); + return -1; +} +#endif /* CONFIG_DPP2 */ + + static int hostapd_config_fill(struct hostapd_config *conf, struct hostapd_bss_config *bss, const char *buf, char *pos, int line) @@ -2496,7 +2485,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "eapol_version") == 0) { int eapol_version = atoi(pos); +#ifdef CONFIG_MACSEC + if (eapol_version < 1 || eapol_version > 3) { +#else /* CONFIG_MACSEC */ if (eapol_version < 1 || eapol_version > 2) { +#endif /* CONFIG_MACSEC */ wpa_printf(MSG_ERROR, "Line %d: invalid EAPOL version (%d): '%s'.", line, eapol_version, pos); @@ -2519,12 +2512,21 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "server_cert") == 0) { os_free(bss->server_cert); bss->server_cert = os_strdup(pos); + } else if (os_strcmp(buf, "server_cert2") == 0) { + os_free(bss->server_cert2); + bss->server_cert2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key") == 0) { os_free(bss->private_key); bss->private_key = os_strdup(pos); + } else if (os_strcmp(buf, "private_key2") == 0) { + os_free(bss->private_key2); + bss->private_key2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key_passwd") == 0) { os_free(bss->private_key_passwd); bss->private_key_passwd = os_strdup(pos); + } else if (os_strcmp(buf, "private_key_passwd2") == 0) { + os_free(bss->private_key_passwd2); + bss->private_key_passwd2 = os_strdup(pos); } else if (os_strcmp(buf, "check_cert_subject") == 0) { if (!pos[0]) { wpa_printf(MSG_ERROR, "Line %d: unknown check_cert_subject '%s'", @@ -2605,6 +2607,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "pac_key_refresh_time") == 0) { bss->pac_key_refresh_time = atoi(pos); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + } else if (os_strcmp(buf, "eap_teap_auth") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid eap_teap_auth value", + line); + return 1; + } + bss->eap_teap_auth = val; + } else if (os_strcmp(buf, "eap_teap_pac_no_inner") == 0) { + bss->eap_teap_pac_no_inner = atoi(pos); +#endif /* EAP_SERVER_TEAP */ #ifdef EAP_SERVER_SIM } else if (os_strcmp(buf, "eap_sim_db") == 0) { os_free(bss->eap_sim_db); @@ -2613,6 +2629,8 @@ static int hostapd_config_fill(struct hostapd_config * bss->eap_sim_db_timeout = atoi(pos); } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) { bss->eap_sim_aka_result_ind = atoi(pos); + } else if (os_strcmp(buf, "eap_sim_id") == 0) { + bss->eap_sim_id = atoi(pos); #endif /* EAP_SERVER_SIM */ #ifdef EAP_SERVER_TNC } else if (os_strcmp(buf, "tnc") == 0) { @@ -2816,6 +2834,9 @@ static int hostapd_config_fill(struct hostapd_config * a = a->next; a->next = attr; } + } else if (os_strcmp(buf, "radius_req_attr_sqlite") == 0) { + os_free(bss->radius_req_attr_sqlite); + bss->radius_req_attr_sqlite = os_strdup(pos); } else if (os_strcmp(buf, "radius_das_port") == 0) { bss->radius_das_port = atoi(pos); } else if (os_strcmp(buf, "radius_das_client") == 0) { @@ -3442,6 +3463,8 @@ static int hostapd_config_fill(struct hostapd_config * conf->he_op.he_twt_required = atoi(pos); } else if (os_strcmp(buf, "he_rts_threshold") == 0) { conf->he_op.he_rts_threshold = atoi(pos); + } else if (os_strcmp(buf, "he_basic_mcs_nss_set") == 0) { + conf->he_op.he_basic_mcs_nss_set = atoi(pos); } else if (os_strcmp(buf, "he_mu_edca_qos_info_param_count") == 0) { conf->he_mu_edca.he_qos_info |= set_he_cap(atoi(pos), HE_QOS_INFO_EDCA_PARAM_SET_COUNT); @@ -3526,6 +3549,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "he_mu_edca_ac_vo_timer") == 0) { conf->he_mu_edca.he_mu_ac_vo_param[HE_MU_AC_PARAM_TIMER_IDX] = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_sr_control") == 0) { + conf->spr.sr_control = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_non_srg_obss_pd_max_offset") == 0) { + conf->spr.non_srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_min_offset") == 0) { + conf->spr.srg_obss_pd_min_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_max_offset") == 0) { + conf->spr.srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_oper_chwidth") == 0) { + conf->he_oper_chwidth = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg0_idx") == 0) { + conf->he_oper_centr_freq_seg0_idx = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) { + conf->he_oper_centr_freq_seg1_idx = atoi(pos); #endif /* CONFIG_IEEE80211AX */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); @@ -4298,6 +4335,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "dpp_csign") == 0) { if (parse_wpabuf_hex(line, buf, &bss->dpp_csign, pos)) return 1; +#ifdef CONFIG_DPP2 + } else if (os_strcmp(buf, "dpp_controller") == 0) { + if (hostapd_dpp_controller_parse(bss, pos)) + return 1; +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ #ifdef CONFIG_OWE } else if (os_strcmp(buf, "owe_transition_bssid") == 0) { @@ -4349,6 +4391,121 @@ static int hostapd_config_fill(struct hostapd_config * conf->rssi_reject_assoc_timeout = atoi(pos); } else if (os_strcmp(buf, "pbss") == 0) { bss->pbss = atoi(pos); +#ifdef CONFIG_AIRTIME_POLICY + } else if (os_strcmp(buf, "airtime_mode") == 0) { + int val = atoi(pos); + + if (val < 0 || val > AIRTIME_MODE_MAX) { + wpa_printf(MSG_ERROR, "Line %d: Unknown airtime_mode", + line); + return 1; + } + conf->airtime_mode = val; + } else if (os_strcmp(buf, "airtime_update_interval") == 0) { + conf->airtime_update_interval = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_weight") == 0) { + bss->airtime_weight = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_limit") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime_bss_limit (must be 0 or 1)", + line); + return 1; + } + bss->airtime_limit = val; + } else if (os_strcmp(buf, "airtime_sta_weight") == 0) { + if (add_airtime_weight(bss, pos) < 0) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime weight '%s'", + line, pos); + return 1; + } +#endif /* CONFIG_AIRTIME_POLICY */ +#ifdef CONFIG_MACSEC + } else if (os_strcmp(buf, "macsec_policy") == 0) { + int macsec_policy = atoi(pos); + + if (macsec_policy < 0 || macsec_policy > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_policy (%d): '%s'.", + line, macsec_policy, pos); + return 1; + } + bss->macsec_policy = macsec_policy; + } else if (os_strcmp(buf, "macsec_integ_only") == 0) { + int macsec_integ_only = atoi(pos); + + if (macsec_integ_only < 0 || macsec_integ_only > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_integ_only (%d): '%s'.", + line, macsec_integ_only, pos); + return 1; + } + bss->macsec_integ_only = macsec_integ_only; + } else if (os_strcmp(buf, "macsec_replay_protect") == 0) { + int macsec_replay_protect = atoi(pos); + + if (macsec_replay_protect < 0 || macsec_replay_protect > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_replay_protect (%d): '%s'.", + line, macsec_replay_protect, pos); + return 1; + } + bss->macsec_replay_protect = macsec_replay_protect; + } else if (os_strcmp(buf, "macsec_replay_window") == 0) { + bss->macsec_replay_window = atoi(pos); + } else if (os_strcmp(buf, "macsec_port") == 0) { + int macsec_port = atoi(pos); + + if (macsec_port < 1 || macsec_port > 65534) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_port (%d): '%s'.", + line, macsec_port, pos); + return 1; + } + bss->macsec_port = macsec_port; + } else if (os_strcmp(buf, "mka_priority") == 0) { + int mka_priority = atoi(pos); + + if (mka_priority < 0 || mka_priority > 255) { + wpa_printf(MSG_ERROR, + "Line %d: invalid mka_priority (%d): '%s'.", + line, mka_priority, pos); + return 1; + } + bss->mka_priority = mka_priority; + } else if (os_strcmp(buf, "mka_cak") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CAK_MAX_LEN || + (len != 2 * 16 && len != 2 * 32) || + hexstr2bin(pos, bss->mka_cak, len / 2)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CAK '%s'.", + line, pos); + return 1; + } + bss->mka_cak_len = len / 2; + bss->mka_psk_set |= MKA_PSK_SET_CAK; + } else if (os_strcmp(buf, "mka_ckn") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CKN_MAX_LEN || /* too long */ + len < 2 || /* too short */ + len % 2 != 0 /* not an integral number of bytes */) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return 1; + } + bss->mka_ckn_len = len / 2; + if (hexstr2bin(pos, bss->mka_ckn, bss->mka_ckn_len)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return -1; + } + bss->mka_psk_set |= MKA_PSK_SET_CKN; +#endif /* CONFIG_MACSEC */ } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", Modified: stable/12/contrib/wpa/hostapd/ctrl_iface.c ============================================================================== --- stable/12/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1830,26 +1830,40 @@ static void hostapd_data_test_rx(void *ctx, const u8 * struct iphdr ip; const u8 *pos; unsigned int i; + char extra[30]; - if (len != HWSIM_PACKETLEN) + if (len < sizeof(*eth) + sizeof(ip) || len > HWSIM_PACKETLEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpected length %d", + (int) len); return; + } eth = (const struct ether_header *) buf; os_memcpy(&ip, eth + 1, sizeof(ip)); pos = &buf[sizeof(*eth) + sizeof(ip)]; if (ip.ihl != 5 || ip.version != 4 || - ntohs(ip.tot_len) != HWSIM_IP_LEN) + ntohs(ip.tot_len) > HWSIM_IP_LEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpect IP header"); return; + } - for (i = 0; i < HWSIM_IP_LEN - sizeof(ip); i++) { - if (*pos != (u8) i) + for (i = 0; i < ntohs(ip.tot_len) - sizeof(ip); i++) { + if (*pos != (u8) i) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore mismatching payload"); return; + } pos++; } - wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR, - MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost)); + extra[0] = '\0'; + if (ntohs(ip.tot_len) != HWSIM_IP_LEN) + os_snprintf(extra, sizeof(extra), " len=%d", ntohs(ip.tot_len)); + wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", + MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); } @@ -1894,7 +1908,7 @@ static int hostapd_ctrl_iface_data_test_config(struct static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) { u8 dst[ETH_ALEN], src[ETH_ALEN]; - char *pos; + char *pos, *pos2; int used; long int val; u8 tos; @@ -1903,11 +1917,12 @@ static int hostapd_ctrl_iface_data_test_tx(struct host struct iphdr *ip; u8 *dpos; unsigned int i; + size_t send_len = HWSIM_IP_LEN; if (hapd->l2_test == NULL) return -1; - /* format: */ + /* format: [len=] */ pos = cmd; used = hwaddr_aton2(pos, dst); @@ -1921,11 +1936,19 @@ static int hostapd_ctrl_iface_data_test_tx(struct host return -1; pos += used; - val = strtol(pos, NULL, 0); + val = strtol(pos, &pos2, 0); if (val < 0 || val > 0xff) return -1; tos = val; + pos = os_strstr(pos2, " len="); + if (pos) { + i = atoi(pos + 5); + if (i < sizeof(*ip) || i > HWSIM_IP_LEN) + return -1; + send_len = i; + } + eth = (struct ether_header *) &buf[2]; os_memcpy(eth->ether_dhost, dst, ETH_ALEN); os_memcpy(eth->ether_shost, src, ETH_ALEN); @@ -1936,17 +1959,17 @@ static int hostapd_ctrl_iface_data_test_tx(struct host ip->version = 4; ip->ttl = 64; ip->tos = tos; - ip->tot_len = htons(HWSIM_IP_LEN); + ip->tot_len = htons(send_len); ip->protocol = 1; ip->saddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 1); ip->daddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 2); ip->check = ipv4_hdr_checksum(ip, sizeof(*ip)); dpos = (u8 *) (ip + 1); - for (i = 0; i < HWSIM_IP_LEN - sizeof(*ip); i++) + for (i = 0; i < send_len - sizeof(*ip); i++) *dpos++ = i; if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, &buf[2], - HWSIM_PACKETLEN) < 0) + sizeof(struct ether_header) + send_len) < 0) return -1; wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR Modified: stable/12/contrib/wpa/hostapd/defconfig ============================================================================== --- stable/12/contrib/wpa/hostapd/defconfig Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/defconfig Thu Aug 29 19:13:27 2019 (r351611) @@ -108,11 +108,18 @@ CONFIG_EAP_TTLS=y #CONFIG_EAP_GPSK_SHA256=y # EAP-FAST for the integrated EAP server -# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed -# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g., -# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions. #CONFIG_EAP_FAST=y +# EAP-TEAP for the integrated EAP server +# Note: The current EAP-TEAP implementation is experimental and should not be +# enabled for production use. The IETF RFC 7170 that defines EAP-TEAP has number +# of conflicting statements and missing details and the implementation has +# vendor specific workarounds for those and as such, may not interoperate with +# any other implementation. This should not be used for anything else than +# experimentation and interoperability testing until those issues has been +# resolved. +#CONFIG_EAP_TEAP=y + # Wi-Fi Protected Setup (WPS) #CONFIG_WPS=y # Enable UPnP support for external WPS Registrars @@ -375,6 +382,9 @@ CONFIG_IPV6=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y + +# Airtime policy support +#CONFIG_AIRTIME_POLICY=y # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. Modified: stable/12/contrib/wpa/hostapd/eap_register.c ============================================================================== --- stable/12/contrib/wpa/hostapd/eap_register.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/eap_register.c Thu Aug 29 19:13:27 2019 (r351611) @@ -121,6 +121,11 @@ int eap_server_register_methods(void) ret = eap_server_fast_register(); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + if (ret == 0) + ret = eap_server_teap_register(); +#endif /* EAP_SERVER_TEAP */ + #ifdef EAP_SERVER_WSC if (ret == 0) ret = eap_server_wsc_register(); Modified: stable/12/contrib/wpa/hostapd/hostapd.conf ============================================================================== --- stable/12/contrib/wpa/hostapd/hostapd.conf Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/hostapd.conf Thu Aug 29 19:13:27 2019 (r351611) @@ -782,10 +782,8 @@ wmm_ac_vo_acm=0 # 1 = supported #he_mu_beamformer=1 -# he_bss_color: BSS color -# 0 = no BSS color (default) -# unsigned integer = BSS color -#he_bss_color=0 +# he_bss_color: BSS color (1-63) +#he_bss_color=1 #he_default_pe_duration: The duration of PE field in an HE PPDU in us # Possible values are 0 us (default), 4 us, 8 us, 12 us, and 16 us @@ -801,6 +799,17 @@ wmm_ac_vo_acm=0 # unsigned integer = duration in units of 16 us #he_rts_threshold=0 +# HE operating channel information; see matching vht_* parameters for details. +#he_oper_chwidth +#he_oper_centr_freq_seg0_idx +#he_oper_centr_freq_seg1_idx + +#he_basic_mcs_nss_set: Basic NSS/MCS set +# 16-bit combination of 2-bit values of Max HE-MCS For 1..8 SS; each 2-bit +# value having following meaning: +# 0 = HE-MCS 0-7, 1 = HE-MCS 0-9, 2 = HE-MCS 0-11, 3 = not supported +#he_basic_mcs_nss_set + #he_mu_edca_qos_info_param_count #he_mu_edca_qos_info_q_ack #he_mu_edca_qos_info_queue_request=1 @@ -825,6 +834,12 @@ wmm_ac_vo_acm=0 #he_mu_edca_ac_vo_ecwmax=15 #he_mu_edca_ac_vo_timer=255 +# Spatial Reuse Parameter Set +#he_spr_sr_control +#he_spr_non_srg_obss_pd_max_offset +#he_spr_srg_obss_pd_min_offset +#he_spr_srg_obss_pd_max_offset + ##### IEEE 802.1X-2004 related configuration ################################## # Require IEEE 802.1X authorization @@ -836,6 +851,8 @@ wmm_ac_vo_acm=0 # the new version number correctly (they seem to drop the frames completely). # In order to make hostapd interoperate with these clients, the version number # can be set to the older version (1) with this configuration value. +# Note: When using MACsec, eapol_version shall be set to 3, which is +# defined in IEEE Std 802.1X-2010. #eapol_version=2 # Optional displayable message sent with EAP Request-Identity. The first \0 @@ -879,6 +896,54 @@ eapol_key_index_workaround=0 # ERP is enabled (eap_server_erp=1). #erp_domain=example.com +##### MACsec ################################################################## + +# macsec_policy: IEEE 802.1X/MACsec options +# This determines how sessions are secured with MACsec (only for MACsec +# drivers). +# 0: MACsec not in use (default) +# 1: MACsec enabled - Should secure, accept key server's advice to +# determine whether to use a secure session or not. +# +# macsec_integ_only: IEEE 802.1X/MACsec transmit mode +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Encrypt traffic (default) +# 1: Integrity only +# +# macsec_replay_protect: IEEE 802.1X/MACsec replay protection +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Replay protection disabled (default) +# 1: Replay protection enabled +# +# macsec_replay_window: IEEE 802.1X/MACsec replay protection window +# This determines a window in which replay is tolerated, to allow receipt +# of frames that have been misordered by the network. +# This setting applies only when MACsec replay protection active, i.e., +# - macsec_replay_protect is enabled +# - the key server has decided to enable MACsec +# 0: No replay window, strict check (default) +# 1..2^32-1: number of packets that could be misordered +# +# macsec_port: IEEE 802.1X/MACsec port +# Port component of the SCI +# Range: 1-65534 (default: 1) +# +# mka_priority (Priority of MKA Actor) +# Range: 0..255 (default: 255) +# +# mka_cak, mka_ckn, and mka_priority: IEEE 802.1X/MACsec pre-shared key mode +# This allows to configure MACsec with a pre-shared key using a (CAK,CKN) pair. +# In this mode, instances of hostapd can act as MACsec peers. The peer +# with lower priority will become the key server and start distributing SAKs. +# mka_cak (CAK = Secure Connectivity Association Key) takes a 16-byte (128-bit) +# hex-string (32 hex-digits) or a 32-byte (256-bit) hex-string (64 hex-digits) +# mka_ckn (CKN = CAK Name) takes a 1..32-bytes (8..256 bit) hex-string +# (2..64 hex-digits) + ##### Integrated EAP server ################################################### # Optionally, hostapd can be configured to use an integrated EAP server @@ -912,6 +977,23 @@ eap_server=0 # Passphrase for private key #private_key_passwd=secret passphrase +# An alternative server certificate and private key can be configured with the +# following parameters (with values just like the parameters above without the +# '2' suffix). The ca_cert file (in PEM encoding) is used to add the trust roots +# for both server certificates and/or client certificates). +# +# The main use case for this alternative server certificate configuration is to +# enable both RSA and ECC public keys. The server will pick which one to use +# based on the client preferences for the cipher suite (in the TLS ClientHello +# message). It should be noted that number of deployed EAP peer implementations +# do not filter out the cipher suite list based on their local configuration and +# as such, configuration of alternative types of certificates on the server may +# result in interoperability issues. +#server_cert2=/etc/hostapd.server-ecc.pem +#private_key2=/etc/hostapd.server-ecc.prv +#private_key_passwd2=secret passphrase + + # Server identity # EAP methods that provide mechanism for authenticated server identity delivery # use this value. If not set, "hostapd" is used as a default. @@ -1109,10 +1191,27 @@ eap_server=0 # (or fewer) of the lifetime remains. #pac_key_refresh_time=86400 +# EAP-TEAP authentication type +# 0 = inner EAP (default) +# 1 = Basic-Password-Auth +#eap_teap_auth=0 + +# EAP-TEAP authentication behavior when using PAC +# 0 = perform inner authentication (default) +# 1 = skip inner authentication (inner EAP/Basic-Password-Auth) +#eap_teap_pac_no_inner=0 + # EAP-SIM and EAP-AKA protected success/failure indication using AT_RESULT_IND # (default: 0 = disabled). #eap_sim_aka_result_ind=1 +# EAP-SIM and EAP-AKA identity options +# 0 = do not use pseudonyms or fast reauthentication +# 1 = use pseudonyms, but not fast reauthentication +# 2 = do not use pseudonyms, but use fast reauthentication +# 3 = use pseudonyms and use fast reauthentication (default) +#eap_sim_id=3 + # Trusted Network Connect (TNC) # If enabled, TNC validation will be required before the peer is allowed to # connect. Note: This is only used with EAP-TTLS and EAP-FAST. If any other @@ -1292,6 +1391,17 @@ own_ip_addr=127.0.0.1 # Operator-Name = "Operator" #radius_acct_req_attr=126:s:Operator +# If SQLite support is included, path to a database from which additional +# RADIUS request attributes are extracted based on the station MAC address. +# +# The schema for the radius_attributes table is: +# id | sta | reqtype | attr : multi-key (sta, reqtype) +# id = autonumber +# sta = station MAC address in `11:22:33:44:55:66` format. +# type = `auth` | `acct` | NULL (match any) +# attr = existing config file format, e.g. `126:s:Test Operator` +#radius_req_attr_sqlite=radius_attr.sqlite + # Dynamic Authorization Extensions (RFC 5176) # This mechanism can be used to allow dynamic changes to user session based on # commands from a RADIUS server (or some other disconnect client that has the @@ -2491,6 +2601,42 @@ own_ip_addr=127.0.0.1 # as a radio measurement even if the request doesn't contain a max age element # that allows sending of such data. Default: 0. #stationary_ap=0 + +##### Airtime policy configuration ########################################### + +# Set the airtime policy operating mode: +# 0 = disabled (default) +# 1 = static config +# 2 = per-BSS dynamic config +# 3 = per-BSS limit mode +#airtime_mode=0 + +# Interval (in milliseconds) to poll the kernel for updated station activity in +# dynamic and limit modes +#airtime_update_interval=200 + +# Static configuration of station weights (when airtime_mode=1). Kernel default +# weight is 256; set higher for larger airtime share, lower for smaller share. +# Each entry is a MAC address followed by a weight. +#airtime_sta_weight=02:01:02:03:04:05 256 +#airtime_sta_weight=02:01:02:03:04:06 512 + +# Per-BSS airtime weight. In multi-BSS mode, set for each BSS and hostapd will +# configure station weights to enforce the correct ratio between BSS weights +# depending on the number of active stations. The *ratios* between different +# BSSes is what's important, not the absolute numbers. +# Must be set for all BSSes if airtime_mode=2 or 3, has no effect otherwise. +#airtime_bss_weight=1 + +# Whether the current BSS should be limited (when airtime_mode=3). +# +# If set, the BSS weight ratio will be applied in the case where the current BSS +# would exceed the share defined by the BSS weight ratio. E.g., if two BSSes are +# set to the same weights, and one is set to limited, the limited BSS will get +# no more than half the available airtime, but if the non-limited BSS has more +# stations active, that *will* be allowed to exceed its half of the available +# airtime. +#airtime_bss_limit=1 ##### TESTING OPTIONS ######################################################### # Modified: stable/12/contrib/wpa/hostapd/hostapd_cli.c ============================================================================== --- stable/12/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1214,6 +1214,13 @@ static int hostapd_cli_cmd_disable(struct wpa_ctrl *ct } +static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc, + char *argv[]) +{ + return wpa_ctrl_command(ctrl, "UPDATE_BEACON"); +} + + static int hostapd_cli_cmd_vendor(struct wpa_ctrl *ctrl, int argc, char *argv[]) { char cmd[256]; @@ -1617,6 +1624,8 @@ static const struct hostapd_cli_cmd hostapd_cli_comman "= reload configuration for current interface" }, { "disable", hostapd_cli_cmd_disable, NULL, "= disable hostapd on current interface" }, + { "update_beacon", hostapd_cli_cmd_update_beacon, NULL, + "= update Beacon frame contents\n"}, { "erp_flush", hostapd_cli_cmd_erp_flush, NULL, "= drop all ERP keys"}, { "log_level", hostapd_cli_cmd_log_level, NULL, Modified: stable/12/contrib/wpa/hostapd/main.c ============================================================================== --- stable/12/contrib/wpa/hostapd/main.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hostapd/main.c Thu Aug 29 19:13:27 2019 (r351611) @@ -653,6 +653,9 @@ int main(int argc, char *argv[]) int start_ifaces_in_sync = 0; char **if_names = NULL; size_t if_names_size = 0; +#ifdef CONFIG_DPP + struct dpp_global_config dpp_conf; +#endif /* CONFIG_DPP */ if (os_program_init()) return -1; @@ -672,7 +675,9 @@ int main(int argc, char *argv[]) dl_list_init(&interfaces.eth_p_oui); #endif /* CONFIG_ETH_P_OUI */ #ifdef CONFIG_DPP - interfaces.dpp = dpp_global_init(); + os_memset(&dpp_conf, 0, sizeof(dpp_conf)); + /* TODO: dpp_conf.msg_ctx? */ + interfaces.dpp = dpp_global_init(&dpp_conf); if (!interfaces.dpp) return -1; #endif /* CONFIG_DPP */ Modified: stable/12/contrib/wpa/hs20/client/osu_client.c ============================================================================== --- stable/12/contrib/wpa/hs20/client/osu_client.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/hs20/client/osu_client.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1588,6 +1588,7 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ xml_node_t *node, const char *fqdn) { char buf[200], dir[200]; + int res; wpa_printf(MSG_INFO, "- Credential/DigitalCertificate"); @@ -1599,14 +1600,20 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ wpa_printf(MSG_INFO, "Failed to set username"); } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "client_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set client_cert"); } } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "private_key", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set private_key"); @@ -1620,6 +1627,7 @@ static void set_pps_cred_realm(struct hs20_osu_client { char *str = xml_node_get_text(ctx->xml, node); char buf[200], dir[200]; + int res; if (str == NULL) return; @@ -1634,7 +1642,9 @@ static void set_pps_cred_realm(struct hs20_osu_client if (getcwd(dir, sizeof(dir)) == NULL) return; - snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "ca_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set CA cert"); @@ -2717,6 +2727,8 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co if (!pps_fname) { char buf[256]; + int res; + wpa_printf(MSG_INFO, "Determining PPS file based on Home SP information"); if (address && os_strncmp(address, "fqdn=", 5) == 0) { wpa_printf(MSG_INFO, "Use requested FQDN from command line"); @@ -2737,8 +2749,13 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co "SP/%s/pps.xml", ctx->fqdn); pps_fname = pps_fname_buf; - os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), "SP/%s/ca.pem", - buf); + res = os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), + "SP/%s/ca.pem", buf); + if (os_snprintf_error(sizeof(ca_fname_buf), res)) { + os_free(ctx->fqdn); + ctx->fqdn = NULL; + return -1; + } ca_fname = ca_fname_buf; } Modified: stable/12/contrib/wpa/src/ap/accounting.c ============================================================================== --- stable/12/contrib/wpa/src/ap/accounting.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/src/ap/accounting.c Thu Aug 29 19:13:27 2019 (r351611) @@ -97,6 +97,9 @@ static struct radius_msg * accounting_msg(struct hosta msg) < 0) goto fail; + if (sta && add_sqlite_radius_attr(hapd, sta, msg, 1) < 0) + goto fail; + if (sta) { for (i = 0; ; i++) { val = ieee802_1x_get_radius_class(sta->eapol_sm, &len, Modified: stable/12/contrib/wpa/src/ap/acs.c ============================================================================== --- stable/12/contrib/wpa/src/ap/acs.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/12/contrib/wpa/src/ap/acs.c Thu Aug 29 19:13:27 2019 (r351611) @@ -594,12 +594,12 @@ acs_find_ideal_chan(struct hostapd_iface *iface) iface->conf->secondary_channel) n_chans = 2; - if (iface->conf->ieee80211ac) { - switch (iface->conf->vht_oper_chwidth) { - case VHT_CHANWIDTH_80MHZ: + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { + switch (hostapd_get_oper_chwidth(iface->conf)) { + case CHANWIDTH_80MHZ: n_chans = 4; break; - case VHT_CHANWIDTH_160MHZ: + case CHANWIDTH_160MHZ: n_chans = 8; break; } @@ -607,7 +607,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface) bw = num_chan_to_bw(n_chans); - /* TODO: VHT80+80. Update acs_adjust_vht_center_freq() too. */ + /* TODO: VHT/HE80+80. Update acs_adjust_center_freq() too. */ wpa_printf(MSG_DEBUG, "ACS: Survey analysis for selected bandwidth %d MHz", bw); @@ -647,9 +647,9 @@ acs_find_ideal_chan(struct hostapd_iface *iface) } if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && - iface->conf->ieee80211ac) { - if (iface->conf->vht_oper_chwidth == *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 29 19:13:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F991DDECB; Thu, 29 Aug 2019 19:13:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KC2326tzz45Cj; Thu, 29 Aug 2019 19:13:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FBD7247F1; Thu, 29 Aug 2019 19:13:31 +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 x7TJDUO5083982; Thu, 29 Aug 2019 19:13:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TJDSK8083970; Thu, 29 Aug 2019 19:13:28 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908291913.x7TJDSK8083970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 29 Aug 2019 19:13: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: r351611 - in stable: 11/contrib/wpa/hostapd 11/contrib/wpa/hs20/client 11/contrib/wpa/src/ap 11/contrib/wpa/src/common 11/contrib/wpa/src/crypto 11/contrib/wpa/src/drivers 11/contrib/wp... X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/wpa/hostapd 11/contrib/wpa/hs20/client 11/contrib/wpa/src/ap 11/contrib/wpa/src/common 11/contrib/wpa/src/crypto 11/contrib/wpa/src/drivers 11/contrib/wpa/src/eap_common 11/contr... X-SVN-Commit-Revision: 351611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 19:13:31 -0000 Author: cy Date: Thu Aug 29 19:13:27 2019 New Revision: 351611 URL: https://svnweb.freebsd.org/changeset/base/351611 Log: MFC r351397: MFV r346563: Update wpa 2.8 --> 2.9 hostapd: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching * added configuration of airtime policy * fixed FILS to and RSNE into (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * added support for regulatory WMM limitation (for ETSI) * added support for MACsec Key Agreement using IEEE 802.1X/PSK * added experimental support for EAP-TEAP server (RFC 7170) * added experimental support for EAP-TLS server with TLS v1.3 * added support for two server certificates/keys (RSA/ECC) * added AKMSuiteSelector into "STA " control interface data to determine with AKM was used for an association * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and fast reauthentication use to be disabled * fixed an ECDH operation corner case with OpenSSL wpa_supplicant: * SAE changes - disable use of groups using Brainpool curves - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * EAP-pwd changes - disable use of groups using Brainpool curves - allow the set of groups to be configured (eap_pwd_groups) - improved protection against side channel attacks [https://w1.fi/security/2019-6/] * fixed FT-EAP initial mobility domain association using PMKSA caching (disabled by default for backwards compatibility; can be enabled with ft_eap_pmksa_caching=1) * fixed a regression in OpenSSL 1.1+ engine loading * added validation of RSNE in (Re)Association Response frames * fixed DPP bootstrapping URI parser of channel list * extended EAP-SIM/AKA fast re-authentication to allow use with FILS * extended ca_cert_blob to support PEM format * improved robustness of P2P Action frame scheduling * added support for EAP-SIM/AKA using anonymous@realm identity * fixed Hotspot 2.0 credential selection based on roaming consortium to ignore credentials without a specific EAP method * added experimental support for EAP-TEAP peer (RFC 7170) * added experimental support for EAP-TLS peer with TLS v1.3 * fixed a regression in WMM parameter configuration for a TDLS peer * fixed a regression in operation with drivers that offload 802.1X 4-way handshake * fixed an ECDH operation corner case with OpenSSL Security: https://w1.fi/security/2019-6/\ sae-eap-pwd-side-channel-attack-update.txt Added: stable/11/contrib/wpa/src/ap/airtime_policy.c - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.c stable/11/contrib/wpa/src/ap/airtime_policy.h - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.h stable/11/contrib/wpa/src/ap/wpa_auth_kay.c - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.c stable/11/contrib/wpa/src/ap/wpa_auth_kay.h - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.h stable/11/contrib/wpa/src/common/dragonfly.c - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.c stable/11/contrib/wpa/src/common/dragonfly.h - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.h stable/11/contrib/wpa/src/drivers/driver_atheros.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_atheros.c stable/11/contrib/wpa/src/drivers/driver_hostap.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_hostap.c stable/11/contrib/wpa/src/drivers/nl80211_copy.h - copied unchanged from r351397, head/contrib/wpa/src/drivers/nl80211_copy.h stable/11/contrib/wpa/src/eap_common/eap_teap_common.c - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.c stable/11/contrib/wpa/src/eap_common/eap_teap_common.h - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.h stable/11/contrib/wpa/src/eap_peer/eap_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap.c stable/11/contrib/wpa/src/eap_peer/eap_teap_pac.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.c stable/11/contrib/wpa/src/eap_peer/eap_teap_pac.h - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.h stable/11/contrib/wpa/src/eap_server/eap_server_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_server/eap_server_teap.c Modified: stable/11/contrib/wpa/hostapd/ChangeLog stable/11/contrib/wpa/hostapd/config_file.c stable/11/contrib/wpa/hostapd/ctrl_iface.c stable/11/contrib/wpa/hostapd/defconfig stable/11/contrib/wpa/hostapd/eap_register.c stable/11/contrib/wpa/hostapd/hostapd.conf stable/11/contrib/wpa/hostapd/hostapd_cli.c stable/11/contrib/wpa/hostapd/main.c stable/11/contrib/wpa/hs20/client/osu_client.c stable/11/contrib/wpa/src/ap/accounting.c stable/11/contrib/wpa/src/ap/acs.c stable/11/contrib/wpa/src/ap/ap_config.c stable/11/contrib/wpa/src/ap/ap_config.h stable/11/contrib/wpa/src/ap/ap_drv_ops.c stable/11/contrib/wpa/src/ap/ap_drv_ops.h stable/11/contrib/wpa/src/ap/authsrv.c stable/11/contrib/wpa/src/ap/beacon.c stable/11/contrib/wpa/src/ap/ctrl_iface_ap.c stable/11/contrib/wpa/src/ap/dfs.c stable/11/contrib/wpa/src/ap/dpp_hostapd.c stable/11/contrib/wpa/src/ap/dpp_hostapd.h stable/11/contrib/wpa/src/ap/drv_callbacks.c stable/11/contrib/wpa/src/ap/gas_serv.c stable/11/contrib/wpa/src/ap/gas_serv.h stable/11/contrib/wpa/src/ap/hostapd.c stable/11/contrib/wpa/src/ap/hostapd.h stable/11/contrib/wpa/src/ap/hw_features.c stable/11/contrib/wpa/src/ap/ieee802_11.c stable/11/contrib/wpa/src/ap/ieee802_11.h stable/11/contrib/wpa/src/ap/ieee802_11_he.c stable/11/contrib/wpa/src/ap/ieee802_11_vht.c stable/11/contrib/wpa/src/ap/ieee802_1x.c stable/11/contrib/wpa/src/ap/ieee802_1x.h stable/11/contrib/wpa/src/ap/neighbor_db.c stable/11/contrib/wpa/src/ap/sta_info.c stable/11/contrib/wpa/src/ap/sta_info.h stable/11/contrib/wpa/src/ap/wmm.c stable/11/contrib/wpa/src/ap/wpa_auth.c stable/11/contrib/wpa/src/ap/wpa_auth.h stable/11/contrib/wpa/src/ap/wpa_auth_ft.c stable/11/contrib/wpa/src/ap/wpa_auth_glue.c stable/11/contrib/wpa/src/ap/wpa_auth_ie.c stable/11/contrib/wpa/src/common/dpp.c stable/11/contrib/wpa/src/common/dpp.h stable/11/contrib/wpa/src/common/hw_features_common.c stable/11/contrib/wpa/src/common/hw_features_common.h stable/11/contrib/wpa/src/common/ieee802_11_common.c stable/11/contrib/wpa/src/common/ieee802_11_common.h stable/11/contrib/wpa/src/common/ieee802_11_defs.h stable/11/contrib/wpa/src/common/qca-vendor.h stable/11/contrib/wpa/src/common/sae.c stable/11/contrib/wpa/src/common/sae.h stable/11/contrib/wpa/src/common/version.h stable/11/contrib/wpa/src/common/wpa_common.c stable/11/contrib/wpa/src/common/wpa_ctrl.h stable/11/contrib/wpa/src/crypto/aes_i.h stable/11/contrib/wpa/src/crypto/crypto.h stable/11/contrib/wpa/src/crypto/crypto_openssl.c stable/11/contrib/wpa/src/crypto/crypto_wolfssl.c stable/11/contrib/wpa/src/crypto/sha1-internal.c stable/11/contrib/wpa/src/crypto/sha1-prf.c stable/11/contrib/wpa/src/crypto/sha1-tlsprf.c stable/11/contrib/wpa/src/crypto/sha1-tprf.c stable/11/contrib/wpa/src/crypto/sha1.c stable/11/contrib/wpa/src/crypto/sha256-kdf.c stable/11/contrib/wpa/src/crypto/sha256-prf.c stable/11/contrib/wpa/src/crypto/sha256-tlsprf.c stable/11/contrib/wpa/src/crypto/sha256.h stable/11/contrib/wpa/src/crypto/sha384-kdf.c stable/11/contrib/wpa/src/crypto/sha384-prf.c stable/11/contrib/wpa/src/crypto/sha512-kdf.c stable/11/contrib/wpa/src/crypto/sha512-prf.c stable/11/contrib/wpa/src/crypto/tls.h stable/11/contrib/wpa/src/crypto/tls_openssl.c stable/11/contrib/wpa/src/crypto/tls_wolfssl.c stable/11/contrib/wpa/src/drivers/driver.h stable/11/contrib/wpa/src/drivers/driver_bsd.c stable/11/contrib/wpa/src/drivers/driver_common.c stable/11/contrib/wpa/src/drivers/driver_macsec_linux.c stable/11/contrib/wpa/src/drivers/driver_macsec_qca.c stable/11/contrib/wpa/src/drivers/driver_ndis.c stable/11/contrib/wpa/src/drivers/driver_nl80211.h stable/11/contrib/wpa/src/drivers/driver_nl80211_capa.c stable/11/contrib/wpa/src/drivers/driver_nl80211_event.c stable/11/contrib/wpa/src/drivers/driver_privsep.c stable/11/contrib/wpa/src/eap_common/eap_defs.h stable/11/contrib/wpa/src/eap_common/eap_pwd_common.c stable/11/contrib/wpa/src/eap_common/eap_sim_common.c stable/11/contrib/wpa/src/eap_common/eap_sim_common.h stable/11/contrib/wpa/src/eap_peer/eap.c stable/11/contrib/wpa/src/eap_peer/eap.h stable/11/contrib/wpa/src/eap_peer/eap_aka.c stable/11/contrib/wpa/src/eap_peer/eap_config.h stable/11/contrib/wpa/src/eap_peer/eap_eke.c stable/11/contrib/wpa/src/eap_peer/eap_leap.c stable/11/contrib/wpa/src/eap_peer/eap_methods.h stable/11/contrib/wpa/src/eap_peer/eap_peap.c stable/11/contrib/wpa/src/eap_peer/eap_pwd.c stable/11/contrib/wpa/src/eap_peer/eap_sim.c stable/11/contrib/wpa/src/eap_peer/eap_tls.c stable/11/contrib/wpa/src/eap_peer/eap_tls_common.c stable/11/contrib/wpa/src/eap_peer/eap_tls_common.h stable/11/contrib/wpa/src/eap_server/eap.h stable/11/contrib/wpa/src/eap_server/eap_i.h stable/11/contrib/wpa/src/eap_server/eap_methods.h stable/11/contrib/wpa/src/eap_server/eap_server.c stable/11/contrib/wpa/src/eap_server/eap_server_aka.c stable/11/contrib/wpa/src/eap_server/eap_server_pax.c stable/11/contrib/wpa/src/eap_server/eap_server_peap.c stable/11/contrib/wpa/src/eap_server/eap_server_pwd.c stable/11/contrib/wpa/src/eap_server/eap_server_sim.c stable/11/contrib/wpa/src/eap_server/eap_server_tls.c stable/11/contrib/wpa/src/eap_server/eap_server_tls_common.c stable/11/contrib/wpa/src/eap_server/eap_tls_common.h stable/11/contrib/wpa/src/eapol_auth/eapol_auth_sm.c stable/11/contrib/wpa/src/eapol_auth/eapol_auth_sm.h stable/11/contrib/wpa/src/eapol_supp/eapol_supp_sm.c stable/11/contrib/wpa/src/eapol_supp/eapol_supp_sm.h stable/11/contrib/wpa/src/p2p/p2p.c stable/11/contrib/wpa/src/p2p/p2p_go_neg.c stable/11/contrib/wpa/src/p2p/p2p_i.h stable/11/contrib/wpa/src/pae/ieee802_1x_kay.c stable/11/contrib/wpa/src/radius/radius_server.c stable/11/contrib/wpa/src/radius/radius_server.h stable/11/contrib/wpa/src/rsn_supp/wpa.c stable/11/contrib/wpa/src/rsn_supp/wpa.h stable/11/contrib/wpa/src/rsn_supp/wpa_ft.c stable/11/contrib/wpa/src/rsn_supp/wpa_i.h stable/11/contrib/wpa/src/tls/asn1.c stable/11/contrib/wpa/src/tls/libtommath.c stable/11/contrib/wpa/src/tls/x509v3.c stable/11/contrib/wpa/src/utils/common.c stable/11/contrib/wpa/src/utils/common.h stable/11/contrib/wpa/src/utils/trace.c stable/11/contrib/wpa/src/utils/wpa_debug.c stable/11/contrib/wpa/src/wps/wps.h stable/11/contrib/wpa/wpa_supplicant/Android.mk stable/11/contrib/wpa/wpa_supplicant/ChangeLog stable/11/contrib/wpa/wpa_supplicant/README-DPP stable/11/contrib/wpa/wpa_supplicant/ap.c stable/11/contrib/wpa/wpa_supplicant/ap.h stable/11/contrib/wpa/wpa_supplicant/bss.c stable/11/contrib/wpa/wpa_supplicant/config.c stable/11/contrib/wpa/wpa_supplicant/config.h stable/11/contrib/wpa/wpa_supplicant/config_file.c stable/11/contrib/wpa/wpa_supplicant/config_ssid.h stable/11/contrib/wpa/wpa_supplicant/ctrl_iface.c stable/11/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c stable/11/contrib/wpa/wpa_supplicant/defconfig stable/11/contrib/wpa/wpa_supplicant/dpp_supplicant.c stable/11/contrib/wpa/wpa_supplicant/dpp_supplicant.h stable/11/contrib/wpa/wpa_supplicant/driver_i.h stable/11/contrib/wpa/wpa_supplicant/eap_register.c stable/11/contrib/wpa/wpa_supplicant/eapol_test.c stable/11/contrib/wpa/wpa_supplicant/events.c stable/11/contrib/wpa/wpa_supplicant/ibss_rsn.c stable/11/contrib/wpa/wpa_supplicant/interworking.c stable/11/contrib/wpa/wpa_supplicant/mesh.c stable/11/contrib/wpa/wpa_supplicant/mesh_mpm.c stable/11/contrib/wpa/wpa_supplicant/notify.c stable/11/contrib/wpa/wpa_supplicant/notify.h stable/11/contrib/wpa/wpa_supplicant/op_classes.c stable/11/contrib/wpa/wpa_supplicant/p2p_supplicant.c stable/11/contrib/wpa/wpa_supplicant/preauth_test.c stable/11/contrib/wpa/wpa_supplicant/rrm.c stable/11/contrib/wpa/wpa_supplicant/sme.c stable/11/contrib/wpa/wpa_supplicant/wnm_sta.c stable/11/contrib/wpa/wpa_supplicant/wpa_cli.c stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant.c stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant.conf stable/11/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h stable/11/contrib/wpa/wpa_supplicant/wpas_glue.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/contrib/wpa/src/ap/airtime_policy.c - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.c stable/12/contrib/wpa/src/ap/airtime_policy.h - copied unchanged from r351397, head/contrib/wpa/src/ap/airtime_policy.h stable/12/contrib/wpa/src/ap/wpa_auth_kay.c - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.c stable/12/contrib/wpa/src/ap/wpa_auth_kay.h - copied unchanged from r351397, head/contrib/wpa/src/ap/wpa_auth_kay.h stable/12/contrib/wpa/src/common/dragonfly.c - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.c stable/12/contrib/wpa/src/common/dragonfly.h - copied unchanged from r351397, head/contrib/wpa/src/common/dragonfly.h stable/12/contrib/wpa/src/drivers/driver_atheros.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_atheros.c stable/12/contrib/wpa/src/drivers/driver_hostap.c - copied unchanged from r351397, head/contrib/wpa/src/drivers/driver_hostap.c stable/12/contrib/wpa/src/drivers/nl80211_copy.h - copied unchanged from r351397, head/contrib/wpa/src/drivers/nl80211_copy.h stable/12/contrib/wpa/src/eap_common/eap_teap_common.c - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.c stable/12/contrib/wpa/src/eap_common/eap_teap_common.h - copied unchanged from r351397, head/contrib/wpa/src/eap_common/eap_teap_common.h stable/12/contrib/wpa/src/eap_peer/eap_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap.c stable/12/contrib/wpa/src/eap_peer/eap_teap_pac.c - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.c stable/12/contrib/wpa/src/eap_peer/eap_teap_pac.h - copied unchanged from r351397, head/contrib/wpa/src/eap_peer/eap_teap_pac.h stable/12/contrib/wpa/src/eap_server/eap_server_teap.c - copied unchanged from r351397, head/contrib/wpa/src/eap_server/eap_server_teap.c Modified: stable/12/contrib/wpa/hostapd/ChangeLog stable/12/contrib/wpa/hostapd/config_file.c stable/12/contrib/wpa/hostapd/ctrl_iface.c stable/12/contrib/wpa/hostapd/defconfig stable/12/contrib/wpa/hostapd/eap_register.c stable/12/contrib/wpa/hostapd/hostapd.conf stable/12/contrib/wpa/hostapd/hostapd_cli.c stable/12/contrib/wpa/hostapd/main.c stable/12/contrib/wpa/hs20/client/osu_client.c stable/12/contrib/wpa/src/ap/accounting.c stable/12/contrib/wpa/src/ap/acs.c stable/12/contrib/wpa/src/ap/ap_config.c stable/12/contrib/wpa/src/ap/ap_config.h stable/12/contrib/wpa/src/ap/ap_drv_ops.c stable/12/contrib/wpa/src/ap/ap_drv_ops.h stable/12/contrib/wpa/src/ap/authsrv.c stable/12/contrib/wpa/src/ap/beacon.c stable/12/contrib/wpa/src/ap/ctrl_iface_ap.c stable/12/contrib/wpa/src/ap/dfs.c stable/12/contrib/wpa/src/ap/dpp_hostapd.c stable/12/contrib/wpa/src/ap/dpp_hostapd.h stable/12/contrib/wpa/src/ap/drv_callbacks.c stable/12/contrib/wpa/src/ap/gas_serv.c stable/12/contrib/wpa/src/ap/gas_serv.h stable/12/contrib/wpa/src/ap/hostapd.c stable/12/contrib/wpa/src/ap/hostapd.h stable/12/contrib/wpa/src/ap/hw_features.c stable/12/contrib/wpa/src/ap/ieee802_11.c stable/12/contrib/wpa/src/ap/ieee802_11.h stable/12/contrib/wpa/src/ap/ieee802_11_he.c stable/12/contrib/wpa/src/ap/ieee802_11_vht.c stable/12/contrib/wpa/src/ap/ieee802_1x.c stable/12/contrib/wpa/src/ap/ieee802_1x.h stable/12/contrib/wpa/src/ap/neighbor_db.c stable/12/contrib/wpa/src/ap/sta_info.c stable/12/contrib/wpa/src/ap/sta_info.h stable/12/contrib/wpa/src/ap/wmm.c stable/12/contrib/wpa/src/ap/wpa_auth.c stable/12/contrib/wpa/src/ap/wpa_auth.h stable/12/contrib/wpa/src/ap/wpa_auth_ft.c stable/12/contrib/wpa/src/ap/wpa_auth_glue.c stable/12/contrib/wpa/src/ap/wpa_auth_ie.c stable/12/contrib/wpa/src/common/dpp.c stable/12/contrib/wpa/src/common/dpp.h stable/12/contrib/wpa/src/common/hw_features_common.c stable/12/contrib/wpa/src/common/hw_features_common.h stable/12/contrib/wpa/src/common/ieee802_11_common.c stable/12/contrib/wpa/src/common/ieee802_11_common.h stable/12/contrib/wpa/src/common/ieee802_11_defs.h stable/12/contrib/wpa/src/common/qca-vendor.h stable/12/contrib/wpa/src/common/sae.c stable/12/contrib/wpa/src/common/sae.h stable/12/contrib/wpa/src/common/version.h stable/12/contrib/wpa/src/common/wpa_common.c stable/12/contrib/wpa/src/common/wpa_ctrl.h stable/12/contrib/wpa/src/crypto/aes_i.h stable/12/contrib/wpa/src/crypto/crypto.h stable/12/contrib/wpa/src/crypto/crypto_openssl.c stable/12/contrib/wpa/src/crypto/crypto_wolfssl.c stable/12/contrib/wpa/src/crypto/sha1-internal.c stable/12/contrib/wpa/src/crypto/sha1-prf.c stable/12/contrib/wpa/src/crypto/sha1-tlsprf.c stable/12/contrib/wpa/src/crypto/sha1-tprf.c stable/12/contrib/wpa/src/crypto/sha1.c stable/12/contrib/wpa/src/crypto/sha256-kdf.c stable/12/contrib/wpa/src/crypto/sha256-prf.c stable/12/contrib/wpa/src/crypto/sha256-tlsprf.c stable/12/contrib/wpa/src/crypto/sha256.h stable/12/contrib/wpa/src/crypto/sha384-kdf.c stable/12/contrib/wpa/src/crypto/sha384-prf.c stable/12/contrib/wpa/src/crypto/sha512-kdf.c stable/12/contrib/wpa/src/crypto/sha512-prf.c stable/12/contrib/wpa/src/crypto/tls.h stable/12/contrib/wpa/src/crypto/tls_openssl.c stable/12/contrib/wpa/src/crypto/tls_wolfssl.c stable/12/contrib/wpa/src/drivers/driver.h stable/12/contrib/wpa/src/drivers/driver_bsd.c stable/12/contrib/wpa/src/drivers/driver_common.c stable/12/contrib/wpa/src/drivers/driver_macsec_linux.c stable/12/contrib/wpa/src/drivers/driver_macsec_qca.c stable/12/contrib/wpa/src/drivers/driver_ndis.c stable/12/contrib/wpa/src/drivers/driver_nl80211.h stable/12/contrib/wpa/src/drivers/driver_nl80211_capa.c stable/12/contrib/wpa/src/drivers/driver_nl80211_event.c stable/12/contrib/wpa/src/drivers/driver_privsep.c stable/12/contrib/wpa/src/eap_common/eap_defs.h stable/12/contrib/wpa/src/eap_common/eap_pwd_common.c stable/12/contrib/wpa/src/eap_common/eap_sim_common.c stable/12/contrib/wpa/src/eap_common/eap_sim_common.h stable/12/contrib/wpa/src/eap_peer/eap.c stable/12/contrib/wpa/src/eap_peer/eap.h stable/12/contrib/wpa/src/eap_peer/eap_aka.c stable/12/contrib/wpa/src/eap_peer/eap_config.h stable/12/contrib/wpa/src/eap_peer/eap_eke.c stable/12/contrib/wpa/src/eap_peer/eap_leap.c stable/12/contrib/wpa/src/eap_peer/eap_methods.h stable/12/contrib/wpa/src/eap_peer/eap_peap.c stable/12/contrib/wpa/src/eap_peer/eap_pwd.c stable/12/contrib/wpa/src/eap_peer/eap_sim.c stable/12/contrib/wpa/src/eap_peer/eap_tls.c stable/12/contrib/wpa/src/eap_peer/eap_tls_common.c stable/12/contrib/wpa/src/eap_peer/eap_tls_common.h stable/12/contrib/wpa/src/eap_server/eap.h stable/12/contrib/wpa/src/eap_server/eap_i.h stable/12/contrib/wpa/src/eap_server/eap_methods.h stable/12/contrib/wpa/src/eap_server/eap_server.c stable/12/contrib/wpa/src/eap_server/eap_server_aka.c stable/12/contrib/wpa/src/eap_server/eap_server_pax.c stable/12/contrib/wpa/src/eap_server/eap_server_peap.c stable/12/contrib/wpa/src/eap_server/eap_server_pwd.c stable/12/contrib/wpa/src/eap_server/eap_server_sim.c stable/12/contrib/wpa/src/eap_server/eap_server_tls.c stable/12/contrib/wpa/src/eap_server/eap_server_tls_common.c stable/12/contrib/wpa/src/eap_server/eap_tls_common.h stable/12/contrib/wpa/src/eapol_auth/eapol_auth_sm.c stable/12/contrib/wpa/src/eapol_auth/eapol_auth_sm.h stable/12/contrib/wpa/src/eapol_supp/eapol_supp_sm.c stable/12/contrib/wpa/src/eapol_supp/eapol_supp_sm.h stable/12/contrib/wpa/src/p2p/p2p.c stable/12/contrib/wpa/src/p2p/p2p_go_neg.c stable/12/contrib/wpa/src/p2p/p2p_i.h stable/12/contrib/wpa/src/pae/ieee802_1x_kay.c stable/12/contrib/wpa/src/radius/radius_server.c stable/12/contrib/wpa/src/radius/radius_server.h stable/12/contrib/wpa/src/rsn_supp/wpa.c stable/12/contrib/wpa/src/rsn_supp/wpa.h stable/12/contrib/wpa/src/rsn_supp/wpa_ft.c stable/12/contrib/wpa/src/rsn_supp/wpa_i.h stable/12/contrib/wpa/src/tls/asn1.c stable/12/contrib/wpa/src/tls/libtommath.c stable/12/contrib/wpa/src/tls/x509v3.c stable/12/contrib/wpa/src/utils/common.c stable/12/contrib/wpa/src/utils/common.h stable/12/contrib/wpa/src/utils/trace.c stable/12/contrib/wpa/src/utils/wpa_debug.c stable/12/contrib/wpa/src/wps/wps.h stable/12/contrib/wpa/wpa_supplicant/Android.mk stable/12/contrib/wpa/wpa_supplicant/ChangeLog stable/12/contrib/wpa/wpa_supplicant/README-DPP stable/12/contrib/wpa/wpa_supplicant/ap.c stable/12/contrib/wpa/wpa_supplicant/ap.h stable/12/contrib/wpa/wpa_supplicant/bss.c stable/12/contrib/wpa/wpa_supplicant/config.c stable/12/contrib/wpa/wpa_supplicant/config.h stable/12/contrib/wpa/wpa_supplicant/config_file.c stable/12/contrib/wpa/wpa_supplicant/config_ssid.h stable/12/contrib/wpa/wpa_supplicant/ctrl_iface.c stable/12/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c stable/12/contrib/wpa/wpa_supplicant/defconfig stable/12/contrib/wpa/wpa_supplicant/dpp_supplicant.c stable/12/contrib/wpa/wpa_supplicant/dpp_supplicant.h stable/12/contrib/wpa/wpa_supplicant/driver_i.h stable/12/contrib/wpa/wpa_supplicant/eap_register.c stable/12/contrib/wpa/wpa_supplicant/eapol_test.c stable/12/contrib/wpa/wpa_supplicant/events.c stable/12/contrib/wpa/wpa_supplicant/ibss_rsn.c stable/12/contrib/wpa/wpa_supplicant/interworking.c stable/12/contrib/wpa/wpa_supplicant/mesh.c stable/12/contrib/wpa/wpa_supplicant/mesh_mpm.c stable/12/contrib/wpa/wpa_supplicant/notify.c stable/12/contrib/wpa/wpa_supplicant/notify.h stable/12/contrib/wpa/wpa_supplicant/op_classes.c stable/12/contrib/wpa/wpa_supplicant/p2p_supplicant.c stable/12/contrib/wpa/wpa_supplicant/preauth_test.c stable/12/contrib/wpa/wpa_supplicant/rrm.c stable/12/contrib/wpa/wpa_supplicant/sme.c stable/12/contrib/wpa/wpa_supplicant/wnm_sta.c stable/12/contrib/wpa/wpa_supplicant/wpa_cli.c stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant.c stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant.conf stable/12/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h stable/12/contrib/wpa/wpa_supplicant/wpas_glue.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/wpa/hostapd/ChangeLog ============================================================================== --- stable/11/contrib/wpa/hostapd/ChangeLog Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/ChangeLog Thu Aug 29 19:13:27 2019 (r351611) @@ -1,5 +1,29 @@ ChangeLog for hostapd +2019-08-07 - v2.9 + * SAE changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * EAP-pwd changes + - disable use of groups using Brainpool curves + - improved protection against side channel attacks + [https://w1.fi/security/2019-6/] + * fixed FT-EAP initial mobility domain association using PMKSA caching + * added configuration of airtime policy + * fixed FILS to and RSNE into (Re)Association Response frames + * fixed DPP bootstrapping URI parser of channel list + * added support for regulatory WMM limitation (for ETSI) + * added support for MACsec Key Agreement using IEEE 802.1X/PSK + * added experimental support for EAP-TEAP server (RFC 7170) + * added experimental support for EAP-TLS server with TLS v1.3 + * added support for two server certificates/keys (RSA/ECC) + * added AKMSuiteSelector into "STA " control interface data to + determine with AKM was used for an association + * added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and + fast reauthentication use to be disabled + * fixed an ECDH operation corner case with OpenSSL + 2019-04-21 - v2.8 * SAE changes - added support for SAE Password Identifier Modified: stable/11/contrib/wpa/hostapd/config_file.c ============================================================================== --- stable/11/contrib/wpa/hostapd/config_file.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/config_file.c Thu Aug 29 19:13:27 2019 (r351611) @@ -24,14 +24,6 @@ #include "config_file.h" -#ifndef CONFIG_NO_RADIUS -#ifdef EAP_SERVER -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value); -#endif /* EAP_SERVER */ -#endif /* CONFIG_NO_RADIUS */ - - #ifndef CONFIG_NO_VLAN static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss, const char *fname) @@ -660,76 +652,7 @@ hostapd_config_read_radius_addr(struct hostapd_radius_ } -static struct hostapd_radius_attr * -hostapd_parse_radius_attr(const char *value) -{ - const char *pos; - char syntax; - struct hostapd_radius_attr *attr; - size_t len; - attr = os_zalloc(sizeof(*attr)); - if (attr == NULL) - return NULL; - - attr->type = atoi(value); - - pos = os_strchr(value, ':'); - if (pos == NULL) { - attr->val = wpabuf_alloc(1); - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - wpabuf_put_u8(attr->val, 0); - return attr; - } - - pos++; - if (pos[0] == '\0' || pos[1] != ':') { - os_free(attr); - return NULL; - } - syntax = *pos++; - pos++; - - switch (syntax) { - case 's': - attr->val = wpabuf_alloc_copy(pos, os_strlen(pos)); - break; - case 'x': - len = os_strlen(pos); - if (len & 1) - break; - len /= 2; - attr->val = wpabuf_alloc(len); - if (attr->val == NULL) - break; - if (hexstr2bin(pos, wpabuf_put(attr->val, len), len) < 0) { - wpabuf_free(attr->val); - os_free(attr); - return NULL; - } - break; - case 'd': - attr->val = wpabuf_alloc(4); - if (attr->val) - wpabuf_put_be32(attr->val, atoi(pos)); - break; - default: - os_free(attr); - return NULL; - } - - if (attr->val == NULL) { - os_free(attr); - return NULL; - } - - return attr; -} - - static int hostapd_parse_das_client(struct hostapd_bss_config *bss, char *val) { char *secret; @@ -2313,6 +2236,42 @@ static unsigned int parse_tls_flags(const char *val) #endif /* EAP_SERVER */ +#ifdef CONFIG_AIRTIME_POLICY +static int add_airtime_weight(struct hostapd_bss_config *bss, char *value) +{ + struct airtime_sta_weight *wt; + char *pos, *next; + + wt = os_zalloc(sizeof(*wt)); + if (!wt) + return -1; + + /* 02:01:02:03:04:05 10 */ + pos = value; + next = os_strchr(pos, ' '); + if (next) + *next++ = '\0'; + if (!next || hwaddr_aton(pos, wt->addr)) { + wpa_printf(MSG_ERROR, "Invalid station address: '%s'", pos); + os_free(wt); + return -1; + } + + pos = next; + wt->weight = atoi(pos); + if (!wt->weight) { + wpa_printf(MSG_ERROR, "Invalid weight: '%s'", pos); + os_free(wt); + return -1; + } + + wt->next = bss->airtime_weight_list; + bss->airtime_weight_list = wt; + return 0; +} +#endif /* CONFIG_AIRTIME_POLICY */ + + #ifdef CONFIG_SAE static int parse_sae_password(struct hostapd_bss_config *bss, const char *val) { @@ -2376,6 +2335,36 @@ fail: #endif /* CONFIG_SAE */ +#ifdef CONFIG_DPP2 +static int hostapd_dpp_controller_parse(struct hostapd_bss_config *bss, + const char *pos) +{ + struct dpp_controller_conf *conf; + char *val; + + conf = os_zalloc(sizeof(*conf)); + if (!conf) + return -1; + val = get_param(pos, "ipaddr="); + if (!val || hostapd_parse_ip_addr(val, &conf->ipaddr)) + goto fail; + os_free(val); + val = get_param(pos, "pkhash="); + if (!val || os_strlen(val) != 2 * SHA256_MAC_LEN || + hexstr2bin(val, conf->pkhash, SHA256_MAC_LEN) < 0) + goto fail; + os_free(val); + conf->next = bss->dpp_controller; + bss->dpp_controller = conf; + return 0; +fail: + os_free(val); + os_free(conf); + return -1; +} +#endif /* CONFIG_DPP2 */ + + static int hostapd_config_fill(struct hostapd_config *conf, struct hostapd_bss_config *bss, const char *buf, char *pos, int line) @@ -2496,7 +2485,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "eapol_version") == 0) { int eapol_version = atoi(pos); +#ifdef CONFIG_MACSEC + if (eapol_version < 1 || eapol_version > 3) { +#else /* CONFIG_MACSEC */ if (eapol_version < 1 || eapol_version > 2) { +#endif /* CONFIG_MACSEC */ wpa_printf(MSG_ERROR, "Line %d: invalid EAPOL version (%d): '%s'.", line, eapol_version, pos); @@ -2519,12 +2512,21 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "server_cert") == 0) { os_free(bss->server_cert); bss->server_cert = os_strdup(pos); + } else if (os_strcmp(buf, "server_cert2") == 0) { + os_free(bss->server_cert2); + bss->server_cert2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key") == 0) { os_free(bss->private_key); bss->private_key = os_strdup(pos); + } else if (os_strcmp(buf, "private_key2") == 0) { + os_free(bss->private_key2); + bss->private_key2 = os_strdup(pos); } else if (os_strcmp(buf, "private_key_passwd") == 0) { os_free(bss->private_key_passwd); bss->private_key_passwd = os_strdup(pos); + } else if (os_strcmp(buf, "private_key_passwd2") == 0) { + os_free(bss->private_key_passwd2); + bss->private_key_passwd2 = os_strdup(pos); } else if (os_strcmp(buf, "check_cert_subject") == 0) { if (!pos[0]) { wpa_printf(MSG_ERROR, "Line %d: unknown check_cert_subject '%s'", @@ -2605,6 +2607,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "pac_key_refresh_time") == 0) { bss->pac_key_refresh_time = atoi(pos); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + } else if (os_strcmp(buf, "eap_teap_auth") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid eap_teap_auth value", + line); + return 1; + } + bss->eap_teap_auth = val; + } else if (os_strcmp(buf, "eap_teap_pac_no_inner") == 0) { + bss->eap_teap_pac_no_inner = atoi(pos); +#endif /* EAP_SERVER_TEAP */ #ifdef EAP_SERVER_SIM } else if (os_strcmp(buf, "eap_sim_db") == 0) { os_free(bss->eap_sim_db); @@ -2613,6 +2629,8 @@ static int hostapd_config_fill(struct hostapd_config * bss->eap_sim_db_timeout = atoi(pos); } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) { bss->eap_sim_aka_result_ind = atoi(pos); + } else if (os_strcmp(buf, "eap_sim_id") == 0) { + bss->eap_sim_id = atoi(pos); #endif /* EAP_SERVER_SIM */ #ifdef EAP_SERVER_TNC } else if (os_strcmp(buf, "tnc") == 0) { @@ -2816,6 +2834,9 @@ static int hostapd_config_fill(struct hostapd_config * a = a->next; a->next = attr; } + } else if (os_strcmp(buf, "radius_req_attr_sqlite") == 0) { + os_free(bss->radius_req_attr_sqlite); + bss->radius_req_attr_sqlite = os_strdup(pos); } else if (os_strcmp(buf, "radius_das_port") == 0) { bss->radius_das_port = atoi(pos); } else if (os_strcmp(buf, "radius_das_client") == 0) { @@ -3442,6 +3463,8 @@ static int hostapd_config_fill(struct hostapd_config * conf->he_op.he_twt_required = atoi(pos); } else if (os_strcmp(buf, "he_rts_threshold") == 0) { conf->he_op.he_rts_threshold = atoi(pos); + } else if (os_strcmp(buf, "he_basic_mcs_nss_set") == 0) { + conf->he_op.he_basic_mcs_nss_set = atoi(pos); } else if (os_strcmp(buf, "he_mu_edca_qos_info_param_count") == 0) { conf->he_mu_edca.he_qos_info |= set_he_cap(atoi(pos), HE_QOS_INFO_EDCA_PARAM_SET_COUNT); @@ -3526,6 +3549,20 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "he_mu_edca_ac_vo_timer") == 0) { conf->he_mu_edca.he_mu_ac_vo_param[HE_MU_AC_PARAM_TIMER_IDX] = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_sr_control") == 0) { + conf->spr.sr_control = atoi(pos) & 0xff; + } else if (os_strcmp(buf, "he_spr_non_srg_obss_pd_max_offset") == 0) { + conf->spr.non_srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_min_offset") == 0) { + conf->spr.srg_obss_pd_min_offset = atoi(pos); + } else if (os_strcmp(buf, "he_spr_srg_obss_pd_max_offset") == 0) { + conf->spr.srg_obss_pd_max_offset = atoi(pos); + } else if (os_strcmp(buf, "he_oper_chwidth") == 0) { + conf->he_oper_chwidth = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg0_idx") == 0) { + conf->he_oper_centr_freq_seg0_idx = atoi(pos); + } else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) { + conf->he_oper_centr_freq_seg1_idx = atoi(pos); #endif /* CONFIG_IEEE80211AX */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); @@ -4298,6 +4335,11 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "dpp_csign") == 0) { if (parse_wpabuf_hex(line, buf, &bss->dpp_csign, pos)) return 1; +#ifdef CONFIG_DPP2 + } else if (os_strcmp(buf, "dpp_controller") == 0) { + if (hostapd_dpp_controller_parse(bss, pos)) + return 1; +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ #ifdef CONFIG_OWE } else if (os_strcmp(buf, "owe_transition_bssid") == 0) { @@ -4349,6 +4391,121 @@ static int hostapd_config_fill(struct hostapd_config * conf->rssi_reject_assoc_timeout = atoi(pos); } else if (os_strcmp(buf, "pbss") == 0) { bss->pbss = atoi(pos); +#ifdef CONFIG_AIRTIME_POLICY + } else if (os_strcmp(buf, "airtime_mode") == 0) { + int val = atoi(pos); + + if (val < 0 || val > AIRTIME_MODE_MAX) { + wpa_printf(MSG_ERROR, "Line %d: Unknown airtime_mode", + line); + return 1; + } + conf->airtime_mode = val; + } else if (os_strcmp(buf, "airtime_update_interval") == 0) { + conf->airtime_update_interval = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_weight") == 0) { + bss->airtime_weight = atoi(pos); + } else if (os_strcmp(buf, "airtime_bss_limit") == 0) { + int val = atoi(pos); + + if (val < 0 || val > 1) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime_bss_limit (must be 0 or 1)", + line); + return 1; + } + bss->airtime_limit = val; + } else if (os_strcmp(buf, "airtime_sta_weight") == 0) { + if (add_airtime_weight(bss, pos) < 0) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid airtime weight '%s'", + line, pos); + return 1; + } +#endif /* CONFIG_AIRTIME_POLICY */ +#ifdef CONFIG_MACSEC + } else if (os_strcmp(buf, "macsec_policy") == 0) { + int macsec_policy = atoi(pos); + + if (macsec_policy < 0 || macsec_policy > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_policy (%d): '%s'.", + line, macsec_policy, pos); + return 1; + } + bss->macsec_policy = macsec_policy; + } else if (os_strcmp(buf, "macsec_integ_only") == 0) { + int macsec_integ_only = atoi(pos); + + if (macsec_integ_only < 0 || macsec_integ_only > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_integ_only (%d): '%s'.", + line, macsec_integ_only, pos); + return 1; + } + bss->macsec_integ_only = macsec_integ_only; + } else if (os_strcmp(buf, "macsec_replay_protect") == 0) { + int macsec_replay_protect = atoi(pos); + + if (macsec_replay_protect < 0 || macsec_replay_protect > 1) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_replay_protect (%d): '%s'.", + line, macsec_replay_protect, pos); + return 1; + } + bss->macsec_replay_protect = macsec_replay_protect; + } else if (os_strcmp(buf, "macsec_replay_window") == 0) { + bss->macsec_replay_window = atoi(pos); + } else if (os_strcmp(buf, "macsec_port") == 0) { + int macsec_port = atoi(pos); + + if (macsec_port < 1 || macsec_port > 65534) { + wpa_printf(MSG_ERROR, + "Line %d: invalid macsec_port (%d): '%s'.", + line, macsec_port, pos); + return 1; + } + bss->macsec_port = macsec_port; + } else if (os_strcmp(buf, "mka_priority") == 0) { + int mka_priority = atoi(pos); + + if (mka_priority < 0 || mka_priority > 255) { + wpa_printf(MSG_ERROR, + "Line %d: invalid mka_priority (%d): '%s'.", + line, mka_priority, pos); + return 1; + } + bss->mka_priority = mka_priority; + } else if (os_strcmp(buf, "mka_cak") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CAK_MAX_LEN || + (len != 2 * 16 && len != 2 * 32) || + hexstr2bin(pos, bss->mka_cak, len / 2)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CAK '%s'.", + line, pos); + return 1; + } + bss->mka_cak_len = len / 2; + bss->mka_psk_set |= MKA_PSK_SET_CAK; + } else if (os_strcmp(buf, "mka_ckn") == 0) { + size_t len = os_strlen(pos); + + if (len > 2 * MACSEC_CKN_MAX_LEN || /* too long */ + len < 2 || /* too short */ + len % 2 != 0 /* not an integral number of bytes */) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return 1; + } + bss->mka_ckn_len = len / 2; + if (hexstr2bin(pos, bss->mka_ckn, bss->mka_ckn_len)) { + wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", + line, pos); + return -1; + } + bss->mka_psk_set |= MKA_PSK_SET_CKN; +#endif /* CONFIG_MACSEC */ } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", Modified: stable/11/contrib/wpa/hostapd/ctrl_iface.c ============================================================================== --- stable/11/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/ctrl_iface.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1830,26 +1830,40 @@ static void hostapd_data_test_rx(void *ctx, const u8 * struct iphdr ip; const u8 *pos; unsigned int i; + char extra[30]; - if (len != HWSIM_PACKETLEN) + if (len < sizeof(*eth) + sizeof(ip) || len > HWSIM_PACKETLEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpected length %d", + (int) len); return; + } eth = (const struct ether_header *) buf; os_memcpy(&ip, eth + 1, sizeof(ip)); pos = &buf[sizeof(*eth) + sizeof(ip)]; if (ip.ihl != 5 || ip.version != 4 || - ntohs(ip.tot_len) != HWSIM_IP_LEN) + ntohs(ip.tot_len) > HWSIM_IP_LEN) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore unexpect IP header"); return; + } - for (i = 0; i < HWSIM_IP_LEN - sizeof(ip); i++) { - if (*pos != (u8) i) + for (i = 0; i < ntohs(ip.tot_len) - sizeof(ip); i++) { + if (*pos != (u8) i) { + wpa_printf(MSG_DEBUG, + "test data: RX - ignore mismatching payload"); return; + } pos++; } - wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR, - MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost)); + extra[0] = '\0'; + if (ntohs(ip.tot_len) != HWSIM_IP_LEN) + os_snprintf(extra, sizeof(extra), " len=%d", ntohs(ip.tot_len)); + wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", + MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); } @@ -1894,7 +1908,7 @@ static int hostapd_ctrl_iface_data_test_config(struct static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) { u8 dst[ETH_ALEN], src[ETH_ALEN]; - char *pos; + char *pos, *pos2; int used; long int val; u8 tos; @@ -1903,11 +1917,12 @@ static int hostapd_ctrl_iface_data_test_tx(struct host struct iphdr *ip; u8 *dpos; unsigned int i; + size_t send_len = HWSIM_IP_LEN; if (hapd->l2_test == NULL) return -1; - /* format: */ + /* format: [len=] */ pos = cmd; used = hwaddr_aton2(pos, dst); @@ -1921,11 +1936,19 @@ static int hostapd_ctrl_iface_data_test_tx(struct host return -1; pos += used; - val = strtol(pos, NULL, 0); + val = strtol(pos, &pos2, 0); if (val < 0 || val > 0xff) return -1; tos = val; + pos = os_strstr(pos2, " len="); + if (pos) { + i = atoi(pos + 5); + if (i < sizeof(*ip) || i > HWSIM_IP_LEN) + return -1; + send_len = i; + } + eth = (struct ether_header *) &buf[2]; os_memcpy(eth->ether_dhost, dst, ETH_ALEN); os_memcpy(eth->ether_shost, src, ETH_ALEN); @@ -1936,17 +1959,17 @@ static int hostapd_ctrl_iface_data_test_tx(struct host ip->version = 4; ip->ttl = 64; ip->tos = tos; - ip->tot_len = htons(HWSIM_IP_LEN); + ip->tot_len = htons(send_len); ip->protocol = 1; ip->saddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 1); ip->daddr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 2); ip->check = ipv4_hdr_checksum(ip, sizeof(*ip)); dpos = (u8 *) (ip + 1); - for (i = 0; i < HWSIM_IP_LEN - sizeof(*ip); i++) + for (i = 0; i < send_len - sizeof(*ip); i++) *dpos++ = i; if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, &buf[2], - HWSIM_PACKETLEN) < 0) + sizeof(struct ether_header) + send_len) < 0) return -1; wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR Modified: stable/11/contrib/wpa/hostapd/defconfig ============================================================================== --- stable/11/contrib/wpa/hostapd/defconfig Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/defconfig Thu Aug 29 19:13:27 2019 (r351611) @@ -108,11 +108,18 @@ CONFIG_EAP_TTLS=y #CONFIG_EAP_GPSK_SHA256=y # EAP-FAST for the integrated EAP server -# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed -# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g., -# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions. #CONFIG_EAP_FAST=y +# EAP-TEAP for the integrated EAP server +# Note: The current EAP-TEAP implementation is experimental and should not be +# enabled for production use. The IETF RFC 7170 that defines EAP-TEAP has number +# of conflicting statements and missing details and the implementation has +# vendor specific workarounds for those and as such, may not interoperate with +# any other implementation. This should not be used for anything else than +# experimentation and interoperability testing until those issues has been +# resolved. +#CONFIG_EAP_TEAP=y + # Wi-Fi Protected Setup (WPS) #CONFIG_WPS=y # Enable UPnP support for external WPS Registrars @@ -375,6 +382,9 @@ CONFIG_IPV6=y # Opportunistic Wireless Encryption (OWE) # Experimental implementation of draft-harkins-owe-07.txt #CONFIG_OWE=y + +# Airtime policy support +#CONFIG_AIRTIME_POLICY=y # Override default value for the wpa_disable_eapol_key_retries configuration # parameter. See that parameter in hostapd.conf for more details. Modified: stable/11/contrib/wpa/hostapd/eap_register.c ============================================================================== --- stable/11/contrib/wpa/hostapd/eap_register.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/eap_register.c Thu Aug 29 19:13:27 2019 (r351611) @@ -121,6 +121,11 @@ int eap_server_register_methods(void) ret = eap_server_fast_register(); #endif /* EAP_SERVER_FAST */ +#ifdef EAP_SERVER_TEAP + if (ret == 0) + ret = eap_server_teap_register(); +#endif /* EAP_SERVER_TEAP */ + #ifdef EAP_SERVER_WSC if (ret == 0) ret = eap_server_wsc_register(); Modified: stable/11/contrib/wpa/hostapd/hostapd.conf ============================================================================== --- stable/11/contrib/wpa/hostapd/hostapd.conf Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/hostapd.conf Thu Aug 29 19:13:27 2019 (r351611) @@ -782,10 +782,8 @@ wmm_ac_vo_acm=0 # 1 = supported #he_mu_beamformer=1 -# he_bss_color: BSS color -# 0 = no BSS color (default) -# unsigned integer = BSS color -#he_bss_color=0 +# he_bss_color: BSS color (1-63) +#he_bss_color=1 #he_default_pe_duration: The duration of PE field in an HE PPDU in us # Possible values are 0 us (default), 4 us, 8 us, 12 us, and 16 us @@ -801,6 +799,17 @@ wmm_ac_vo_acm=0 # unsigned integer = duration in units of 16 us #he_rts_threshold=0 +# HE operating channel information; see matching vht_* parameters for details. +#he_oper_chwidth +#he_oper_centr_freq_seg0_idx +#he_oper_centr_freq_seg1_idx + +#he_basic_mcs_nss_set: Basic NSS/MCS set +# 16-bit combination of 2-bit values of Max HE-MCS For 1..8 SS; each 2-bit +# value having following meaning: +# 0 = HE-MCS 0-7, 1 = HE-MCS 0-9, 2 = HE-MCS 0-11, 3 = not supported +#he_basic_mcs_nss_set + #he_mu_edca_qos_info_param_count #he_mu_edca_qos_info_q_ack #he_mu_edca_qos_info_queue_request=1 @@ -825,6 +834,12 @@ wmm_ac_vo_acm=0 #he_mu_edca_ac_vo_ecwmax=15 #he_mu_edca_ac_vo_timer=255 +# Spatial Reuse Parameter Set +#he_spr_sr_control +#he_spr_non_srg_obss_pd_max_offset +#he_spr_srg_obss_pd_min_offset +#he_spr_srg_obss_pd_max_offset + ##### IEEE 802.1X-2004 related configuration ################################## # Require IEEE 802.1X authorization @@ -836,6 +851,8 @@ wmm_ac_vo_acm=0 # the new version number correctly (they seem to drop the frames completely). # In order to make hostapd interoperate with these clients, the version number # can be set to the older version (1) with this configuration value. +# Note: When using MACsec, eapol_version shall be set to 3, which is +# defined in IEEE Std 802.1X-2010. #eapol_version=2 # Optional displayable message sent with EAP Request-Identity. The first \0 @@ -879,6 +896,54 @@ eapol_key_index_workaround=0 # ERP is enabled (eap_server_erp=1). #erp_domain=example.com +##### MACsec ################################################################## + +# macsec_policy: IEEE 802.1X/MACsec options +# This determines how sessions are secured with MACsec (only for MACsec +# drivers). +# 0: MACsec not in use (default) +# 1: MACsec enabled - Should secure, accept key server's advice to +# determine whether to use a secure session or not. +# +# macsec_integ_only: IEEE 802.1X/MACsec transmit mode +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Encrypt traffic (default) +# 1: Integrity only +# +# macsec_replay_protect: IEEE 802.1X/MACsec replay protection +# This setting applies only when MACsec is in use, i.e., +# - macsec_policy is enabled +# - the key server has decided to enable MACsec +# 0: Replay protection disabled (default) +# 1: Replay protection enabled +# +# macsec_replay_window: IEEE 802.1X/MACsec replay protection window +# This determines a window in which replay is tolerated, to allow receipt +# of frames that have been misordered by the network. +# This setting applies only when MACsec replay protection active, i.e., +# - macsec_replay_protect is enabled +# - the key server has decided to enable MACsec +# 0: No replay window, strict check (default) +# 1..2^32-1: number of packets that could be misordered +# +# macsec_port: IEEE 802.1X/MACsec port +# Port component of the SCI +# Range: 1-65534 (default: 1) +# +# mka_priority (Priority of MKA Actor) +# Range: 0..255 (default: 255) +# +# mka_cak, mka_ckn, and mka_priority: IEEE 802.1X/MACsec pre-shared key mode +# This allows to configure MACsec with a pre-shared key using a (CAK,CKN) pair. +# In this mode, instances of hostapd can act as MACsec peers. The peer +# with lower priority will become the key server and start distributing SAKs. +# mka_cak (CAK = Secure Connectivity Association Key) takes a 16-byte (128-bit) +# hex-string (32 hex-digits) or a 32-byte (256-bit) hex-string (64 hex-digits) +# mka_ckn (CKN = CAK Name) takes a 1..32-bytes (8..256 bit) hex-string +# (2..64 hex-digits) + ##### Integrated EAP server ################################################### # Optionally, hostapd can be configured to use an integrated EAP server @@ -912,6 +977,23 @@ eap_server=0 # Passphrase for private key #private_key_passwd=secret passphrase +# An alternative server certificate and private key can be configured with the +# following parameters (with values just like the parameters above without the +# '2' suffix). The ca_cert file (in PEM encoding) is used to add the trust roots +# for both server certificates and/or client certificates). +# +# The main use case for this alternative server certificate configuration is to +# enable both RSA and ECC public keys. The server will pick which one to use +# based on the client preferences for the cipher suite (in the TLS ClientHello +# message). It should be noted that number of deployed EAP peer implementations +# do not filter out the cipher suite list based on their local configuration and +# as such, configuration of alternative types of certificates on the server may +# result in interoperability issues. +#server_cert2=/etc/hostapd.server-ecc.pem +#private_key2=/etc/hostapd.server-ecc.prv +#private_key_passwd2=secret passphrase + + # Server identity # EAP methods that provide mechanism for authenticated server identity delivery # use this value. If not set, "hostapd" is used as a default. @@ -1109,10 +1191,27 @@ eap_server=0 # (or fewer) of the lifetime remains. #pac_key_refresh_time=86400 +# EAP-TEAP authentication type +# 0 = inner EAP (default) +# 1 = Basic-Password-Auth +#eap_teap_auth=0 + +# EAP-TEAP authentication behavior when using PAC +# 0 = perform inner authentication (default) +# 1 = skip inner authentication (inner EAP/Basic-Password-Auth) +#eap_teap_pac_no_inner=0 + # EAP-SIM and EAP-AKA protected success/failure indication using AT_RESULT_IND # (default: 0 = disabled). #eap_sim_aka_result_ind=1 +# EAP-SIM and EAP-AKA identity options +# 0 = do not use pseudonyms or fast reauthentication +# 1 = use pseudonyms, but not fast reauthentication +# 2 = do not use pseudonyms, but use fast reauthentication +# 3 = use pseudonyms and use fast reauthentication (default) +#eap_sim_id=3 + # Trusted Network Connect (TNC) # If enabled, TNC validation will be required before the peer is allowed to # connect. Note: This is only used with EAP-TTLS and EAP-FAST. If any other @@ -1292,6 +1391,17 @@ own_ip_addr=127.0.0.1 # Operator-Name = "Operator" #radius_acct_req_attr=126:s:Operator +# If SQLite support is included, path to a database from which additional +# RADIUS request attributes are extracted based on the station MAC address. +# +# The schema for the radius_attributes table is: +# id | sta | reqtype | attr : multi-key (sta, reqtype) +# id = autonumber +# sta = station MAC address in `11:22:33:44:55:66` format. +# type = `auth` | `acct` | NULL (match any) +# attr = existing config file format, e.g. `126:s:Test Operator` +#radius_req_attr_sqlite=radius_attr.sqlite + # Dynamic Authorization Extensions (RFC 5176) # This mechanism can be used to allow dynamic changes to user session based on # commands from a RADIUS server (or some other disconnect client that has the @@ -2491,6 +2601,42 @@ own_ip_addr=127.0.0.1 # as a radio measurement even if the request doesn't contain a max age element # that allows sending of such data. Default: 0. #stationary_ap=0 + +##### Airtime policy configuration ########################################### + +# Set the airtime policy operating mode: +# 0 = disabled (default) +# 1 = static config +# 2 = per-BSS dynamic config +# 3 = per-BSS limit mode +#airtime_mode=0 + +# Interval (in milliseconds) to poll the kernel for updated station activity in +# dynamic and limit modes +#airtime_update_interval=200 + +# Static configuration of station weights (when airtime_mode=1). Kernel default +# weight is 256; set higher for larger airtime share, lower for smaller share. +# Each entry is a MAC address followed by a weight. +#airtime_sta_weight=02:01:02:03:04:05 256 +#airtime_sta_weight=02:01:02:03:04:06 512 + +# Per-BSS airtime weight. In multi-BSS mode, set for each BSS and hostapd will +# configure station weights to enforce the correct ratio between BSS weights +# depending on the number of active stations. The *ratios* between different +# BSSes is what's important, not the absolute numbers. +# Must be set for all BSSes if airtime_mode=2 or 3, has no effect otherwise. +#airtime_bss_weight=1 + +# Whether the current BSS should be limited (when airtime_mode=3). +# +# If set, the BSS weight ratio will be applied in the case where the current BSS +# would exceed the share defined by the BSS weight ratio. E.g., if two BSSes are +# set to the same weights, and one is set to limited, the limited BSS will get +# no more than half the available airtime, but if the non-limited BSS has more +# stations active, that *will* be allowed to exceed its half of the available +# airtime. +#airtime_bss_limit=1 ##### TESTING OPTIONS ######################################################### # Modified: stable/11/contrib/wpa/hostapd/hostapd_cli.c ============================================================================== --- stable/11/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/hostapd_cli.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1214,6 +1214,13 @@ static int hostapd_cli_cmd_disable(struct wpa_ctrl *ct } +static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc, + char *argv[]) +{ + return wpa_ctrl_command(ctrl, "UPDATE_BEACON"); +} + + static int hostapd_cli_cmd_vendor(struct wpa_ctrl *ctrl, int argc, char *argv[]) { char cmd[256]; @@ -1617,6 +1624,8 @@ static const struct hostapd_cli_cmd hostapd_cli_comman "= reload configuration for current interface" }, { "disable", hostapd_cli_cmd_disable, NULL, "= disable hostapd on current interface" }, + { "update_beacon", hostapd_cli_cmd_update_beacon, NULL, + "= update Beacon frame contents\n"}, { "erp_flush", hostapd_cli_cmd_erp_flush, NULL, "= drop all ERP keys"}, { "log_level", hostapd_cli_cmd_log_level, NULL, Modified: stable/11/contrib/wpa/hostapd/main.c ============================================================================== --- stable/11/contrib/wpa/hostapd/main.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hostapd/main.c Thu Aug 29 19:13:27 2019 (r351611) @@ -653,6 +653,9 @@ int main(int argc, char *argv[]) int start_ifaces_in_sync = 0; char **if_names = NULL; size_t if_names_size = 0; +#ifdef CONFIG_DPP + struct dpp_global_config dpp_conf; +#endif /* CONFIG_DPP */ if (os_program_init()) return -1; @@ -672,7 +675,9 @@ int main(int argc, char *argv[]) dl_list_init(&interfaces.eth_p_oui); #endif /* CONFIG_ETH_P_OUI */ #ifdef CONFIG_DPP - interfaces.dpp = dpp_global_init(); + os_memset(&dpp_conf, 0, sizeof(dpp_conf)); + /* TODO: dpp_conf.msg_ctx? */ + interfaces.dpp = dpp_global_init(&dpp_conf); if (!interfaces.dpp) return -1; #endif /* CONFIG_DPP */ Modified: stable/11/contrib/wpa/hs20/client/osu_client.c ============================================================================== --- stable/11/contrib/wpa/hs20/client/osu_client.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/hs20/client/osu_client.c Thu Aug 29 19:13:27 2019 (r351611) @@ -1588,6 +1588,7 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ xml_node_t *node, const char *fqdn) { char buf[200], dir[200]; + int res; wpa_printf(MSG_INFO, "- Credential/DigitalCertificate"); @@ -1599,14 +1600,20 @@ static void set_pps_cred_digital_cert(struct hs20_osu_ wpa_printf(MSG_INFO, "Failed to set username"); } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-cert.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "client_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set client_cert"); } } - snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/client-key.pem", dir, + fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "private_key", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set private_key"); @@ -1620,6 +1627,7 @@ static void set_pps_cred_realm(struct hs20_osu_client { char *str = xml_node_get_text(ctx->xml, node); char buf[200], dir[200]; + int res; if (str == NULL) return; @@ -1634,7 +1642,9 @@ static void set_pps_cred_realm(struct hs20_osu_client if (getcwd(dir, sizeof(dir)) == NULL) return; - snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + res = os_snprintf(buf, sizeof(buf), "%s/SP/%s/aaa-ca.pem", dir, fqdn); + if (os_snprintf_error(sizeof(buf), res)) + return; if (os_file_exists(buf)) { if (set_cred_quoted(ctx->ifname, id, "ca_cert", buf) < 0) { wpa_printf(MSG_INFO, "Failed to set CA cert"); @@ -2717,6 +2727,8 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co if (!pps_fname) { char buf[256]; + int res; + wpa_printf(MSG_INFO, "Determining PPS file based on Home SP information"); if (address && os_strncmp(address, "fqdn=", 5) == 0) { wpa_printf(MSG_INFO, "Use requested FQDN from command line"); @@ -2737,8 +2749,13 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, co "SP/%s/pps.xml", ctx->fqdn); pps_fname = pps_fname_buf; - os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), "SP/%s/ca.pem", - buf); + res = os_snprintf(ca_fname_buf, sizeof(ca_fname_buf), + "SP/%s/ca.pem", buf); + if (os_snprintf_error(sizeof(ca_fname_buf), res)) { + os_free(ctx->fqdn); + ctx->fqdn = NULL; + return -1; + } ca_fname = ca_fname_buf; } Modified: stable/11/contrib/wpa/src/ap/accounting.c ============================================================================== --- stable/11/contrib/wpa/src/ap/accounting.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/src/ap/accounting.c Thu Aug 29 19:13:27 2019 (r351611) @@ -97,6 +97,9 @@ static struct radius_msg * accounting_msg(struct hosta msg) < 0) goto fail; + if (sta && add_sqlite_radius_attr(hapd, sta, msg, 1) < 0) + goto fail; + if (sta) { for (i = 0; ; i++) { val = ieee802_1x_get_radius_class(sta->eapol_sm, &len, Modified: stable/11/contrib/wpa/src/ap/acs.c ============================================================================== --- stable/11/contrib/wpa/src/ap/acs.c Thu Aug 29 18:53:00 2019 (r351610) +++ stable/11/contrib/wpa/src/ap/acs.c Thu Aug 29 19:13:27 2019 (r351611) @@ -594,12 +594,12 @@ acs_find_ideal_chan(struct hostapd_iface *iface) iface->conf->secondary_channel) n_chans = 2; - if (iface->conf->ieee80211ac) { - switch (iface->conf->vht_oper_chwidth) { - case VHT_CHANWIDTH_80MHZ: + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { + switch (hostapd_get_oper_chwidth(iface->conf)) { + case CHANWIDTH_80MHZ: n_chans = 4; break; - case VHT_CHANWIDTH_160MHZ: + case CHANWIDTH_160MHZ: n_chans = 8; break; } @@ -607,7 +607,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface) bw = num_chan_to_bw(n_chans); - /* TODO: VHT80+80. Update acs_adjust_vht_center_freq() too. */ + /* TODO: VHT/HE80+80. Update acs_adjust_center_freq() too. */ wpa_printf(MSG_DEBUG, "ACS: Survey analysis for selected bandwidth %d MHz", bw); @@ -647,9 +647,9 @@ acs_find_ideal_chan(struct hostapd_iface *iface) } if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && - iface->conf->ieee80211ac) { - if (iface->conf->vht_oper_chwidth == *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 29 22:13:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 045AAE15B9; Thu, 29 Aug 2019 22:13:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KH1R6JC8z4G7L; Thu, 29 Aug 2019 22:13:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9B4826893; Thu, 29 Aug 2019 22:13:15 +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 x7TMDFUa090785; Thu, 29 Aug 2019 22:13:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TMDFpJ090784; Thu, 29 Aug 2019 22:13:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908292213.x7TMDFpJ090784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 29 Aug 2019 22:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351613 - head/sys/fs/fuse X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/fs/fuse X-SVN-Commit-Revision: 351613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 22:13:16 -0000 Author: markj Date: Thu Aug 29 22:13:15 2019 New Revision: 351613 URL: https://svnweb.freebsd.org/changeset/base/351613 Log: Remove unused VM page locking macros. They were orphaned by r292373. Reviewed by: asomers MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21469 Modified: head/sys/fs/fuse/fuse_vnops.c Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Thu Aug 29 20:39:24 2019 (r351612) +++ head/sys/fs/fuse/fuse_vnops.c Thu Aug 29 22:13:15 2019 (r351613) @@ -226,11 +226,6 @@ struct vop_vector fuse_vnops = { uma_zone_t fuse_pbuf_zone; -#define fuse_vm_page_lock(m) vm_page_lock((m)); -#define fuse_vm_page_unlock(m) vm_page_unlock((m)); -#define fuse_vm_page_lock_queues() ((void)0) -#define fuse_vm_page_unlock_queues() ((void)0) - /* Check permission for extattr operations, much like extattr_check_cred */ static int fuse_extattr_check_cred(struct vnode *vp, int ns, struct ucred *cred, From owner-svn-src-all@freebsd.org Thu Aug 29 23:23:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC894E2522; Thu, 29 Aug 2019 23:23:12 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KJZ85FZKz4JSN; Thu, 29 Aug 2019 23:23:12 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96D97274FF; Thu, 29 Aug 2019 23:23:12 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7TNNC3S031423; Thu, 29 Aug 2019 23:23:12 GMT (envelope-from jgh@FreeBSD.org) Received: (from jgh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7TNNCNT031422; Thu, 29 Aug 2019 23:23:12 GMT (envelope-from jgh@FreeBSD.org) Message-Id: <201908292323.x7TNNCNT031422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jgh set sender to jgh@FreeBSD.org using -f From: Jason Helfman Date: Thu, 29 Aug 2019 23:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351614 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: jgh X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 351614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2019 23:23:12 -0000 Author: jgh (doc,ports committer) Date: Thu Aug 29 23:23:12 2019 New Revision: 351614 URL: https://svnweb.freebsd.org/changeset/base/351614 Log: - address missing whitespace for indent PR: 239727 Submitted by: gbergling@gmail.com Reviewed by: 0mp@ MFC after: 1 week Modified: head/usr.bin/indent/indent.1 Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Thu Aug 29 22:13:15 2019 (r351613) +++ head/usr.bin/indent/indent.1 Thu Aug 29 23:23:12 2019 (r351614) @@ -159,7 +159,7 @@ except that it only applies to the first set of declar in a procedure (just after the first `{') and it causes a blank line to be generated even if there are no declarations. The default is -.Fl nbadp. +.Fl nbadp . .It Fl bap , nbap If .Fl bap @@ -202,7 +202,7 @@ if (...) { .It Fl bs , nbs Whether a blank should always be inserted after sizeof. The default is -.Fl nbs. +.Fl nbs . .It Fl c Ns Ar n The column in which comments on code start. The default is 33. @@ -353,7 +353,7 @@ The default is 78. .It Fl lc Ns Ar n Maximum length of an output line in a block comment. The default is 0, which means to limit block comment lines in accordance with -.Fl l. +.Fl l . .It Fl \&ldi Ns Ar n Specifies the indentation, in character positions, of local variable names From owner-svn-src-all@freebsd.org Fri Aug 30 00:03:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83E53E3903; Fri, 30 Aug 2019 00:03:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KKSt2DHvz4MC6; Fri, 30 Aug 2019 00:03:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2233D27C2F; Fri, 30 Aug 2019 00:03:42 +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 x7U03gr2055511; Fri, 30 Aug 2019 00:03:42 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U03fio055510; Fri, 30 Aug 2019 00:03:41 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201908300003.x7U03fio055510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 30 Aug 2019 00:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351615 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 351615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:03:42 -0000 Author: glebius Date: Fri Aug 30 00:03:41 2019 New Revision: 351615 URL: https://svnweb.freebsd.org/changeset/base/351615 Log: Allow mbuf queues to be unlimited. There is number of legacy code that uses ifqueue without setting a limit on it first. Easier to allow for that rather than improve legacy drivers. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Aug 29 23:23:12 2019 (r351614) +++ head/sys/sys/mbuf.h Fri Aug 30 00:03:41 2019 (r351615) @@ -1434,7 +1434,7 @@ static inline int mbufq_full(const struct mbufq *mq) { - return (mq->mq_len >= mq->mq_maxlen); + return (mq->mq_maxlen > 0 && mq->mq_len >= mq->mq_maxlen); } static inline int From owner-svn-src-all@freebsd.org Fri Aug 30 00:05:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADFDEE3C88; Fri, 30 Aug 2019 00:05:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KKVV1qY0z4NZh; Fri, 30 Aug 2019 00:05:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA41627C3F; Fri, 30 Aug 2019 00:05:05 +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 x7U055hQ057391; Fri, 30 Aug 2019 00:05:05 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U055YI057385; Fri, 30 Aug 2019 00:05:05 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201908300005.x7U055YI057385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 30 Aug 2019 00:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351616 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 351616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:05:06 -0000 Author: glebius Date: Fri Aug 30 00:05:04 2019 New Revision: 351616 URL: https://svnweb.freebsd.org/changeset/base/351616 Log: Use mbuf queue instead of ifqueue in USB network drivers. Reviewed by: stevek Modified: head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_axge.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/net/usb_ethernet.h Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Fri Aug 30 00:03:41 2019 (r351615) +++ head/sys/dev/usb/net/if_axe.c Fri Aug 30 00:05:04 2019 (r351616) @@ -1149,7 +1149,7 @@ axe_rxeof(struct usb_ether *ue, struct usb_page_cache } } - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } Modified: head/sys/dev/usb/net/if_axge.c ============================================================================== --- head/sys/dev/usb/net/if_axge.c Fri Aug 30 00:03:41 2019 (r351615) +++ head/sys/dev/usb/net/if_axge.c Fri Aug 30 00:05:04 2019 (r351616) @@ -1041,7 +1041,7 @@ axge_rxeof(struct usb_ether *ue, struct usb_page_cache } if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); } static void Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Fri Aug 30 00:03:41 2019 (r351615) +++ head/sys/dev/usb/net/usb_ethernet.c Fri Aug 30 00:05:04 2019 (r351616) @@ -598,7 +598,7 @@ uether_rxmbuf(struct usb_ether *ue, struct mbuf *m, m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -628,7 +628,7 @@ uether_rxbuf(struct usb_ether *ue, struct usb_page_cac m->m_pkthdr.len = m->m_len = len; /* enqueue for later when the lock can be released */ - _IF_ENQUEUE(&ue->ue_rxq, m); + (void)mbufq_enqueue(&ue->ue_rxq, m); return (0); } @@ -641,7 +641,7 @@ uether_rxflush(struct usb_ether *ue) UE_LOCK_ASSERT(ue, MA_OWNED); for (;;) { - _IF_DEQUEUE(&ue->ue_rxq, m); + m = mbufq_dequeue(&ue->ue_rxq); if (m == NULL) break; Modified: head/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.h Fri Aug 30 00:03:41 2019 (r351615) +++ head/sys/dev/usb/net/usb_ethernet.h Fri Aug 30 00:05:04 2019 (r351616) @@ -41,12 +41,10 @@ #include #include -#include #include #include #include #include -#include #include #include @@ -89,7 +87,7 @@ struct usb_ether { struct usb_process ue_tq; struct sysctl_ctx_list ue_sysctl_ctx; - struct ifqueue ue_rxq; + struct mbufq ue_rxq; struct usb_callout ue_watchdog; struct usb_ether_cfg_task ue_sync_task[2]; struct usb_ether_cfg_task ue_media_task[2]; From owner-svn-src-all@freebsd.org Fri Aug 30 00:30:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A18F8E4875; Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KL3J3pvhz4R2c; Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6124427FEB; Fri, 30 Aug 2019 00:30:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7U0U437071585; Fri, 30 Aug 2019 00:30:04 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0U4Ss071584; Fri, 30 Aug 2019 00:30:04 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908300030.x7U0U4Ss071584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 30 Aug 2019 00:30:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351617 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 351617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:30:04 -0000 Author: mjg Date: Fri Aug 30 00:30:03 2019 New Revision: 351617 URL: https://svnweb.freebsd.org/changeset/base/351617 Log: nullfs: use VOP_NEED_INACTIVE Reviewed by: kib Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Fri Aug 30 00:05:04 2019 (r351616) +++ head/sys/fs/nullfs/null_vnops.c Fri Aug 30 00:30:03 2019 (r351617) @@ -732,14 +732,13 @@ null_unlock(struct vop_unlock_args *ap) * ours. */ static int -null_inactive(struct vop_inactive_args *ap __unused) +null_want_recycle(struct vnode *vp) { - struct vnode *vp, *lvp; + struct vnode *lvp; struct null_node *xp; struct mount *mp; struct null_mount *xmp; - vp = ap->a_vp; xp = VTONULL(vp); lvp = NULLVPTOLOWERVP(vp); mp = vp->v_mount; @@ -753,12 +752,31 @@ null_inactive(struct vop_inactive_args *ap __unused) * deleted, then free up the vnode so as not to tie up * the lower vnodes. */ + return (1); + } + return (0); +} + +static int +null_inactive(struct vop_inactive_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + if (null_want_recycle(vp)) { vp->v_object = NULL; vrecycle(vp); } return (0); } +static int +null_need_inactive(struct vop_need_inactive_args *ap) +{ + + return (null_want_recycle(ap->a_vp)); +} + /* * Now, the nullfs vnode and, due to the sharing lock, the lower * vnode, are exclusively locked, and we shall destroy the null vnode. @@ -907,7 +925,7 @@ struct vop_vector null_vnodeops = { .vop_getattr = null_getattr, .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, - .vop_need_inactive = vop_stdneed_inactive, + .vop_need_inactive = null_need_inactive, .vop_islocked = vop_stdislocked, .vop_lock1 = null_lock, .vop_lookup = null_lookup, From owner-svn-src-all@freebsd.org Fri Aug 30 00:34:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4511E4A92; Fri, 30 Aug 2019 00:34:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KL8N3sJMz4RQF; Fri, 30 Aug 2019 00:34:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 663AF281A7; Fri, 30 Aug 2019 00:34:28 +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 x7U0YSQ3076937; Fri, 30 Aug 2019 00:34:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0YSXx076936; Fri, 30 Aug 2019 00:34:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908300034.x7U0YSXx076936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 30 Aug 2019 00:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351618 - head/sys/arm/samsung/exynos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/samsung/exynos X-SVN-Commit-Revision: 351618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:34:28 -0000 Author: emaste Date: Fri Aug 30 00:34:27 2019 New Revision: 351618 URL: https://svnweb.freebsd.org/changeset/base/351618 Log: exynos5: avoid NULL deref in error case Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/samsung/exynos/exynos5_combiner.c Modified: head/sys/arm/samsung/exynos/exynos5_combiner.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_combiner.c Fri Aug 30 00:30:03 2019 (r351617) +++ head/sys/arm/samsung/exynos/exynos5_combiner.c Fri Aug 30 00:34:27 2019 (r351618) @@ -314,7 +314,7 @@ combiner_setup_intr(char *source_name, void (*ih)(void sc = combiner_sc; if (sc == NULL) { - device_printf(sc->dev, "Error: combiner is not attached\n"); + printf("%s: error: combiner is not attached\n", __func__); return; } From owner-svn-src-all@freebsd.org Fri Aug 30 00:36:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29E8DE4B20; Fri, 30 Aug 2019 00:36:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KLBV0Hz8z4RY4; Fri, 30 Aug 2019 00:36:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFCBE281A9; Fri, 30 Aug 2019 00:36:17 +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 x7U0aH43077071; Fri, 30 Aug 2019 00:36:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0aHU6077070; Fri, 30 Aug 2019 00:36:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908300036.x7U0aHU6077070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 30 Aug 2019 00:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351619 - head/sys/arm/samsung/exynos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/samsung/exynos X-SVN-Commit-Revision: 351619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:36:18 -0000 Author: emaste Date: Fri Aug 30 00:36:17 2019 New Revision: 351619 URL: https://svnweb.freebsd.org/changeset/base/351619 Log: exynos5: avoid NULL deref in error case Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days MFC with: r351618 Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/samsung/exynos/exynos5_pad.c Modified: head/sys/arm/samsung/exynos/exynos5_pad.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_pad.c Fri Aug 30 00:34:27 2019 (r351618) +++ head/sys/arm/samsung/exynos/exynos5_pad.c Fri Aug 30 00:36:17 2019 (r351619) @@ -410,7 +410,7 @@ pad_setup_intr(int gpio_number, void (*ih)(void *), vo sc = gpio_sc; if (sc == NULL) { - device_printf(sc->dev, "Error: pad is not attached\n"); + printf("%s: Error: pad is not attached\n", __func__); return (-1); } From owner-svn-src-all@freebsd.org Fri Aug 30 00:38:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CDA1E4BB3; Fri, 30 Aug 2019 00:38:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KLDm72Wqz4Rgj; Fri, 30 Aug 2019 00:38:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEEFD281AA; Fri, 30 Aug 2019 00:38:16 +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 x7U0cGpY077202; Fri, 30 Aug 2019 00:38:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0cGEq077201; Fri, 30 Aug 2019 00:38:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908300038.x7U0cGEq077201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 30 Aug 2019 00:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351620 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 351620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:38:17 -0000 Author: emaste Date: Fri Aug 30 00:38:16 2019 New Revision: 351620 URL: https://svnweb.freebsd.org/changeset/base/351620 Log: qlxgbe: avoid NULL deref in error case Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/qlxgbe/ql_isr.c Modified: head/sys/dev/qlxgbe/ql_isr.c ============================================================================== --- head/sys/dev/qlxgbe/ql_isr.c Fri Aug 30 00:36:17 2019 (r351619) +++ head/sys/dev/qlxgbe/ql_isr.c Fri Aug 30 00:38:16 2019 (r351620) @@ -793,7 +793,7 @@ ql_mbx_isr(void *arg) ha = arg; if (ha == NULL) { - device_printf(ha->pci_dev, "%s: arg == NULL\n", __func__); + printf("%s: arg == NULL\n", __func__); return; } From owner-svn-src-all@freebsd.org Fri Aug 30 00:40:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46D9E4C74; Fri, 30 Aug 2019 00:40:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KLGw4JzNz4Rq9; Fri, 30 Aug 2019 00:40:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72FC1281AE; Fri, 30 Aug 2019 00:40:08 +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 x7U0e8cK077357; Fri, 30 Aug 2019 00:40:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0e8aQ077356; Fri, 30 Aug 2019 00:40:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201908300040.x7U0e8aQ077356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 30 Aug 2019 00:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351621 - head/sys/dev/xdma X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/xdma X-SVN-Commit-Revision: 351621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:40:08 -0000 Author: emaste Date: Fri Aug 30 00:40:08 2019 New Revision: 351621 URL: https://svnweb.freebsd.org/changeset/base/351621 Log: xdma: avoid NULL deref in error case Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/xdma/xdma_sg.c Modified: head/sys/dev/xdma/xdma_sg.c ============================================================================== --- head/sys/dev/xdma/xdma_sg.c Fri Aug 30 00:38:16 2019 (r351620) +++ head/sys/dev/xdma/xdma_sg.c Fri Aug 30 00:40:08 2019 (r351621) @@ -186,8 +186,7 @@ xchan_bufs_alloc(xdma_channel_t *xchan) xdma = xchan->xdma; if (xdma == NULL) { - device_printf(xdma->dev, - "%s: Channel was not allocated properly.\n", __func__); + printf("%s: Channel was not allocated properly.\n", __func__); return (-1); } From owner-svn-src-all@freebsd.org Fri Aug 30 00:45:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC89AE4EE5; Fri, 30 Aug 2019 00:45:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KLPZ5BrJz4SF2; Fri, 30 Aug 2019 00:45:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FA032836B; Fri, 30 Aug 2019 00:45:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7U0jsx5083260; Fri, 30 Aug 2019 00:45:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U0jsq9083259; Fri, 30 Aug 2019 00:45:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908300045.x7U0jsq9083259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 30 Aug 2019 00:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351622 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 00:45:54 -0000 Author: mjg Date: Fri Aug 30 00:45:53 2019 New Revision: 351622 URL: https://svnweb.freebsd.org/changeset/base/351622 Log: vfs: tidy up assertions in vfs_subr - assert unlocked vnode interlock in vref - assert right counts in vputx - print debug info for panic in vdrop Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Aug 30 00:40:08 2019 (r351621) +++ head/sys/kern/vfs_subr.c Fri Aug 30 00:45:53 2019 (r351622) @@ -2778,6 +2778,7 @@ void vref(struct vnode *vp) { + ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); _vhold(vp, false); v_incr_usecount(vp); @@ -2853,6 +2854,9 @@ vputx(struct vnode *vp, int func) else KASSERT(func == VPUTX_VRELE, ("vputx: wrong func")); ASSERT_VI_UNLOCKED(vp, __func__); + VNASSERT(vp->v_holdcnt > 0 && vp->v_usecount > 0, vp, + ("%s: wrong ref counts", __func__)); + CTR2(KTR_VFS, "%s: vp %p", __func__, vp); if (vp->v_type != VCHR && @@ -3069,8 +3073,10 @@ _vdrop(struct vnode *vp, bool locked) else ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if ((int)vp->v_holdcnt <= 0) - panic("vdrop: holdcnt %d", vp->v_holdcnt); + if (__predict_false((int)vp->v_holdcnt <= 0)) { + vn_printf(vp, "vdrop: holdcnt %d", vp->v_holdcnt); + panic("vdrop: wrong holdcnt"); + } if (!locked) { if (refcount_release_if_not_last(&vp->v_holdcnt)) return; From owner-svn-src-all@freebsd.org Fri Aug 30 04:29:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3709DC12EF; Fri, 30 Aug 2019 04:29:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 46KRMQ161bz4d04; Fri, 30 Aug 2019 04:29:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 2DA28362490; Fri, 30 Aug 2019 14:29:19 +1000 (AEST) Date: Fri, 30 Aug 2019 14:29:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351319 - in head/usr.sbin/makefs: ffs msdos In-Reply-To: <201908210145.x7L1jU3x072180@repo.freebsd.org> Message-ID: <20190830140337.D1405@besplex.bde.org> References: <201908210145.x7L1jU3x072180@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=D+Q3ErZj c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=Tet0GMRg2H-6MN17sk8A:9 a=PqWL37kH3jd52NYQ:21 a=5lQ2c9eFih_14WG5:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 46KRMQ161bz4d04 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.249 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-3.23 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_IN_DNSWL_LOW(-0.10)[249.132.29.211.list.dnswl.org : 127.0.5.1]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23:c]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; IP_SCORE(0.00)[ip: (-5.35), ipnet: 211.28.0.0/14(-3.27), asn: 4804(-2.40), country: AU(0.01)]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 04:29:23 -0000 On Wed, 21 Aug 2019, Ed Maste wrote: > Author: emaste > Date: Wed Aug 21 01:45:29 2019 > New Revision: 351319 > URL: https://svnweb.freebsd.org/changeset/base/351319 > > Log: > makefs: use `char *` not `void *` for buf b_data, drop casts in msdos > > (The kernel uses caddr_t.) This is much better than churning the copy of the working code. However, the kernel type is still bogus. caddr_t should not exist, and should have been more like vm_offset_t to begin with. void * is no good as an opaque type for it, since void * is only good for C addresses within a single address space, but caddr_t is supposed to be able to represent anything in a (possibly multiple) "core" address space. [u]intptr_t has the same problem. Bus space addresses are also withing a single address space and in general need a tag for uniqueness. caddr_t has been char * for too long, so too much code including buf b_data depends on it being precisely char * or u_char * to work. char * is an honestly broken variant of void *. It is similarly limited to a single address space. This is hard to fix. It works for [Free]BSD since no arches with more than a single address space are supported (i386 with PAE or pae_mode=1 or pae_mode has a larger physical address space where addresses aren't unique, but only the kernel can see this). Bruce From owner-svn-src-all@freebsd.org Fri Aug 30 06:06:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2252EC3579; Fri, 30 Aug 2019 06:06:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KTW90361z3D9g; Fri, 30 Aug 2019 06:06:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7A692BD78; Fri, 30 Aug 2019 06:06:12 +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 x7U66C1A072410; Fri, 30 Aug 2019 06:06:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7U66CUV072409; Fri, 30 Aug 2019 06:06:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908300606.x7U66CUV072409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 30 Aug 2019 06:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351623 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 351623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 06:06:13 -0000 Author: delphij Date: Fri Aug 30 06:06:12 2019 New Revision: 351623 URL: https://svnweb.freebsd.org/changeset/base/351623 Log: Remove unneeded blank line. No functional change. MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/fat.c Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Fri Aug 30 00:45:53 2019 (r351622) +++ head/sbin/fsck_msdosfs/fat.c Fri Aug 30 06:06:12 2019 (r351623) @@ -518,7 +518,6 @@ clear: } if (head == fat[n].head) { pwarn("Cluster chain starting at %u loops at cluster %u\n", - head, p); goto clear; } From owner-svn-src-all@freebsd.org Fri Aug 30 10:29:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE78ACA3AD; Fri, 30 Aug 2019 10:29:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46KbMP2bC6z3xkn; Fri, 30 Aug 2019 10:29:52 +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 x7UATi7t091264 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 30 Aug 2019 13:29:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x7UATi7t091264 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x7UATi2v091263; Fri, 30 Aug 2019 13:29:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 30 Aug 2019 13:29:43 +0300 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351622 - head/sys/kern Message-ID: <20190830102943.GE71821@kib.kiev.ua> References: <201908300045.x7U0jsq9083259@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201908300045.x7U0jsq9083259@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46KbMP2bC6z3xkn X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.91)[-0.906,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 10:29:53 -0000 On Fri, Aug 30, 2019 at 12:45:54AM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Fri Aug 30 00:45:53 2019 > New Revision: 351622 > URL: https://svnweb.freebsd.org/changeset/base/351622 > > Log: > vfs: tidy up assertions in vfs_subr > > - assert unlocked vnode interlock in vref > - assert right counts in vputx > - print debug info for panic in vdrop > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/kern/vfs_subr.c > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Fri Aug 30 00:40:08 2019 (r351621) > +++ head/sys/kern/vfs_subr.c Fri Aug 30 00:45:53 2019 (r351622) > @@ -2778,6 +2778,7 @@ void > vref(struct vnode *vp) > { > > + ASSERT_VI_UNLOCKED(vp, __func__); > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > _vhold(vp, false); > v_incr_usecount(vp); > @@ -2853,6 +2854,9 @@ vputx(struct vnode *vp, int func) > else > KASSERT(func == VPUTX_VRELE, ("vputx: wrong func")); > ASSERT_VI_UNLOCKED(vp, __func__); > + VNASSERT(vp->v_holdcnt > 0 && vp->v_usecount > 0, vp, A more precise assert condition would also include vp->v_holdcont >= vp->v_usecount > + ("%s: wrong ref counts", __func__)); > + > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > > if (vp->v_type != VCHR && > @@ -3069,8 +3073,10 @@ _vdrop(struct vnode *vp, bool locked) > else > ASSERT_VI_UNLOCKED(vp, __func__); > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > - if ((int)vp->v_holdcnt <= 0) > - panic("vdrop: holdcnt %d", vp->v_holdcnt); > + if (__predict_false((int)vp->v_holdcnt <= 0)) { > + vn_printf(vp, "vdrop: holdcnt %d", vp->v_holdcnt); > + panic("vdrop: wrong holdcnt"); > + } > if (!locked) { > if (refcount_release_if_not_last(&vp->v_holdcnt)) > return; From owner-svn-src-all@freebsd.org Fri Aug 30 15:40:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F04D17A2; Fri, 30 Aug 2019 15:40:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KkFq5GkDz4DwK; Fri, 30 Aug 2019 15:40:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93F2C2497; Fri, 30 Aug 2019 15:40:31 +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 x7UFeVp2011332; Fri, 30 Aug 2019 15:40:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UFeVrN011331; Fri, 30 Aug 2019 15:40:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908301540.x7UFeVrN011331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 30 Aug 2019 15:40:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351624 - head/sys/dev/sound/midi X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/sound/midi X-SVN-Commit-Revision: 351624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 15:40:31 -0000 Author: markj Date: Fri Aug 30 15:40:31 2019 New Revision: 351624 URL: https://svnweb.freebsd.org/changeset/base/351624 Log: Properly check for an interrupted cv_wait_sig(). The returned error number may be EINTR or ERESTART depending on whether or not the signal is supposed to interrupt the system call. Reported and tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/sound/midi/sequencer.c Modified: head/sys/dev/sound/midi/sequencer.c ============================================================================== --- head/sys/dev/sound/midi/sequencer.c Fri Aug 30 06:06:12 2019 (r351623) +++ head/sys/dev/sound/midi/sequencer.c Fri Aug 30 15:40:31 2019 (r351624) @@ -912,7 +912,7 @@ mseq_read(struct cdev *i_dev, struct uio *uio, int iof goto err1; retval = cv_wait_sig(&scp->in_cv, &scp->seq_lock); - if (retval == EINTR) + if (retval != 0) goto err1; } @@ -977,7 +977,7 @@ mseq_write(struct cdev *i_dev, struct uio *uio, int io * We slept, maybe things have changed since last * dying check */ - if (retval == EINTR) + if (retval != 0) goto err0; #if 0 /* From owner-svn-src-all@freebsd.org Fri Aug 30 16:30:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88DE3D289B; Fri, 30 Aug 2019 16:30:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KlM633tgz4H5P; Fri, 30 Aug 2019 16:30:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FF3E2D78; Fri, 30 Aug 2019 16:30:10 +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 x7UGUA49040273; Fri, 30 Aug 2019 16:30:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UGUA9Q040272; Fri, 30 Aug 2019 16:30:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201908301630.x7UGUA9Q040272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 30 Aug 2019 16:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351625 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 351625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 16:30:10 -0000 Author: jhb Date: Fri Aug 30 16:30:09 2019 New Revision: 351625 URL: https://svnweb.freebsd.org/changeset/base/351625 Log: Add entries for unmapped mbufs and KTLS. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Fri Aug 30 15:40:31 2019 (r351624) +++ head/RELNOTES Fri Aug 30 16:30:09 2019 (r351625) @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r351522: + Add kernel-side support for in-kernel Transport Layer Security + (KTLS). KTLS permits using sendfile(2) over sockets using + TLS. + r351361: Add probes for lockmgr(9) to the lockstat DTrace provider, add corresponding lockstat(1) events, and document the new probes in @@ -64,6 +69,9 @@ r350315, r350316: r350307: libcap_random(3) has been removed. Applications can use native APIs to get random data in capability mode. + +r349529,r349530: + Add support for using unmapped mbufs with sendfile(2). r349352: nand(4) and related components have been removed. From owner-svn-src-all@freebsd.org Fri Aug 30 16:35:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DB2FD2B78; Fri, 30 Aug 2019 16:35:32 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KlTH6vdHz4HZJ; Fri, 30 Aug 2019 16:35:31 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CABC22F30; Fri, 30 Aug 2019 16:35:31 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7UGZVh0045885; Fri, 30 Aug 2019 16:35:31 GMT (envelope-from emax@FreeBSD.org) Received: (from emax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UGZVQp045884; Fri, 30 Aug 2019 16:35:31 GMT (envelope-from emax@FreeBSD.org) Message-Id: <201908301635.x7UGZVQp045884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emax set sender to emax@FreeBSD.org using -f From: Maksim Yevmenkin Date: Fri, 30 Aug 2019 16:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351626 - head/sys/netgraph/bluetooth/socket X-SVN-Group: head X-SVN-Commit-Author: emax X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/socket X-SVN-Commit-Revision: 351626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 16:35:32 -0000 Author: emax Date: Fri Aug 30 16:35:31 2019 New Revision: 351626 URL: https://svnweb.freebsd.org/changeset/base/351626 Log: avoid holding PCB mutex during copyin/copyout() Reported by: imp, mms dot vanbreukelingen at gmail dot com Reviewed by: imp Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Fri Aug 30 16:30:09 2019 (r351625) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Fri Aug 30 16:35:31 2019 (r351626) @@ -1156,15 +1156,15 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long if (p->num_entries <= 0 || p->num_entries > NG_HCI_MAX_NEIGHBOR_NUM || p->entries == NULL) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_NODE_GET_NEIGHBOR_CACHE, 0, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_hci_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -1173,7 +1173,8 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long NG_SEND_MSG_PATH(error, ng_btsocket_hci_raw_node, msg, path, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, @@ -1181,16 +1182,21 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long ng_btsocket_hci_raw_ioctl_timeout * hz); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_HCI_NODE_GET_NEIGHBOR_CACHE) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_HCI_NODE_GET_NEIGHBOR_CACHE) { /* Return data back to user space */ - p1 = (ng_hci_node_get_neighbor_cache_ep *) - (pcb->msg->data); - p2 = (ng_hci_node_neighbor_cache_entry_ep *) - (p1 + 1); + p1 = (ng_hci_node_get_neighbor_cache_ep *)(msg->data); + p2 = (ng_hci_node_neighbor_cache_entry_ep *)(p1 + 1); p->num_entries = min(p->num_entries, p1->num_entries); if (p->num_entries > 0) @@ -1200,8 +1206,9 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - }break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_HCI_RAW_NODE_GET_CON_LIST: { struct ng_btsocket_hci_raw_con_list *p = @@ -1212,15 +1219,15 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long if (p->num_connections == 0 || p->num_connections > NG_HCI_MAX_CON_NUM || p->connections == NULL) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_NODE_GET_CON_LIST, 0, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_hci_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -1229,7 +1236,8 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long NG_SEND_MSG_PATH(error, ng_btsocket_hci_raw_node, msg, path, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, @@ -1237,13 +1245,20 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long ng_btsocket_hci_raw_ioctl_timeout * hz); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_HCI_NODE_GET_CON_LIST) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_HCI_NODE_GET_CON_LIST) { /* Return data back to user space */ - p1 = (ng_hci_node_con_list_ep *)(pcb->msg->data); + p1 = (ng_hci_node_con_list_ep *)(msg->data); p2 = (ng_hci_node_con_ep *)(p1 + 1); p->num_connections = min(p->num_connections, @@ -1255,8 +1270,9 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK: { struct ng_btsocket_hci_raw_node_link_policy_mask *p = @@ -1332,15 +1348,15 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long struct nodeinfo *ni = nl->names; if (nl->num_names == 0) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_LISTNAMES, 0, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_hci_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -1349,7 +1365,8 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long NG_SEND_MSG_PATH(error, ng_btsocket_hci_raw_node, msg, ".:", 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, @@ -1357,12 +1374,19 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long ng_btsocket_hci_raw_ioctl_timeout * hz); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && pcb->msg->header.cmd == NGM_LISTNAMES) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && msg->header.cmd == NGM_LISTNAMES) { /* Return data back to user space */ - struct namelist *nl1 = (struct namelist *) pcb->msg->data; + struct namelist *nl1 = (struct namelist *) msg->data; struct nodeinfo *ni1 = &nl1->nodeinfo[0]; while (nl->num_names > 0 && nl1->numnames > 0) { @@ -1385,8 +1409,9 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ default: error = EINVAL; Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Fri Aug 30 16:30:09 2019 (r351625) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Fri Aug 30 16:35:31 2019 (r351626) @@ -852,15 +852,15 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon if (p->num_connections == 0 || p->num_connections > NG_L2CAP_MAX_CON_NUM || p->connections == NULL) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CON_LIST, 0, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_l2cap_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -870,20 +870,28 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon pcb->rt->hook, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl", ng_btsocket_l2cap_raw_ioctl_timeout * hz); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_L2CAP_NODE_GET_CON_LIST) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_L2CAP_NODE_GET_CON_LIST) { /* Return data back to user space */ - p1 = (ng_l2cap_node_con_list_ep *)(pcb->msg->data); + p1 = (ng_l2cap_node_con_list_ep *)(msg->data); p2 = (ng_l2cap_node_con_ep *)(p1 + 1); p->num_connections = min(p->num_connections, @@ -895,8 +903,9 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_L2CAP_NODE_GET_CHAN_LIST: { struct ng_btsocket_l2cap_raw_chan_list *p = @@ -907,15 +916,15 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon if (p->num_channels == 0 || p->num_channels > NG_L2CAP_MAX_CHAN_NUM || p->channels == NULL) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CHAN_LIST, 0, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_l2cap_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -925,20 +934,28 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon pcb->rt->hook, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl", ng_btsocket_l2cap_raw_ioctl_timeout * hz); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_L2CAP_NODE_GET_CHAN_LIST) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_L2CAP_NODE_GET_CHAN_LIST) { /* Return data back to user space */ - p1 = (ng_l2cap_node_chan_list_ep *)(pcb->msg->data); + p1 = (ng_l2cap_node_chan_list_ep *)(msg->data); p2 = (ng_l2cap_node_chan_ep *)(p1 + 1); p->num_channels = min(p->num_channels, @@ -950,8 +967,9 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_L2CAP_L2CA_PING: { struct ng_btsocket_l2cap_raw_ping *p = @@ -961,16 +979,16 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon if ((p->echo_size != 0 && p->echo_data == NULL) || p->echo_size > NG_L2CAP_MAX_ECHO_SIZE) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_PING, sizeof(*ip) + p->echo_size, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_l2cap_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -981,11 +999,15 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon ip->echo_size = p->echo_size; if (ip->echo_size > 0) { + mtx_unlock(&pcb->pcb_mtx); error = copyin(p->echo_data, ip + 1, p->echo_size); + mtx_lock(&pcb->pcb_mtx); + if (error != 0) { NG_FREE_MSG(msg); pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } } @@ -993,20 +1015,28 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon pcb->rt->hook, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl", bluetooth_l2cap_rtx_timeout()); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_L2CAP_L2CA_PING) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_L2CAP_L2CA_PING) { /* Return data back to the user space */ - op = (ng_l2cap_l2ca_ping_op *)(pcb->msg->data); + op = (ng_l2cap_l2ca_ping_op *)(msg->data); p->result = op->result; p->echo_size = min(p->echo_size, op->echo_size); @@ -1016,8 +1046,9 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_L2CAP_L2CA_GET_INFO: { struct ng_btsocket_l2cap_raw_get_info *p = @@ -1026,21 +1057,21 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon ng_l2cap_l2ca_get_info_op *op = NULL; if (!(pcb->flags & NG_BTSOCKET_L2CAP_RAW_PRIVILEGED)) { - error = EPERM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EPERM); } if (p->info_size != 0 && p->info_data == NULL) { - error = EINVAL; - break; + mtx_unlock(&pcb->pcb_mtx); + return (EINVAL); } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_GET_INFO, sizeof(*ip) + p->info_size, M_NOWAIT); if (msg == NULL) { - error = ENOMEM; - break; + mtx_unlock(&pcb->pcb_mtx); + return (ENOMEM); } ng_btsocket_l2cap_raw_get_token(&msg->header.token); pcb->token = msg->header.token; @@ -1054,20 +1085,28 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon pcb->rt->hook, 0); if (error != 0) { pcb->token = 0; - break; + mtx_unlock(&pcb->pcb_mtx); + return (error); } error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl", bluetooth_l2cap_rtx_timeout()); pcb->token = 0; - if (error != 0) - break; + if (error != 0) { + mtx_unlock(&pcb->pcb_mtx); + return (error); + } - if (pcb->msg != NULL && - pcb->msg->header.cmd == NGM_L2CAP_L2CA_GET_INFO) { + msg = pcb->msg; + pcb->msg = NULL; + + mtx_unlock(&pcb->pcb_mtx); + + if (msg != NULL && + msg->header.cmd == NGM_L2CAP_L2CA_GET_INFO) { /* Return data back to the user space */ - op = (ng_l2cap_l2ca_get_info_op *)(pcb->msg->data); + op = (ng_l2cap_l2ca_get_info_op *)(msg->data); p->result = op->result; p->info_size = min(p->info_size, op->info_size); @@ -1077,8 +1116,9 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_lon } else error = EINVAL; - NG_FREE_MSG(pcb->msg); /* checks for != NULL */ - } break; + NG_FREE_MSG(msg); /* checks for != NULL */ + return (error); + } /* NOTREACHED */ case SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO: { struct ng_btsocket_l2cap_raw_auto_discon_timo *p = From owner-svn-src-all@freebsd.org Fri Aug 30 17:36:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1490D42F9; Fri, 30 Aug 2019 17:36:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Kmqx65c2z4LnF; Fri, 30 Aug 2019 17:36:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE99D3C42; Fri, 30 Aug 2019 17:36:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7UHajIe081023; Fri, 30 Aug 2019 17:36:45 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UHajvY081022; Fri, 30 Aug 2019 17:36:45 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201908301736.x7UHajvY081022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Fri, 30 Aug 2019 17:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351627 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 351627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 17:36:46 -0000 Author: erj Date: Fri Aug 30 17:36:45 2019 New Revision: 351627 URL: https://svnweb.freebsd.org/changeset/base/351627 Log: Bump __FreeBSD_version number for changes made in r351276 Sponsored by: Intel Corporation Modified: stable/12/sys/sys/param.h Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Fri Aug 30 16:35:31 2019 (r351626) +++ stable/12/sys/sys/param.h Fri Aug 30 17:36:45 2019 (r351627) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200515 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200516 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Aug 30 19:35:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA17CD68B2; Fri, 30 Aug 2019 19:35:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KqTD67LMz4Sq6; Fri, 30 Aug 2019 19:35:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B35865229; Fri, 30 Aug 2019 19:35:44 +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 x7UJZiV3052132; Fri, 30 Aug 2019 19:35:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UJZiqV052130; Fri, 30 Aug 2019 19:35:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201908301935.x7UJZiqV052130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 30 Aug 2019 19:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351628 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 351628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 19:35:44 -0000 Author: markj Date: Fri Aug 30 19:35:44 2019 New Revision: 351628 URL: https://svnweb.freebsd.org/changeset/base/351628 Log: Update and clean up the UMA man page. - Fix warnings from igor and mandoc. - Provide a brief description of the separation between zones and their backend slab allocators. - Document cache zones and secondary zones. - Document the kernel config options added in r350659. - Document the uma_zalloc_pcpu() and uma_zfree_pcpu() wrappers. - Document uma_zone_reserve(), uma_zone_reserve_kva() and uma_zone_prealloc(). - Document uma_zone_alloc() and uma_zone_freef(). - Add some missing MLINKs and Xrefs. MFC after: 2 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/zone.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Aug 30 17:36:45 2019 (r351627) +++ head/share/man/man9/Makefile Fri Aug 30 19:35:44 2019 (r351628) @@ -2223,7 +2223,9 @@ MLINKS+=vm_map_lookup.9 vm_map_lookup_done.9 MLINKS+=vm_map_max.9 vm_map_min.9 \ vm_map_max.9 vm_map_pmap.9 MLINKS+=vm_map_stack.9 vm_map_growstack.9 -MLINKS+=vm_map_wire.9 vm_map_unwire.9 +MLINKS+=vm_map_wire.9 vm_map_wire_mapped.9 \ + vm_page_wire.9 vm_page_unwire.9 \ + vm_page_wire.9 vm_page_unwire_noq.9 MLINKS+=vm_page_bits.9 vm_page_clear_dirty.9 \ vm_page_bits.9 vm_page_dirty.9 \ vm_page_bits.9 vm_page_is_valid.9 \ @@ -2282,15 +2284,27 @@ MLINKS+=zone.9 uma.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ zone.9 uma_zalloc_domain.9 \ + zone.9 uma_zalloc_pcpu.9 \ + zone.9 uma_zalloc_pcpu_arg.9 \ + zone.9 uma_zcache_create.9 \ zone.9 uma_zcreate.9 \ zone.9 uma_zdestroy.9 \ zone.9 uma_zfree.9 \ zone.9 uma_zfree_arg.9 \ zone.9 uma_zfree_domain.9 \ + zone.9 uma_zfree_pcpu.9 \ + zone.9 uma_zfree_pcpu_arg.9 \ zone.9 uma_zone_get_cur.9 \ zone.9 uma_zone_get_max.9 \ + zone.9 uma_zone_prealloc.9 \ + zone.9 uma_zone_reserve.9 \ + zone.9 uma_zone_reserve_kva.9 \ + zone.9 uma_zone_set_allocf.9 \ + zone.9 uma_zone_set_freef.9 \ zone.9 uma_zone_set_max.9 \ + zone.9 uma_zone_set_maxaction.9 \ + zone.9 uma_zone_set_maxcache.9 \ zone.9 uma_zone_set_warning.9 \ - zone.9 uma_zone_set_maxaction.9 + zone.9 uma_zsecond_create.9 .include Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Fri Aug 30 17:36:45 2019 (r351627) +++ head/share/man/man9/zone.9 Fri Aug 30 19:35:44 2019 (r351628) @@ -25,40 +25,62 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2018 -.Dt ZONE 9 +.Dd August 30, 2019 +.Dt UMA 9 .Os .Sh NAME -.Nm uma_zcreate , -.Nm uma_zalloc , -.Nm uma_zalloc_arg , -.Nm uma_zalloc_domain , -.Nm uma_zfree , -.Nm uma_zfree_arg , -.Nm uma_zfree_domain , -.Nm uma_zdestroy , -.Nm uma_zone_set_max , -.Nm uma_zone_get_max , -.Nm uma_zone_get_cur , -.Nm uma_zone_set_warning , -.Nm uma_zone_set_maxaction -.Nd zone allocator +.Nm UMA +.Nd general-purpose kernel object allocator .Sh SYNOPSIS .In sys/param.h .In sys/queue.h .In vm/uma.h +.Cd "options UMA_FIRSTTOUCH" +.Cd "options UMA_XDOMAIN" +.Bd -literal +typedef int (*uma_ctor)(void *mem, int size, void *arg, int flags); +typedef void (*uma_dtor)(void *mem, int size, void *arg); +typedef int (*uma_init)(void *mem, int size, int flags); +typedef void (*uma_fini)(void *mem, int size); +typedef int (*uma_import)(void *arg, void **store, int count, int domain, + int flags); +typedef void (*uma_release)(void *arg, void **store, int count); +typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t size, int domain, + uint8_t *pflag, int wait); +typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag); + +.Ed .Ft uma_zone_t .Fo uma_zcreate .Fa "char *name" "int size" -.Fa "uma_ctor ctor" "uma_dtor dtor" "uma_init uminit" "uma_fini fini" +.Fa "uma_ctor ctor" "uma_dtor dtor" "uma_init zinit" "uma_fini zfini" .Fa "int align" "uint16_t flags" .Fc +.Ft uma_zone_t +.Fo uma_zcache_create +.Fa "char *name" "int size" +.Fa "uma_ctor ctor" "uma_dtor dtor" "uma_init zinit" "uma_fini zfini" +.Fa "uma_import zimport" "uma_release zrelease" +.Fa "void *arg" "int flags" +.Fc +.Ft uma_zone_t +.Fo uma_zsecond_create +.Fa "char *name" +.Fa "uma_ctor ctor" "uma_dtor dtor" "uma_init zinit" "uma_fini zfini" +.Fa "uma_zone_t master" +.Fc +.Ft void +.Fn uma_zdestroy "uma_zone_t zone" .Ft "void *" .Fn uma_zalloc "uma_zone_t zone" "int flags" .Ft "void *" .Fn uma_zalloc_arg "uma_zone_t zone" "void *arg" "int flags" .Ft "void *" .Fn uma_zalloc_domain "uma_zone_t zone" "void *arg" "int domain" "int flags" +.Ft "void *" +.Fn uma_zalloc_pcpu "uma_zone_t zone" "int flags" +.Ft "void *" +.Fn uma_zalloc_pcpu_arg "uma_zone_t zone" "void *arg" "int flags" .Ft void .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void @@ -66,10 +88,24 @@ .Ft void .Fn uma_zfree_domain "uma_zone_t zone" "void *item" "void *arg" .Ft void -.Fn uma_zdestroy "uma_zone_t zone" +.Fn uma_zfree_pcpu "uma_zone_t zone" "void *item" +.Ft void +.Fn uma_zfree_pcpu_arg "uma_zone_t zone" "void *item" "void *arg" +.Ft void +.Fn uma_prealloc "uma_zone_t zone" "int nitems" +.Ft void +.Fn uma_zone_reserve "uma_zone_t zone" "int nitems" +.Ft void +.Fn uma_zone_reserve_kva "uma_zone_t zone" "int nitems" +.Ft void +.Fn uma_zone_set_allocf "uma_zone_t zone" "uma_alloc allocf" +.Ft void +.Fn uma_zone_set_freef "uma_zone_t zone" "uma_free freef" .Ft int .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" .Ft int +.Fn uma_zone_set_maxcache "uma_zone_t zone" "int nitems" +.Ft int .Fn uma_zone_get_max "uma_zone_t zone" .Ft int .Fn uma_zone_get_cur "uma_zone_t zone" @@ -77,34 +113,56 @@ .Fn uma_zone_set_warning "uma_zone_t zone" "const char *warning" .Ft void .Fn uma_zone_set_maxaction "uma_zone_t zone" "void (*maxaction)(uma_zone_t)" +.Ft void +.Fn uma_reclaim .In sys/sysctl.h .Fn SYSCTL_UMA_MAX parent nbr name access zone descr .Fn SYSCTL_ADD_UMA_MAX ctx parent nbr name access zone descr .Fn SYSCTL_UMA_CUR parent nbr name access zone descr .Fn SYSCTL_ADD_UMA_CUR ctx parent nbr name access zone descr .Sh DESCRIPTION -The zone allocator provides an efficient interface for managing -dynamically-sized collections of items of identical size. -The zone allocator can work with preallocated zones as well as with -runtime-allocated ones, and is therefore available much earlier in the -boot process than other memory management routines. The zone allocator -provides per-cpu allocation caches with linear scalability on SMP +UMA (Universal Memory Allocator) provides an efficient interface for managing +dynamically-sized collections of items of identical size, referred to as zones. +Zones keep track of which items are in use and which +are not, and UMA provides functions for allocating items from a zone and +for releasing them back, making them available for subsequent allocation requests. +Zones maintain per-CPU caches with linear scalability on SMP systems as well as round-robin and first-touch policies for NUMA systems. +The number of items cached per CPU is bounded, and each zone additionally +maintains an unbounded cache of items that is used to quickly satisfy +per-CPU cache allocation misses. .Pp -A zone is an extensible collection of items of identical size. -The zone allocator keeps track of which items are in use and which -are not, and provides functions for allocating items from the zone and -for releasing them back (which makes them available for later use). +Two types of zones exist: regular zones and cache zones. +In a regular zone, items are allocated from a slab, which is one or more +virtually contiguous memory pages that have been allocated from the kernel's +page allocator. +Internally, slabs are managed by a UMA keg, which is responsible for allocating +slabs and keeping track of their usage by one or more zones. +In typical usage, there is one keg per zone, so slabs are not shared among +multiple zones. .Pp -After the first allocation of an item, -it will have been cleared to zeroes, however subsequent allocations -will retain the contents as of the last free. +Normal zones import items from a keg, and release items back to that keg if +requested. +Cache zones do not have a keg, and instead use custom import and release +methods. +For example, some collections of kernel objects are statically allocated +at boot-time, and the size of the collection does not change. +A cache zone can be used to implement an efficient allocator for the objects in +such a collection. .Pp The .Fn uma_zcreate -function creates a new zone from which items may then be allocated from. +and +.Fn uma_zcache_create +functions create a new regular zone and cache zone, respectively. The +.Fn uma_zsecond_create +function creates a regular zone which shares the keg of the zone +specified by the +.Fa master +argument. +The .Fa name argument is a text name of the zone for debugging and stats; this memory should not be freed until the zone has been deallocated. @@ -114,7 +172,7 @@ The and .Fa dtor arguments are callback functions that are called by -the uma subsystem at the time of the call to +the UMA subsystem at the time of the call to .Fn uma_zalloc and .Fn uma_zfree @@ -126,49 +184,91 @@ A good usage for the .Fa ctor and .Fa dtor -callbacks -might be to adjust a global count of the number of objects allocated. +callbacks might be to initialize a data structure embedded in the item, +such as a +.Xr queue 3 +head. .Pp The -.Fa uminit +.Fa zinit and -.Fa fini -arguments are used to optimize the allocation of -objects from the zone. -They are called by the uma subsystem whenever -it needs to allocate or free several items to satisfy requests or memory -pressure. +.Fa zfini +arguments are used to optimize the allocation of items from the zone. +They are called by the UMA subsystem whenever +it needs to allocate or free items to satisfy requests or memory pressure. A good use for the -.Fa uminit +.Fa zinit and -.Fa fini +.Fa zfini callbacks might be to -initialize and destroy mutexes contained within the object. -This would -allow one to re-use already initialized mutexes when an object is returned -from the uma subsystem's object cache. +initialize and destroy a mutex contained within an item. +This would allow one to avoid destroying and re-initializing the mutex +each time the item is freed and re-allocated. They are not called on each call to .Fn uma_zalloc and .Fn uma_zfree -but rather in a batch mode on several objects. +but rather when an item is imported into a zone's cache, and when a zone +releases an item to the slab allocator, typically as a response to memory +pressure. .Pp +For +.Fn uma_zcache_create , +the +.Fa zimport +and +.Fa zrelease +functions are called to import items into the zone and to release items +from the zone, respectively. The +.Fa zimport +function should store pointers to items in the +.Fa store +array, which contains a maximum of +.Fa count +entries. +The function must return the number of imported items, which may be less than +the maximum. +Similarly, the +.Fa store +parameter to the +.Fa zrelease +function contains an array of +.Fa count +pointers to items. +The +.Fa arg +parameter passed to +.Fn uma_zcache_create +is provided to the import and release functions. +The +.Fa domain +parameter to +.Fa zimport +specifies the requested +.Xr numa 4 +domain for the allocation. +It is either a NUMA domain number or the special value +.Dv UMA_ANYDOMAIN . +.Pp +The .Fa flags -argument of the +argument of .Fn uma_zcreate +and +.Fn uma_zcache_create is a subset of the following flags: .Bl -tag -width "foo" .It Dv UMA_ZONE_NOFREE -Slabs of the zone are never returned back to VM. +Slabs allocated to the zone's keg are never freed. .It Dv UMA_ZONE_NODUMP -Pages belonging to the zone will not be included into mini-dumps. +Pages belonging to the zone will not be included in minidumps. .It Dv UMA_ZONE_PCPU An allocation from zone would have .Va mp_ncpu shadow copies, that are privately assigned to CPUs. -A CPU can address its private copy using base allocation address plus -multiple of current CPU id and +A CPU can address its private copy using base the allocation address plus +a multiple of the current CPU ID and .Fn sizeof "struct pcpu" : .Bd -literal -offset indent foo_zone = uma_zcreate(..., UMA_ZONE_PCPU); @@ -179,7 +279,15 @@ critical_enter(); foo_pcpu = (foo_t *)zpcpu_get(foo_base); /* do something with foo_pcpu */ critical_exit(); + .Ed +Note that +.Dv M_ZERO +cannot be used when allocating items from a PCPU zone. +To obtain zeroed memory from a PCPU zone, use the +.Fn uma_zalloc_pcpu +function and its variants instead, and pass +.Dv M_ZERO . .It Dv UMA_ZONE_OFFPAGE By default book-keeping of items within a slab is done in the slab page itself. This flag explicitly tells subsystem that book-keeping structure should be @@ -220,24 +328,40 @@ subsystem. The zone is for the VM subsystem. .It Dv UMA_ZONE_NUMA The zone should use a first-touch NUMA policy rather than the round-robin -default. Callers that do not free memory on the same domain it is allocated -from will cause mixing in per-cpu caches. See -.Xr numa 9 for more details. +default. +If the +.Dv UMA_FIRSTTOUCH +kernel option is configured, all zones implicitly use a first-touch policy, +and the +.Dv UMA_ZONE_NUMA +flag has no effect. +The +.Dv UMA_XDOMAIN +kernel option, when configured, causes UMA to do the extra tracking to ensure +that allocations from first-touch zones are always local. +Otherwise, consumers that do not free memory on the same domain from which it +was allocated will cause mixing in per-CPU caches. +See +.Xr numa 4 +for more details. .El .Pp +Zones can be destroyed using +.Fn uma_zdestroy , +freeing all memory that is cached in the zone. +All items allocated from the zone must be freed to the zone before the zone +may be safely destroyed. +.Pp To allocate an item from a zone, simply call .Fn uma_zalloc -with a pointer to that zone -and set the +with a pointer to that zone and set the .Fa flags argument to selected flags as documented in .Xr malloc 9 . -It will return a pointer to an item if successful, -or +It will return a pointer to an item if successful, or .Dv NULL in the rare case where all items in the zone are in use and the -allocator is unable to grow the zone -and +allocator is unable to grow the zone and .Dv M_NOWAIT is specified. .Pp @@ -253,7 +377,7 @@ then .Fn uma_zfree does nothing. .Pp -The variations +The variants .Fn uma_zalloc_arg and .Fn uma_zfree_arg @@ -262,29 +386,71 @@ specify an argument for the .Dv ctor and .Dv dtor -functions, respectively. -The +functions of the zone, respectively. +The .Fn uma_zalloc_domain function allows callers to specify a fixed -.Xr numa 9 domain to allocate from. This uses a guaranteed but slow path in -the allocator which reduces concurrency. The +.Xr numa 4 +domain to allocate from. +This uses a guaranteed but slow path in the allocator which reduces +concurrency. +The .Fn uma_zfree_domain -function should be used to return memory allocated in this fashion. This -function infers the domain from the pointer and does not require it as an +function should be used to return memory allocated in this fashion. +This function infers the domain from the pointer and does not require it as an argument. .Pp -Created zones, -which are empty, -can be destroyed using -.Fn uma_zdestroy , -freeing all memory that was allocated for the zone. -All items allocated from the zone with +The +.Fn uma_zone_prealloc +function allocates slabs for the requested number of items, typically following +the initial creation of a zone. +Subsequent allocations from the zone will be satisfied using the pre-allocated +slabs. +Note that slab allocation is performed with the +.Dv M_WAITOK +flag, so +.Fn uma_zone_prealloc +may sleep. +.Pp +The +.Fn uma_zone_reserve +function sets the number of reserved items for the zone. .Fn uma_zalloc -must have been freed with -.Fn uma_zfree -before. +and variants will ensure that the zone contains at least the reserved number +of free items. +Reserved items may be allocated by specifying +.Dv M_USE_RESERVE +in the allocation request flags. +.Fn uma_zone_reserve +does not perform any pre-allocation by itself. .Pp The +.Fn uma_zone_reserve_kva +function pre-allocates kernel virtual address space for the requested +number of items. +Subsequent allocations from the zone will be satisfied using the pre-allocated +address space. +Note that unlike +.Fn uma_zone_reserve , +.Fn uma_zone_reserve_kva +does not restrict the use of the pre-allocation to +.Dv M_USE_RESERVE +requests. +.Pp +The +.Fn uma_zone_set_allocf +and +.Fn uma_zone_set_freef +functions allow a zone's default slab allocation and free functions to be +overridden. +This is useful if the zone's items have special memory allocation constraints. +For example, if multi-page objects are required to be physically contiguous, +an +.Fa allocf +function which requests contiguous memory from the kernel's page allocator +may be used. +.Pp +The .Fn uma_zone_set_max function limits the number of items .Pq and therefore memory @@ -304,12 +470,21 @@ because all of the remaining free items may be in the other CPUs when the limit is hit. .Pp The +.Fn uma_zone_set_maxcache +function limits the number of free items which may be cached in the zone, +excluding the per-CPU caches, which are bounded in size. +For example, to implement a +.Ql pure +per-CPU cache, a cache zone may be configured with a maximum cache size of 0. +.Pp +The .Fn uma_zone_get_max function returns the effective upper limit number of items for a zone. .Pp The .Fn uma_zone_get_cur -function returns the approximate current occupancy of the zone. +function returns an approximation of the number of items currently allocated +from the zone. The returned value is approximate because appropriate synchronisation to determine an exact value is not performed by the implementation. This ensures low overhead at the expense of potentially stale data being used @@ -338,7 +513,7 @@ this function should do very little work (similar to a The .Fn SYSCTL_UMA_MAX parent nbr name access zone descr macro declares a static -.Xr sysctl +.Xr sysctl 9 oid that exports the effective upper limit number of items for a zone. The .Fa zone @@ -355,7 +530,7 @@ macro is provided to create this type of oid dynamical The .Fn SYSCTL_UMA_CUR parent nbr name access zone descr macro declares a static read-only -.Xr sysctl +.Xr sysctl 9 oid that exports the approximate current occupancy of the zone. The .Fa zone @@ -366,15 +541,6 @@ A read of the oid returns value obtained through The .Fn SYSCTL_ADD_UMA_CUR ctx parent nbr name zone descr macro is provided to create this type of oid dynamically. -.Sh RETURN VALUES -The -.Fn uma_zalloc -function returns a pointer to an item, or -.Dv NULL -if the zone ran out of unused items -and -.Dv M_NOWAIT -was specified. .Sh IMPLEMENTATION NOTES The memory that these allocation calls return is not executable. The @@ -385,7 +551,14 @@ flag to allocate executable memory. Not all platforms enforce a distinction between executable and non-executable memory. .Sh SEE ALSO +.Xr numa 4 , +.Xr vmstat 8 , .Xr malloc 9 +.Rs +.%A Jeff Bonwick +.%T "The Slab Allocator: An Object-Caching Kernel Memory Allocator" +.%D 1994 +.Re .Sh HISTORY The zone allocator first appeared in .Fx 3.0 . From owner-svn-src-all@freebsd.org Fri Aug 30 20:19:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BD71D7895; Fri, 30 Aug 2019 20:19:44 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KrS02hY0z4WBr; Fri, 30 Aug 2019 20:19:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39D3D5969; Fri, 30 Aug 2019 20:19:44 +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 x7UKJidI080470; Fri, 30 Aug 2019 20:19:44 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UKJiRQ080469; Fri, 30 Aug 2019 20:19:44 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201908302019.x7UKJiRQ080469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Fri, 30 Aug 2019 20:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351629 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 351629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 20:19:44 -0000 Author: mjoras Date: Fri Aug 30 20:19:43 2019 New Revision: 351629 URL: https://svnweb.freebsd.org/changeset/base/351629 Log: Wrap a vlan's parent's if_output in a separate function. When a vlan interface is created, its if_output is set directly to the parent interface's if_output. This is fine in the normal case but has an unfortunate consequence if you end up with a certain combination of vlan and lagg interfaces. Consider you have a lagg interface with a single laggport member. When an interface is added to a lagg its if_output is set to lagg_port_output, which blackholes traffic from the normal networking stack but not certain frames from BPF (pseudo_AF_HDRCMPLT). If you now create a vlan with the laggport member (not the lagg interface) as its parent, its if_output is set to lagg_port_output as well. While this is confusing conceptually and likely represents a misconfigured system, it is not itself a problem. The problem arises when you then remove the lagg interface. Doing this resets the if_output of the laggport member back to its original state, but the vlan's if_output is left pointing to lagg_port_output. This gives rise to the possibility that the system will panic when e.g. bpf is used to send any frames on the vlan interface. Fix this by creating a new function, vlan_output, which simply wraps the parent's current if_output. That way when the parent's if_output is restored there is no stale usage of lagg_port_output. Reviewed by: rstone Differential Revision: D21209 Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Fri Aug 30 19:35:44 2019 (r351628) +++ head/sys/net/if_vlan.c Fri Aug 30 20:19:43 2019 (r351629) @@ -294,6 +294,8 @@ static int vlan_setflag(struct ifnet *ifp, int flag, i static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); +static int vlan_output(struct ifnet *ifp, struct mbuf *m, + const struct sockaddr *dst, struct route *ro); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp, int departing); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); @@ -1209,6 +1211,27 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) return (error); } +static int +vlan_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, + struct route *ro) +{ + struct epoch_tracker et; + struct ifvlan *ifv; + struct ifnet *p; + + NET_EPOCH_ENTER(et); + ifv = ifp->if_softc; + if (TRUNK(ifv) == NULL) { + NET_EPOCH_EXIT(et); + m_freem(m); + return (ENETDOWN); + } + p = PARENT(ifv); + NET_EPOCH_EXIT(et); + return p->if_output(ifp, m, dst, ro); +} + + /* * The ifp->if_qflush entry point for vlan(4) is a no-op. */ @@ -1424,12 +1447,17 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 */ ifp->if_mtu = p->if_mtu - ifv->ifv_mtufudge; ifp->if_baudrate = p->if_baudrate; - ifp->if_output = p->if_output; ifp->if_input = p->if_input; ifp->if_resolvemulti = p->if_resolvemulti; ifp->if_addrlen = p->if_addrlen; ifp->if_broadcastaddr = p->if_broadcastaddr; ifp->if_pcp = ifv->ifv_pcp; + + /* + * We wrap the parent's if_output using vlan_output to ensure that it + * can't become stale. + */ + ifp->if_output = vlan_output; /* * Copy only a selected subset of flags from the parent. From owner-svn-src-all@freebsd.org Fri Aug 30 20:54:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C0E4D83C1; Fri, 30 Aug 2019 20:54:31 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KsD70Lxfz4XwW; Fri, 30 Aug 2019 20:54:31 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD7C160B6; Fri, 30 Aug 2019 20:54:30 +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 x7UKsUfd005628; Fri, 30 Aug 2019 20:54:30 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7UKsUWp005627; Fri, 30 Aug 2019 20:54:30 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908302054.x7UKsUWp005627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 30 Aug 2019 20:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351630 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 351630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 20:54:31 -0000 Author: tsoome Date: Fri Aug 30 20:54:30 2019 New Revision: 351630 URL: https://svnweb.freebsd.org/changeset/base/351630 Log: qemu-system-aarch64 does list block device with very large block size Also insert Vendor device as "parent" disk (found in qemu-system-aarch64 -cpu cortex-a57). This does fix lsdev in loader.efi on this platform. Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Fri Aug 30 20:19:43 2019 (r351629) +++ head/stand/efi/libefi/efipart.c Fri Aug 30 20:54:30 2019 (r351630) @@ -255,10 +255,12 @@ efipart_inithandles(void) /* * We assume the block size 512 or greater power of 2. + * Also skip devices with block size > 32k. * iPXE is known to insert stub BLOCK IO device with * BlockSize 1. */ if (blkio->Media->BlockSize < 512 || + blkio->Media->BlockSize > (1 << 15) || !powerof2(blkio->Media->BlockSize)) { continue; } @@ -603,7 +605,8 @@ restart: continue; if (DevicePathType(node) == HARDWARE_DEVICE_PATH && - DevicePathSubType(node) == HW_PCI_DP) { + (DevicePathSubType(node) == HW_PCI_DP || + DevicePathSubType(node) == HW_VENDOR_DP)) { STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); efipart_hdinfo_add(hd, NULL); goto restart; From owner-svn-src-all@freebsd.org Fri Aug 30 21:49:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17B5BD9687; Fri, 30 Aug 2019 21:49:01 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KtR06dTGz4bSK; Fri, 30 Aug 2019 21:49: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0CD669AC; Fri, 30 Aug 2019 21:49: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 x7ULn0Ek036023; Fri, 30 Aug 2019 21:49:00 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7ULn0dO036022; Fri, 30 Aug 2019 21:49:00 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201908302149.x7ULn0dO036022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Fri, 30 Aug 2019 21:49:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351631 - 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: 351631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 21:49:01 -0000 Author: sevan (doc committer) Date: Fri Aug 30 21:49:00 2019 New Revision: 351631 URL: https://svnweb.freebsd.org/changeset/base/351631 Log: Earliest reference to /dev/null I can find is in v4 sh(1) and nulldev in nsys/ken/subr.c via TUHS archive https://minnie.tuhs.org/cgi-bin/utree.pl?file=V4 MFC after: 5 days Modified: head/share/man/man4/null.4 Modified: head/share/man/man4/null.4 ============================================================================== --- head/share/man/man4/null.4 Fri Aug 30 20:54:30 2019 (r351630) +++ head/share/man/man4/null.4 Fri Aug 30 21:49:00 2019 (r351631) @@ -28,7 +28,7 @@ .\" @(#)null.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 5, 1993 +.Dd August 30, 2019 .Dt NULL 4 .Os .Sh NAME @@ -54,4 +54,4 @@ device is always zero. A .Nm device appeared in -.At v7 . +.At v4 . From owner-svn-src-all@freebsd.org Fri Aug 30 21:54:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3533ED995C; Fri, 30 Aug 2019 21:54:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KtYf0WxTz4bx1; Fri, 30 Aug 2019 21:54:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E76AF6B83; Fri, 30 Aug 2019 21:54:45 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7ULsjix041812; Fri, 30 Aug 2019 21:54:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7ULsjda041811; Fri, 30 Aug 2019 21:54:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908302154.x7ULsjda041811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 30 Aug 2019 21:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351632 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 351632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 21:54:46 -0000 Author: mjg Date: Fri Aug 30 21:54:45 2019 New Revision: 351632 URL: https://svnweb.freebsd.org/changeset/base/351632 Log: vfs: add a missing VNODE_REFCOUNT_FENCE_REL to v_incr_usecount_locked Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Aug 30 21:49:00 2019 (r351631) +++ head/sys/kern/vfs_subr.c Fri Aug 30 21:54:45 2019 (r351632) @@ -2641,6 +2641,7 @@ v_incr_usecount_locked(struct vnode *vp) VNASSERT(vp->v_usecount == 0, vp, ("vnode with usecount and VI_OWEINACT set")); vp->v_iflag &= ~VI_OWEINACT; + VNODE_REFCOUNT_FENCE_REL(); } refcount_acquire(&vp->v_usecount); v_incr_devcount(vp); From owner-svn-src-all@freebsd.org Fri Aug 30 22:00:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 627C9D9A62; Fri, 30 Aug 2019 22:00:27 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KthB3cdRz4cBD; Fri, 30 Aug 2019 22:00:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x230.google.com with SMTP id h4so3092193oih.8; Fri, 30 Aug 2019 15:00:26 -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=8jadTFPHqI2qy7CCPO767KRMGil7ZNTX2CJLKyglCYA=; b=CNoL0OnPjDFOUBaNDpPe/bSyW4YsABEPeVcQernMwznYXCP+RYQjM1QfksUnU4hYHd YPQy8XvptNr5fcYtC8YOs0Z9/VrNRze4Y9GCQlzUW5NrhVN25mUCRn52ZKahAQAQDtN7 l/C8RqF+H31dsogiwnl1bIG9DYT2Hws/feF/r2onZCe257khr41mzZX3DUwOugMvKyLM gSJuOpRkU0QEA99GM/FIwXBHJxwUA7LdAQORkRPCWXnHTqcHRCCaO76qB5vupcYLTV0d yh3UYZBH1t9vCDhByiCTLZg2t37tOdnmuNZDuI5fTfPzUPTxBsf8Ui74Q/D3anPtRTHS 2G4g== 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=8jadTFPHqI2qy7CCPO767KRMGil7ZNTX2CJLKyglCYA=; b=L9/n2SPDottw2HaLuJPX32f3RDtskeKkmp/AcsX5cWn4+rsRW8gSZBhN7l0756Mcrp NY0Zsf5h/T4SfX+TSu46HYMtzxPzpeKXaEOkbFPnytSDl23R+FZttN0zfjQRHGes7yS0 DebnmTLmIcfH6jFBtumATbJhsgqg4TxSpzc7Asw1m8BvO6bPQvkd6YDDs9nbcXZ6HQpt N4y1mCXQtJN+tBPHzwoYO3P5IUdDqrmhBDWTuchHm5QWjCYwbz1B3O8yad3s+n+aNGQh Lzgp9PJtFH0Lvuc8n2vsXRZZUCpMV3WMSuSzaWz0MoMz54kTNxxdz+ggBOLFlDaez34N 3R2A== X-Gm-Message-State: APjAAAWvlPmhNP7knTO00zvEBm7lbUM41L58PAfJ2CiO0WiU8yVrnNvd guXIvBTvraZg6xbAjhAJ9XH1xwkpNOk+Yf/aQNA= X-Google-Smtp-Source: APXvYqxVQzqWjcQETz/o9ukowb46jWZ1tJMOwtF+fuaU5VppLprv6IJRuDaWFlGgk9glTJ305PMRATNvn1PyUvLacZE= X-Received: by 2002:aca:bb42:: with SMTP id l63mr11859820oif.85.1567202424975; Fri, 30 Aug 2019 15:00:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:83d6:0:0:0:0:0 with HTTP; Fri, 30 Aug 2019 15:00:24 -0700 (PDT) In-Reply-To: <20190830102943.GE71821@kib.kiev.ua> References: <201908300045.x7U0jsq9083259@repo.freebsd.org> <20190830102943.GE71821@kib.kiev.ua> From: Mateusz Guzik Date: Sat, 31 Aug 2019 00:00:24 +0200 Message-ID: Subject: Re: svn commit: r351622 - head/sys/kern To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46KthB3cdRz4cBD X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=CNoL0OnP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::230 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-8.23), ipnet: 2607:f8b0::/32(-2.84), asn: 15169(-2.32), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[0.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 22:00:27 -0000 On 8/30/19, Konstantin Belousov wrote: > On Fri, Aug 30, 2019 at 12:45:54AM +0000, Mateusz Guzik wrote: >> + VNASSERT(vp->v_holdcnt > 0 && vp->v_usecount > 0, vp, > A more precise assert condition would also include > vp->v_holdcont >= vp->v_usecount > I agree, but that would be problematic to test for due to other threads playing with these counters. Note this commit was just diff reduction for "usecount implies holdcnt" ( https://reviews.freebsd.org/D21471 ) after which the stronger assertion would not hold. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Fri Aug 30 22:03:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94BA7D9C63; Fri, 30 Aug 2019 22:03:11 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KtlL5fxNz4cYj; Fri, 30 Aug 2019 22:03:10 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-ot1-x32a.google.com with SMTP id n7so940644otk.6; Fri, 30 Aug 2019 15:03:10 -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=nMw7XNkA4/p00cNqHNL5Pq5Gy+S1aHYJthDnzgkucoM=; b=RmaMf6a0js/5ZPhA+N8ApOHQjx12QSVDlM7AwEmlVhZ1qUrUF3aIvHz61zK1bXAWMZ 5KCySgEpmHSa6g1Qc8t2AJodKAzzBPXD8BXwJWDIiHPa45OlugMjpeyQBLA66N1W1mlf q3OYSQQkEoHVx57ojHnk56cEp2+wZiXjXcrIEhkZgn5GMhLcAbUdMf52ohK700WcXe+n mzPwPBo19QtXaaMkiCEGL9R7PETfkDJ5pFzS24BcRt4qkEx8GCaP2yC53fRDERb+6jge /m7ZW1Q3q4HYMDEi3/MtxwpfGFXuRveBMH3usajn4Be7S2pS8R2l5MKadfHIlojT+bg8 +fPw== 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=nMw7XNkA4/p00cNqHNL5Pq5Gy+S1aHYJthDnzgkucoM=; b=jQCc64goME4sAN0Mk8rcGkaRsOAAoZUJyhoIleBe5Owa7ZncfX2cQ4kEMVPdXE4Jmx ZM2F1bDnzfHVIlDDq7m7Eg50PAUk7ltfFcm2r9tJIZPjcDlZIsXfkAziyBjEEjJRFVGA xZ+hDC+MnTCKjXrZK7kg1UbxcMiJKOjvAxiwafCuj+iwGObNRroVFwzEl3wMTZ5muZPj h2WWtbscahw4DS1/8MLDAiikEOkONXA5MuN1X3l2dYUdl6/sbDPR6jqMh/V8U5KXhxOR cGEX7jUYzM587CiLK5u23+vIuuAmO581zGFUIWy0Mg18WWd8fZtKm8rNW6rb1ZCWTVjh 9WUg== X-Gm-Message-State: APjAAAX7jCHkejZar4GR5OQsCxfi02akOmtYKKH6/HRjlFqA3GiFCMzW 9WGOhzmyWqnc+68sr6Ay2JIcXkT6R2X0y+Ifp6OYWQ== X-Google-Smtp-Source: APXvYqwshPBQXyh0XwGHA1XapoHrXxcRCShkoUE6jQwclTFWw+S5bRrJPYUGd3+f7zW/P9F5gVlxilTGQUdwhUqD254= X-Received: by 2002:a9d:7f05:: with SMTP id j5mr5429033otq.102.1567202589509; Fri, 30 Aug 2019 15:03:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:83d6:0:0:0:0:0 with HTTP; Fri, 30 Aug 2019 15:03:08 -0700 (PDT) In-Reply-To: References: <201908250511.x7P5BiPl016074@repo.freebsd.org> From: Mateusz Guzik Date: Sat, 31 Aug 2019 00:03:08 +0200 Message-ID: Subject: Re: svn commit: r351471 - in head/sys: kern sys To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46KtlL5fxNz4cYj X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=RmaMf6a0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::32a as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.99 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-7.71), ipnet: 2607:f8b0::/32(-2.84), asn: 15169(-2.32), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[a.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 22:03:11 -0000 On 8/25/19, Oliver Pinter wrote: > On Sunday, August 25, 2019, Mateusz Guzik wrote: > >> Author: mjg >> Date: Sun Aug 25 05:11:43 2019 >> New Revision: 351471 >> URL: https://svnweb.freebsd.org/changeset/base/351471 >> >> Log: >> vfs: add vholdnz (for already held vnodes) > > > Why? > > (Yes, is can read the real reason in phabricator, but the phabricator > didn't considered a persistent information in relation to commit message. > Review helper tool just comes and goes as time goes forward, but commit > messages survives the repo conversions to other VCS...) > > And once you have taken the time to write a correct description in > phabricator, it would be really really nice and helpful if you would copy > them into commit message. > I think it's a fair point that if I included this info in the review it should make it's way into the commit message. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Fri Aug 30 22:09:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 028CBDA237 for ; Fri, 30 Aug 2019 22:09:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46KttH4Dyxz4cyb for ; Fri, 30 Aug 2019 22:09:11 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1567202949; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=BDnzhzE0LkDTjnsUmL9zcDpb/Tsk/FQgEIvQ1WPCgLpRi8bOXsttT9gIlXiBYK0B+XGmaQJlvpGkx 04KAdPiV577aIIzmO2CLcoZSV+71PTpBl9wMlVvHs4AqEj1IlUTb92KQ+zTfLHedC+L0H8d+k82HqW 5u69E6tus7RY/HZYsksZX8bHtayQVwIDw6+v/iyv0IyuO4B1GVa8g0CQ7JSHIGrFb3wsgWIbBwBWT9 W6PN5t6EGxf2RfZuOdzUydRL4C1Rsm40imMCXqSIXrx3sSVboEetObVycAJLwvERJKuOi2F1n3z27y xee5kPN9F6c69/bzWmwnR2z26xj+2Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=Y2vNdoT36ll9dWXbUeng8xFhar5CS2TAf83tj3AUalM=; b=gOaVBI0Rz1AaNz48KB0D9B6WTGpVSgxcMCSf2mGwc1L1id1HhR+6VGWM6lCI0Pn3TOjc5CzaVtYLO HDzxLiunBi6eqNT5T3gKeu2aE3YFjqlElSVMV4c9TSXNaNILg306Qy3//JfaRf+TiDlQEuilv7ce+6 8Lok6BCD1PvJHdlrUpMn7e9Ea2lWihZSPM2Jf9uMRFF+f82MHLI0U2r6bhp2RyO+JjCY5EPVjjOVdT 8/R1y0tMM+WJOqDarbTxXDMNO4nCmAD5z0Dp6X+EOPvu6jKs3pU7F9/dCQED7PKQGeyhXO03xg2xMI 2VMgjSMrVbCJuKUoZ0Wd2cdp8P1yfkg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=Y2vNdoT36ll9dWXbUeng8xFhar5CS2TAf83tj3AUalM=; b=so5Ac+XmcIpus9PacZnDPeHR0BOpLZdqb453R5PRaY5NnJj2qsTz50laofCbWtiNu0xXAcB9NASVy qLLj09lR37uqqs24XKONtElFZaNL1xdxCQoaxdhv3NvPwsf+kdjVtjo9ZSCuadzPKnmxtXQQKzYqUg 82MZ40tXfQF1ana7byNgMq1GruXIw9n+EPmR6fR0a7X4yfM0LpR7tNf/BD3k2xgvBvArZ1Bzv2R2Vl bjWs5VtInldb086+INKf2TeOn9bgVNiGCSDVDuDI9QHUZbJbixQ2qJIv/examb/S7NGe2fnfNLQr/Z Q0uygIm8pE5WQab6jBVRfLANZB+M9iQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: c8e7425b-cb72-11e9-85ed-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id c8e7425b-cb72-11e9-85ed-13b9aae3a1d2; Fri, 30 Aug 2019 22:09:08 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x7UM96rB022648; Fri, 30 Aug 2019 16:09:06 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <6035df87490ebb7429f76d57a3a5d33e86c06b56.camel@freebsd.org> Subject: Re: svn commit: r351471 - in head/sys: kern sys From: Ian Lepore To: Mateusz Guzik , Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 30 Aug 2019 16:09:06 -0600 In-Reply-To: References: <201908250511.x7P5BiPl016074@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46KttH4Dyxz4cyb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2019 22:09:12 -0000 On Sat, 2019-08-31 at 00:03 +0200, Mateusz Guzik wrote: > On 8/25/19, Oliver Pinter wrote: > > On Sunday, August 25, 2019, Mateusz Guzik wrote: > > > > > Author: mjg > > > Date: Sun Aug 25 05:11:43 2019 > > > New Revision: 351471 > > > URL: https://svnweb.freebsd.org/changeset/base/351471 > > > > > > Log: > > > vfs: add vholdnz (for already held vnodes) > > > > > > Why? > > > > (Yes, is can read the real reason in phabricator, but the > > phabricator > > didn't considered a persistent information in relation to commit > > message. > > Review helper tool just comes and goes as time goes forward, but > > commit > > messages survives the repo conversions to other VCS...) > > > > And once you have taken the time to write a correct description in > > phabricator, it would be really really nice and helpful if you > > would copy > > them into commit message. > > > > I think it's a fair point that if I included this info in the review > it > should make it's way into the commit message. > When I open a new phab review, I specifically write the one-line summary and text that follows with the idea that I'm going to cut and paste that exact text as the commit message (mostly because it's easier to just write all that stuff once). If there are things I want to say there that don't make sense for the commit I typically add them as a separate comment right after I open the initial review. -- Ian From owner-svn-src-all@freebsd.org Sat Aug 31 00:45:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 586BADC887; Sat, 31 Aug 2019 00:45:02 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46KyL56XQpz3Fky; Sat, 31 Aug 2019 00:45:01 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 3rVgiYr3ISrVc3rVhi3G37; Fri, 30 Aug 2019 18:44:59 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=xqWC_Br6kY4A:10 a=FmdZ9Uzk2mMA:10 a=6I5d2MoRAAAA:8 a=ypVJL4-jAAAA:8 a=YxBL1-UpAAAA:8 a=KWaSwiQ3T9b_v806dOsA:9 a=QEXdDO2ut3YA:10 a=IjZwj45LgO3ly-622nXo:22 a=khIbc0fXALFIcTpOSxgJ:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from [IPv6:2605:8d80:403:7c6b:45f7:b036:707d:4d1f] (unknown [72.143.236.68]) by spqr.komquats.com (Postfix) with ESMTPSA id 268CB97A; Fri, 30 Aug 2019 17:44:55 -0700 (PDT) Date: Fri, 30 Aug 2019 17:44:26 -0700 In-Reply-To: <6035df87490ebb7429f76d57a3a5d33e86c06b56.camel@freebsd.org> References: <201908250511.x7P5BiPl016074@repo.freebsd.org> <6035df87490ebb7429f76d57a3a5d33e86c06b56.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r351471 - in head/sys: kern sys To: Ian Lepore , Mateusz Guzik , Oliver Pinter CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfFQXh4OD9+nXTHXvrSfxvAArtUAegC3sJuW4rhoGKUvZqxJzgy6ctoP3i3g0shM/BDv45mqu+5Gl73azHOl7UUnCOtBjD4fDGMae0H0cV1L4xCKpd6jQ ltzCNdUwmJa7sBaX8h+fryxlOmnsMAaEhgBZyObgx2pwUtmrOsTBk0W338mzpDK3Wn6s3NWQ0zHHXmCd5n76BEe+UTG7KHsm4ty45XjANQSKs3V3F1PWEUBz HzYStXkbseRDY4K/fv1wOm7VeoU610d/ZqFiUvVnbp+WMrqh53txNrAAJnmg5v6987zsm7lE1yW2uwjVer93SeffG629HXvMDK1Bw+RRsXY= X-Rspamd-Queue-Id: 46KyL56XQpz3Fky X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 00:45:02 -0000 On August 30, 2019 3:09:06 PM PDT, Ian Lepore wrote: >On Sat, 2019-08-31 at 00:03 +0200, Mateusz Guzik wrote: >> On 8/25/19, Oliver Pinter wrote: >> > On Sunday, August 25, 2019, Mateusz Guzik wrote: >> >=20 >> > > Author: mjg >> > > Date: Sun Aug 25 05:11:43 2019 >> > > New Revision: 351471 >> > > URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/351471 >> > >=20 >> > > Log: >> > > vfs: add vholdnz (for already held vnodes) >> >=20 >> >=20 >> > Why? >> >=20 >> > (Yes, is can read the real reason in phabricator, but the >> > phabricator >> > didn't considered a persistent information in relation to commit >> > message=2E >> > Review helper tool just comes and goes as time goes forward, but >> > commit >> > messages survives the repo conversions to other VCS=2E=2E=2E) >> >=20 >> > And once you have taken the time to write a correct description in >> > phabricator, it would be really really nice and helpful if you >> > would copy >> > them into commit message=2E >> >=20 >>=20 >> I think it's a fair point that if I included this info in the review >> it >> should make it's way into the commit message=2E >>=20 > >When I open a new phab review, I specifically write the one-line >summary and text that follows with the idea that I'm going to cut and >paste that exact text as the commit message (mostly because it's easier >to just write all that stuff once)=2E If there are things I want to say >there that don't make sense for the commit I typically add them as a >separate comment right after I open the initial review=2E > >-- Ian I like to start out with a one line summary if possible, subsequently prov= iding more detail=2E The first paragraph or two of a phab review could/should be written to sim= ply cut and paste that into the commit message=2E I try to aim for this=2E I suppose when a person has been working on some code for a while what app= ears obvious may not be so obvious to others at first=2E It's an easy trap = to fall into=2E Something I catch myself at times=2E --=20 Pardon the typos and autocorrect, small keyboard in use=2E Cheers, Cy Schubert FreeBSD UNIX: Web: http://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E From owner-svn-src-all@freebsd.org Sat Aug 31 04:23:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B93D0E345B; Sat, 31 Aug 2019 04:23:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3B64tMwz3yLr; Sat, 31 Aug 2019 04:23:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 701C7B400; Sat, 31 Aug 2019 04:23:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7V4NQ4U073831; Sat, 31 Aug 2019 04:23:26 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4NPrF073827; Sat, 31 Aug 2019 04:23:25 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310423.x7V4NPrF073827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351633 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 12/contrib/sqlite3 12/contrib/sqlite3/tea X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 12/contrib/sqlite3 12/contrib/sqlite3/tea X-SVN-Commit-Revision: 351633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:23:26 -0000 Author: cy Date: Sat Aug 31 04:23:25 2019 New Revision: 351633 URL: https://svnweb.freebsd.org/changeset/base/351633 Log: MFC r350103: MFV r350080: Update sqlite3-3.28.0 (3280000) --> sqlite3-3.29.0 (3290000) Modified: stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/sqlite3/configure ============================================================================== --- stable/11/contrib/sqlite3/configure Fri Aug 30 21:54:45 2019 (r351632) +++ stable/11/contrib/sqlite3/configure Sat Aug 31 04:23:25 2019 (r351633) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.28.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.28.0' -PACKAGE_STRING='sqlite 3.28.0' +PACKAGE_VERSION='3.29.0' +PACKAGE_STRING='sqlite 3.29.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.28.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.28.0:";; + short | recursive ) echo "Configuration of sqlite 3.29.0:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.28.0 +sqlite configure 3.29.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.28.0, which was +It was created by sqlite $as_me 3.29.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.28.0' + VERSION='3.29.0' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.28.0, which was +This file was extended by sqlite $as_me 3.29.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.28.0 +sqlite config.status 3.29.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/sqlite3/configure.ac ============================================================================== --- stable/11/contrib/sqlite3/configure.ac Fri Aug 30 21:54:45 2019 (r351632) +++ stable/11/contrib/sqlite3/configure.ac Sat Aug 31 04:23:25 2019 (r351633) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.28.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/11/contrib/sqlite3/shell.c ============================================================================== --- stable/11/contrib/sqlite3/shell.c Fri Aug 30 21:54:45 2019 (r351632) +++ stable/11/contrib/sqlite3/shell.c Sat Aug 31 04:23:25 2019 (r351633) @@ -983,6 +983,7 @@ static void shellAddSchemaName( ** We need several support functions from the SQLite core. */ +/* #include "sqlite3.h" */ /* ** We need several things from the ANSI and MSVCRT headers. @@ -1336,6 +1337,7 @@ INT closedir( ** is used. If SIZE is included it must be one of the integers 224, 256, ** 384, or 512, to determine SHA3 hash variant that is computed. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -2099,6 +2101,7 @@ int sqlite3_shathree_init( ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -3056,6 +3059,7 @@ int sqlite3_fileio_init( ** faster than any human can type. ** */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -3572,6 +3576,7 @@ int sqlite3_completion_init( ** If the file being opened is not an appended database, then this shim is ** a pass-through into the default underlying VFS. **/ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -4228,6 +4233,7 @@ int sqlite3MemTraceDeactivate(void){ ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -6398,6 +6404,7 @@ int sqlite3_zipfile_init( ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include @@ -6520,6 +6527,7 @@ int sqlite3_sqlar_init( */ +/* #include "sqlite3.h" */ typedef struct sqlite3expert sqlite3expert; @@ -6688,6 +6696,7 @@ void sqlite3_expert_destroy(sqlite3expert*); ** ************************************************************************* */ +/* #include "sqlite3expert.h" */ #include #include #include @@ -8631,6 +8640,863 @@ void sqlite3_expert_destroy(sqlite3expert *p){ /************************* End ../ext/expert/sqlite3expert.c ********************/ +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +/************************* Begin ../ext/misc/dbdata.c ******************/ +/* +** 2019-04-17 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains an implementation of two eponymous virtual tables, +** "sqlite_dbdata" and "sqlite_dbptr". Both modules require that the +** "sqlite_dbpage" eponymous virtual table be available. +** +** SQLITE_DBDATA: +** sqlite_dbdata is used to extract data directly from a database b-tree +** page and its associated overflow pages, bypassing the b-tree layer. +** The table schema is equivalent to: +** +** CREATE TABLE sqlite_dbdata( +** pgno INTEGER, +** cell INTEGER, +** field INTEGER, +** value ANY, +** schema TEXT HIDDEN +** ); +** +** IMPORTANT: THE VIRTUAL TABLE SCHEMA ABOVE IS SUBJECT TO CHANGE. IN THE +** FUTURE NEW NON-HIDDEN COLUMNS MAY BE ADDED BETWEEN "value" AND +** "schema". +** +** Each page of the database is inspected. If it cannot be interpreted as +** a b-tree page, or if it is a b-tree page containing 0 entries, the +** sqlite_dbdata table contains no rows for that page. Otherwise, the +** table contains one row for each field in the record associated with +** each cell on the page. For intkey b-trees, the key value is stored in +** field -1. +** +** For example, for the database: +** +** CREATE TABLE t1(a, b); -- root page is page 2 +** INSERT INTO t1(rowid, a, b) VALUES(5, 'v', 'five'); +** INSERT INTO t1(rowid, a, b) VALUES(10, 'x', 'ten'); +** +** the sqlite_dbdata table contains, as well as from entries related to +** page 1, content equivalent to: +** +** INSERT INTO sqlite_dbdata(pgno, cell, field, value) VALUES +** (2, 0, -1, 5 ), +** (2, 0, 0, 'v' ), +** (2, 0, 1, 'five'), +** (2, 1, -1, 10 ), +** (2, 1, 0, 'x' ), +** (2, 1, 1, 'ten' ); +** +** If database corruption is encountered, this module does not report an +** error. Instead, it attempts to extract as much data as possible and +** ignores the corruption. +** +** SQLITE_DBPTR: +** The sqlite_dbptr table has the following schema: +** +** CREATE TABLE sqlite_dbptr( +** pgno INTEGER, +** child INTEGER, +** schema TEXT HIDDEN +** ); +** +** It contains one entry for each b-tree pointer between a parent and +** child page in the database. +*/ +#if !defined(SQLITEINT_H) +/* #include "sqlite3ext.h" */ + +/* typedef unsigned char u8; */ + +#endif +SQLITE_EXTENSION_INIT1 +#include +#include + +#define DBDATA_PADDING_BYTES 100 + +typedef struct DbdataTable DbdataTable; +typedef struct DbdataCursor DbdataCursor; + +/* Cursor object */ +struct DbdataCursor { + sqlite3_vtab_cursor base; /* Base class. Must be first */ + sqlite3_stmt *pStmt; /* For fetching database pages */ + + int iPgno; /* Current page number */ + u8 *aPage; /* Buffer containing page */ + int nPage; /* Size of aPage[] in bytes */ + int nCell; /* Number of cells on aPage[] */ + int iCell; /* Current cell number */ + int bOnePage; /* True to stop after one page */ + int szDb; + sqlite3_int64 iRowid; + + /* Only for the sqlite_dbdata table */ + u8 *pRec; /* Buffer containing current record */ + int nRec; /* Size of pRec[] in bytes */ + int nHdr; /* Size of header in bytes */ + int iField; /* Current field number */ + u8 *pHdrPtr; + u8 *pPtr; + + sqlite3_int64 iIntkey; /* Integer key value */ +}; + +/* Table object */ +struct DbdataTable { + sqlite3_vtab base; /* Base class. Must be first */ + sqlite3 *db; /* The database connection */ + sqlite3_stmt *pStmt; /* For fetching database pages */ + int bPtr; /* True for sqlite3_dbptr table */ +}; + +/* Column and schema definitions for sqlite_dbdata */ +#define DBDATA_COLUMN_PGNO 0 +#define DBDATA_COLUMN_CELL 1 +#define DBDATA_COLUMN_FIELD 2 +#define DBDATA_COLUMN_VALUE 3 +#define DBDATA_COLUMN_SCHEMA 4 +#define DBDATA_SCHEMA \ + "CREATE TABLE x(" \ + " pgno INTEGER," \ + " cell INTEGER," \ + " field INTEGER," \ + " value ANY," \ + " schema TEXT HIDDEN" \ + ")" + +/* Column and schema definitions for sqlite_dbptr */ +#define DBPTR_COLUMN_PGNO 0 +#define DBPTR_COLUMN_CHILD 1 +#define DBPTR_COLUMN_SCHEMA 2 +#define DBPTR_SCHEMA \ + "CREATE TABLE x(" \ + " pgno INTEGER," \ + " child INTEGER," \ + " schema TEXT HIDDEN" \ + ")" + +/* +** Connect to an sqlite_dbdata (pAux==0) or sqlite_dbptr (pAux!=0) virtual +** table. +*/ +static int dbdataConnect( + sqlite3 *db, + void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVtab, + char **pzErr +){ + DbdataTable *pTab = 0; + int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA); + + if( rc==SQLITE_OK ){ + pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable)); + if( pTab==0 ){ + rc = SQLITE_NOMEM; + }else{ + memset(pTab, 0, sizeof(DbdataTable)); + pTab->db = db; + pTab->bPtr = (pAux!=0); + } + } + + *ppVtab = (sqlite3_vtab*)pTab; + return rc; +} + +/* +** Disconnect from or destroy a sqlite_dbdata or sqlite_dbptr virtual table. +*/ +static int dbdataDisconnect(sqlite3_vtab *pVtab){ + DbdataTable *pTab = (DbdataTable*)pVtab; + if( pTab ){ + sqlite3_finalize(pTab->pStmt); + sqlite3_free(pVtab); + } + return SQLITE_OK; +} + +/* +** This function interprets two types of constraints: +** +** schema=? +** pgno=? +** +** If neither are present, idxNum is set to 0. If schema=? is present, +** the 0x01 bit in idxNum is set. If pgno=? is present, the 0x02 bit +** in idxNum is set. +** +** If both parameters are present, schema is in position 0 and pgno in +** position 1. +*/ +static int dbdataBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdx){ + DbdataTable *pTab = (DbdataTable*)tab; + int i; + int iSchema = -1; + int iPgno = -1; + int colSchema = (pTab->bPtr ? DBPTR_COLUMN_SCHEMA : DBDATA_COLUMN_SCHEMA); + + for(i=0; inConstraint; i++){ + struct sqlite3_index_constraint *p = &pIdx->aConstraint[i]; + if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ + if( p->iColumn==colSchema ){ + if( p->usable==0 ) return SQLITE_CONSTRAINT; + iSchema = i; + } + if( p->iColumn==DBDATA_COLUMN_PGNO && p->usable ){ + iPgno = i; + } + } + } + + if( iSchema>=0 ){ + pIdx->aConstraintUsage[iSchema].argvIndex = 1; + pIdx->aConstraintUsage[iSchema].omit = 1; + } + if( iPgno>=0 ){ + pIdx->aConstraintUsage[iPgno].argvIndex = 1 + (iSchema>=0); + pIdx->aConstraintUsage[iPgno].omit = 1; + pIdx->estimatedCost = 100; + pIdx->estimatedRows = 50; + + if( pTab->bPtr==0 && pIdx->nOrderBy && pIdx->aOrderBy[0].desc==0 ){ + int iCol = pIdx->aOrderBy[0].iColumn; + if( pIdx->nOrderBy==1 ){ + pIdx->orderByConsumed = (iCol==0 || iCol==1); + }else if( pIdx->nOrderBy==2 && pIdx->aOrderBy[1].desc==0 && iCol==0 ){ + pIdx->orderByConsumed = (pIdx->aOrderBy[1].iColumn==1); + } + } + + }else{ + pIdx->estimatedCost = 100000000; + pIdx->estimatedRows = 1000000000; + } + pIdx->idxNum = (iSchema>=0 ? 0x01 : 0x00) | (iPgno>=0 ? 0x02 : 0x00); + return SQLITE_OK; +} + +/* +** Open a new sqlite_dbdata or sqlite_dbptr cursor. +*/ +static int dbdataOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ + DbdataCursor *pCsr; + + pCsr = (DbdataCursor*)sqlite3_malloc64(sizeof(DbdataCursor)); + if( pCsr==0 ){ + return SQLITE_NOMEM; + }else{ + memset(pCsr, 0, sizeof(DbdataCursor)); + pCsr->base.pVtab = pVTab; + } + + *ppCursor = (sqlite3_vtab_cursor *)pCsr; + return SQLITE_OK; +} + +/* +** Restore a cursor object to the state it was in when first allocated +** by dbdataOpen(). +*/ +static void dbdataResetCursor(DbdataCursor *pCsr){ + DbdataTable *pTab = (DbdataTable*)(pCsr->base.pVtab); + if( pTab->pStmt==0 ){ + pTab->pStmt = pCsr->pStmt; + }else{ + sqlite3_finalize(pCsr->pStmt); + } + pCsr->pStmt = 0; + pCsr->iPgno = 1; + pCsr->iCell = 0; + pCsr->iField = 0; + pCsr->bOnePage = 0; + sqlite3_free(pCsr->aPage); + sqlite3_free(pCsr->pRec); + pCsr->pRec = 0; + pCsr->aPage = 0; +} + +/* +** Close an sqlite_dbdata or sqlite_dbptr cursor. +*/ +static int dbdataClose(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + dbdataResetCursor(pCsr); + sqlite3_free(pCsr); + return SQLITE_OK; +} + +/* +** Utility methods to decode 16 and 32-bit big-endian unsigned integers. +*/ +static unsigned int get_uint16(unsigned char *a){ + return (a[0]<<8)|a[1]; +} +static unsigned int get_uint32(unsigned char *a){ + return ((unsigned int)a[0]<<24) + | ((unsigned int)a[1]<<16) + | ((unsigned int)a[2]<<8) + | ((unsigned int)a[3]); +} + +/* +** Load page pgno from the database via the sqlite_dbpage virtual table. +** If successful, set (*ppPage) to point to a buffer containing the page +** data, (*pnPage) to the size of that buffer in bytes and return +** SQLITE_OK. In this case it is the responsibility of the caller to +** eventually free the buffer using sqlite3_free(). +** +** Or, if an error occurs, set both (*ppPage) and (*pnPage) to 0 and +** return an SQLite error code. +*/ +static int dbdataLoadPage( + DbdataCursor *pCsr, /* Cursor object */ + unsigned int pgno, /* Page number of page to load */ + u8 **ppPage, /* OUT: pointer to page buffer */ + int *pnPage /* OUT: Size of (*ppPage) in bytes */ +){ + int rc2; + int rc = SQLITE_OK; + sqlite3_stmt *pStmt = pCsr->pStmt; + + *ppPage = 0; + *pnPage = 0; + sqlite3_bind_int64(pStmt, 2, pgno); + if( SQLITE_ROW==sqlite3_step(pStmt) ){ + int nCopy = sqlite3_column_bytes(pStmt, 0); + if( nCopy>0 ){ + u8 *pPage; + pPage = (u8*)sqlite3_malloc64(nCopy + DBDATA_PADDING_BYTES); + if( pPage==0 ){ + rc = SQLITE_NOMEM; + }else{ + const u8 *pCopy = sqlite3_column_blob(pStmt, 0); + memcpy(pPage, pCopy, nCopy); + memset(&pPage[nCopy], 0, DBDATA_PADDING_BYTES); + } + *ppPage = pPage; + *pnPage = nCopy; + } + } + rc2 = sqlite3_reset(pStmt); + if( rc==SQLITE_OK ) rc = rc2; + + return rc; +} + +/* +** Read a varint. Put the value in *pVal and return the number of bytes. +*/ +static int dbdataGetVarint(const u8 *z, sqlite3_int64 *pVal){ + sqlite3_int64 v = 0; + int i; + for(i=0; i<8; i++){ + v = (v<<7) + (z[i]&0x7f); + if( (z[i]&0x80)==0 ){ *pVal = v; return i+1; } + } + v = (v<<8) + (z[i]&0xff); + *pVal = v; + return 9; +} + +/* +** Return the number of bytes of space used by an SQLite value of type +** eType. +*/ +static int dbdataValueBytes(int eType){ + switch( eType ){ + case 0: case 8: case 9: + case 10: case 11: + return 0; + case 1: + return 1; + case 2: + return 2; + case 3: + return 3; + case 4: + return 4; + case 5: + return 6; + case 6: + case 7: + return 8; + default: + if( eType>0 ){ + return ((eType-12) / 2); + } + return 0; + } +} + +/* +** Load a value of type eType from buffer pData and use it to set the +** result of context object pCtx. +*/ +static void dbdataValue( + sqlite3_context *pCtx, + int eType, + u8 *pData, + int nData +){ + if( eType>=0 && dbdataValueBytes(eType)<=nData ){ + switch( eType ){ + case 0: + case 10: + case 11: + sqlite3_result_null(pCtx); + break; + + case 8: + sqlite3_result_int(pCtx, 0); + break; + case 9: + sqlite3_result_int(pCtx, 1); + break; + + case 1: case 2: case 3: case 4: case 5: case 6: case 7: { + sqlite3_uint64 v = (signed char)pData[0]; + pData++; + switch( eType ){ + case 7: + case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 4: v = (v<<8) + pData[0]; pData++; + case 3: v = (v<<8) + pData[0]; pData++; + case 2: v = (v<<8) + pData[0]; pData++; + } + + if( eType==7 ){ + double r; + memcpy(&r, &v, sizeof(r)); + sqlite3_result_double(pCtx, r); + }else{ + sqlite3_result_int64(pCtx, (sqlite3_int64)v); + } + break; + } + + default: { + int n = ((eType-12) / 2); + if( eType % 2 ){ + sqlite3_result_text(pCtx, (const char*)pData, n, SQLITE_TRANSIENT); + }else{ + sqlite3_result_blob(pCtx, pData, n, SQLITE_TRANSIENT); + } + } + } + } +} + +/* +** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry. +*/ +static int dbdataNext(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + + pCsr->iRowid++; + while( 1 ){ + int rc; + int iOff = (pCsr->iPgno==1 ? 100 : 0); + int bNextPage = 0; + + if( pCsr->aPage==0 ){ + while( 1 ){ + if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK; + rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage); + if( rc!=SQLITE_OK ) return rc; + if( pCsr->aPage ) break; + pCsr->iPgno++; + } + pCsr->iCell = pTab->bPtr ? -2 : 0; + pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]); + } + + if( pTab->bPtr ){ + if( pCsr->aPage[iOff]!=0x02 && pCsr->aPage[iOff]!=0x05 ){ + pCsr->iCell = pCsr->nCell; + } + pCsr->iCell++; + if( pCsr->iCell>=pCsr->nCell ){ + sqlite3_free(pCsr->aPage); + pCsr->aPage = 0; + if( pCsr->bOnePage ) return SQLITE_OK; + pCsr->iPgno++; + }else{ + return SQLITE_OK; + } + }else{ + /* If there is no record loaded, load it now. */ + if( pCsr->pRec==0 ){ + int bHasRowid = 0; + int nPointer = 0; + sqlite3_int64 nPayload = 0; + sqlite3_int64 nHdr = 0; + int iHdr; + int U, X; + int nLocal; + + switch( pCsr->aPage[iOff] ){ + case 0x02: + nPointer = 4; + break; + case 0x0a: + break; + case 0x0d: + bHasRowid = 1; + break; + default: + /* This is not a b-tree page with records on it. Continue. */ + pCsr->iCell = pCsr->nCell; + break; + } + + if( pCsr->iCell>=pCsr->nCell ){ + bNextPage = 1; + }else{ + + iOff += 8 + nPointer + pCsr->iCell*2; + if( iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + iOff = get_uint16(&pCsr->aPage[iOff]); + } + + /* For an interior node cell, skip past the child-page number */ + iOff += nPointer; + + /* Load the "byte of payload including overflow" field */ + if( bNextPage || iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + iOff += dbdataGetVarint(&pCsr->aPage[iOff], &nPayload); + } + + /* If this is a leaf intkey cell, load the rowid */ + if( bHasRowid && !bNextPage && iOffnPage ){ + iOff += dbdataGetVarint(&pCsr->aPage[iOff], &pCsr->iIntkey); + } + + /* Figure out how much data to read from the local page */ + U = pCsr->nPage; + if( bHasRowid ){ + X = U-35; + }else{ + X = ((U-12)*64/255)-23; + } + if( nPayload<=X ){ + nLocal = nPayload; + }else{ + int M, K; + M = ((U-12)*32/255)-23; + K = M+((nPayload-M)%(U-4)); + if( K<=X ){ + nLocal = K; + }else{ + nLocal = M; + } + } + + if( bNextPage || nLocal+iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + + /* Allocate space for payload. And a bit more to catch small buffer + ** overruns caused by attempting to read a varint or similar from + ** near the end of a corrupt record. */ + pCsr->pRec = (u8*)sqlite3_malloc64(nPayload+DBDATA_PADDING_BYTES); + if( pCsr->pRec==0 ) return SQLITE_NOMEM; + memset(pCsr->pRec, 0, nPayload+DBDATA_PADDING_BYTES); + pCsr->nRec = nPayload; + + /* Load the nLocal bytes of payload */ + memcpy(pCsr->pRec, &pCsr->aPage[iOff], nLocal); + iOff += nLocal; + + /* Load content from overflow pages */ + if( nPayload>nLocal ){ + sqlite3_int64 nRem = nPayload - nLocal; + unsigned int pgnoOvfl = get_uint32(&pCsr->aPage[iOff]); + while( nRem>0 ){ + u8 *aOvfl = 0; + int nOvfl = 0; + int nCopy; + rc = dbdataLoadPage(pCsr, pgnoOvfl, &aOvfl, &nOvfl); + assert( rc!=SQLITE_OK || aOvfl==0 || nOvfl==pCsr->nPage ); + if( rc!=SQLITE_OK ) return rc; + if( aOvfl==0 ) break; + + nCopy = U-4; + if( nCopy>nRem ) nCopy = nRem; + memcpy(&pCsr->pRec[nPayload-nRem], &aOvfl[4], nCopy); + nRem -= nCopy; + + pgnoOvfl = get_uint32(aOvfl); + sqlite3_free(aOvfl); + } + } + + iHdr = dbdataGetVarint(pCsr->pRec, &nHdr); + pCsr->nHdr = nHdr; + pCsr->pHdrPtr = &pCsr->pRec[iHdr]; + pCsr->pPtr = &pCsr->pRec[pCsr->nHdr]; + pCsr->iField = (bHasRowid ? -1 : 0); + } + } + }else{ + pCsr->iField++; + if( pCsr->iField>0 ){ + sqlite3_int64 iType; + if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){ + bNextPage = 1; + }else{ + pCsr->pHdrPtr += dbdataGetVarint(pCsr->pHdrPtr, &iType); + pCsr->pPtr += dbdataValueBytes(iType); + } + } + } + + if( bNextPage ){ + sqlite3_free(pCsr->aPage); + sqlite3_free(pCsr->pRec); + pCsr->aPage = 0; + pCsr->pRec = 0; + if( pCsr->bOnePage ) return SQLITE_OK; + pCsr->iPgno++; + }else{ + if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->pRec[pCsr->nHdr] ){ + return SQLITE_OK; + } + + /* Advance to the next cell. The next iteration of the loop will load + ** the record and so on. */ + sqlite3_free(pCsr->pRec); + pCsr->pRec = 0; + pCsr->iCell++; + } + } + } + + assert( !"can't get here" ); + return SQLITE_OK; +} + +/* +** Return true if the cursor is at EOF. +*/ +static int dbdataEof(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + return pCsr->aPage==0; +} + +/* +** Determine the size in pages of database zSchema (where zSchema is +** "main", "temp" or the name of an attached database) and set +** pCsr->szDb accordingly. If successful, return SQLITE_OK. Otherwise, +** an SQLite error code. +*/ +static int dbdataDbsize(DbdataCursor *pCsr, const char *zSchema){ + DbdataTable *pTab = (DbdataTable*)pCsr->base.pVtab; + char *zSql = 0; + int rc, rc2; + sqlite3_stmt *pStmt = 0; + + zSql = sqlite3_mprintf("PRAGMA %Q.page_count", zSchema); + if( zSql==0 ) return SQLITE_NOMEM; + rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + pCsr->szDb = sqlite3_column_int(pStmt, 0); + } + rc2 = sqlite3_finalize(pStmt); + if( rc==SQLITE_OK ) rc = rc2; + return rc; +} + +/* +** xFilter method for sqlite_dbdata and sqlite_dbptr. +*/ +static int dbdataFilter( + sqlite3_vtab_cursor *pCursor, + int idxNum, const char *idxStr, + int argc, sqlite3_value **argv +){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + int rc = SQLITE_OK; + const char *zSchema = "main"; + + dbdataResetCursor(pCsr); + assert( pCsr->iPgno==1 ); + if( idxNum & 0x01 ){ + zSchema = (const char*)sqlite3_value_text(argv[0]); + } + if( idxNum & 0x02 ){ + pCsr->iPgno = sqlite3_value_int(argv[(idxNum & 0x01)]); + pCsr->bOnePage = 1; + }else{ + pCsr->nPage = dbdataDbsize(pCsr, zSchema); + rc = dbdataDbsize(pCsr, zSchema); + } + + if( rc==SQLITE_OK ){ + if( pTab->pStmt ){ + pCsr->pStmt = pTab->pStmt; + pTab->pStmt = 0; + }else{ + rc = sqlite3_prepare_v2(pTab->db, + "SELECT data FROM sqlite_dbpage(?) WHERE pgno=?", -1, + &pCsr->pStmt, 0 + ); + } + } + if( rc==SQLITE_OK ){ + rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT); + }else{ + pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db)); + } + if( rc==SQLITE_OK ){ + rc = dbdataNext(pCursor); + } + return rc; +} + +/* +** Return a column for the sqlite_dbdata or sqlite_dbptr table. +*/ +static int dbdataColumn( + sqlite3_vtab_cursor *pCursor, + sqlite3_context *ctx, + int i +){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + if( pTab->bPtr ){ + switch( i ){ + case DBPTR_COLUMN_PGNO: + sqlite3_result_int64(ctx, pCsr->iPgno); + break; + case DBPTR_COLUMN_CHILD: { + int iOff = pCsr->iPgno==1 ? 100 : 0; + if( pCsr->iCell<0 ){ + iOff += 8; + }else{ + iOff += 12 + pCsr->iCell*2; + if( iOff>pCsr->nPage ) return SQLITE_OK; + iOff = get_uint16(&pCsr->aPage[iOff]); + } + if( iOff<=pCsr->nPage ){ + sqlite3_result_int64(ctx, get_uint32(&pCsr->aPage[iOff])); + } + break; + } + } + }else{ + switch( i ){ + case DBDATA_COLUMN_PGNO: + sqlite3_result_int64(ctx, pCsr->iPgno); + break; + case DBDATA_COLUMN_CELL: + sqlite3_result_int(ctx, pCsr->iCell); + break; + case DBDATA_COLUMN_FIELD: + sqlite3_result_int(ctx, pCsr->iField); + break; + case DBDATA_COLUMN_VALUE: { + if( pCsr->iField<0 ){ + sqlite3_result_int64(ctx, pCsr->iIntkey); + }else{ + sqlite3_int64 iType; + dbdataGetVarint(pCsr->pHdrPtr, &iType); + dbdataValue( + ctx, iType, pCsr->pPtr, &pCsr->pRec[pCsr->nRec] - pCsr->pPtr + ); + } + break; + } + } + } + return SQLITE_OK; +} + +/* +** Return the rowid for an sqlite_dbdata or sqlite_dptr table. +*/ +static int dbdataRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + *pRowid = pCsr->iRowid; + return SQLITE_OK; +} + + +/* +** Invoke this routine to register the "sqlite_dbdata" virtual table module +*/ +static int sqlite3DbdataRegister(sqlite3 *db){ + static sqlite3_module dbdata_module = { + 0, /* iVersion */ + 0, /* xCreate */ + dbdataConnect, /* xConnect */ + dbdataBestIndex, /* xBestIndex */ + dbdataDisconnect, /* xDisconnect */ + 0, /* xDestroy */ + dbdataOpen, /* xOpen - open a cursor */ + dbdataClose, /* xClose - close a cursor */ + dbdataFilter, /* xFilter - configure scan constraints */ + dbdataNext, /* xNext - advance a cursor */ + dbdataEof, /* xEof - check for end of scan */ + dbdataColumn, /* xColumn - read data */ + dbdataRowid, /* xRowid - read data */ + 0, /* xUpdate */ + 0, /* xBegin */ + 0, /* xSync */ + 0, /* xCommit */ + 0, /* xRollback */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 31 04:23:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76CDAE3463; Sat, 31 Aug 2019 04:23:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3B73Ht5z3yLs; Sat, 31 Aug 2019 04:23:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50E4CB401; Sat, 31 Aug 2019 04:23:27 +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 x7V4NRxk073840; Sat, 31 Aug 2019 04:23:27 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4NQJw073836; Sat, 31 Aug 2019 04:23:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310423.x7V4NQJw073836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351633 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 12/contrib/sqlite3 12/contrib/sqlite3/tea X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 12/contrib/sqlite3 12/contrib/sqlite3/tea X-SVN-Commit-Revision: 351633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:23:27 -0000 Author: cy Date: Sat Aug 31 04:23:25 2019 New Revision: 351633 URL: https://svnweb.freebsd.org/changeset/base/351633 Log: MFC r350103: MFV r350080: Update sqlite3-3.28.0 (3280000) --> sqlite3-3.29.0 (3290000) Modified: stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/sqlite3/configure ============================================================================== --- stable/12/contrib/sqlite3/configure Fri Aug 30 21:54:45 2019 (r351632) +++ stable/12/contrib/sqlite3/configure Sat Aug 31 04:23:25 2019 (r351633) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.28.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.28.0' -PACKAGE_STRING='sqlite 3.28.0' +PACKAGE_VERSION='3.29.0' +PACKAGE_STRING='sqlite 3.29.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.28.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.28.0:";; + short | recursive ) echo "Configuration of sqlite 3.29.0:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.28.0 +sqlite configure 3.29.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.28.0, which was +It was created by sqlite $as_me 3.29.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.28.0' + VERSION='3.29.0' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.28.0, which was +This file was extended by sqlite $as_me 3.29.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.28.0 +sqlite config.status 3.29.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/12/contrib/sqlite3/configure.ac ============================================================================== --- stable/12/contrib/sqlite3/configure.ac Fri Aug 30 21:54:45 2019 (r351632) +++ stable/12/contrib/sqlite3/configure.ac Sat Aug 31 04:23:25 2019 (r351633) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.28.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/12/contrib/sqlite3/shell.c ============================================================================== --- stable/12/contrib/sqlite3/shell.c Fri Aug 30 21:54:45 2019 (r351632) +++ stable/12/contrib/sqlite3/shell.c Sat Aug 31 04:23:25 2019 (r351633) @@ -983,6 +983,7 @@ static void shellAddSchemaName( ** We need several support functions from the SQLite core. */ +/* #include "sqlite3.h" */ /* ** We need several things from the ANSI and MSVCRT headers. @@ -1336,6 +1337,7 @@ INT closedir( ** is used. If SIZE is included it must be one of the integers 224, 256, ** 384, or 512, to determine SHA3 hash variant that is computed. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -2099,6 +2101,7 @@ int sqlite3_shathree_init( ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -3056,6 +3059,7 @@ int sqlite3_fileio_init( ** faster than any human can type. ** */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -3572,6 +3576,7 @@ int sqlite3_completion_init( ** If the file being opened is not an appended database, then this shim is ** a pass-through into the default underlying VFS. **/ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -4228,6 +4233,7 @@ int sqlite3MemTraceDeactivate(void){ ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include #include @@ -6398,6 +6404,7 @@ int sqlite3_zipfile_init( ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ +/* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include @@ -6520,6 +6527,7 @@ int sqlite3_sqlar_init( */ +/* #include "sqlite3.h" */ typedef struct sqlite3expert sqlite3expert; @@ -6688,6 +6696,7 @@ void sqlite3_expert_destroy(sqlite3expert*); ** ************************************************************************* */ +/* #include "sqlite3expert.h" */ #include #include #include @@ -8631,6 +8640,863 @@ void sqlite3_expert_destroy(sqlite3expert *p){ /************************* End ../ext/expert/sqlite3expert.c ********************/ +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +/************************* Begin ../ext/misc/dbdata.c ******************/ +/* +** 2019-04-17 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains an implementation of two eponymous virtual tables, +** "sqlite_dbdata" and "sqlite_dbptr". Both modules require that the +** "sqlite_dbpage" eponymous virtual table be available. +** +** SQLITE_DBDATA: +** sqlite_dbdata is used to extract data directly from a database b-tree +** page and its associated overflow pages, bypassing the b-tree layer. +** The table schema is equivalent to: +** +** CREATE TABLE sqlite_dbdata( +** pgno INTEGER, +** cell INTEGER, +** field INTEGER, +** value ANY, +** schema TEXT HIDDEN +** ); +** +** IMPORTANT: THE VIRTUAL TABLE SCHEMA ABOVE IS SUBJECT TO CHANGE. IN THE +** FUTURE NEW NON-HIDDEN COLUMNS MAY BE ADDED BETWEEN "value" AND +** "schema". +** +** Each page of the database is inspected. If it cannot be interpreted as +** a b-tree page, or if it is a b-tree page containing 0 entries, the +** sqlite_dbdata table contains no rows for that page. Otherwise, the +** table contains one row for each field in the record associated with +** each cell on the page. For intkey b-trees, the key value is stored in +** field -1. +** +** For example, for the database: +** +** CREATE TABLE t1(a, b); -- root page is page 2 +** INSERT INTO t1(rowid, a, b) VALUES(5, 'v', 'five'); +** INSERT INTO t1(rowid, a, b) VALUES(10, 'x', 'ten'); +** +** the sqlite_dbdata table contains, as well as from entries related to +** page 1, content equivalent to: +** +** INSERT INTO sqlite_dbdata(pgno, cell, field, value) VALUES +** (2, 0, -1, 5 ), +** (2, 0, 0, 'v' ), +** (2, 0, 1, 'five'), +** (2, 1, -1, 10 ), +** (2, 1, 0, 'x' ), +** (2, 1, 1, 'ten' ); +** +** If database corruption is encountered, this module does not report an +** error. Instead, it attempts to extract as much data as possible and +** ignores the corruption. +** +** SQLITE_DBPTR: +** The sqlite_dbptr table has the following schema: +** +** CREATE TABLE sqlite_dbptr( +** pgno INTEGER, +** child INTEGER, +** schema TEXT HIDDEN +** ); +** +** It contains one entry for each b-tree pointer between a parent and +** child page in the database. +*/ +#if !defined(SQLITEINT_H) +/* #include "sqlite3ext.h" */ + +/* typedef unsigned char u8; */ + +#endif +SQLITE_EXTENSION_INIT1 +#include +#include + +#define DBDATA_PADDING_BYTES 100 + +typedef struct DbdataTable DbdataTable; +typedef struct DbdataCursor DbdataCursor; + +/* Cursor object */ +struct DbdataCursor { + sqlite3_vtab_cursor base; /* Base class. Must be first */ + sqlite3_stmt *pStmt; /* For fetching database pages */ + + int iPgno; /* Current page number */ + u8 *aPage; /* Buffer containing page */ + int nPage; /* Size of aPage[] in bytes */ + int nCell; /* Number of cells on aPage[] */ + int iCell; /* Current cell number */ + int bOnePage; /* True to stop after one page */ + int szDb; + sqlite3_int64 iRowid; + + /* Only for the sqlite_dbdata table */ + u8 *pRec; /* Buffer containing current record */ + int nRec; /* Size of pRec[] in bytes */ + int nHdr; /* Size of header in bytes */ + int iField; /* Current field number */ + u8 *pHdrPtr; + u8 *pPtr; + + sqlite3_int64 iIntkey; /* Integer key value */ +}; + +/* Table object */ +struct DbdataTable { + sqlite3_vtab base; /* Base class. Must be first */ + sqlite3 *db; /* The database connection */ + sqlite3_stmt *pStmt; /* For fetching database pages */ + int bPtr; /* True for sqlite3_dbptr table */ +}; + +/* Column and schema definitions for sqlite_dbdata */ +#define DBDATA_COLUMN_PGNO 0 +#define DBDATA_COLUMN_CELL 1 +#define DBDATA_COLUMN_FIELD 2 +#define DBDATA_COLUMN_VALUE 3 +#define DBDATA_COLUMN_SCHEMA 4 +#define DBDATA_SCHEMA \ + "CREATE TABLE x(" \ + " pgno INTEGER," \ + " cell INTEGER," \ + " field INTEGER," \ + " value ANY," \ + " schema TEXT HIDDEN" \ + ")" + +/* Column and schema definitions for sqlite_dbptr */ +#define DBPTR_COLUMN_PGNO 0 +#define DBPTR_COLUMN_CHILD 1 +#define DBPTR_COLUMN_SCHEMA 2 +#define DBPTR_SCHEMA \ + "CREATE TABLE x(" \ + " pgno INTEGER," \ + " child INTEGER," \ + " schema TEXT HIDDEN" \ + ")" + +/* +** Connect to an sqlite_dbdata (pAux==0) or sqlite_dbptr (pAux!=0) virtual +** table. +*/ +static int dbdataConnect( + sqlite3 *db, + void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVtab, + char **pzErr +){ + DbdataTable *pTab = 0; + int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA); + + if( rc==SQLITE_OK ){ + pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable)); + if( pTab==0 ){ + rc = SQLITE_NOMEM; + }else{ + memset(pTab, 0, sizeof(DbdataTable)); + pTab->db = db; + pTab->bPtr = (pAux!=0); + } + } + + *ppVtab = (sqlite3_vtab*)pTab; + return rc; +} + +/* +** Disconnect from or destroy a sqlite_dbdata or sqlite_dbptr virtual table. +*/ +static int dbdataDisconnect(sqlite3_vtab *pVtab){ + DbdataTable *pTab = (DbdataTable*)pVtab; + if( pTab ){ + sqlite3_finalize(pTab->pStmt); + sqlite3_free(pVtab); + } + return SQLITE_OK; +} + +/* +** This function interprets two types of constraints: +** +** schema=? +** pgno=? +** +** If neither are present, idxNum is set to 0. If schema=? is present, +** the 0x01 bit in idxNum is set. If pgno=? is present, the 0x02 bit +** in idxNum is set. +** +** If both parameters are present, schema is in position 0 and pgno in +** position 1. +*/ +static int dbdataBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdx){ + DbdataTable *pTab = (DbdataTable*)tab; + int i; + int iSchema = -1; + int iPgno = -1; + int colSchema = (pTab->bPtr ? DBPTR_COLUMN_SCHEMA : DBDATA_COLUMN_SCHEMA); + + for(i=0; inConstraint; i++){ + struct sqlite3_index_constraint *p = &pIdx->aConstraint[i]; + if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ + if( p->iColumn==colSchema ){ + if( p->usable==0 ) return SQLITE_CONSTRAINT; + iSchema = i; + } + if( p->iColumn==DBDATA_COLUMN_PGNO && p->usable ){ + iPgno = i; + } + } + } + + if( iSchema>=0 ){ + pIdx->aConstraintUsage[iSchema].argvIndex = 1; + pIdx->aConstraintUsage[iSchema].omit = 1; + } + if( iPgno>=0 ){ + pIdx->aConstraintUsage[iPgno].argvIndex = 1 + (iSchema>=0); + pIdx->aConstraintUsage[iPgno].omit = 1; + pIdx->estimatedCost = 100; + pIdx->estimatedRows = 50; + + if( pTab->bPtr==0 && pIdx->nOrderBy && pIdx->aOrderBy[0].desc==0 ){ + int iCol = pIdx->aOrderBy[0].iColumn; + if( pIdx->nOrderBy==1 ){ + pIdx->orderByConsumed = (iCol==0 || iCol==1); + }else if( pIdx->nOrderBy==2 && pIdx->aOrderBy[1].desc==0 && iCol==0 ){ + pIdx->orderByConsumed = (pIdx->aOrderBy[1].iColumn==1); + } + } + + }else{ + pIdx->estimatedCost = 100000000; + pIdx->estimatedRows = 1000000000; + } + pIdx->idxNum = (iSchema>=0 ? 0x01 : 0x00) | (iPgno>=0 ? 0x02 : 0x00); + return SQLITE_OK; +} + +/* +** Open a new sqlite_dbdata or sqlite_dbptr cursor. +*/ +static int dbdataOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ + DbdataCursor *pCsr; + + pCsr = (DbdataCursor*)sqlite3_malloc64(sizeof(DbdataCursor)); + if( pCsr==0 ){ + return SQLITE_NOMEM; + }else{ + memset(pCsr, 0, sizeof(DbdataCursor)); + pCsr->base.pVtab = pVTab; + } + + *ppCursor = (sqlite3_vtab_cursor *)pCsr; + return SQLITE_OK; +} + +/* +** Restore a cursor object to the state it was in when first allocated +** by dbdataOpen(). +*/ +static void dbdataResetCursor(DbdataCursor *pCsr){ + DbdataTable *pTab = (DbdataTable*)(pCsr->base.pVtab); + if( pTab->pStmt==0 ){ + pTab->pStmt = pCsr->pStmt; + }else{ + sqlite3_finalize(pCsr->pStmt); + } + pCsr->pStmt = 0; + pCsr->iPgno = 1; + pCsr->iCell = 0; + pCsr->iField = 0; + pCsr->bOnePage = 0; + sqlite3_free(pCsr->aPage); + sqlite3_free(pCsr->pRec); + pCsr->pRec = 0; + pCsr->aPage = 0; +} + +/* +** Close an sqlite_dbdata or sqlite_dbptr cursor. +*/ +static int dbdataClose(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + dbdataResetCursor(pCsr); + sqlite3_free(pCsr); + return SQLITE_OK; +} + +/* +** Utility methods to decode 16 and 32-bit big-endian unsigned integers. +*/ +static unsigned int get_uint16(unsigned char *a){ + return (a[0]<<8)|a[1]; +} +static unsigned int get_uint32(unsigned char *a){ + return ((unsigned int)a[0]<<24) + | ((unsigned int)a[1]<<16) + | ((unsigned int)a[2]<<8) + | ((unsigned int)a[3]); +} + +/* +** Load page pgno from the database via the sqlite_dbpage virtual table. +** If successful, set (*ppPage) to point to a buffer containing the page +** data, (*pnPage) to the size of that buffer in bytes and return +** SQLITE_OK. In this case it is the responsibility of the caller to +** eventually free the buffer using sqlite3_free(). +** +** Or, if an error occurs, set both (*ppPage) and (*pnPage) to 0 and +** return an SQLite error code. +*/ +static int dbdataLoadPage( + DbdataCursor *pCsr, /* Cursor object */ + unsigned int pgno, /* Page number of page to load */ + u8 **ppPage, /* OUT: pointer to page buffer */ + int *pnPage /* OUT: Size of (*ppPage) in bytes */ +){ + int rc2; + int rc = SQLITE_OK; + sqlite3_stmt *pStmt = pCsr->pStmt; + + *ppPage = 0; + *pnPage = 0; + sqlite3_bind_int64(pStmt, 2, pgno); + if( SQLITE_ROW==sqlite3_step(pStmt) ){ + int nCopy = sqlite3_column_bytes(pStmt, 0); + if( nCopy>0 ){ + u8 *pPage; + pPage = (u8*)sqlite3_malloc64(nCopy + DBDATA_PADDING_BYTES); + if( pPage==0 ){ + rc = SQLITE_NOMEM; + }else{ + const u8 *pCopy = sqlite3_column_blob(pStmt, 0); + memcpy(pPage, pCopy, nCopy); + memset(&pPage[nCopy], 0, DBDATA_PADDING_BYTES); + } + *ppPage = pPage; + *pnPage = nCopy; + } + } + rc2 = sqlite3_reset(pStmt); + if( rc==SQLITE_OK ) rc = rc2; + + return rc; +} + +/* +** Read a varint. Put the value in *pVal and return the number of bytes. +*/ +static int dbdataGetVarint(const u8 *z, sqlite3_int64 *pVal){ + sqlite3_int64 v = 0; + int i; + for(i=0; i<8; i++){ + v = (v<<7) + (z[i]&0x7f); + if( (z[i]&0x80)==0 ){ *pVal = v; return i+1; } + } + v = (v<<8) + (z[i]&0xff); + *pVal = v; + return 9; +} + +/* +** Return the number of bytes of space used by an SQLite value of type +** eType. +*/ +static int dbdataValueBytes(int eType){ + switch( eType ){ + case 0: case 8: case 9: + case 10: case 11: + return 0; + case 1: + return 1; + case 2: + return 2; + case 3: + return 3; + case 4: + return 4; + case 5: + return 6; + case 6: + case 7: + return 8; + default: + if( eType>0 ){ + return ((eType-12) / 2); + } + return 0; + } +} + +/* +** Load a value of type eType from buffer pData and use it to set the +** result of context object pCtx. +*/ +static void dbdataValue( + sqlite3_context *pCtx, + int eType, + u8 *pData, + int nData +){ + if( eType>=0 && dbdataValueBytes(eType)<=nData ){ + switch( eType ){ + case 0: + case 10: + case 11: + sqlite3_result_null(pCtx); + break; + + case 8: + sqlite3_result_int(pCtx, 0); + break; + case 9: + sqlite3_result_int(pCtx, 1); + break; + + case 1: case 2: case 3: case 4: case 5: case 6: case 7: { + sqlite3_uint64 v = (signed char)pData[0]; + pData++; + switch( eType ){ + case 7: + case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 4: v = (v<<8) + pData[0]; pData++; + case 3: v = (v<<8) + pData[0]; pData++; + case 2: v = (v<<8) + pData[0]; pData++; + } + + if( eType==7 ){ + double r; + memcpy(&r, &v, sizeof(r)); + sqlite3_result_double(pCtx, r); + }else{ + sqlite3_result_int64(pCtx, (sqlite3_int64)v); + } + break; + } + + default: { + int n = ((eType-12) / 2); + if( eType % 2 ){ + sqlite3_result_text(pCtx, (const char*)pData, n, SQLITE_TRANSIENT); + }else{ + sqlite3_result_blob(pCtx, pData, n, SQLITE_TRANSIENT); + } + } + } + } +} + +/* +** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry. +*/ +static int dbdataNext(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + + pCsr->iRowid++; + while( 1 ){ + int rc; + int iOff = (pCsr->iPgno==1 ? 100 : 0); + int bNextPage = 0; + + if( pCsr->aPage==0 ){ + while( 1 ){ + if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK; + rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage); + if( rc!=SQLITE_OK ) return rc; + if( pCsr->aPage ) break; + pCsr->iPgno++; + } + pCsr->iCell = pTab->bPtr ? -2 : 0; + pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]); + } + + if( pTab->bPtr ){ + if( pCsr->aPage[iOff]!=0x02 && pCsr->aPage[iOff]!=0x05 ){ + pCsr->iCell = pCsr->nCell; + } + pCsr->iCell++; + if( pCsr->iCell>=pCsr->nCell ){ + sqlite3_free(pCsr->aPage); + pCsr->aPage = 0; + if( pCsr->bOnePage ) return SQLITE_OK; + pCsr->iPgno++; + }else{ + return SQLITE_OK; + } + }else{ + /* If there is no record loaded, load it now. */ + if( pCsr->pRec==0 ){ + int bHasRowid = 0; + int nPointer = 0; + sqlite3_int64 nPayload = 0; + sqlite3_int64 nHdr = 0; + int iHdr; + int U, X; + int nLocal; + + switch( pCsr->aPage[iOff] ){ + case 0x02: + nPointer = 4; + break; + case 0x0a: + break; + case 0x0d: + bHasRowid = 1; + break; + default: + /* This is not a b-tree page with records on it. Continue. */ + pCsr->iCell = pCsr->nCell; + break; + } + + if( pCsr->iCell>=pCsr->nCell ){ + bNextPage = 1; + }else{ + + iOff += 8 + nPointer + pCsr->iCell*2; + if( iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + iOff = get_uint16(&pCsr->aPage[iOff]); + } + + /* For an interior node cell, skip past the child-page number */ + iOff += nPointer; + + /* Load the "byte of payload including overflow" field */ + if( bNextPage || iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + iOff += dbdataGetVarint(&pCsr->aPage[iOff], &nPayload); + } + + /* If this is a leaf intkey cell, load the rowid */ + if( bHasRowid && !bNextPage && iOffnPage ){ + iOff += dbdataGetVarint(&pCsr->aPage[iOff], &pCsr->iIntkey); + } + + /* Figure out how much data to read from the local page */ + U = pCsr->nPage; + if( bHasRowid ){ + X = U-35; + }else{ + X = ((U-12)*64/255)-23; + } + if( nPayload<=X ){ + nLocal = nPayload; + }else{ + int M, K; + M = ((U-12)*32/255)-23; + K = M+((nPayload-M)%(U-4)); + if( K<=X ){ + nLocal = K; + }else{ + nLocal = M; + } + } + + if( bNextPage || nLocal+iOff>pCsr->nPage ){ + bNextPage = 1; + }else{ + + /* Allocate space for payload. And a bit more to catch small buffer + ** overruns caused by attempting to read a varint or similar from + ** near the end of a corrupt record. */ + pCsr->pRec = (u8*)sqlite3_malloc64(nPayload+DBDATA_PADDING_BYTES); + if( pCsr->pRec==0 ) return SQLITE_NOMEM; + memset(pCsr->pRec, 0, nPayload+DBDATA_PADDING_BYTES); + pCsr->nRec = nPayload; + + /* Load the nLocal bytes of payload */ + memcpy(pCsr->pRec, &pCsr->aPage[iOff], nLocal); + iOff += nLocal; + + /* Load content from overflow pages */ + if( nPayload>nLocal ){ + sqlite3_int64 nRem = nPayload - nLocal; + unsigned int pgnoOvfl = get_uint32(&pCsr->aPage[iOff]); + while( nRem>0 ){ + u8 *aOvfl = 0; + int nOvfl = 0; + int nCopy; + rc = dbdataLoadPage(pCsr, pgnoOvfl, &aOvfl, &nOvfl); + assert( rc!=SQLITE_OK || aOvfl==0 || nOvfl==pCsr->nPage ); + if( rc!=SQLITE_OK ) return rc; + if( aOvfl==0 ) break; + + nCopy = U-4; + if( nCopy>nRem ) nCopy = nRem; + memcpy(&pCsr->pRec[nPayload-nRem], &aOvfl[4], nCopy); + nRem -= nCopy; + + pgnoOvfl = get_uint32(aOvfl); + sqlite3_free(aOvfl); + } + } + + iHdr = dbdataGetVarint(pCsr->pRec, &nHdr); + pCsr->nHdr = nHdr; + pCsr->pHdrPtr = &pCsr->pRec[iHdr]; + pCsr->pPtr = &pCsr->pRec[pCsr->nHdr]; + pCsr->iField = (bHasRowid ? -1 : 0); + } + } + }else{ + pCsr->iField++; + if( pCsr->iField>0 ){ + sqlite3_int64 iType; + if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){ + bNextPage = 1; + }else{ + pCsr->pHdrPtr += dbdataGetVarint(pCsr->pHdrPtr, &iType); + pCsr->pPtr += dbdataValueBytes(iType); + } + } + } + + if( bNextPage ){ + sqlite3_free(pCsr->aPage); + sqlite3_free(pCsr->pRec); + pCsr->aPage = 0; + pCsr->pRec = 0; + if( pCsr->bOnePage ) return SQLITE_OK; + pCsr->iPgno++; + }else{ + if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->pRec[pCsr->nHdr] ){ + return SQLITE_OK; + } + + /* Advance to the next cell. The next iteration of the loop will load + ** the record and so on. */ + sqlite3_free(pCsr->pRec); + pCsr->pRec = 0; + pCsr->iCell++; + } + } + } + + assert( !"can't get here" ); + return SQLITE_OK; +} + +/* +** Return true if the cursor is at EOF. +*/ +static int dbdataEof(sqlite3_vtab_cursor *pCursor){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + return pCsr->aPage==0; +} + +/* +** Determine the size in pages of database zSchema (where zSchema is +** "main", "temp" or the name of an attached database) and set +** pCsr->szDb accordingly. If successful, return SQLITE_OK. Otherwise, +** an SQLite error code. +*/ +static int dbdataDbsize(DbdataCursor *pCsr, const char *zSchema){ + DbdataTable *pTab = (DbdataTable*)pCsr->base.pVtab; + char *zSql = 0; + int rc, rc2; + sqlite3_stmt *pStmt = 0; + + zSql = sqlite3_mprintf("PRAGMA %Q.page_count", zSchema); + if( zSql==0 ) return SQLITE_NOMEM; + rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + pCsr->szDb = sqlite3_column_int(pStmt, 0); + } + rc2 = sqlite3_finalize(pStmt); + if( rc==SQLITE_OK ) rc = rc2; + return rc; +} + +/* +** xFilter method for sqlite_dbdata and sqlite_dbptr. +*/ +static int dbdataFilter( + sqlite3_vtab_cursor *pCursor, + int idxNum, const char *idxStr, + int argc, sqlite3_value **argv +){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + int rc = SQLITE_OK; + const char *zSchema = "main"; + + dbdataResetCursor(pCsr); + assert( pCsr->iPgno==1 ); + if( idxNum & 0x01 ){ + zSchema = (const char*)sqlite3_value_text(argv[0]); + } + if( idxNum & 0x02 ){ + pCsr->iPgno = sqlite3_value_int(argv[(idxNum & 0x01)]); + pCsr->bOnePage = 1; + }else{ + pCsr->nPage = dbdataDbsize(pCsr, zSchema); + rc = dbdataDbsize(pCsr, zSchema); + } + + if( rc==SQLITE_OK ){ + if( pTab->pStmt ){ + pCsr->pStmt = pTab->pStmt; + pTab->pStmt = 0; + }else{ + rc = sqlite3_prepare_v2(pTab->db, + "SELECT data FROM sqlite_dbpage(?) WHERE pgno=?", -1, + &pCsr->pStmt, 0 + ); + } + } + if( rc==SQLITE_OK ){ + rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT); + }else{ + pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db)); + } + if( rc==SQLITE_OK ){ + rc = dbdataNext(pCursor); + } + return rc; +} + +/* +** Return a column for the sqlite_dbdata or sqlite_dbptr table. +*/ +static int dbdataColumn( + sqlite3_vtab_cursor *pCursor, + sqlite3_context *ctx, + int i +){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; + if( pTab->bPtr ){ + switch( i ){ + case DBPTR_COLUMN_PGNO: + sqlite3_result_int64(ctx, pCsr->iPgno); + break; + case DBPTR_COLUMN_CHILD: { + int iOff = pCsr->iPgno==1 ? 100 : 0; + if( pCsr->iCell<0 ){ + iOff += 8; + }else{ + iOff += 12 + pCsr->iCell*2; + if( iOff>pCsr->nPage ) return SQLITE_OK; + iOff = get_uint16(&pCsr->aPage[iOff]); + } + if( iOff<=pCsr->nPage ){ + sqlite3_result_int64(ctx, get_uint32(&pCsr->aPage[iOff])); + } + break; + } + } + }else{ + switch( i ){ + case DBDATA_COLUMN_PGNO: + sqlite3_result_int64(ctx, pCsr->iPgno); + break; + case DBDATA_COLUMN_CELL: + sqlite3_result_int(ctx, pCsr->iCell); + break; + case DBDATA_COLUMN_FIELD: + sqlite3_result_int(ctx, pCsr->iField); + break; + case DBDATA_COLUMN_VALUE: { + if( pCsr->iField<0 ){ + sqlite3_result_int64(ctx, pCsr->iIntkey); + }else{ + sqlite3_int64 iType; + dbdataGetVarint(pCsr->pHdrPtr, &iType); + dbdataValue( + ctx, iType, pCsr->pPtr, &pCsr->pRec[pCsr->nRec] - pCsr->pPtr + ); + } + break; + } + } + } + return SQLITE_OK; +} + +/* +** Return the rowid for an sqlite_dbdata or sqlite_dptr table. +*/ +static int dbdataRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ + DbdataCursor *pCsr = (DbdataCursor*)pCursor; + *pRowid = pCsr->iRowid; + return SQLITE_OK; +} + + +/* +** Invoke this routine to register the "sqlite_dbdata" virtual table module +*/ +static int sqlite3DbdataRegister(sqlite3 *db){ + static sqlite3_module dbdata_module = { + 0, /* iVersion */ + 0, /* xCreate */ + dbdataConnect, /* xConnect */ + dbdataBestIndex, /* xBestIndex */ + dbdataDisconnect, /* xDisconnect */ + 0, /* xDestroy */ + dbdataOpen, /* xOpen - open a cursor */ + dbdataClose, /* xClose - close a cursor */ + dbdataFilter, /* xFilter - configure scan constraints */ + dbdataNext, /* xNext - advance a cursor */ + dbdataEof, /* xEof - check for end of scan */ + dbdataColumn, /* xColumn - read data */ + dbdataRowid, /* xRowid - read data */ + 0, /* xUpdate */ + 0, /* xBegin */ + 0, /* xSync */ + 0, /* xCommit */ + 0, /* xRollback */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 31 04:25:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EFB1E3585; Sat, 31 Aug 2019 04:25:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3Dc0ppxz3yc3; Sat, 31 Aug 2019 04:25:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1C88B407; Sat, 31 Aug 2019 04:25:35 +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 x7V4PZSE074003; Sat, 31 Aug 2019 04:25:35 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4PZwx074002; Sat, 31 Aug 2019 04:25:35 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310425.x7V4PZwx074002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r351634 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:25:36 -0000 Author: cy Date: Sat Aug 31 04:25:35 2019 New Revision: 351634 URL: https://svnweb.freebsd.org/changeset/base/351634 Log: MFC r351561: Fixup typo in comment. Obtained from: NetBSD ip_nat.c r1.7 Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:23:25 2019 (r351633) +++ stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:25:35 2019 (r351634) @@ -3073,7 +3073,7 @@ ipf_nat_newrdr(fin, nat, ni) /* Attempts to create a new NAT entry. Does not actually change the packet */ /* in any way. */ /* */ -/* This fucntion is in three main parts: (1) deal with creating a new NAT */ +/* This function is in three main parts: (1) deal with creating a new NAT */ /* structure for a "MAP" rule (outgoing NAT translation); (2) deal with */ /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ From owner-svn-src-all@freebsd.org Sat Aug 31 04:25:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D91F2E3589; Sat, 31 Aug 2019 04:25:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3Dc42xjz3yc6; Sat, 31 Aug 2019 04:25:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CB4FB408; Sat, 31 Aug 2019 04:25:36 +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 x7V4Pa6R074009; Sat, 31 Aug 2019 04:25:36 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4Pacf074008; Sat, 31 Aug 2019 04:25:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310425.x7V4Pacf074008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351634 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:25:36 -0000 Author: cy Date: Sat Aug 31 04:25:35 2019 New Revision: 351634 URL: https://svnweb.freebsd.org/changeset/base/351634 Log: MFC r351561: Fixup typo in comment. Obtained from: NetBSD ip_nat.c r1.7 Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:23:25 2019 (r351633) +++ stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:25:35 2019 (r351634) @@ -3073,7 +3073,7 @@ ipf_nat_newrdr(fin, nat, ni) /* Attempts to create a new NAT entry. Does not actually change the packet */ /* in any way. */ /* */ -/* This fucntion is in three main parts: (1) deal with creating a new NAT */ +/* This function is in three main parts: (1) deal with creating a new NAT */ /* structure for a "MAP" rule (outgoing NAT translation); (2) deal with */ /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ From owner-svn-src-all@freebsd.org Sat Aug 31 04:27:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21E57E36BC; Sat, 31 Aug 2019 04:27:01 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3GD2Vz4z3yrX; Sat, 31 Aug 2019 04:27:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E11BBB40C; Sat, 31 Aug 2019 04:26:59 +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 x7V4Qx4a074144; Sat, 31 Aug 2019 04:26:59 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4Qx1m074143; Sat, 31 Aug 2019 04:26:59 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310426.x7V4Qx1m074143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351635 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:27:01 -0000 Author: cy Date: Sat Aug 31 04:26:59 2019 New Revision: 351635 URL: https://svnweb.freebsd.org/changeset/base/351635 Log: MFC r351562: Destroy the mutex in case of error. Obtained from: NetBSD ip_nat.c r1.7 Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:25:35 2019 (r351634) +++ stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:26:59 2019 (r351635) @@ -3078,7 +3078,7 @@ ipf_nat_newrdr(fin, nat, ni) /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ /* */ -/* NOTE: natsave should NOT be used top point back to an ipstate_t struct */ +/* NOTE: natsave should NOT be used to point back to an ipstate_t struct */ /* as it can result in memory being corrupted. */ /* ------------------------------------------------------------------------ */ nat_t * @@ -3406,6 +3406,7 @@ ipf_nat_insert(softc, softn, nat) u_int hv0, hv1; u_int sp, dp; ipnat_t *in; + int ret; /* * Try and return an error as early as possible, so calculate the hash @@ -3488,7 +3489,10 @@ ipf_nat_insert(softc, softn, nat) nat->nat_mtu[1] = GETIFMTU_4(nat->nat_ifps[1]); } - return ipf_nat_hashtab_add(softc, softn, nat); + ret = ipf_nat_hashtab_add(softc, softn, nat); + if (ret == -1) + MUTEX_DESTROY(&nat->nat_lock); + return ret; } From owner-svn-src-all@freebsd.org Sat Aug 31 04:27:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56F15E36B0; Sat, 31 Aug 2019 04:27:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3GC50Hsz3yrW; Sat, 31 Aug 2019 04:26:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CE44B40B; Sat, 31 Aug 2019 04:26:59 +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 x7V4Qx5Q074138; Sat, 31 Aug 2019 04:26:59 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4QxA6074137; Sat, 31 Aug 2019 04:26:59 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310426.x7V4QxA6074137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:26: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: r351635 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:27:00 -0000 Author: cy Date: Sat Aug 31 04:26:59 2019 New Revision: 351635 URL: https://svnweb.freebsd.org/changeset/base/351635 Log: MFC r351562: Destroy the mutex in case of error. Obtained from: NetBSD ip_nat.c r1.7 Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:25:35 2019 (r351634) +++ stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:26:59 2019 (r351635) @@ -3078,7 +3078,7 @@ ipf_nat_newrdr(fin, nat, ni) /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */ /* and (3) building that structure and putting it into the NAT table(s). */ /* */ -/* NOTE: natsave should NOT be used top point back to an ipstate_t struct */ +/* NOTE: natsave should NOT be used to point back to an ipstate_t struct */ /* as it can result in memory being corrupted. */ /* ------------------------------------------------------------------------ */ nat_t * @@ -3406,6 +3406,7 @@ ipf_nat_insert(softc, softn, nat) u_int hv0, hv1; u_int sp, dp; ipnat_t *in; + int ret; /* * Try and return an error as early as possible, so calculate the hash @@ -3488,7 +3489,10 @@ ipf_nat_insert(softc, softn, nat) nat->nat_mtu[1] = GETIFMTU_4(nat->nat_ifps[1]); } - return ipf_nat_hashtab_add(softc, softn, nat); + ret = ipf_nat_hashtab_add(softc, softn, nat); + if (ret == -1) + MUTEX_DESTROY(&nat->nat_lock); + return ret; } From owner-svn-src-all@freebsd.org Sat Aug 31 04:28:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B62DE3798; Sat, 31 Aug 2019 04:28:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3Hq2cfmz405f; Sat, 31 Aug 2019 04:28:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35427B40D; Sat, 31 Aug 2019 04:28:23 +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 x7V4SNqK074251; Sat, 31 Aug 2019 04:28:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4SNa6074250; Sat, 31 Aug 2019 04:28:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310428.x7V4SNa6074250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:28: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: r351636 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:28:23 -0000 Author: cy Date: Sat Aug 31 04:28:22 2019 New Revision: 351636 URL: https://svnweb.freebsd.org/changeset/base/351636 Log: MFC r351563: Document ipf_nat_hashtab_add() return codes. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:26:59 2019 (r351635) +++ stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:28:22 2019 (r351636) @@ -3498,6 +3498,7 @@ ipf_nat_insert(softc, softn, nat) /* ------------------------------------------------------------------------ */ /* Function: ipf_nat_hashtab_add */ +/* Returns: int - 0 == sucess, -1 == failure */ /* Parameters: softc(I) - pointer to soft context main structure */ /* softn(I) - pointer to NAT context structure */ /* nat(I) - pointer to NAT structure */ From owner-svn-src-all@freebsd.org Sat Aug 31 04:28:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDAF8E379C; Sat, 31 Aug 2019 04:28:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L3Hq4z6Qz405g; Sat, 31 Aug 2019 04:28:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A5DFB40E; Sat, 31 Aug 2019 04:28:23 +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 x7V4SNKq074257; Sat, 31 Aug 2019 04:28:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V4SNeQ074256; Sat, 31 Aug 2019 04:28:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201908310428.x7V4SNeQ074256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 31 Aug 2019 04:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351636 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 351636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 04:28:23 -0000 Author: cy Date: Sat Aug 31 04:28:22 2019 New Revision: 351636 URL: https://svnweb.freebsd.org/changeset/base/351636 Log: MFC r351563: Document ipf_nat_hashtab_add() return codes. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:26:59 2019 (r351635) +++ stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Sat Aug 31 04:28:22 2019 (r351636) @@ -3498,6 +3498,7 @@ ipf_nat_insert(softc, softn, nat) /* ------------------------------------------------------------------------ */ /* Function: ipf_nat_hashtab_add */ +/* Returns: int - 0 == sucess, -1 == failure */ /* Parameters: softc(I) - pointer to soft context main structure */ /* softn(I) - pointer to NAT context structure */ /* nat(I) - pointer to NAT structure */ From owner-svn-src-all@freebsd.org Sat Aug 31 06:24:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6866E59FC; Sat, 31 Aug 2019 06:24:09 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L5sP5P5jz4516; Sat, 31 Aug 2019 06:24:09 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AF1BCB63; Sat, 31 Aug 2019 06:24:09 +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 x7V6O9up046187; Sat, 31 Aug 2019 06:24:09 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V6O987046186; Sat, 31 Aug 2019 06:24:09 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908310624.x7V6O987046186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 31 Aug 2019 06:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351637 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 351637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 06:24:09 -0000 Author: tsoome Date: Sat Aug 31 06:24:09 2019 New Revision: 351637 URL: https://svnweb.freebsd.org/changeset/base/351637 Log: loader.efi: use shift 16 in efipart as it is max ashift supported by zfs Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Sat Aug 31 04:28:22 2019 (r351636) +++ head/stand/efi/libefi/efipart.c Sat Aug 31 06:24:09 2019 (r351637) @@ -255,12 +255,13 @@ efipart_inithandles(void) /* * We assume the block size 512 or greater power of 2. - * Also skip devices with block size > 32k. + * Also skip devices with block size > 64k (16 is max + * ashift supported by zfs). * iPXE is known to insert stub BLOCK IO device with * BlockSize 1. */ if (blkio->Media->BlockSize < 512 || - blkio->Media->BlockSize > (1 << 15) || + blkio->Media->BlockSize > (1 << 16) || !powerof2(blkio->Media->BlockSize)) { continue; } From owner-svn-src-all@freebsd.org Sat Aug 31 08:18:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42422C9FEF; Sat, 31 Aug 2019 08:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L8Pk1016z4DhB; Sat, 31 Aug 2019 08:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFC62DF8F; Sat, 31 Aug 2019 08:18:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7V8Inch014822; Sat, 31 Aug 2019 08:18:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V8InOR014821; Sat, 31 Aug 2019 08:18:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908310818.x7V8InOR014821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 31 Aug 2019 08:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351638 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 351638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 08:18:50 -0000 Author: tuexen Date: Sat Aug 31 08:18:49 2019 New Revision: 351638 URL: https://svnweb.freebsd.org/changeset/base/351638 Log: Improve the handling of illegal sequence number combinations in received data chunks. Abort the association if there are data chunks with larger fragement sequence numbers than the fragement sequence of the last fragment. Thanks to Mark Wodrich from Google who found this issue by fuzz testing the userland stack and reporting this issue in https://github.com/sctplab/usrsctp/issues/355 MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Aug 31 06:24:09 2019 (r351637) +++ head/sys/netinet/sctp_indata.c Sat Aug 31 08:18:49 2019 (r351638) @@ -1479,6 +1479,16 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc "The last fsn is now in place fsn: %u\n", chk->rec.data.fsn); control->last_frag_seen = 1; + if (SCTP_TSN_GT(control->top_fsn, chk->rec.data.fsn)) { + SCTPDBG(SCTP_DEBUG_XXX, + "New fsn: %u is not at top_fsn: %u -- abort\n", + chk->rec.data.fsn, + control->top_fsn); + sctp_abort_in_reasm(stcb, control, chk, + abort_flag, + SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); + return; + } } if (asoc->idata_supported || control->first_frag_seen) { /* @@ -1494,7 +1504,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc */ sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_10); return; } } @@ -1506,7 +1516,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc chk->rec.data.fsn, control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_10); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_11); return; } if (asoc->idata_supported || control->first_frag_seen) { @@ -1527,7 +1537,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc chk->rec.data.fsn, control->fsn_included); sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_11); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_12); return; } } @@ -1542,7 +1552,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_12); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_13); return; } } @@ -1585,7 +1595,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc at->rec.data.fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_13); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_14); return; } } From owner-svn-src-all@freebsd.org Sat Aug 31 08:40:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40C7ECAA95; Sat, 31 Aug 2019 08:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L8ty14Yyz4Fmm; Sat, 31 Aug 2019 08:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08491E361; Sat, 31 Aug 2019 08:40:42 +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 x7V8efMC027032; Sat, 31 Aug 2019 08:40:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V8efJU027031; Sat, 31 Aug 2019 08:40:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908310840.x7V8efJU027031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 31 Aug 2019 08:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351639 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 351639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 08:40:42 -0000 Author: kib Date: Sat Aug 31 08:40:41 2019 New Revision: 351639 URL: https://svnweb.freebsd.org/changeset/base/351639 Log: MFC r351453: Make stack grow use the same gap as stack create. Modified: stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Sat Aug 31 08:18:49 2019 (r351638) +++ stable/12/sys/vm/vm_map.c Sat Aug 31 08:40:41 2019 (r351639) @@ -4156,8 +4156,20 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); - if (rv != KERN_SUCCESS) + if (rv == KERN_SUCCESS) { + /* + * Gap can never successfully handle a fault, so + * read-ahead logic is never used for it. Re-use + * next_read of the gap entry to store + * stack_guard_page for vm_map_growstack(). + */ + if (orient == MAP_STACK_GROWS_DOWN) + new_entry->prev->next_read = sgp; + else + new_entry->next->next_read = sgp; + } else { (void)vm_map_delete(map, bot, top); + } return (rv); } @@ -4198,7 +4210,6 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma MPASS(!map->system_map); - guard = stack_guard_page * PAGE_SIZE; lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); stacklim = lim_cur(curthread, RLIMIT_STACK); vmemlim = lim_cur(curthread, RLIMIT_VMEM); @@ -4225,6 +4236,7 @@ retry: } else { return (KERN_FAILURE); } + guard = gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); From owner-svn-src-all@freebsd.org Sat Aug 31 08:52:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4E04CB14D; Sat, 31 Aug 2019 08:52:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46L9963lLGz4GSY; Sat, 31 Aug 2019 08:52:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6238CE6D4; Sat, 31 Aug 2019 08:52: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 x7V8qwkO038064; Sat, 31 Aug 2019 08:52:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7V8qwts038063; Sat, 31 Aug 2019 08:52:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201908310852.x7V8qwts038063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 31 Aug 2019 08:52: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: r351640 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 351640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 08:52:58 -0000 Author: kib Date: Sat Aug 31 08:52:57 2019 New Revision: 351640 URL: https://svnweb.freebsd.org/changeset/base/351640 Log: MFC r351453: Make stack grow use the same gap as stack create. Modified: stable/11/sys/vm/vm_map.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Sat Aug 31 08:40:41 2019 (r351639) +++ stable/11/sys/vm/vm_map.c Sat Aug 31 08:52:57 2019 (r351640) @@ -3686,8 +3686,20 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); - if (rv != KERN_SUCCESS) + if (rv == KERN_SUCCESS) { + /* + * Gap can never successfully handle a fault, so + * read-ahead logic is never used for it. Re-use + * next_read of the gap entry to store + * stack_guard_page for vm_map_growstack(). + */ + if (orient == MAP_STACK_GROWS_DOWN) + new_entry->prev->next_read = sgp; + else + new_entry->next->next_read = sgp; + } else { (void)vm_map_delete(map, bot, top); + } return (rv); } @@ -3728,7 +3740,6 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma MPASS(!map->system_map); - guard = stack_guard_page * PAGE_SIZE; lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); stacklim = lim_cur(curthread, RLIMIT_STACK); vmemlim = lim_cur(curthread, RLIMIT_VMEM); @@ -3755,6 +3766,7 @@ retry: } else { return (KERN_FAILURE); } + guard = gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); From owner-svn-src-all@freebsd.org Sat Aug 31 13:13:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C497D1DCF; Sat, 31 Aug 2019 13:13:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LGxx11FKz4Tfx; Sat, 31 Aug 2019 13:13:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07A6219670; Sat, 31 Aug 2019 13:13: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 x7VDDecA093322; Sat, 31 Aug 2019 13:13:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VDDebb093321; Sat, 31 Aug 2019 13:13:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201908311313.x7VDDebb093321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 31 Aug 2019 13:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351641 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 351641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 13:13:41 -0000 Author: tuexen Date: Sat Aug 31 13:13:40 2019 New Revision: 351641 URL: https://svnweb.freebsd.org/changeset/base/351641 Log: Improve function definition. MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 31 08:52:57 2019 (r351640) +++ head/sys/netinet/sctp_pcb.c Sat Aug 31 13:13:40 2019 (r351641) @@ -5771,7 +5771,7 @@ sctp_startup_mcore_threads(void) #endif void -sctp_pcb_init() +sctp_pcb_init(void) { /* * SCTP initialization for the PCB structures should be called by From owner-svn-src-all@freebsd.org Sat Aug 31 13:24:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 190FAD2129; Sat, 31 Aug 2019 13:24:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LHBG70Mhz4V65; Sat, 31 Aug 2019 13:24:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D36A319837; Sat, 31 Aug 2019 13:24:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VDOMnR099487; Sat, 31 Aug 2019 13:24:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VDOM9p099486; Sat, 31 Aug 2019 13:24:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201908311324.x7VDOM9p099486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 31 Aug 2019 13:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351642 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 351642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 13:24:23 -0000 Author: mjg Date: Sat Aug 31 13:24:22 2019 New Revision: 351642 URL: https://svnweb.freebsd.org/changeset/base/351642 Log: zfs: fix snapshot dir destruction after introducion of VOP_NEED_INACTIVE Reported by: lwhsu PR: 240221 Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Aug 31 13:13:40 2019 (r351641) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Aug 31 13:24:22 2019 (r351642) @@ -1247,6 +1247,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) static struct vop_vector zfsctl_ops_snapshot = { .vop_default = NULL, /* ensure very restricted access */ .vop_inactive = zfsctl_snapshot_inactive, + .vop_need_inactive = vop_stdneed_inactive, .vop_reclaim = zfsctl_snapshot_reclaim, .vop_vptocnp = zfsctl_snapshot_vptocnp, .vop_lock1 = vop_stdlock, From owner-svn-src-all@freebsd.org Sat Aug 31 14:41:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C8B3D3923; Sat, 31 Aug 2019 14:41:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LJvq2KnNz4Y3l; Sat, 31 Aug 2019 14:41:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32AB11A553; Sat, 31 Aug 2019 14:41:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VEfxpD045984; Sat, 31 Aug 2019 14:41:59 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VEfwZ3045957; Sat, 31 Aug 2019 14:41:58 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908311441.x7VEfwZ3045957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 31 Aug 2019 14:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation X-SVN-Commit-Revision: 351643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 14:41:59 -0000 Author: lwhsu Date: Sat Aug 31 14:41:58 2019 New Revision: 351643 URL: https://svnweb.freebsd.org/changeset/base/351643 Log: Fix tests use /etc/motd after r350184 by using an always existing file Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 13:24:22 2019 (r351642) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 14:41:58 2019 (r351643) @@ -43,7 +43,7 @@ reader() while true do sleep 0.1 - cat /etc/motd > /dev/null + cat /COPYRIGHT > /dev/null done } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 13:24:22 2019 (r351642) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 14:41:58 2019 (r351643) @@ -44,7 +44,7 @@ reader() while true do sleep 0.1 - cat /etc/motd > /dev/null + cat /COPYRIGHT > /dev/null done } Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 13:24:22 2019 (r351642) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 14:41:58 2019 (r351643) @@ -26,5 +26,5 @@ while true do sleep 0.1 - cat /etc/motd > /dev/null + cat /COPYRIGHT > /dev/null done From owner-svn-src-all@freebsd.org Sat Aug 31 15:10:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04706D44C6; Sat, 31 Aug 2019 15:10:28 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LKXg6K0zz4Zjt; Sat, 31 Aug 2019 15:10:27 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0B81AA41; Sat, 31 Aug 2019 15:10:27 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VFARSV059852; Sat, 31 Aug 2019 15:10:27 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VFARwa059851; Sat, 31 Aug 2019 15:10:27 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908311510.x7VFARwa059851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 31 Aug 2019 15:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351644 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Commit-Revision: 351644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 15:10:28 -0000 Author: lwhsu Date: Sat Aug 31 15:10:27 2019 New Revision: 351644 URL: https://svnweb.freebsd.org/changeset/base/351644 Log: Fix dtrace test case after r351423 due to ping6(8) options changed Failure test case: cddl.usr.sbin.dtrace.common.ip.t_dtrace_contrib.tst_ipv6localicmp_ksh Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh Sat Aug 31 14:41:58 2019 (r351643) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh Sat Aug 31 15:10:27 2019 (r351644) @@ -55,7 +55,7 @@ else removeinet6=0 fi -$dtrace -c "/sbin/ping6 -q -c 1 -X 3 $local" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && From owner-svn-src-all@freebsd.org Sat Aug 31 16:14:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97E47D5AC8; Sat, 31 Aug 2019 16:14:27 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46LLyW0k9Kz4dbK; Sat, 31 Aug 2019 16:14:26 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x7VGEHwO000362; Sat, 31 Aug 2019 09:14:17 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x7VGEHFl000361; Sat, 31 Aug 2019 09:14:17 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201908311614.x7VGEHFl000361@gndrsh.dnsmgr.net> Subject: Re: svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation In-Reply-To: <201908311441.x7VEfwZ3045957@repo.freebsd.org> To: Li-Wen Hsu Date: Sat, 31 Aug 2019 09:14:17 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 46LLyW0k9Kz4dbK X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.940,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 16:14:27 -0000 > Author: lwhsu > Date: Sat Aug 31 14:41:58 2019 > New Revision: 351643 > URL: https://svnweb.freebsd.org/changeset/base/351643 > > Log: > Fix tests use /etc/motd after r350184 by using an always existing file If the tests is dependent on "always existing" shouldnt the test insure that itself by actually creating the file? > Sponsored by: The FreeBSD Foundation > > Modified: > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 14:41:58 2019 (r351643) > @@ -43,7 +43,7 @@ reader() > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > } > > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 14:41:58 2019 (r351643) > @@ -44,7 +44,7 @@ reader() > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > } > > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 14:41:58 2019 (r351643) > @@ -26,5 +26,5 @@ > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Aug 31 20:45:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C081DDB9A0; Sat, 31 Aug 2019 20:45:46 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LSzZ4QJDz3NZb; Sat, 31 Aug 2019 20:45:46 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BCFF1E828; Sat, 31 Aug 2019 20:45:46 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VKjkVQ062518; Sat, 31 Aug 2019 20:45:46 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VKjk4c062516; Sat, 31 Aug 2019 20:45:46 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201908312045.x7VKjk4c062516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 31 Aug 2019 20:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351648 - in head/lib: libc/tests/stdlib msun/tests X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/lib: libc/tests/stdlib msun/tests X-SVN-Commit-Revision: 351648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 20:45:46 -0000 Author: lwhsu Date: Sat Aug 31 20:45:45 2019 New Revision: 351648 URL: https://svnweb.freebsd.org/changeset/base/351648 Log: Unskip test cases from netbsd-tests by defining __HAVE_FENV This unskips: - lib.libc.stdlib.strtod_test.strtod_round - lib.msun.fe_round_test.t_nofe_round In lib/msun/tests/Makefile only define on fe_round_test.c because lib.msun.ilogb_test.ilogb will get wrong results and needs more examination. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/tests/stdlib/Makefile head/lib/msun/tests/Makefile Modified: head/lib/libc/tests/stdlib/Makefile ============================================================================== --- head/lib/libc/tests/stdlib/Makefile Sat Aug 31 18:04:33 2019 (r351647) +++ head/lib/libc/tests/stdlib/Makefile Sat Aug 31 20:45:45 2019 (r351648) @@ -14,6 +14,9 @@ ATF_TESTS_CXX+= cxa_thread_atexit_test ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test .endif +# All architectures on FreeBSD have fenv.h +CFLAGS+= -D__HAVE_FENV + # Not sure why this isn't defined for all architectures, since most # have long double. .if ${MACHINE_CPUARCH} == "aarch64" || \ Modified: head/lib/msun/tests/Makefile ============================================================================== --- head/lib/msun/tests/Makefile Sat Aug 31 18:04:33 2019 (r351647) +++ head/lib/msun/tests/Makefile Sat Aug 31 20:45:45 2019 (r351648) @@ -99,6 +99,8 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH} # precision is. CFLAGS+= -DLDBL_PREC=${LDBL_PREC} +CFLAGS.fe_round_test+= -D__HAVE_FENV + .include .include From owner-svn-src-all@freebsd.org Sat Aug 31 21:28:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FEDDDC894; Sat, 31 Aug 2019 21:28:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LTwR2Nwvz3QRl; Sat, 31 Aug 2019 21:28:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 353E31EF7E; Sat, 31 Aug 2019 21:28:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VLS7iQ086675; Sat, 31 Aug 2019 21:28:07 GMT (envelope-from ray@FreeBSD.org) Received: (from ray@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VLS73b086674; Sat, 31 Aug 2019 21:28:07 GMT (envelope-from ray@FreeBSD.org) Message-Id: <201908312128.x7VLS73b086674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ray set sender to ray@FreeBSD.org using -f From: Aleksandr Rybalko Date: Sat, 31 Aug 2019 21:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351649 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: ray X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 351649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 21:28:07 -0000 Author: ray Date: Sat Aug 31 21:28:06 2019 New Revision: 351649 URL: https://svnweb.freebsd.org/changeset/base/351649 Log: ARM kernel can get RAM regions three ways: o from FDT; o from EFI; o from Linux Boot API (ATAG). U-Boot may pass RAM info all that 3 ways simultaneously. We do select between FDT and EFI, but not for ATAG. So this is not problem fix, but correctness check. MFC after: 2 weeks Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sat Aug 31 20:45:45 2019 (r351648) +++ head/sys/arm/arm/physmem.c Sat Aug 31 21:28:06 2019 (r351649) @@ -264,6 +264,8 @@ insert_region(struct region *regions, size_t rcnt, vm_ ep = regions + rcnt; for (i = 0, rp = regions; i < rcnt; ++i, ++rp) { + if (rp->addr == addr && rp->size == size) /* Pure dup. */ + return (rcnt); if (flags == rp->flags) { if (addr + size == rp->addr) { rp->addr = addr; From owner-svn-src-all@freebsd.org Sat Aug 31 23:28:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB368E24D0; Sat, 31 Aug 2019 23:28:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LXbm51nnz4PFs; Sat, 31 Aug 2019 23:28:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f47.google.com with SMTP id d25so19418314iob.6; Sat, 31 Aug 2019 16:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=EEcKzJO7KoEbW0gO6ktFs132/4F638h7Tq9/24XE8bM=; b=UGaJ6GUmfKOaK0WXSdVZPzpFLvlITFyq+1ByA0nssxHfLBWMzz0eZq6PDq9500Wl4F k4VrwvCeiJCiAa6LSXkXlLW3KhtWRUH46kqB2gkOeTG+W4rR+p2U+jZFEXgRARF/bN02 VfYd3UBTDPuhoVfaIg8HCSUfhYUwoB+SpTykZTZjXkSLZwEQCz4VapCmB137+DdDlvuD cWyMZhKS3B+G3ZCAYygTtmJIVGzXoPN9cGUQwKMSQMG04dexdj3IHo04iJYtyJQKPZB5 7zC48NJV6Va0AIuI2Kj6hPW9cT5oU0TnX0IAsYgszg6UFw79TqzposBhcTUhsfYknYpG jfdw== X-Gm-Message-State: APjAAAXJANjeY5IPj69uh1fvqOLPnDEH7r72YNJOLtSyFjxGkS2O/2Jk ioUBb3yulWuXfx0GzL1RpmIEWBvC X-Google-Smtp-Source: APXvYqypZ438RghmTOyLRSqwqyLPcg8961/CqNzhmm74nBKZLVlYnWtoSD0YCFGFNxVVzQBhtR1ERQ== X-Received: by 2002:a6b:f717:: with SMTP id k23mr13188198iog.210.1567294131400; Sat, 31 Aug 2019 16:28:51 -0700 (PDT) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com. [209.85.166.42]) by smtp.gmail.com with ESMTPSA id r2sm7337963ioh.61.2019.08.31.16.28.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 31 Aug 2019 16:28:50 -0700 (PDT) Received: by mail-io1-f42.google.com with SMTP id f12so4430518iog.12; Sat, 31 Aug 2019 16:28:50 -0700 (PDT) X-Received: by 2002:a5e:a80f:: with SMTP id c15mr8992974ioa.270.1567294130667; Sat, 31 Aug 2019 16:28:50 -0700 (PDT) MIME-Version: 1.0 References: <201908311441.x7VEfwZ3045957@repo.freebsd.org> In-Reply-To: <201908311441.x7VEfwZ3045957@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 31 Aug 2019 16:28:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation To: Li-Wen Hsu Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46LXbm51nnz4PFs X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2019 23:28:52 -0000 Thanks Li-Wen! Might it be less fragile to have the test fixture create a file, if the test(s) will expect one to be present to read? On Sat, Aug 31, 2019 at 7:42 AM Li-Wen Hsu wrote: > > Author: lwhsu > Date: Sat Aug 31 14:41:58 2019 > New Revision: 351643 > URL: https://svnweb.freebsd.org/changeset/base/351643 > > Log: > Fix tests use /etc/motd after r350184 by using an always existing file > > Sponsored by: The FreeBSD Foundation > > Modified: > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh Sat Aug 31 14:41:58 2019 (r351643) > @@ -43,7 +43,7 @@ reader() > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > } > > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh Sat Aug 31 14:41:58 2019 (r351643) > @@ -44,7 +44,7 @@ reader() > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > } > > > Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 13:24:22 2019 (r351642) > +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe Sat Aug 31 14:41:58 2019 (r351643) > @@ -26,5 +26,5 @@ > while true > do > sleep 0.1 > - cat /etc/motd > /dev/null > + cat /COPYRIGHT > /dev/null > done > From owner-svn-src-all@freebsd.org Sat Aug 31 23:30:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E45AE26ED for ; Sat, 31 Aug 2019 23:30:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LXdB5Qqnz4PyT for ; Sat, 31 Aug 2019 23:30:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82c.google.com with SMTP id a13so11844999qtj.1 for ; Sat, 31 Aug 2019 16:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3QinbwSc7vA1ZhxJ87RviyLt6uLNXfmmtrDJtyP0Ff4=; b=BvB3AplxTY79/3sTKwewvIhmJYXLkmmF7XcUrHoDoBMsNzqgK11BDzBwEB7SYnEV3G wUsmuxztpjmMBbxtx+s24dMnzTiTeDSHuC1PLilwsJnmYTv0csYp/rvVIBssyMEqTEyM J2MdLpl+KDhjJgyBmK8qL5SBWJFaGpH+Vt8pXH7Yg7Ti3ZpVUUxn6E58VNXC5Xe/0T2O d+Bhu4LOXEfFoxJvuacpyFExKLCXK1p3GICD3L9xNvkypTrBo7QUxnQvU066Nh0XrREa khwGt8xMKM9UXkXYKD7fuCFglI6laWnTq5cZdvCw86KsBPntKx0vuGaVJg1AxKrxczpU QbOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3QinbwSc7vA1ZhxJ87RviyLt6uLNXfmmtrDJtyP0Ff4=; b=NfEzb8RlnhLvX8rCZznb7B7ZezOfuecgflOK5mHWhN3BBKSaXjOVAauier8MqiyJkA V2+AjcetFvpAplzNpemj24SFibZECE1saF++jQFhWRuMeYEPiVVtTcbUXO/lOhmkw7wA zasMbp93T1o8MUK0E5Q50NuK5Od0kH9QjZCKPO8FiMtEY7bxdjnfzk6/KpC7Gq39toQb +RKnKlPx41BlLdNmI58/dGg508YKf1OUA++rDUgaZwwHrB8ZdbxTbK+WpTxGVrSX00pY xA8FbKb2K4GuouVi5dn1obyue8oGe1ontCUIRu0E5lS9ZHAbp0oLe6oQ0CvCjqUct6Nz DqxQ== X-Gm-Message-State: APjAAAWg6GNCMXOxjR2+4FkK2bmT0PodNMbhQOtdJl92uIYqq4bFXJIK 0+zyme4p+xeQWgzqFe0ldVwHPceFjLFsPt7jG04i8EptKAY= X-Google-Smtp-Source: APXvYqz38Dq7XzWBsIouQkP3W3XrGvHLSGVhTFaZ5kH3ufPE/JStT3yqB2bq9BwDjTzxZ2cjIlBLRMfVuBMgEZukSyE= X-Received: by 2002:ac8:3364:: with SMTP id u33mr4352147qta.187.1567294205397; Sat, 31 Aug 2019 16:30:05 -0700 (PDT) MIME-Version: 1.0 References: <201908311441.x7VEfwZ3045957@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Aug 2019 17:29:54 -0600 Message-ID: Subject: Re: svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation To: "Conrad E. Meyer" Cc: Li-Wen Hsu , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46LXdB5Qqnz4PyT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=BvB3Aplx; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.89 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; RCVD_IN_DNSWL_NONE(0.00)[c.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.89)[ip: (-9.27), ipnet: 2607:f8b0::/32(-2.83), asn: 15169(-2.31), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Aug 2019 23:30:08 -0000 On Sat, Aug 31, 2019 at 5:29 PM Conrad Meyer wrote: > Thanks Li-Wen! Might it be less fragile to have the test fixture > create a file, if the test(s) will expect one to be present to read? > Or just use the realpath $0, which you know has to exist :) Warner > On Sat, Aug 31, 2019 at 7:42 AM Li-Wen Hsu wrote: > > > > Author: lwhsu > > Date: Sat Aug 31 14:41:58 2019 > > New Revision: 351643 > > URL: https://svnweb.freebsd.org/changeset/base/351643 > > > > Log: > > Fix tests use /etc/motd after r350184 by using an always existing file > > > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > > > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > > > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > > > > Modified: > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > > > ============================================================================== > > --- > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > Sat Aug 31 13:24:22 2019 (r351642) > > +++ > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh > Sat Aug 31 14:41:58 2019 (r351643) > > @@ -43,7 +43,7 @@ reader() > > while true > > do > > sleep 0.1 > > - cat /etc/motd > /dev/null > > + cat /COPYRIGHT > /dev/null > > done > > } > > > > > > Modified: > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > > > ============================================================================== > > --- > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > Sat Aug 31 13:24:22 2019 (r351642) > > +++ > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh > Sat Aug 31 14:41:58 2019 (r351643) > > @@ -44,7 +44,7 @@ reader() > > while true > > do > > sleep 0.1 > > - cat /etc/motd > /dev/null > > + cat /COPYRIGHT > /dev/null > > done > > } > > > > > > Modified: > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > > > ============================================================================== > > --- > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > Sat Aug 31 13:24:22 2019 (r351642) > > +++ > head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe > Sat Aug 31 14:41:58 2019 (r351643) > > @@ -26,5 +26,5 @@ > > while true > > do > > sleep 0.1 > > - cat /etc/motd > /dev/null > > + cat /COPYRIGHT > /dev/null > > done > > > >