From owner-svn-src-all@freebsd.org Sun Sep 15 01:02: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 2E497D4FD8; Sun, 15 Sep 2019 01:02:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WB0p0XNCz3CGY; Sun, 15 Sep 2019 01:02:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAFBF3AC; Sun, 15 Sep 2019 01:02:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F121Pj052528; Sun, 15 Sep 2019 01:02:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F121j0052527; Sun, 15 Sep 2019 01:02:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201909150102.x8F121j0052527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 15 Sep 2019 01:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352342 - head/sys/arm/ti X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti X-SVN-Commit-Revision: 352342 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 01:02:02 -0000 Author: ian Date: Sun Sep 15 01:02:01 2019 New Revision: 352342 URL: https://svnweb.freebsd.org/changeset/base/352342 Log: Make the ti_sysc device quiet. It's an internal utility pseudo-device that makes the upstream FDT data work right, so we don't need to see a couple dozen instances of it spam the dmesg at boot time unless it's a verbose boot. Modified: head/sys/arm/ti/ti_sysc.c Modified: head/sys/arm/ti/ti_sysc.c ============================================================================== --- head/sys/arm/ti/ti_sysc.c Sat Sep 14 21:49:42 2019 (r352341) +++ head/sys/arm/ti/ti_sysc.c Sun Sep 15 01:02:01 2019 (r352342) @@ -71,6 +71,9 @@ ti_sysc_probe(device_t dev) return (ENXIO); device_set_desc(dev, "TI SYSC Interconnect"); + if (!bootverbose) + device_quiet(dev); + return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Sun Sep 15 02:36: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 03C55DAF9F; Sun, 15 Sep 2019 02:36:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WD6C67vcz3KHR; Sun, 15 Sep 2019 02:36:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5FE715FB; Sun, 15 Sep 2019 02:36:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2apxM006453; Sun, 15 Sep 2019 02:36:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2apXf006450; Sun, 15 Sep 2019 02:36:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150236.x8F2apXf006450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352344 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 352344 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:36:52 -0000 Author: kevans Date: Sun Sep 15 02:36:50 2019 New Revision: 352344 URL: https://svnweb.freebsd.org/changeset/base/352344 Log: MFC r351813, r352092: bectl(8) list sorting MFC r351813: bectl(8): implement sorting for 'bectl list' output Allow 'bectl list' to sort output by a given property name. The property name is passed in using a command-line flag, '-c' for ascending order and '-C' for descending order. The properties allowed to sort by are: - name (the default output, even if '-c' or '-C' are not used) - creation - origin - used - usedds - usedsnap - usedrefreserv The default output for 'bectl list' is now ascending alphabetical order of BE name. To sort by creation time from earliest to latest, the command would be 'bectl list -c creation' MFC r352092: bectl(8): initialize reverse earlier This turns into a warning in GCC 4.2 that 'reverse' may be used uninitialized in this function. While I don't immediately see where it's deciding this from (there's only two paths that make column != NULL, and they both set reverse), initializing reverse earlier is good for clarity. Modified: stable/12/sbin/bectl/bectl.8 stable/12/sbin/bectl/bectl.c stable/12/sbin/bectl/bectl_list.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Sun Sep 15 02:17:30 2019 (r352343) +++ stable/12/sbin/bectl/bectl.8 Sun Sep 15 02:36:50 2019 (r352344) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2019 +.Dd September 14, 2019 .Dt BECTL 8 .Os .Sh NAME @@ -57,6 +57,9 @@ .Nm .Cm list .Op Fl aDHs +.Op Fl c Ar property +.Op Fl C Ar property +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Nm .Cm mount .Ar beName @@ -234,7 +237,12 @@ generated by .El .Pp All default parameters may be overwritten. -.It Cm list Op Fl aDHs +.It Xo +.Cm list +.Op Fl DHas +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc +.Xc +.Pp Display all boot environments. The .Em Active @@ -245,21 +253,44 @@ active on reboot or both .Pq Em \&NR . .Pp -If -.Fl a -is used, display all datasets. -If -.Fl D -is used, display the full space usage for each boot environment, assuming all +.Bl -tag -width indent +.It Fl a +Display all datasets. +.It Fl D +Display the full space usage for each boot environment, assuming all other boot environments were destroyed. -The -.Fl H -option is used for scripting. -It does not print headers and separate fields by a single tab instead of +.It Fl H +Used for scripting. +Do not print headers and separate fields by a single tab instead of arbitrary white space. -If +.It Fl s +Display all snapshots as well. +.It Fl c Ar property +Sort boot environments by given property name. +The following properties are supported: +.Pp +.Bl -tag -width 4n -offset indent -compact +.It name (default output) +.It creation +.It origin +.It used +.It usedds +.It usedsnap +.It usedrefreserv +.El +.It Fl C Ar property +Same as the +.Fl c +option, but displays in descending order. +.El +.Pp +The +.Fl D +option is ignored when either the .Fl s -is used, display all snapshots as well. +or +.Fl a +option is used. .It Cm mount Ar beName Op Ar mountpoint Temporarily mount the boot environment. Mount at the specified Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Sun Sep 15 02:17:30 2019 (r352343) +++ stable/12/sbin/bectl/bectl.c Sun Sep 15 02:36:50 2019 (r352344) @@ -80,7 +80,7 @@ usage(bool explicit) "\tbectl jail {-b | -U} [{-o key=value | -u key}]... " "{jailID | jailName}\n" "\t bootenv [utility [argument ...]]\n" - "\tbectl list [-DHas]\n" + "\tbectl list [-DHas] [{-c property | -C property}]\n" "\tbectl mount beName [mountpoint]\n" "\tbectl rename origBeName newBeName\n" "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n" Modified: stable/12/sbin/bectl/bectl_list.c ============================================================================== --- stable/12/sbin/bectl/bectl_list.c Sun Sep 15 02:17:30 2019 (r352343) +++ stable/12/sbin/bectl/bectl_list.c Sun Sep 15 02:36:50 2019 (r352344) @@ -38,6 +38,12 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" +struct sort_column { + char *name; + char *val; + nvlist_t *nvl; +}; + struct printc { int active_colsz_def; int be_colsz; @@ -324,6 +330,74 @@ print_headers(nvlist_t *props, struct printc *pc) printf("\n"); } +/* + * Sort the given nvlist of boot environments by property. + */ +static int +prop_list_sort(nvlist_t *props, char *property, bool reverse) +{ + nvpair_t *nvp; + nvlist_t *nvl; + int i, nvp_count; + uint64_t lval, rval; + struct sort_column sc_prev, sc_next; + + /* a temporary list to work with */ + nvlist_dup(props, &nvl, 0); + + nvp_count = fnvlist_num_pairs(nvl); + for (i = 0; i < nvp_count; i++) { + + nvp = nvlist_next_nvpair(nvl, NULL); + nvpair_value_nvlist(nvp, &sc_prev.nvl); + nvlist_lookup_string(sc_prev.nvl, "name", &sc_prev.name); + nvlist_lookup_string(sc_prev.nvl, property, &sc_prev.val); + + while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { + + nvpair_value_nvlist(nvp, &sc_next.nvl); + nvlist_lookup_string(sc_next.nvl, "name", &sc_next.name); + nvlist_lookup_string(sc_next.nvl, property, &sc_next.val); + + /* properties that use numerical comparison */ + if (strcmp(property, "creation") == 0 || + strcmp(property, "used") == 0 || + strcmp(property, "usedds") == 0 || + strcmp(property, "usedsnap") == 0 || + strcmp(property, "usedrefreserv") == 0) { + + lval = strtoull(sc_prev.val, NULL, 10); + rval = strtoull(sc_next.val, NULL, 10); + + if ((lval < rval && reverse) || + (lval > rval && !reverse)) + sc_prev = sc_next; + } + + /* properties that use string comparison */ + else if (strcmp(property, "name") == 0 || + strcmp(property, "origin") == 0) { + if ((strcmp(sc_prev.val, sc_next.val) < 0 && reverse) || + (strcmp(sc_prev.val, sc_next.val) > 0 && !reverse)) + sc_prev = sc_next; + } + } + + /* + * The 'props' nvlist has been created to only have unique names. + * When a name is added, any existing nvlist's with the same name + * will be removed. Eventually, all existing nvlist's are replaced + * in sorted order. + */ + nvlist_add_nvlist(props, sc_prev.name, sc_prev.nvl); + nvlist_remove_all(nvl, sc_prev.name); + } + + be_prop_list_free(nvl); + + return 0; +} + int bectl_cmd_list(int argc, char *argv[]) { @@ -331,12 +405,15 @@ bectl_cmd_list(int argc, char *argv[]) nvpair_t *cur; nvlist_t *dsprops, *props; int opt, printed; - boolean_t active_now, active_reboot; + char *column; + bool reverse; + column = NULL; props = NULL; printed = 0; bzero(&pc, sizeof(pc)); - while ((opt = getopt(argc, argv, "aDHs")) != -1) { + reverse = false; + while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) { switch (opt) { case 'a': pc.show_all_datasets = true; @@ -350,6 +427,18 @@ bectl_cmd_list(int argc, char *argv[]) case 's': pc.show_snaps = true; break; + case 'c': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = false; + break; + case 'C': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = true; + break; default: fprintf(stderr, "bectl list: unknown option '-%c'\n", optopt); @@ -374,44 +463,31 @@ bectl_cmd_list(int argc, char *argv[]) return (1); } + /* List boot environments in alphabetical order by default */ + if (column == NULL) + column = strdup("name"); + + prop_list_sort(props, column, reverse); + /* Force -D off if either -a or -s are specified */ if (pc.show_all_datasets || pc.show_snaps) pc.show_space = false; if (!pc.script_fmt) print_headers(props, &pc); - /* Do a first pass to print active and next active first */ - for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; - cur = nvlist_next_nvpair(props, cur)) { - nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (!active_now && !active_reboot) - continue; - if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) - printf("\n"); - print_info(nvpair_name(cur), dsprops, &pc); - printed++; - } - - /* Now pull everything else */ + /* Print boot environments */ for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; cur = nvlist_next_nvpair(props, cur)) { nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (active_now || active_reboot) - continue; if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) printf("\n"); + print_info(nvpair_name(cur), dsprops, &pc); printed++; } + + free(column); be_prop_list_free(props); return (0); From owner-svn-src-all@freebsd.org Sun Sep 15 02:37: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 314BDDB075; Sun, 15 Sep 2019 02:37:29 +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 46WD6x0Hbkz3KQ4; Sun, 15 Sep 2019 02:37:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E227A15FF; Sun, 15 Sep 2019 02:37:28 +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 x8F2bSWM006538; Sun, 15 Sep 2019 02:37:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2bSpK006537; Sun, 15 Sep 2019 02:37:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150237.x8F2bSpK006537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:37: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: r352345 - stable/11/sbin/bectl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sbin/bectl X-SVN-Commit-Revision: 352345 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:37:29 -0000 Author: kevans Date: Sun Sep 15 02:37:28 2019 New Revision: 352345 URL: https://svnweb.freebsd.org/changeset/base/352345 Log: MFC r352092: bectl(8): initialize reverse earlier This turns into a warning in GCC 4.2 that 'reverse' may be used uninitialized in this function. While I don't immediately see where it's deciding this from (there's only two paths that make column != NULL, and they both set reverse), initializing reverse earlier is good for clarity. Modified: stable/11/sbin/bectl/bectl_list.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/bectl/bectl_list.c ============================================================================== --- stable/11/sbin/bectl/bectl_list.c Sun Sep 15 02:36:50 2019 (r352344) +++ stable/11/sbin/bectl/bectl_list.c Sun Sep 15 02:37:28 2019 (r352345) @@ -412,6 +412,7 @@ bectl_cmd_list(int argc, char *argv[]) props = NULL; printed = 0; bzero(&pc, sizeof(pc)); + reverse = false; while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) { switch (opt) { case 'a': @@ -463,10 +464,8 @@ bectl_cmd_list(int argc, char *argv[]) } /* List boot environments in alphabetical order by default */ - if (column == NULL) { + if (column == NULL) column = strdup("name"); - reverse = false; - } prop_list_sort(props, column, reverse); From owner-svn-src-all@freebsd.org Sun Sep 15 02:41: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 CBFFEDB394; Sun, 15 Sep 2019 02:41:13 +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 46WDCF56Jqz3Kk7; Sun, 15 Sep 2019 02:41:13 +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 930141650; Sun, 15 Sep 2019 02:41:13 +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 x8F2fDOv009067; Sun, 15 Sep 2019 02:41:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2fDY4009066; Sun, 15 Sep 2019 02:41:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150241.x8F2fDY4009066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:41:13 +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: r352346 - in stable: 11 11/sys/arm64/conf 12 12/sys/arm64/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 11/sys/arm64/conf 12 12/sys/arm64/conf X-SVN-Commit-Revision: 352346 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:41:13 -0000 Author: kevans Date: Sun Sep 15 02:41:13 2019 New Revision: 352346 URL: https://svnweb.freebsd.org/changeset/base/352346 Log: MFC r352172-r352173: Ignore LINT* in sys/arm64/conf [Note that neither of these branches have NOTES yet, but this doesn't hurt] r352172: Ignore LINT kernconf on arm64 r352173: ... it was so easy, and I goofed it up. Correct dir Modified: Directory Properties: stable/11/ (props changed) stable/11/sys/arm64/conf/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/12/ (props changed) stable/12/sys/arm64/conf/ (props changed) From owner-svn-src-all@freebsd.org Sun Sep 15 02:41: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 2D41DDB39A; Sun, 15 Sep 2019 02:41:14 +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 46WDCG0RwYz3KkB; Sun, 15 Sep 2019 02:41:14 +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 E81FC1653; Sun, 15 Sep 2019 02:41:13 +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 x8F2fDah009072; Sun, 15 Sep 2019 02:41:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2fDI8009071; Sun, 15 Sep 2019 02:41:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150241.x8F2fDI8009071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:41:13 +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: r352346 - in stable: 11 11/sys/arm64/conf 12 12/sys/arm64/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 11/sys/arm64/conf 12 12/sys/arm64/conf X-SVN-Commit-Revision: 352346 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:41:14 -0000 Author: kevans Date: Sun Sep 15 02:41:13 2019 New Revision: 352346 URL: https://svnweb.freebsd.org/changeset/base/352346 Log: MFC r352172-r352173: Ignore LINT* in sys/arm64/conf [Note that neither of these branches have NOTES yet, but this doesn't hurt] r352172: Ignore LINT kernconf on arm64 r352173: ... it was so easy, and I goofed it up. Correct dir Modified: Directory Properties: stable/12/ (props changed) stable/12/sys/arm64/conf/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/11/ (props changed) stable/11/sys/arm64/conf/ (props changed) From owner-svn-src-all@freebsd.org Sun Sep 15 02:44: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 DB5FEDB7B1; Sun, 15 Sep 2019 02:44:29 +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 46WDH15WRnz3LCg; Sun, 15 Sep 2019 02:44:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1F3517EF; Sun, 15 Sep 2019 02:44:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2iT4f012268; Sun, 15 Sep 2019 02:44:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2iTVj012267; Sun, 15 Sep 2019 02:44:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150244.x8F2iTVj012267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:44: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: r352347 - in stable: 11 12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 12 X-SVN-Commit-Revision: 352347 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:44:29 -0000 Author: kevans Date: Sun Sep 15 02:44:28 2019 New Revision: 352347 URL: https://svnweb.freebsd.org/changeset/base/352347 Log: MFC r351799, r351816: NOP; these two revert each other r351799: LOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work Currently LOCAL_MODULES= works, but LOCAL_MODULES="" causes build errors as .for still has the empty string to loop over. An .if empty prior to the loop was considered, but LOCAL_MODULES has empty quotes at that point and thus, isn't empty. A better solution likely exists, but this floats us by for now... r351816: Back out r351799 empty does not appear to work like I thought it did and it actively breaks real LOCAL_MODULES usage, of which I have none at the moment... Modified: Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Sun Sep 15 02:44: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 A33A0DB7AC; Sun, 15 Sep 2019 02:44:29 +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 46WDH13q16z3LCf; Sun, 15 Sep 2019 02:44:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 666FD17EE; Sun, 15 Sep 2019 02:44:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2iTa1012263; Sun, 15 Sep 2019 02:44:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2iTbP012262; Sun, 15 Sep 2019 02:44:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150244.x8F2iTbP012262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:44:29 +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: r352347 - in stable: 11 12 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 12 X-SVN-Commit-Revision: 352347 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:44:29 -0000 Author: kevans Date: Sun Sep 15 02:44:28 2019 New Revision: 352347 URL: https://svnweb.freebsd.org/changeset/base/352347 Log: MFC r351799, r351816: NOP; these two revert each other r351799: LOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work Currently LOCAL_MODULES= works, but LOCAL_MODULES="" causes build errors as .for still has the empty string to loop over. An .if empty prior to the loop was considered, but LOCAL_MODULES has empty quotes at that point and thus, isn't empty. A better solution likely exists, but this floats us by for now... r351816: Back out r351799 empty does not appear to work like I thought it did and it actively breaks real LOCAL_MODULES usage, of which I have none at the moment... Modified: Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Sun Sep 15 02:46: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 2183FDB9A4; Sun, 15 Sep 2019 02:46:42 +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 46WDKZ03tvz3LVr; Sun, 15 Sep 2019 02:46:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3B417FA; Sun, 15 Sep 2019 02:46:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2kfGi012613; Sun, 15 Sep 2019 02:46:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2kfVW012610; Sun, 15 Sep 2019 02:46:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150246.x8F2kfVW012610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:46: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: r352348 - in stable: 11/sbin/bectl 12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/bectl 12/sbin/bectl X-SVN-Commit-Revision: 352348 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:46:42 -0000 Author: kevans Date: Sun Sep 15 02:46:40 2019 New Revision: 352348 URL: https://svnweb.freebsd.org/changeset/base/352348 Log: MFC r352211: bectl(8): Add a "check" command This command simply returns 0 at the moment and explicitly takes no arguments. This should be used by utilities wanting to see if bectl can operate on the system they're running, or with a specific root (`bectl -r`). It may grow more checks than "will libbe successfully init" in the future, but for now this is enough as that checks for the dataset mounted at "/" and that it looks capable of being a BE root (e.g. it's not a top-level dataset) bectl commands can now specify if they want to be silent, and this will turn off libbe_print_on_error so they can control the output as needed. This is already used in `bectl check`, and may be turned on in the future for some other commands where libbe errors are better suppressed as the failure mode may be obvious. Modified: stable/12/sbin/bectl/bectl.8 stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sbin/bectl/bectl.8 stable/11/sbin/bectl/bectl.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Sun Sep 15 02:44:28 2019 (r352347) +++ stable/12/sbin/bectl/bectl.8 Sun Sep 15 02:46:40 2019 (r352348) @@ -30,6 +30,8 @@ .Op Fl t .Ar beName .Nm +.Cm check +.Nm .Cm create .Op Fl r .Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot @@ -103,6 +105,15 @@ as the default boot filesystem. If the .Op Fl t flag is given, this takes effect only for the next boot. +.It Xo +.Cm check +.Xc +Performs a silent sanity check on the current system. +If boot environments are supported and used, +.Nm +will exit with a status code of 0. +Any other status code is not currently defined and may, in the future, grow +special meaning for different degrees of sanity check failures. .It Xo .Cm create .Op Fl r Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Sun Sep 15 02:44:28 2019 (r352347) +++ stable/12/sbin/bectl/bectl.c Sun Sep 15 02:46:40 2019 (r352348) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" static int bectl_cmd_activate(int argc, char *argv[]); +static int bectl_cmd_check(int argc, char *argv[]); static int bectl_cmd_create(int argc, char *argv[]); static int bectl_cmd_destroy(int argc, char *argv[]); static int bectl_cmd_export(int argc, char *argv[]); @@ -72,6 +73,7 @@ usage(bool explicit) "\tbectl add (path)*\n" #endif "\tbectl activate [-t] beName\n" + "\tbectl check\n" "\tbectl create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n" "\tbectl create [-r] beName@snapshot\n" "\tbectl destroy [-F] {beName | beName@snapshot}\n" @@ -97,40 +99,40 @@ usage(bool explicit) struct command_map_entry { const char *command; int (*fn)(int argc, char *argv[]); + /* True if libbe_print_on_error should be disabled */ + bool silent; }; static struct command_map_entry command_map[] = { - { "activate", bectl_cmd_activate }, - { "create", bectl_cmd_create }, - { "destroy", bectl_cmd_destroy }, - { "export", bectl_cmd_export }, - { "import", bectl_cmd_import }, + { "activate", bectl_cmd_activate,false }, + { "create", bectl_cmd_create, false }, + { "destroy", bectl_cmd_destroy, false }, + { "export", bectl_cmd_export, false }, + { "import", bectl_cmd_import, false }, #if SOON - { "add", bectl_cmd_add }, + { "add", bectl_cmd_add, false }, #endif - { "jail", bectl_cmd_jail }, - { "list", bectl_cmd_list }, - { "mount", bectl_cmd_mount }, - { "rename", bectl_cmd_rename }, - { "unjail", bectl_cmd_unjail }, - { "unmount", bectl_cmd_unmount }, + { "jail", bectl_cmd_jail, false }, + { "list", bectl_cmd_list, false }, + { "mount", bectl_cmd_mount, false }, + { "rename", bectl_cmd_rename, false }, + { "unjail", bectl_cmd_unjail, false }, + { "unmount", bectl_cmd_unmount, false }, + { "check", bectl_cmd_check, true }, }; -static int -get_cmd_index(const char *cmd, int *idx) +static struct command_map_entry * +get_cmd_info(const char *cmd) { - int map_size; + size_t i; - map_size = nitems(command_map); - for (int i = 0; i < map_size; ++i) { - if (strcmp(cmd, command_map[i].command) == 0) { - *idx = i; - return (0); - } + for (i = 0; i < nitems(command_map); ++i) { + if (strcmp(cmd, command_map[i].command) == 0) + return (&command_map[i]); } - return (1); + return (NULL); } @@ -509,14 +511,28 @@ bectl_cmd_unmount(int argc, char *argv[]) return (err); } +static int +bectl_cmd_check(int argc, char *argv[] __unused) +{ + /* The command is left as argv[0] */ + if (argc != 1) { + fprintf(stderr, "bectl check: wrong number of arguments\n"); + return (usage(false)); + } + + return (0); +} + int main(int argc, char *argv[]) { + struct command_map_entry *cmd; const char *command; char *root; - int command_index, rc; + int rc; + cmd = NULL; root = NULL; if (argc < 2) return (usage(false)); @@ -544,18 +560,17 @@ main(int argc, char *argv[]) if ((strcmp(command, "-?") == 0) || (strcmp(command, "-h") == 0)) return (usage(true)); - if (get_cmd_index(command, &command_index)) { + if ((cmd = get_cmd_info(command)) == NULL) { fprintf(stderr, "unknown command: %s\n", command); return (usage(false)); } - if ((be = libbe_init(root)) == NULL) return (-1); - libbe_print_on_error(be, true); + libbe_print_on_error(be, !cmd->silent); - rc = command_map[command_index].fn(argc, argv); + rc = cmd->fn(argc, argv); libbe_close(be); return (rc); From owner-svn-src-all@freebsd.org Sun Sep 15 02:46: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 7BCC0DB997; Sun, 15 Sep 2019 02:46:41 +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 46WDKY2kTLz3LVg; Sun, 15 Sep 2019 02:46:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4067E17F9; Sun, 15 Sep 2019 02:46:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2kfue012603; Sun, 15 Sep 2019 02:46:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2keZO012601; Sun, 15 Sep 2019 02:46:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150246.x8F2keZO012601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:46:40 +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: r352348 - in stable: 11/sbin/bectl 12/sbin/bectl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/bectl 12/sbin/bectl X-SVN-Commit-Revision: 352348 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:46:41 -0000 Author: kevans Date: Sun Sep 15 02:46:40 2019 New Revision: 352348 URL: https://svnweb.freebsd.org/changeset/base/352348 Log: MFC r352211: bectl(8): Add a "check" command This command simply returns 0 at the moment and explicitly takes no arguments. This should be used by utilities wanting to see if bectl can operate on the system they're running, or with a specific root (`bectl -r`). It may grow more checks than "will libbe successfully init" in the future, but for now this is enough as that checks for the dataset mounted at "/" and that it looks capable of being a BE root (e.g. it's not a top-level dataset) bectl commands can now specify if they want to be silent, and this will turn off libbe_print_on_error so they can control the output as needed. This is already used in `bectl check`, and may be turned on in the future for some other commands where libbe errors are better suppressed as the failure mode may be obvious. Modified: stable/11/sbin/bectl/bectl.8 stable/11/sbin/bectl/bectl.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sbin/bectl/bectl.8 stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sbin/bectl/bectl.8 ============================================================================== --- stable/11/sbin/bectl/bectl.8 Sun Sep 15 02:44:28 2019 (r352347) +++ stable/11/sbin/bectl/bectl.8 Sun Sep 15 02:46:40 2019 (r352348) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 4, 2019 +.Dd September 11, 2019 .Dt BECTL 8 .Os .Sh NAME @@ -30,6 +30,8 @@ .Op Fl t .Ar beName .Nm +.Cm check +.Nm .Cm create .Op Fl r .Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot @@ -103,6 +105,15 @@ as the default boot filesystem. If the .Op Fl t flag is given, this takes effect only for the next boot. +.It Xo +.Cm check +.Xc +Performs a silent sanity check on the current system. +If boot environments are supported and used, +.Nm +will exit with a status code of 0. +Any other status code is not currently defined and may, in the future, grow +special meaning for different degrees of sanity check failures. .It Xo .Cm create .Op Fl r Modified: stable/11/sbin/bectl/bectl.c ============================================================================== --- stable/11/sbin/bectl/bectl.c Sun Sep 15 02:44:28 2019 (r352347) +++ stable/11/sbin/bectl/bectl.c Sun Sep 15 02:46:40 2019 (r352348) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" static int bectl_cmd_activate(int argc, char *argv[]); +static int bectl_cmd_check(int argc, char *argv[]); static int bectl_cmd_create(int argc, char *argv[]); static int bectl_cmd_destroy(int argc, char *argv[]); static int bectl_cmd_export(int argc, char *argv[]); @@ -72,6 +73,7 @@ usage(bool explicit) "\tbectl add (path)*\n" #endif "\tbectl activate [-t] beName\n" + "\tbectl check\n" "\tbectl create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n" "\tbectl create [-r] beName@snapshot\n" "\tbectl destroy [-F] {beName | beName@snapshot}\n" @@ -97,40 +99,40 @@ usage(bool explicit) struct command_map_entry { const char *command; int (*fn)(int argc, char *argv[]); + /* True if libbe_print_on_error should be disabled */ + bool silent; }; static struct command_map_entry command_map[] = { - { "activate", bectl_cmd_activate }, - { "create", bectl_cmd_create }, - { "destroy", bectl_cmd_destroy }, - { "export", bectl_cmd_export }, - { "import", bectl_cmd_import }, + { "activate", bectl_cmd_activate,false }, + { "create", bectl_cmd_create, false }, + { "destroy", bectl_cmd_destroy, false }, + { "export", bectl_cmd_export, false }, + { "import", bectl_cmd_import, false }, #if SOON - { "add", bectl_cmd_add }, + { "add", bectl_cmd_add, false }, #endif - { "jail", bectl_cmd_jail }, - { "list", bectl_cmd_list }, - { "mount", bectl_cmd_mount }, - { "rename", bectl_cmd_rename }, - { "unjail", bectl_cmd_unjail }, - { "unmount", bectl_cmd_unmount }, + { "jail", bectl_cmd_jail, false }, + { "list", bectl_cmd_list, false }, + { "mount", bectl_cmd_mount, false }, + { "rename", bectl_cmd_rename, false }, + { "unjail", bectl_cmd_unjail, false }, + { "unmount", bectl_cmd_unmount, false }, + { "check", bectl_cmd_check, true }, }; -static int -get_cmd_index(const char *cmd, int *idx) +static struct command_map_entry * +get_cmd_info(const char *cmd) { - int map_size; + size_t i; - map_size = nitems(command_map); - for (int i = 0; i < map_size; ++i) { - if (strcmp(cmd, command_map[i].command) == 0) { - *idx = i; - return (0); - } + for (i = 0; i < nitems(command_map); ++i) { + if (strcmp(cmd, command_map[i].command) == 0) + return (&command_map[i]); } - return (1); + return (NULL); } @@ -509,14 +511,28 @@ bectl_cmd_unmount(int argc, char *argv[]) return (err); } +static int +bectl_cmd_check(int argc, char *argv[] __unused) +{ + /* The command is left as argv[0] */ + if (argc != 1) { + fprintf(stderr, "bectl check: wrong number of arguments\n"); + return (usage(false)); + } + + return (0); +} + int main(int argc, char *argv[]) { + struct command_map_entry *cmd; const char *command; char *root; - int command_index, rc; + int rc; + cmd = NULL; root = NULL; if (argc < 2) return (usage(false)); @@ -544,18 +560,17 @@ main(int argc, char *argv[]) if ((strcmp(command, "-?") == 0) || (strcmp(command, "-h") == 0)) return (usage(true)); - if (get_cmd_index(command, &command_index)) { + if ((cmd = get_cmd_info(command)) == NULL) { fprintf(stderr, "unknown command: %s\n", command); return (usage(false)); } - if ((be = libbe_init(root)) == NULL) return (-1); - libbe_print_on_error(be, true); + libbe_print_on_error(be, !cmd->silent); - rc = command_map[command_index].fn(argc, argv); + rc = cmd->fn(argc, argv); libbe_close(be); return (rc); From owner-svn-src-all@freebsd.org Sun Sep 15 02:48: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 73264DBB15; Sun, 15 Sep 2019 02:48:16 +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 46WDMN2RB1z3Lq1; Sun, 15 Sep 2019 02:48:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37A7F1801; Sun, 15 Sep 2019 02:48:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2mGuN012756; Sun, 15 Sep 2019 02:48:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2mFE2012754; Sun, 15 Sep 2019 02:48:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150248.x8F2mFE2012754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:48: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: r352349 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 352349 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:48:16 -0000 Author: kevans Date: Sun Sep 15 02:48:15 2019 New Revision: 352349 URL: https://svnweb.freebsd.org/changeset/base/352349 Log: MFC r352194: lualoader: Revert to ASCII menu frame for serial console The box drawing characters we use aren't necessarily safe with a serial console; for instance, in the report by npn@, these were causing his xterm to send back a sequence that lua picked up as input and halted the boot. This is less than ideal. Fallback to ASCII frames for console with 'comconsole' in it. This is a partial revert r338108 by imp@ -- instead of removing the menu entirely and disabling color/cursor sequences, just reverting the default frame to ASCII is enough to not break in this setup. Modified: stable/11/stand/lua/core.lua stable/11/stand/lua/drawer.lua Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/lua/core.lua stable/12/stand/lua/drawer.lua Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/lua/core.lua ============================================================================== --- stable/11/stand/lua/core.lua Sun Sep 15 02:46:40 2019 (r352348) +++ stable/11/stand/lua/core.lua Sun Sep 15 02:48:15 2019 (r352349) @@ -319,6 +319,16 @@ function core.isZFSBoot() return false end +function core.isSerialConsole() + local c = loader.getenv("console") + if c ~= nil then + if c:find("comconsole") ~= nil then + return true + end + end + return false +end + function core.isSerialBoot() local s = loader.getenv("boot_serial") if s ~= nil then Modified: stable/11/stand/lua/drawer.lua ============================================================================== --- stable/11/stand/lua/drawer.lua Sun Sep 15 02:46:40 2019 (r352348) +++ stable/11/stand/lua/drawer.lua Sun Sep 15 02:48:15 2019 (r352349) @@ -144,13 +144,20 @@ local function drawmenu(menudef) return alias_table end +local function defaultframe() + if core.isSerialConsole() then + return "ascii" + end + return "double" +end + local function drawbox() local x = menu_position.x - 3 local y = menu_position.y - 1 local w = frame_size.w local h = frame_size.h - local framestyle = loader.getenv("loader_menu_frame") or "double" + local framestyle = loader.getenv("loader_menu_frame") or defaultframe() local framespec = drawer.frame_styles[framestyle] -- If we don't have a framespec for the current frame style, just don't -- draw a box. From owner-svn-src-all@freebsd.org Sun Sep 15 02:48: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 F3B1CDBB24; Sun, 15 Sep 2019 02:48:16 +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 46WDMN6CpFz3Lq2; Sun, 15 Sep 2019 02:48:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8EE01802; Sun, 15 Sep 2019 02:48:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F2mGWe012764; Sun, 15 Sep 2019 02:48:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2mGGD012761; Sun, 15 Sep 2019 02:48:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150248.x8F2mGGD012761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:48: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: r352349 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 352349 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:48:17 -0000 Author: kevans Date: Sun Sep 15 02:48:15 2019 New Revision: 352349 URL: https://svnweb.freebsd.org/changeset/base/352349 Log: MFC r352194: lualoader: Revert to ASCII menu frame for serial console The box drawing characters we use aren't necessarily safe with a serial console; for instance, in the report by npn@, these were causing his xterm to send back a sequence that lua picked up as input and halted the boot. This is less than ideal. Fallback to ASCII frames for console with 'comconsole' in it. This is a partial revert r338108 by imp@ -- instead of removing the menu entirely and disabling color/cursor sequences, just reverting the default frame to ASCII is enough to not break in this setup. Modified: stable/12/stand/lua/core.lua stable/12/stand/lua/drawer.lua Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/lua/core.lua stable/11/stand/lua/drawer.lua Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/lua/core.lua ============================================================================== --- stable/12/stand/lua/core.lua Sun Sep 15 02:46:40 2019 (r352348) +++ stable/12/stand/lua/core.lua Sun Sep 15 02:48:15 2019 (r352349) @@ -325,6 +325,16 @@ function core.isZFSBoot() return false end +function core.isSerialConsole() + local c = loader.getenv("console") + if c ~= nil then + if c:find("comconsole") ~= nil then + return true + end + end + return false +end + function core.isSerialBoot() local s = loader.getenv("boot_serial") if s ~= nil then Modified: stable/12/stand/lua/drawer.lua ============================================================================== --- stable/12/stand/lua/drawer.lua Sun Sep 15 02:46:40 2019 (r352348) +++ stable/12/stand/lua/drawer.lua Sun Sep 15 02:48:15 2019 (r352349) @@ -144,13 +144,20 @@ local function drawmenu(menudef) return alias_table end +local function defaultframe() + if core.isSerialConsole() then + return "ascii" + end + return "double" +end + local function drawbox() local x = menu_position.x - 3 local y = menu_position.y - 1 local w = frame_size.w local h = frame_size.h - local framestyle = loader.getenv("loader_menu_frame") or "double" + local framestyle = loader.getenv("loader_menu_frame") or defaultframe() local framespec = drawer.frame_styles[framestyle] -- If we don't have a framespec for the current frame style, just don't -- draw a box. From owner-svn-src-all@freebsd.org Sun Sep 15 02:59: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 19333DC138; Sun, 15 Sep 2019 02:59:54 +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 46WDcn6xpvz3McW; Sun, 15 Sep 2019 02:59:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1CE419CD; Sun, 15 Sep 2019 02:59:53 +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 x8F2xrD8018989; Sun, 15 Sep 2019 02:59:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F2xrSe018987; Sun, 15 Sep 2019 02:59:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909150259.x8F2xrSe018987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 02:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352350 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 352350 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 02:59:54 -0000 Author: kevans Date: Sun Sep 15 02:59:53 2019 New Revision: 352350 URL: https://svnweb.freebsd.org/changeset/base/352350 Log: rangelock: add rangelock_cookie_assert A future change to posixshm to add file sealing (in DIFF_21391[0] and child) will move locking out of shm_dotruncate as kern_shm_open() will require the lock to be held across the dotruncate until the seal is actually applied. For this, the cookie is passed into shm_dotruncate_locked which asserts RCA_WLOCKED. [0] Name changed to protect the innocent, hopefully, from getting autoclosed due to this reference... Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D21628 Modified: head/sys/kern/kern_rangelock.c head/sys/sys/rangelock.h Modified: head/sys/kern/kern_rangelock.c ============================================================================== --- head/sys/kern/kern_rangelock.c Sun Sep 15 02:48:15 2019 (r352349) +++ head/sys/kern/kern_rangelock.c Sun Sep 15 02:59:53 2019 (r352350) @@ -299,3 +299,35 @@ rangelock_trywlock(struct rangelock *lock, off_t start return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk, true)); } + +#ifdef INVARIANT_SUPPORT +void +_rangelock_cookie_assert(void *cookie, int what, const char *file, int line) +{ + struct rl_q_entry *entry; + int flags; + + MPASS(cookie != NULL); + entry = cookie; + flags = entry->rl_q_flags; + switch (what) { + case RCA_LOCKED: + if ((flags & RL_LOCK_GRANTED) == 0) + panic("rangelock not held @ %s:%d\n", file, line); + break; + case RCA_RLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_READ)) != + (RL_LOCK_GRANTED | RL_LOCK_READ)) + panic("rangelock not rlocked @ %s:%d\n", file, line); + break; + case RCA_WLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_WRITE)) != + (RL_LOCK_GRANTED | RL_LOCK_WRITE)) + panic("rangelock not wlocked @ %s:%d\n", file, line); + break; + default: + panic("Unknown rangelock assertion: %d @ %s:%d", what, file, + line); + } +} +#endif /* INVARIANT_SUPPORT */ Modified: head/sys/sys/rangelock.h ============================================================================== --- head/sys/sys/rangelock.h Sun Sep 15 02:48:15 2019 (r352349) +++ head/sys/sys/rangelock.h Sun Sep 15 02:59:53 2019 (r352350) @@ -82,6 +82,29 @@ void *rangelock_wlock(struct rangelock *lock, off_t st void *rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk); void rlqentry_free(struct rl_q_entry *rlqe); +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void _rangelock_cookie_assert(void *cookie, int what, const char *file, + int line); +#endif + +#ifdef INVARIANTS +#define rangelock_cookie_assert_(cookie, what, file, line) \ + _rangelock_cookie_assert((cookie), (what), (file), (line)) +#else +#define rangelock_cookie_assert_(cookie, what, file, line) (void)0 +#endif + +#define rangelock_cookie_assert(cookie, what) \ + rangelock_cookie_assert_((cookie), (what), __FILE__, __LINE__) + +/* + * Assertion flags. + */ +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +#define RCA_LOCKED 0x0001 +#define RCA_RLOCKED 0x0002 +#define RCA_WLOCKED 0x0004 +#endif #endif /* _KERNEL */ From owner-svn-src-all@freebsd.org Sun Sep 15 04:14: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 83B54DEF94; Sun, 15 Sep 2019 04:14:33 +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 46WGGx3SWgz3RK8; Sun, 15 Sep 2019 04:14:33 +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 415B128D9; Sun, 15 Sep 2019 04:14:33 +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 x8F4EXO5066723; Sun, 15 Sep 2019 04:14:33 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F4EVBa066714; Sun, 15 Sep 2019 04:14:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909150414.x8F4EVBa066714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 15 Sep 2019 04:14: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: r352351 - in stable/12: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: . etc/mtree sbin/mount_fusefs share/man/man5 sys/fs/fuse sys/sys tests/sys/fs tests/sys/fs/fusefs X-SVN-Commit-Revision: 352351 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 04:14:33 -0000 Author: asomers Date: Sun Sep 15 04:14:31 2019 New Revision: 352351 URL: https://svnweb.freebsd.org/changeset/base/352351 Log: MFC the new fusefs driver MFC r350665, r350990, r350992, r351039, r351042, r351061, r351066, r351113, r351560, r351961, r351963, r352021, r352025, r352230 r350665: fusefs: merge from projects/fuse2 This commit imports the new fusefs driver. It raises the protocol level from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and adds many new features. New features include: * Optional kernel-side permissions checks (-o default_permissions) * Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK * Allow interrupting FUSE operations * Support named pipes and unix-domain sockets in fusefs file systems * Forward UTIME_NOW during utimensat(2) to the daemon * kqueue support for /dev/fuse * Allow updating mounts with "mount -u" * Allow exporting fusefs file systems over NFS * Server-initiated invalidation of the name cache or data cache * Respect RLIMIT_FSIZE * Try to support servers as old as protocol 7.4 Performance enhancements include: * Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags * Cache file attributes * Cache lookup entries, both positive and negative * Server-selectable cache modes: writethrough, writeback, or uncached * Write clustering * Readahead * Use counter(9) for statistical reporting PR: 199934 216391 233783 234581 235773 235774 235775 PR: 236226 236231 236236 236291 236329 236381 236405 PR: 236327 236466 236472 236473 236474 236530 236557 PR: 236560 236844 237052 237181 237588 238565 Reviewed by: bcr (man pages) Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit review on project branch) Relnotes: yes Sponsored by: The FreeBSD Foundation Pull Request: https://reviews.freebsd.org/D21110 r350990: fusefs: add SVN Keywords to the test files Reported by: SVN pre-commit hooks MFC-With: r350665 Sponsored by: The FreeBSD Foundation r350992: fusefs: skip some tests when unsafe aio is disabled MFC-With: r350665 Sponsored by: The FreeBSD Foundation r351039: fusefs: fix intermittency in the default_permissions.Unlink.ok test The test needs to expect a FUSE_FORGET operation. Most of the time the test would pass anyway, because by chance FUSE_FORGET would arrive after the unmount. MFC-With: 350665 Sponsored by: The FreeBSD Foundation r351042: fusefs: Fix the size of fuse_getattr_in In FUSE protocol 7.9, the size of the FUSE_GETATTR request has increased. However, the fusefs driver is currently not sending the additional fields. In our implementation, the additional fields are always zero, so I there haven't been any test failures until now. But fusefs-lkl requires the request's length to be correct. Fix this bug, and also enhance the test suite to catch similar bugs. PR: 239830 MFC-With: 350665 Sponsored by: The FreeBSD Foundation r351061: fusefs: fix the 32-bit build after 351042 Reported by: jhb MFC-With: 351042 Sponsored by: The FreeBSD Foundation r351066: fusefs: fix conditional from r351061 The entirety of r351061 was a copy/paste error. I'm sorry I've been comitting so hastily. Reported by: rpokala Reviewed by: rpokala MFC-With: 351061 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21265 r351113: fusefs: don't send the namespace during listextattr The FUSE_LISTXATTR operation always returns the full list of a file's extended attributes, in all namespaces. There's no way to filter the list server-side. However, currently FreeBSD's fusefs driver sends a namespace string with the FUSE_LISTXATTR request. That behavior was probably copied from fuse_vnop_getextattr, which has an attribute name argument. It's been there ever since extended attribute support was added in r324620. This commit removes it. Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21280 r351560: 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 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21287 r351961: Coverity fixes in fusefs(5) CID 1404532 fixes a signed vs unsigned comparison error in fuse_vnop_bmap. It could potentially have resulted in VOP_BMAP reporting too many consecutive blocks. CID 1404364 is much worse. It was an array access by an untrusted, user-provided variable. It could potentially have resulted in a malicious file system crashing the kernel or worse. Reported by: Coverity Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21466 r351963: fusefs: coverity cleanup in the tests Address the following defects reported by Coverity: * Structurally dead code (CID 1404366): set m_quit before FAIL, not after * Unchecked return value of sysctlbyname (CID 1404321) * Unchecked return value of stat(2) (CID 1404471) * Unchecked return value of open(2) (CID 1404402, 1404529) * Unchecked return value of dup(2) (CID 1404478) * Buffer overflows. These are all false positives caused by the fact that Coverity thinks I'm using a buffer to store strings, when in fact I'm really just using it to store a byte array that happens to be initialized with a string. I'm changing the type from char to uint8_t in the hopes that it will placate Coverity. (CID 1404338, 1404350, 1404367, 1404376, 1404379, 1404381, 1404388, 1404403, 1404425, 1404433, 1404434, 1404474, 1404480, 1404484, 1404503, 1404505) * False positive file descriptor leak. I'm going to try to fix this with Coverity modeling, but I'll also change an EXPECT to ASSERT so we don't perform meaningless assertions after the failure. (CID 1404320, 1404324, 1404440, 1404445). * Unannotated file descriptor leak. This will be followed up by a Coverity modeling change. (CID 1404326, 1404334, 1404336, 1404357, 1404361, 1404372, 1404391, 1404395, 1404409, 1404430, 1404448, 1404451, 1404455, 1404457, 1404458, 1404460) * Uninitialized variables in C++ constructors (CID 1404327, 1404346). In the case of m_maxphys, this actually led to part of the FUSE_INIT's response being set to stack garbage during the WriteCluster::clustering test. * Uninitialized sun_len field in struct sockaddr_un (CID 1404330, 1404371, 1404429). Reported by: Coverity Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21457 r352021: fusefs: suppress some Coverity resource leak CIDs in the tests The fusefs tests deliberately leak file descriptors. To do otherwise would add extra complications to the tests' mock FUSE server. This annotation should hopefully convince Coverity to shut up about the leaks. Reviewed by: uqs Sponsored by: The FreeBSD Foundation r352025: mount_fusefs: fix a segfault on memory allocation failure Reported by: Coverity Coverity CID: 1354188 Sponsored by: The FreeBSD Foundation r352230: fusefs: Fix iosize for FUSE_WRITE in 7.8 compat mode When communicating with a FUSE server that implements version 7.8 (or older) of the FUSE protocol, the FUSE_WRITE request structure is 16 bytes shorter than normal. The protocol version check wasn't applied universally, leading to an extra 16 bytes being sent to such servers. The extra bytes were allocated and bzero()d, so there was no information disclosure. Reviewed by: emaste MFC-With: r350665 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21557 Added: stable/12/tests/sys/fs/fusefs/ - copied from r350665, head/tests/sys/fs/fusefs/ Deleted: stable/12/sys/fs/fuse/fuse_param.h Modified: stable/12/MAINTAINERS stable/12/UPDATING stable/12/etc/mtree/BSD.tests.dist stable/12/sbin/mount_fusefs/mount_fusefs.8 stable/12/sbin/mount_fusefs/mount_fusefs.c stable/12/share/man/man5/fusefs.5 stable/12/sys/fs/fuse/fuse.h stable/12/sys/fs/fuse/fuse_device.c stable/12/sys/fs/fuse/fuse_file.c stable/12/sys/fs/fuse/fuse_file.h stable/12/sys/fs/fuse/fuse_internal.c stable/12/sys/fs/fuse/fuse_internal.h stable/12/sys/fs/fuse/fuse_io.c stable/12/sys/fs/fuse/fuse_io.h stable/12/sys/fs/fuse/fuse_ipc.c stable/12/sys/fs/fuse/fuse_ipc.h stable/12/sys/fs/fuse/fuse_kernel.h stable/12/sys/fs/fuse/fuse_main.c stable/12/sys/fs/fuse/fuse_node.c stable/12/sys/fs/fuse/fuse_node.h stable/12/sys/fs/fuse/fuse_vfsops.c stable/12/sys/fs/fuse/fuse_vnops.c stable/12/sys/sys/param.h stable/12/tests/sys/fs/Makefile stable/12/tests/sys/fs/fusefs/access.cc stable/12/tests/sys/fs/fusefs/allow_other.cc stable/12/tests/sys/fs/fusefs/bmap.cc stable/12/tests/sys/fs/fusefs/create.cc stable/12/tests/sys/fs/fusefs/default_permissions.cc stable/12/tests/sys/fs/fusefs/default_permissions_privileged.cc stable/12/tests/sys/fs/fusefs/destroy.cc stable/12/tests/sys/fs/fusefs/dev_fuse_poll.cc stable/12/tests/sys/fs/fusefs/fifo.cc stable/12/tests/sys/fs/fusefs/flush.cc stable/12/tests/sys/fs/fusefs/forget.cc stable/12/tests/sys/fs/fusefs/fsync.cc stable/12/tests/sys/fs/fusefs/fsyncdir.cc stable/12/tests/sys/fs/fusefs/getattr.cc stable/12/tests/sys/fs/fusefs/interrupt.cc stable/12/tests/sys/fs/fusefs/io.cc stable/12/tests/sys/fs/fusefs/link.cc stable/12/tests/sys/fs/fusefs/locks.cc stable/12/tests/sys/fs/fusefs/lookup.cc stable/12/tests/sys/fs/fusefs/mkdir.cc stable/12/tests/sys/fs/fusefs/mknod.cc stable/12/tests/sys/fs/fusefs/mockfs.cc stable/12/tests/sys/fs/fusefs/mockfs.hh (contents, props changed) stable/12/tests/sys/fs/fusefs/mount.cc stable/12/tests/sys/fs/fusefs/nfs.cc stable/12/tests/sys/fs/fusefs/notify.cc stable/12/tests/sys/fs/fusefs/open.cc stable/12/tests/sys/fs/fusefs/opendir.cc stable/12/tests/sys/fs/fusefs/read.cc stable/12/tests/sys/fs/fusefs/readdir.cc stable/12/tests/sys/fs/fusefs/readlink.cc stable/12/tests/sys/fs/fusefs/release.cc stable/12/tests/sys/fs/fusefs/releasedir.cc stable/12/tests/sys/fs/fusefs/rename.cc stable/12/tests/sys/fs/fusefs/rmdir.cc stable/12/tests/sys/fs/fusefs/setattr.cc stable/12/tests/sys/fs/fusefs/statfs.cc stable/12/tests/sys/fs/fusefs/symlink.cc stable/12/tests/sys/fs/fusefs/unlink.cc stable/12/tests/sys/fs/fusefs/utils.cc stable/12/tests/sys/fs/fusefs/utils.hh (contents, props changed) stable/12/tests/sys/fs/fusefs/write.cc stable/12/tests/sys/fs/fusefs/xattr.cc Directory Properties: stable/12/ (props changed) Modified: stable/12/MAINTAINERS ============================================================================== --- stable/12/MAINTAINERS Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/MAINTAINERS Sun Sep 15 04:14:31 2019 (r352351) @@ -50,6 +50,7 @@ dev/usb/wlan adrian Pre-commit review requested, send etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE. etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE. fetch des Pre-commit review requested, email only. +fusefs(5) asomers Pre-commit review requested. geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). isci(4) jimharris Pre-commit review requested. iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/UPDATING Sun Sep 15 04:14:31 2019 (r352351) @@ -16,6 +16,18 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20190914: + The vfs.fusefs.sync_unmount and vfs.fusefs.init_backgrounded sysctls + and the "-o sync_unmount" and "-o init_backgrounded" mount options have + been removed from mount_fusefs(8). You can safely remove them from + your scripts, because they had no effect. + + The vfs.fusefs.fix_broken_io, vfs.fusefs.sync_resize, + vfs.fusefs.refresh_size, vfs.fusefs.mmap_enable, + vfs.fusefs.reclaim_revoked, and vfs.fusefs.data_cache_invalidate + sysctls have been removed. If you felt the need to set any of them to + a non-default value, please tell asomers@FreeBSD.org why. + 20190906: The fuse(4) module has been renamed to fusefs(4) for consistency with other filesystems. You should update any kld_load="fuse" entries in Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/etc/mtree/BSD.tests.dist Sun Sep 15 04:14:31 2019 (r352351) @@ -717,6 +717,8 @@ file .. fs + fusefs + .. tmpfs .. .. Modified: stable/12/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- stable/12/sbin/mount_fusefs/mount_fusefs.8 Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/sbin/mount_fusefs/mount_fusefs.8 Sun Sep 15 04:14:31 2019 (r352351) @@ -3,6 +3,11 @@ .\" Copyright (c) 2005, 2006 Csaba Henk .\" All rights reserved. .\" +.\" Copyright (c) 2019 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by BFF Storage Systems 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: @@ -29,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 17, 2018 +.Dd July 31, 2019 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -108,27 +113,27 @@ Intended for use in scripts and the .Xr sudoers 5 file. .It Fl S , Ic --safe -Run in safe mode (i.e. reject invoking a filesystem daemon) +Run in safe mode (i.e., reject invoking a filesystem daemon). .It Fl v -Be verbose -.It Fl D, Ic --daemon Ar daemon +Be verbose. +.It Fl D , Ic --daemon Ar daemon Call the specified -.Ar daemon -.It Fl O, Ic --daemon_opts Ar opts +.Ar daemon . +.It Fl O , Ic --daemon_opts Ar opts Add .Ar opts -to the daemon's command line -.It Fl s, Ic --special Ar special +to the daemon's command line. +.It Fl s , Ic --special Ar special Use .Ar special -as special -.It Fl m, Ic --mountpath Ar node +as special. +.It Fl m , Ic --mountpath Ar node Mount on -.Ar node -.It Fl h, Ic --help -Show help -.It Fl V, Ic --version -Show version information +.Ar node . +.It Fl h , Ic --help +Show help. +.It Fl V , Ic --version +Show version information. .It Fl o Mount options are specified via .Fl o . @@ -136,23 +141,38 @@ The following options are available (and also their ne by prefixing them with .Dq no ) : .Bl -tag -width indent -.It Cm default_permissions -Enable traditional (file mode based) permission checking in kernel .It Cm allow_other Do not apply .Sx STRICT ACCESS POLICY . -Only root can use this option +Only root can use this option. +.It Cm async +I/O to the file system may be done asynchronously. +Writes may be delayed and/or reordered. +.It Cm default_permissions +Enable traditional (file mode based) permission checking in kernel. +.It Cm intr +Allow signals to interrupt operations that are blocked waiting for a reply from the server. +When this option is in use, system calls may fail with +.Er EINTR +whenever a signal is received. .It Cm max_read Ns = Ns Ar n Limit size of read requests to -.Ar n +.Ar n . +.It Cm neglect_shares +Do not refuse unmounting if there are secondary mounts. .It Cm private Refuse shared mounting of the daemon. This is the default behaviour, to allow sharing, expicitly use -.Fl o Cm noprivate -.It Cm neglect_shares -Do not refuse unmounting if there are secondary mounts +.Fl o Cm noprivate . .It Cm push_symlinks_in -Prefix absolute symlinks with the mountpoint +Prefix absolute symlinks with the mountpoint. +.It Cm subtype Ns = Ns Ar fsname +Suffix +.Ar fsname +to the file system name as reported by +.Xr statfs 2 . +This option can be used to identify the file system implemented by +.Ar fuse_daemon . .El .El .Pp @@ -167,11 +187,11 @@ However, there are some which do require in-kernel sup Currently the options supported by the kernel are: .Bl -tag -width indent .It Cm direct_io -Bypass the buffer cache system +Bypass the buffer cache system. .It Cm kernel_cache By default cached buffers of a given file are flushed at each .Xr open 2 . -This option disables this behaviour +This option disables this behaviour. .El .Sh DAEMON MOUNTS Usually users do not need to use @@ -194,7 +214,7 @@ only if the filesystem daemon has the same credentials real gid) as the user. .Pp This is applied for Fuse mounts by default and only root can mount without -the strict access policy (i.e. the +the strict access policy (i.e., the .Cm allow_other mount option). .Pp @@ -206,7 +226,7 @@ Users might opt to willingly relax strict access polic are concerned) by doing their own secondary mount (See .Sx SHARED MOUNTS ) . .Sh SHARED MOUNTS -A Fuse daemon can be shared (i.e. mounted multiple times). +A Fuse daemon can be shared (i.e., mounted multiple times). When doing the first (primary) mount, the spawner and the mounter of the daemon must have the same uid, or the mounter should be the superuser. .Pp @@ -225,7 +245,7 @@ is used or not. .Pp The device name of a secondary mount is the device name of the corresponding primary mount, followed by a '#' character and the index of the secondary -mount; e.g. +mount; e.g., .Pa /dev/fuse0#3 . .Sh SECURITY System administrators might want to use a custom mount policy (ie., one going @@ -239,7 +259,7 @@ However, given that is capable of invoking an arbitrary program, one must be careful when doing this. .Nm is designed in a way such that it makes that easy. -For this purpose, there are options which disable certain risky features (i.e. +For this purpose, there are options which disable certain risky features ( .Fl S and .Fl A ) , @@ -342,7 +362,7 @@ does not call any external utility and also provides a was written as the part of the .Fx implementation of the Fuse userspace filesystem framework (see -.Xr https://github.com/libfuse/libfuse ) +.Lk https://github.com/libfuse/libfuse ) and first appeared in the .Pa sysutils/fusefs-kmod port, supporting Modified: stable/12/sbin/mount_fusefs/mount_fusefs.c ============================================================================== --- stable/12/sbin/mount_fusefs/mount_fusefs.c Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/sbin/mount_fusefs/mount_fusefs.c Sun Sep 15 04:14:31 2019 (r352351) @@ -5,6 +5,11 @@ * Copyright (c) 2005 Csaba Henk * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems 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: @@ -60,7 +65,6 @@ void __usage_short(void); void usage(void); void helpmsg(void); void showversion(void); -int init_backgrounded(void); static struct mntopt mopts[] = { #define ALTF_PRIVATE 0x01 @@ -73,8 +77,6 @@ static struct mntopt mopts[] = { { "max_read=", 0, ALTF_MAXREAD, 1 }, #define ALTF_SUBTYPE 0x40 { "subtype=", 0, ALTF_SUBTYPE, 1 }, - #define ALTF_SYNC_UNMOUNT 0x80 - { "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 }, /* * MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into * the 'flags' argument to nmount(2). We have to abuse altflags @@ -82,6 +84,8 @@ static struct mntopt mopts[] = { */ #define ALTF_AUTOMOUNTED 0x100 { "automounted", 0, ALTF_AUTOMOUNTED, 1 }, + #define ALTF_INTR 0x200 + { "intr", 0, ALTF_INTR, 1 }, /* Linux specific options, we silently ignore them */ { "fsname=", 0, 0x00, 1 }, { "fd=", 0, 0x00, 1 }, @@ -91,6 +95,8 @@ static struct mntopt mopts[] = { { "large_read", 0, 0x00, 1 }, /* "nonempty", just the first two chars are stripped off during parsing */ { "nempty", 0, 0x00, 1 }, + { "async", 0, MNT_ASYNC, 0}, + { "noasync", 1, MNT_ASYNC, 0}, MOPT_STDOPTS, MOPT_END }; @@ -107,7 +113,7 @@ static struct mntval mvals[] = { { 0, NULL, 0 } }; -#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE | ALTF_SYNC_UNMOUNT +#define DEFAULT_MOUNT_FLAGS ALTF_PRIVATE int main(int argc, char *argv[]) @@ -206,6 +212,8 @@ main(int argc, char *argv[]) q++; mv->mv_len = q - p + 1; mv->mv_value = malloc(mv->mv_len); + if (mv->mv_value == NULL) + err(1, "malloc"); memcpy(mv->mv_value, p, mv->mv_len - 1); ((char *)mv->mv_value)[mv->mv_len - 1] = '\0'; break; @@ -409,12 +417,6 @@ main(int argc, char *argv[]) } } - if (fd >= 0 && ! init_backgrounded() && close(fd) < 0) { - if (pid) - kill(pid, SIGKILL); - err(1, "failed to close fuse device"); - } - /* Prepare the options vector for nmount(). build_iovec() is declared * in mntopts.h. */ sprintf(fdstr, "%d", fd); @@ -471,6 +473,7 @@ helpmsg(void) " -o allow_other allow access to other users\n" /* " -o nonempty allow mounts over non-empty file/dir\n" */ " -o default_permissions enable permission checking by kernel\n" + " -o intr interruptible mount\n" /* " -o fsname=NAME set filesystem name\n" " -o large_read issue large read requests (2.4 only)\n" @@ -481,7 +484,6 @@ helpmsg(void) " -o neglect_shares don't report EBUSY when unmount attempted\n" " in presence of secondary mounts\n" " -o push_symlinks_in prefix absolute symlinks with mountpoint\n" - " -o sync_unmount do unmount synchronously\n" ); exit(EX_USAGE); } @@ -491,18 +493,4 @@ showversion(void) { puts("mount_fusefs [fuse4bsd] version: " FUSE4BSD_VERSION); exit(EX_USAGE); -} - -int -init_backgrounded(void) -{ - int ibg; - size_t len; - - len = sizeof(ibg); - - if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) - return (0); - - return (ibg); } Modified: stable/12/share/man/man5/fusefs.5 ============================================================================== --- stable/12/share/man/man5/fusefs.5 Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/share/man/man5/fusefs.5 Sun Sep 15 04:14:31 2019 (r352351) @@ -3,8 +3,8 @@ .\" .\" Copyright (c) 2019 The FreeBSD Foundation .\" -.\" This software was developed by BFF Storage Systems, LLC under sponsorship -.\" from the FreeBSD Foundation. +.\" This documentation was written by BFF Storage Systems, LLC 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 @@ -28,7 +28,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 13, 2019 +.Dd July 31, 2019 .Dt FUSEFS 5 .Os .Sh NAME @@ -60,11 +60,9 @@ Finally, the API is portable. Many daemons can run on multiple operating systems with minimal modifications. .Sh SYSCTL VARIABLES -The following variables are available as both +The following .Xr sysctl 8 -variables and -.Xr loader 8 -tunables: +variables are available: .Bl -tag -width indent .It Va vfs.fusefs.kernelabi_major Major version of the FUSE kernel ABI supported by this driver. @@ -73,7 +71,7 @@ Minor version of the FUSE kernel ABI supported by this .It Va vfs.fusefs.data_cache_mode Controls how .Nm -will cache file data. +will cache file data for pre-7.23 file systems. A value of 0 will disable caching entirely. Every data access will be forwarded to the daemon. A value of 1 will select write-through caching. @@ -84,33 +82,26 @@ Reads and writes will both be cached, and writes will to the daemon by the page daemon. Write-back caching is usually unsafe, especially for FUSE file systems that require network access. -.It Va vfs.fusefs.lookup_cache_enable -Controls whether -.Nm -will cache lookup responses from the file system. -FUSE file systems indicate whether lookup responses should be cacheable, but -it may be useful to globally disable caching them if a file system is -misbehaving. +.Pp +FUSE file systems using protocol 7.23 or later specify their cache behavior +on a per-mountpoint basis, ignoring this sysctl. +.It Va vfs.fusefs.stats.filehandle_count +Current number of open FUSE file handles. +.It Va vfs.fusefs.stats.lookup_cache_hits +Total number of lookup cache hits. +.It Va vfs.fusefs.stats.lookup_cache_misses +Total number of lookup cache misses. +.It Va vfs.fusefs.stats.node_count +Current number of allocated FUSE vnodes. +.It Va vfs.fusefs.stats.ticket_count +Current number of allocated FUSE tickets, which is roughly equal to the number +of FUSE operations currently being processed by daemons. .\" Undocumented sysctls .\" ==================== -.\" Counters: I intend to rename to vfs.fusefs.stats.* for clarity -.\" vfs.fusefs.lookup_cache_{hits, misses} -.\" vfs.fusefs.filehandle_count -.\" vfs.fusefs.ticker_count -.\" vfs.fusefs.node_count -.\" -.\" vfs.fusefs.version - useless since the driver moved in-tree -.\" vfs.fusefs.reclaim_revoked: I don't understand it well-enough -.\" vfs.fusefs.sync_unmount: dead code .\" vfs.fusefs.enforce_dev_perms: I don't understand it well enough. -.\" vfs.fusefs.init_backgrounded: dead code .\" vfs.fusefs.iov_credit: I don't understand it well enough .\" vfs.fusefs.iov_permanent_bufsize: I don't understand it well enough -.\" vfs.fusefs.fix_broken_io: I don't understand it well enough -.\" vfs.fusefs.sync_resize: useless and should be removed -.\" vfs.fusefs.refresh_size: probably useless? -.\" vfs.fusefs.mmap_enable: why is this optional? -.\" vfs.fusefs.data_cache_invalidate: what is this needed for? +.El .Sh SEE ALSO .Xr mount_fusefs 8 .Sh HISTORY @@ -119,7 +110,7 @@ The driver was written as the part of the .Fx implementation of the FUSE userspace file system framework (see -.Xr https://github.com/libfuse/libfuse ) +.Lk https://github.com/libfuse/libfuse ) and first appeared in the .Pa sysutils/fusefs-kmod port, supporting Modified: stable/12/sys/fs/fuse/fuse.h ============================================================================== --- stable/12/sys/fs/fuse/fuse.h Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/sys/fs/fuse/fuse.h Sun Sep 15 04:14:31 2019 (r352351) @@ -32,6 +32,11 @@ * * Copyright (C) 2005 Csaba Henk. * All rights reserved. + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC 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 @@ -63,87 +68,10 @@ #define FUSE_MIN_DAEMON_TIMEOUT 0 /* s */ #define FUSE_MAX_DAEMON_TIMEOUT 600 /* s */ -#ifndef FUSE_FREEBSD_VERSION -#define FUSE_FREEBSD_VERSION "0.4.4" -#endif - -/* Mapping versions to features */ - -#define FUSE_KERNELABI_GEQ(maj, min) \ -(FUSE_KERNEL_VERSION > (maj) || (FUSE_KERNEL_VERSION == (maj) && FUSE_KERNEL_MINOR_VERSION >= (min))) - -/* - * Appearance of new FUSE operations is not always in par with version - * numbering... At least, 7.3 is a sufficient condition for having - * FUSE_{ACCESS,CREATE}. - */ -#if FUSE_KERNELABI_GEQ(7, 3) -#ifndef FUSE_HAS_ACCESS -#define FUSE_HAS_ACCESS 1 -#endif -#ifndef FUSE_HAS_CREATE -#define FUSE_HAS_CREATE 1 -#endif -#else /* FUSE_KERNELABI_GEQ(7, 3) */ -#ifndef FUSE_HAS_ACCESS -#define FUSE_HAS_ACCESS 0 -#endif -#ifndef FUSE_HAS_CREATE -#define FUSE_HAS_CREATE 0 -#endif -#endif - -#if FUSE_KERNELABI_GEQ(7, 7) -#ifndef FUSE_HAS_GETLK -#define FUSE_HAS_GETLK 1 -#endif -#ifndef FUSE_HAS_SETLK -#define FUSE_HAS_SETLK 1 -#endif -#ifndef FUSE_HAS_SETLKW -#define FUSE_HAS_SETLKW 1 -#endif -#ifndef FUSE_HAS_INTERRUPT -#define FUSE_HAS_INTERRUPT 1 -#endif -#else /* FUSE_KERNELABI_GEQ(7, 7) */ -#ifndef FUSE_HAS_GETLK -#define FUSE_HAS_GETLK 0 -#endif -#ifndef FUSE_HAS_SETLK -#define FUSE_HAS_SETLK 0 -#endif -#ifndef FUSE_HAS_SETLKW -#define FUSE_HAS_SETLKW 0 -#endif -#ifndef FUSE_HAS_INTERRUPT -#define FUSE_HAS_INTERRUPT 0 -#endif -#endif - -#if FUSE_KERNELABI_GEQ(7, 8) -#ifndef FUSE_HAS_FLUSH_RELEASE -#define FUSE_HAS_FLUSH_RELEASE 1 -/* - * "DESTROY" came in the middle of the 7.8 era, - * so this is not completely exact... - */ -#ifndef FUSE_HAS_DESTROY -#define FUSE_HAS_DESTROY 1 -#endif -#endif -#else /* FUSE_KERNELABI_GEQ(7, 8) */ -#ifndef FUSE_HAS_FLUSH_RELEASE -#define FUSE_HAS_FLUSH_RELEASE 0 -#ifndef FUSE_HAS_DESTROY -#define FUSE_HAS_DESTROY 0 -#endif -#endif -#endif - /* misc */ SYSCTL_DECL(_vfs_fusefs); +SYSCTL_DECL(_vfs_fusefs_stats); /* Fuse locking */ Modified: stable/12/sys/fs/fuse/fuse_device.c ============================================================================== --- stable/12/sys/fs/fuse/fuse_device.c Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/sys/fs/fuse/fuse_device.c Sun Sep 15 04:14:31 2019 (r352351) @@ -33,6 +33,11 @@ * Copyright (C) 2005 Csaba Henk. * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC 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: @@ -81,27 +86,28 @@ __FBSDID("$FreeBSD$"); #include #include "fuse.h" +#include "fuse_internal.h" #include "fuse_ipc.h" -SDT_PROVIDER_DECLARE(fuse); +SDT_PROVIDER_DECLARE(fusefs); /* * Fuse trace probe: * arg0: verbosity. Higher numbers give more verbose messages * arg1: Textual message */ -SDT_PROBE_DEFINE2(fuse, , device, trace, "int", "char*"); +SDT_PROBE_DEFINE2(fusefs, , device, trace, "int", "char*"); static struct cdev *fuse_dev; +static d_kqfilter_t fuse_device_filter; static d_open_t fuse_device_open; -static d_close_t fuse_device_close; static d_poll_t fuse_device_poll; static d_read_t fuse_device_read; static d_write_t fuse_device_write; static struct cdevsw fuse_device_cdevsw = { + .d_kqfilter = fuse_device_filter, .d_open = fuse_device_open, - .d_close = fuse_device_close, .d_name = "fuse", .d_poll = fuse_device_poll, .d_read = fuse_device_read, @@ -109,6 +115,15 @@ static struct cdevsw fuse_device_cdevsw = { .d_version = D_VERSION, }; +static int fuse_device_filt_read(struct knote *kn, long hint); +static void fuse_device_filt_detach(struct knote *kn); + +struct filterops fuse_device_rfiltops = { + .f_isfd = 1, + .f_detach = fuse_device_filt_detach, + .f_event = fuse_device_filt_read, +}; + /**************************** * * >>> Fuse device op defs @@ -119,11 +134,100 @@ static void fdata_dtor(void *arg) { struct fuse_data *fdata; + struct fuse_ticket *tick; fdata = arg; + if (fdata == NULL) + return; + + fdata_set_dead(fdata); + + FUSE_LOCK(); + fuse_lck_mtx_lock(fdata->aw_mtx); + /* wakup poll()ers */ + selwakeuppri(&fdata->ks_rsel, PZERO + 1); + /* Don't let syscall handlers wait in vain */ + while ((tick = fuse_aw_pop(fdata))) { + fuse_lck_mtx_lock(tick->tk_aw_mtx); + fticket_set_answered(tick); + tick->tk_aw_errno = ENOTCONN; + wakeup(tick); + fuse_lck_mtx_unlock(tick->tk_aw_mtx); + FUSE_ASSERT_AW_DONE(tick); + fuse_ticket_drop(tick); + } + fuse_lck_mtx_unlock(fdata->aw_mtx); + + /* Cleanup unsent operations */ + fuse_lck_mtx_lock(fdata->ms_mtx); + while ((tick = fuse_ms_pop(fdata))) { + fuse_ticket_drop(tick); + } + fuse_lck_mtx_unlock(fdata->ms_mtx); + FUSE_UNLOCK(); + fdata_trydestroy(fdata); } +static int +fuse_device_filter(struct cdev *dev, struct knote *kn) +{ + struct fuse_data *data; + int error; + + error = devfs_get_cdevpriv((void **)&data); + + /* EVFILT_WRITE is not supported; the device is always ready to write */ + if (error == 0 && kn->kn_filter == EVFILT_READ) { + kn->kn_fop = &fuse_device_rfiltops; + kn->kn_hook = data; + knlist_add(&data->ks_rsel.si_note, kn, 0); + error = 0; + } else if (error == 0) { + error = EINVAL; + kn->kn_data = error; + } + + return (error); +} + +static void +fuse_device_filt_detach(struct knote *kn) +{ + struct fuse_data *data; + + data = (struct fuse_data*)kn->kn_hook; + MPASS(data != NULL); + knlist_remove(&data->ks_rsel.si_note, kn, 0); + kn->kn_hook = NULL; +} + +static int +fuse_device_filt_read(struct knote *kn, long hint) +{ + struct fuse_data *data; + int ready; + + data = (struct fuse_data*)kn->kn_hook; + MPASS(data != NULL); + + mtx_assert(&data->ms_mtx, MA_OWNED); + if (fdata_get_dead(data)) { + kn->kn_flags |= EV_EOF; + kn->kn_fflags = ENODEV; + kn->kn_data = 1; + ready = 1; + } else if (STAILQ_FIRST(&data->ms_head)) { + MPASS(data->ms_count >= 1); + kn->kn_data = data->ms_count; + ready = 1; + } else { + ready = 0; + } + + return (ready); +} + /* * Resources are set up on a per-open basis */ @@ -133,52 +237,17 @@ fuse_device_open(struct cdev *dev, int oflags, int dev struct fuse_data *fdata; int error; - SDT_PROBE2(fuse, , device, trace, 1, "device open"); + SDT_PROBE2(fusefs, , device, trace, 1, "device open"); fdata = fdata_alloc(dev, td->td_ucred); error = devfs_set_cdevpriv(fdata, fdata_dtor); if (error != 0) fdata_trydestroy(fdata); else - SDT_PROBE2(fuse, , device, trace, 1, "device open success"); + SDT_PROBE2(fusefs, , device, trace, 1, "device open success"); return (error); } -static int -fuse_device_close(struct cdev *dev, int fflag, int devtype, struct thread *td) -{ - struct fuse_data *data; - struct fuse_ticket *tick; - int error; - - error = devfs_get_cdevpriv((void **)&data); - if (error != 0) - return (error); - if (!data) - panic("no fuse data upon fuse device close"); - fdata_set_dead(data); - - FUSE_LOCK(); - fuse_lck_mtx_lock(data->aw_mtx); - /* wakup poll()ers */ - selwakeuppri(&data->ks_rsel, PZERO + 1); - /* Don't let syscall handlers wait in vain */ - while ((tick = fuse_aw_pop(data))) { - fuse_lck_mtx_lock(tick->tk_aw_mtx); - fticket_set_answered(tick); - tick->tk_aw_errno = ENOTCONN; - wakeup(tick); - fuse_lck_mtx_unlock(tick->tk_aw_mtx); - FUSE_ASSERT_AW_DONE(tick); - fuse_ticket_drop(tick); - } - fuse_lck_mtx_unlock(data->aw_mtx); - FUSE_UNLOCK(); - - SDT_PROBE2(fuse, , device, trace, 1, "device close"); - return (0); -} - int fuse_device_poll(struct cdev *dev, int events, struct thread *td) { @@ -219,7 +288,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in int buflen[3]; int i; - SDT_PROBE2(fuse, , device, trace, 1, "fuse device read"); + SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read"); err = devfs_get_cdevpriv((void **)&data); if (err != 0) @@ -228,7 +297,7 @@ fuse_device_read(struct cdev *dev, struct uio *uio, in fuse_lck_mtx_lock(data->ms_mtx); again: if (fdata_get_dead(data)) { - SDT_PROBE2(fuse, , device, trace, 2, + SDT_PROBE2(fusefs, , device, trace, 2, "we know early on that reader should be kicked so we " "don't wait for news"); fuse_lck_mtx_unlock(data->ms_mtx); @@ -256,7 +325,7 @@ again: * -- and some other cases, too, tho not totally clear, when * (cv_signal/wakeup_one signals the whole process ?) */ - SDT_PROBE2(fuse, , device, trace, 1, "no message on thread"); + SDT_PROBE2(fusefs, , device, trace, 1, "no message on thread"); goto again; } fuse_lck_mtx_unlock(data->ms_mtx); @@ -266,9 +335,10 @@ again: * somebody somewhere -- eg., umount routine -- * wants this liaison finished off */ - SDT_PROBE2(fuse, , device, trace, 2, "reader is to be sacked"); + SDT_PROBE2(fusefs, , device, trace, 2, + "reader is to be sacked"); if (tick) { - SDT_PROBE2(fuse, , device, trace, 2, "weird -- " + SDT_PROBE2(fusefs, , device, trace, 2, "weird -- " "\"kick\" is set tho there is message"); FUSE_ASSERT_MS_DONE(tick); fuse_ticket_drop(tick); @@ -276,7 +346,7 @@ again: return (ENODEV); /* This should make the daemon get off * of us */ } - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read message successfully"); KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0, @@ -311,7 +381,7 @@ again: */ if (uio->uio_resid < buflen[i]) { fdata_set_dead(data); - SDT_PROBE2(fuse, , device, trace, 2, + SDT_PROBE2(fusefs, , device, trace, 2, "daemon is stupid, kick it off..."); err = ENODEV; break; @@ -331,23 +401,26 @@ static inline int fuse_ohead_audit(struct fuse_out_header *ohead, struct uio *uio) { if (uio->uio_resid + sizeof(struct fuse_out_header) != ohead->len) { - SDT_PROBE2(fuse, , device, trace, 1, "Format error: body size " + SDT_PROBE2(fusefs, , device, trace, 1, + "Format error: body size " "differs from size claimed by header"); return (EINVAL); } - if (uio->uio_resid && ohead->error) { - SDT_PROBE2(fuse, , device, trace, 1, + if (uio->uio_resid && ohead->unique != 0 && ohead->error) { + SDT_PROBE2(fusefs, , device, trace, 1, "Format error: non zero error but message had a body"); return (EINVAL); } - /* Sanitize the linuxism of negative errnos */ - ohead->error = -(ohead->error); return (0); } -SDT_PROBE_DEFINE1(fuse, , device, fuse_device_write_bumped_into_callback, - "uint64_t"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_notify, + "struct fuse_out_header*"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_missing_ticket, + "uint64_t"); +SDT_PROBE_DEFINE1(fusefs, , device, fuse_device_write_found, + "struct fuse_ticket*"); /* * fuse_device_write first reads the header sent by the daemon. * If that's OK, looks up ticket/callback node by the unique id seen in header. @@ -360,15 +433,17 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i struct fuse_out_header ohead; int err = 0; struct fuse_data *data; - struct fuse_ticket *tick, *x_tick; + struct mount *mp; + struct fuse_ticket *tick, *itick, *x_tick; int found = 0; err = devfs_get_cdevpriv((void **)&data); if (err != 0) return (err); + mp = data->mp; if (uio->uio_resid < sizeof(struct fuse_out_header)) { - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "fuse_device_write got less than a header!"); fdata_set_dead(data); return (EINVAL); @@ -393,15 +468,29 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i fuse_lck_mtx_lock(data->aw_mtx); TAILQ_FOREACH_SAFE(tick, &data->aw_head, tk_aw_link, x_tick) { - SDT_PROBE1(fuse, , device, - fuse_device_write_bumped_into_callback, - tick->tk_unique); if (tick->tk_unique == ohead.unique) { + SDT_PROBE1(fusefs, , device, fuse_device_write_found, + tick); found = 1; fuse_aw_remove(tick); break; } } + if (found && tick->irq_unique > 0) { + /* + * Discard the FUSE_INTERRUPT ticket that tried to interrupt + * this operation + */ + TAILQ_FOREACH_SAFE(itick, &data->aw_head, tk_aw_link, + x_tick) { + if (itick->tk_unique == tick->irq_unique) { + fuse_aw_remove(itick); + fuse_ticket_drop(itick); + break; + } + } + tick->irq_unique = 0; + } fuse_lck_mtx_unlock(data->aw_mtx); if (found) { @@ -414,13 +503,15 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i * via ticket_drop(), so no manual mucking * around...) */ - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "pass ticket to a callback"); + /* Sanitize the linuxism of negative errnos */ + ohead.error *= -1; memcpy(&tick->tk_aw_ohead, &ohead, sizeof(ohead)); err = tick->tk_aw_handler(tick, uio); } else { /* pretender doesn't wanna do anything with answer */ - SDT_PROBE2(fuse, , device, trace, 1, + SDT_PROBE2(fusefs, , device, trace, 1, "stuff devalidated, so we drop it"); } @@ -430,11 +521,51 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i * because fuse_ticket_drop() will deal with refcount anyway. */ fuse_ticket_drop(tick); + } else if (ohead.unique == 0){ + /* unique == 0 means asynchronous notification */ + SDT_PROBE1(fusefs, , device, fuse_device_write_notify, &ohead); + switch (ohead.error) { + case FUSE_NOTIFY_INVAL_ENTRY: + err = fuse_internal_invalidate_entry(mp, uio); + break; + case FUSE_NOTIFY_INVAL_INODE: + err = fuse_internal_invalidate_inode(mp, uio); + break; + case FUSE_NOTIFY_RETRIEVE: + case FUSE_NOTIFY_STORE: + /* + * Unimplemented. I don't know of any file systems + * that use them, and the protocol isn't sound anyway, + * since the notification messages don't include the + * inode's generation number. Without that, it's + * possible to manipulate the cache of the wrong vnode. + * Finally, it's not defined what this message should + * do for a file with dirty cache. + */ + case FUSE_NOTIFY_POLL: + /* Unimplemented. See comments in fuse_vnops */ + default: + /* Not implemented */ + err = ENOSYS; + } } else { /* no callback at all! */ - SDT_PROBE2(fuse, , device, trace, 1, - "erhm, no handler for this response"); - err = EINVAL; + SDT_PROBE1(fusefs, , device, fuse_device_write_missing_ticket, + ohead.unique); + if (ohead.error == -EAGAIN) { + /* + * This was probably a response to a FUSE_INTERRUPT + * operation whose original operation is already + * complete. We can't store FUSE_INTERRUPT tickets + * indefinitely because their responses are optional. + * So we delete them when the original operation + * completes. And sadly the fuse_header_out doesn't + * identify the opcode, so we have to guess. + */ + err = 0; + } else { + err = EINVAL; + } } return (err); @@ -445,7 +576,7 @@ fuse_device_init(void) { fuse_dev = make_dev(&fuse_device_cdevsw, 0, UID_ROOT, GID_OPERATOR, - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, "fuse"); + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, "fuse"); if (fuse_dev == NULL) return (ENOMEM); return (0); Modified: stable/12/sys/fs/fuse/fuse_file.c ============================================================================== --- stable/12/sys/fs/fuse/fuse_file.c Sun Sep 15 02:59:53 2019 (r352350) +++ stable/12/sys/fs/fuse/fuse_file.c Sun Sep 15 04:14:31 2019 (r352351) @@ -33,6 +33,11 @@ * Copyright (C) 2005 Csaba Henk. * All rights reserved. * + * Copyright (c) 2019 The FreeBSD Foundation + * + * Portions of this software were developed by BFF Storage Systems, LLC 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: @@ -59,8 +64,9 @@ __FBSDID("$FreeBSD$"); #include -#include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 15 08:16: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 D0C79E694E; Sun, 15 Sep 2019 08:16:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46WMf53r0Pz46lP; Sun, 15 Sep 2019 08:16:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66D16564E; Sun, 15 Sep 2019 08:16:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8F8GTKJ006854; Sun, 15 Sep 2019 08:16:29 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8F8GTe3006853; Sun, 15 Sep 2019 08:16:29 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201909150816.x8F8GTe3006853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 15 Sep 2019 08:16: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: r352352 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352352 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 08:16:29 -0000 Author: bz Date: Sun Sep 15 08:16:28 2019 New Revision: 352352 URL: https://svnweb.freebsd.org/changeset/base/352352 Log: MFC 346554,346556,346595,348060,348061,348494 udp locking fixes Fix multiple possible locking problems found by syzkaller and update comment (which was wrong already anyway due to previous changes). Improve KASSERTs for debugging lock related issues. Fold two RSS sections together. Modified: stable/12/sys/netinet/udp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/udp_usrreq.c ============================================================================== --- stable/12/sys/netinet/udp_usrreq.c Sun Sep 15 04:14:31 2019 (r352351) +++ stable/12/sys/netinet/udp_usrreq.c Sun Sep 15 08:16:28 2019 (r352352) @@ -1156,9 +1156,23 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s src.sin_family = 0; sin = (struct sockaddr_in *)addr; +retry: if (sin == NULL || (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) { INP_WLOCK(inp); + /* + * In case we lost a race and another thread bound addr/port + * on the inp we cannot keep the wlock (which still would be + * fine) as further down, based on these values we make + * decisions for the pcbinfo lock. If the locks are not in + * synch the assertions on unlock will fire, hence we go for + * one retry loop. + */ + if (sin != NULL && (inp->inp_laddr.s_addr != INADDR_ANY || + inp->inp_lport != 0)) { + INP_WUNLOCK(inp); + goto retry; + } unlock_inp = UH_WLOCKED; } else { INP_RLOCK(inp); @@ -1258,36 +1272,44 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s } /* - * Depending on whether or not the application has bound or connected - * the socket, we may have to do varying levels of work. The optimal - * case is for a connected UDP socket, as a global lock isn't - * required at all. - * - * In order to decide which we need, we require stability of the - * inpcb binding, which we ensure by acquiring a read lock on the - * inpcb. This doesn't strictly follow the lock order, so we play - * the trylock and retry game; note that we may end up with more - * conservative locks than required the second time around, so later - * assertions have to accept that. Further analysis of the number of - * misses under contention is required. - * - * XXXRW: Check that hash locking update here is correct. + * In the old days, depending on whether or not the application had + * bound or connected the socket, we had to do varying levels of work. + * The optimal case was for a connected UDP socket, as a global lock + * wasn't required at all. + * In order to decide which we need, we required stability of the + * inpcb binding, which we ensured by acquiring a read lock on the + * inpcb. This didn't strictly follow the lock order, so we played + * the trylock and retry game. + * With the re-introduction of the route-cache in some cases, we started + * to acquire an early inp wlock and a possible race during re-lock + * went away. With the introduction of epoch(9) some read locking + * became epoch(9) and the lock-order issues also went away. + * Due to route-cache we may now hold more conservative locks than + * otherwise required and have split up the 2nd case in case 2 and 3 + * in order to keep the udpinfo lock level in sync with the inp one + * for the IP_SENDSRCADDR case below. */ pr = inp->inp_socket->so_proto->pr_protocol; pcbinfo = udp_get_inpcbinfo(pr); - sin = (struct sockaddr_in *)addr; if (sin != NULL && (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) { INP_HASH_WLOCK(pcbinfo); unlock_udbinfo = UH_WLOCKED; - } else if ((sin != NULL && ( - (sin->sin_addr.s_addr == INADDR_ANY) || - (sin->sin_addr.s_addr == INADDR_BROADCAST) || - (inp->inp_laddr.s_addr == INADDR_ANY) || - (inp->inp_lport == 0))) || - (src.sin_family == AF_INET)) { + } else if (sin != NULL && + (sin->sin_addr.s_addr == INADDR_ANY || + sin->sin_addr.s_addr == INADDR_BROADCAST || + inp->inp_laddr.s_addr == INADDR_ANY || + inp->inp_lport == 0)) { INP_HASH_RLOCK_ET(pcbinfo, et); unlock_udbinfo = UH_RLOCKED; + } else if (src.sin_family == AF_INET) { + if (unlock_inp == UH_WLOCKED) { + INP_HASH_WLOCK(pcbinfo); + unlock_udbinfo = UH_WLOCKED; + } else { + INP_HASH_RLOCK_ET(pcbinfo, et); + unlock_udbinfo = UH_RLOCKED; + } } else unlock_udbinfo = UH_UNLOCKED; @@ -1497,8 +1519,9 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s if (flowtype != M_HASHTYPE_NONE) { m->m_pkthdr.flowid = flowid; M_HASHTYPE_SET(m, flowtype); + } #ifdef RSS - } else { + else { uint32_t hash_val, hash_type; /* * Calculate an appropriate RSS hash for UDP and @@ -1521,10 +1544,8 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s m->m_pkthdr.flowid = hash_val; M_HASHTYPE_SET(m, hash_type); } -#endif } -#ifdef RSS /* * Don't override with the inp cached flowid value. * @@ -1559,12 +1580,22 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s release: if (unlock_udbinfo == UH_WLOCKED) { KASSERT(unlock_inp == UH_WLOCKED, - ("%s: excl udbinfo lock, shared inp lock", __func__)); + ("%s: excl udbinfo lock %#03x, shared inp lock %#03x, " + "sin %p daddr %#010x inp %p laddr %#010x lport %#06x " + "src fam %#04x", + __func__, unlock_udbinfo, unlock_inp, sin, + (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp, + inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family)); INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); } else if (unlock_udbinfo == UH_RLOCKED) { KASSERT(unlock_inp == UH_RLOCKED, - ("%s: shared udbinfo lock, excl inp lock", __func__)); + ("%s: shared udbinfo lock %#03x, excl inp lock %#03x, " + "sin %p daddr %#010x inp %p laddr %#010x lport %#06x " + "src fam %#04x", + __func__, unlock_udbinfo, unlock_inp, sin, + (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp, + inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family)); INP_HASH_RUNLOCK_ET(pcbinfo, et); INP_RUNLOCK(inp); } else if (unlock_inp == UH_WLOCKED) From owner-svn-src-all@freebsd.org Sun Sep 15 10:54: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 630DDEA24F; Sun, 15 Sep 2019 10:54:21 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46WR8F2hVXz4F6X; Sun, 15 Sep 2019 10:54:21 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F3A172B3; Sun, 15 Sep 2019 10:54:21 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FAsLpj001237; Sun, 15 Sep 2019 10:54:21 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FAsJpu001227; Sun, 15 Sep 2019 10:54:19 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201909151054.x8FAsJpu001227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sun, 15 Sep 2019 10:54: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: r352353 - stable/12/contrib/tzdata X-SVN-Group: stable-12 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/12/contrib/tzdata X-SVN-Commit-Revision: 352353 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 10:54:21 -0000 Author: philip Date: Sun Sep 15 10:54:18 2019 New Revision: 352353 URL: https://svnweb.freebsd.org/changeset/base/352353 Log: MFC r352238: Import tzdata 2019c Modified: stable/12/contrib/tzdata/NEWS stable/12/contrib/tzdata/asia stable/12/contrib/tzdata/australasia stable/12/contrib/tzdata/backzone stable/12/contrib/tzdata/europe stable/12/contrib/tzdata/leap-seconds.list stable/12/contrib/tzdata/leapseconds stable/12/contrib/tzdata/leapseconds.awk stable/12/contrib/tzdata/northamerica stable/12/contrib/tzdata/southamerica stable/12/contrib/tzdata/theory.html stable/12/contrib/tzdata/version Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/tzdata/NEWS ============================================================================== --- stable/12/contrib/tzdata/NEWS Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/NEWS Sun Sep 15 10:54:18 2019 (r352353) @@ -1,5 +1,80 @@ News for the tz database +Release 2019c - 2019-09-11 08:59:48 -0700 + + Briefly: + Fiji observes DST from 2019-11-10 to 2020-01-12. + Norfolk Island starts observing Australian-style DST. + + Changes to future timestamps + + Fiji's next DST transitions will be 2019-11-10 and 2020-01-12 + instead of 2019-11-03 and 2020-01-19. (Thanks to Raymond Kumar.) + Adjust future guesses accordingly. + + Norfolk Island will observe Australian-style DST starting in + spring 2019. The first transition is on 2019-10-06. (Thanks to + Kyle Czech and Michael Deckers.) + + Changes to past timestamps + + Many corrections to time in Turkey from 1940 through 1985. + (Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.) + + The Norfolk Island 1975-03-02 transition was at 02:00 standard + time, not 02:00 DST. (Thanks to Michael Deckers.) + + South Korea observed DST from 1948 through 1951. Although this + info was supposed to appear in release 2014j, a typo inadvertently + suppressed the change. (Thanks to Alois Treindl.) + + Detroit observed DST in 1967 and 1968 following the US DST rules, + except that its 1967 DST began on June 14 at 00:01. (Thanks to + Alois Treindl for pointing out that the old data entries were + probably wrong.) + + Fix several errors in pre-1970 transitions in Perry County, IN. + (Thanks to Alois Triendl for pointing out the 1967/9 errors.) + + Edmonton did not observe DST in 1967 or 1969. In 1946 Vancouver + ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not + 10-06. In 1945 Königsberg (now Kaliningrad) switched from +01/+02 + to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated + EET/EEST, not CET/CEST. (Thanks to Alois Triendl.) In 1946 + Königsberg switched to +03 on 04-07 not 01-01. + + In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not + 01-01 at 00:00. (Thanks to Alois Treindl and Michael Deckers.) + Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27. + + The 1892-05-01 transition in Brussels was at 00:17:30, not at noon. + (Thanks to Michael Deckers.) + + Changes to past time zone abbreviations and DST flags + + Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25, + is now flagged as DST and is abbreviated HKWT not HKT. + + Changes to code + + leapseconds.awk now relies only on its input data, rather than + also relying on its comments. (Inspired by code from Dennis + Ferguson and Chris Woodbury.) + + The code now defends against CRLFs in leap-seconds.list. + (Thanks to Brian Inglis and Chris Woodbury.) + + Changes to documentation and commentary + + theory.html discusses leap seconds. (Thanks to Steve Summit.) + + Nashville's newspapers dueled about the time of day in the 1950s. + (Thanks to John Seigenthaler.) + + Liechtenstein observed Swiss DST in 1941/2. + (Thanks to Alois Treindl.) + + Release 2019b - 2019-07-01 00:09:53 -0700 Briefly: Modified: stable/12/contrib/tzdata/asia ============================================================================== --- stable/12/contrib/tzdata/asia Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/asia Sun Sep 15 10:54:18 2019 (r352353) @@ -8,7 +8,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2018-06-19): +# From Paul Eggert (2019-07-11): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -47,13 +47,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China -# 8:00 PST PDT* Philippine Standard Time +# 8:00 HKT HKST Hong Kong (HKWT* for Winter Time in late 1941) +# 8:00 PST PDT* Philippines # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 -# 9:30 ACST Australian Central Standard Time -# *I invented the abbreviation PDT; see "Philippines" below. +# *I invented the abbreviations HKWT and PDT; see below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -653,6 +653,15 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # * 1941-09-30, Hong Kong Daily Press, Winter Time Warning. # https://i.imgur.com/dge4kFJ.png +# From Paul Eggert (2019-07-11): +# "Hong Kong winter time" is considered to be daylight saving. +# "Hong Kong had adopted daylight saving on June 15 as a wartime measure, +# clocks moving forward one hour until October 1, when they would be put back +# by just half an hour for 'Hong Kong Winter time', so that daylight saving +# operated year round." -- Low Z. The longest day: when wartime Hong Kong +# introduced daylight saving. South China Morning Post. 2019-06-28. +# https://www.scmp.com/magazines/post-magazine/short-reads/article/3016281/longest-day-when-wartime-hong-kong-introduced + # From P Chan (2018-12-31): # * According to the Hong Kong Daylight-Saving Regulations, 1941, the # 1941 spring-forward transition was at 03:00. @@ -754,7 +763,7 @@ Rule HK 1979 only - Oct 21 3:30 0 - Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 0:36:42 8:00 - HKT 1941 Jun 15 3:00 8:00 1:00 HKST 1941 Oct 1 4:00 - 8:30 - HKT 1941 Dec 25 + 8:00 0:30 HKWT 1941 Dec 25 9:00 - JST 1945 Nov 18 2:00 8:00 HK HK%sT @@ -2419,7 +2428,7 @@ Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Sep 8 - 9:00 - KST 1954 Mar 21 + 9:00 ROK K%sT 1954 Mar 21 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 @@ -3604,7 +3613,7 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and in South Vietnam in particular (after 1954): # To 07:00 on 1911-05-01. # To 08:00 on 1942-12-31 at 23:00. -# To 09:00 in 1945-03-14 at 23:00. +# To 09:00 on 1945-03-14 at 23:00. # To 07:00 on 1945-09-02 in Vietnam. # To 08:00 on 1947-04-01 in French-controlled Indochina. # To 07:00 on 1955-07-01 in South Vietnam. Modified: stable/12/contrib/tzdata/australasia ============================================================================== --- stable/12/contrib/tzdata/australasia Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/australasia Sun Sep 15 10:54:18 2019 (r352353) @@ -367,13 +367,18 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # From Raymond Kumar (2018-07-13): # http://www.fijitimes.com/government-approves-2018-daylight-saving/ # ... The daylight saving period will end at 3am on Sunday January 13, 2019. -# -# From Paul Eggert (2018-07-15): -# For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 13. January transitions reportedly + +# From Paul Eggert (2019-08-06): +# Today Raymond Kumar reported the Government of Fiji Gazette Supplement No. 27 +# (2019-08-02) said that Fiji observes DST "commencing at 2.00 am on +# Sunday, 10 November 2019 and ending at 3.00 am on Sunday, 12 January 2020." +# For now, guess DST from 02:00 the second Sunday in November to 03:00 +# the first Sunday on or after January 12. January transitions reportedly # depend on when school terms start. Although the guess is ad hoc, it matches -# transitions since late 2014 and seems more likely to match future -# practice than guessing no DST. +# transitions planned this year and seems more likely to match future practice +# than guessing no DST. +# From Michael Deckers (2019-08-06): +# https://www.laws.gov.fj/LawsAsMade/downloadfile/848 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -384,8 +389,9 @@ Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - +Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - +Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2019 max - Nov Sun>=8 2:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 @@ -604,10 +610,11 @@ Zone Pacific/Niue -11:19:40 - LMT 1901 # Alofi # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston 11:12 - +1112 1951 - 11:30 - +1130 1974 Oct 27 02:00 - 11:30 1:00 +1230 1975 Mar 2 02:00 - 11:30 - +1130 2015 Oct 4 02:00 - 11:00 - +11 + 11:30 - +1130 1974 Oct 27 02:00s + 11:30 1:00 +1230 1975 Mar 2 02:00s + 11:30 - +1130 2015 Oct 4 02:00s + 11:00 - +11 2019 Jul + 11:00 AN +11/+12 # Palau (Belau) # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -1875,12 +1882,21 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # ... at 12.30 am (by legal time in New South Wales) on 4 October 2015. # http://www.norfolkisland.gov.nf/nia/MediaRelease/Media%20Release%20Norfolk%20Island%20Standard%20Time%20Change.pdf -# From Paul Eggert (2015-09-23): +# From Paul Eggert (2019-08-28): # Transitions before 2015 are from timeanddate.com, which consulted # the Norfolk Island Museum and the Australian Bureau of Meteorology's # Norfolk Island station, and found no record of Norfolk observing DST # other than in 1974/5. See: # https://www.timeanddate.com/time/australia/norfolk-island.html +# However, disagree with timeanddate about the 1975-03-02 transition; +# timeanddate has 02:00 but 02:00s corresponds to what the NSW law said +# (thanks to Michael Deckers). + +# Norfolk started observing Australian DST in spring 2019. +# From Kyle Czech (2019-08-13): +# https://www.legislation.gov.au/Details/F2018L01702 +# From Michael Deckers (2019-08-14): +# https://www.legislation.gov.au/Details/F2019C00010 # Palau # See commentary for Micronesia. Modified: stable/12/contrib/tzdata/backzone ============================================================================== --- stable/12/contrib/tzdata/backzone Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/backzone Sun Sep 15 10:54:18 2019 (r352353) @@ -507,19 +507,35 @@ Zone Asia/Muscat 3:54:24 - LMT 1920 #Zone Asia/Panaji [not enough info to complete] # Cambodia -# From Paul Eggert (2014-10-11): -# See Asia/Ho_Chi_Minh for the source for most of this data. Also, guess -# (1) Cambodia reverted to UT +07 on 1945-09-02, when Vietnam did, and -# (2) they also reverted to +07 on 1953-11-09, the date of independence. -# These guesses are probably wrong but they're better than guessing no -# transitions there. + +# From an adoptive daughter of the late Cambodian ruler Prince Sihanouk, +# via Alois Treindl (2019-08-08): +# +# King Sihanouk said that, during the Japanese occupation, starting with +# what historians refer to as "le coup de force du 9 mars 1945", Cambodia, +# like the entire French Indochina, used Tokyo time zone. After Japan +# surrendered, 2 September 1945, Cambodia fell under French rule again and +# adopted Hanoi time zone again. +# +# However, on 7 January 1946, Sihanouk and Tioulong managed to obtain a +# status of "internal autonomy" from the government of Charles de Gaulle. +# Although many fields remained under the administration of the French +# (customs, taxes, justice, defence, foreign affairs, etc.), the Cambodian +# administration was responsible for religious matters and traditional +# celebrations, which included our calendar and time. The time zone was GMT +# + 7 and _no_ DST was applied. +# +# After Sihanouk and Tioulong achieved full independence, on 9 November 1953, +# GMT + 7 was maintained. + +# From Paul Eggert (2019-08-26): +# See Asia/Ho_Chi_Minh for the source for most of rest of this data. + Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jul 1 7:06:30 - PLMT 1911 May 1 7:00 - +07 1942 Dec 31 23:00 8:00 - +08 1945 Mar 14 23:00 9:00 - +09 1945 Sep 2 - 7:00 - +07 1947 Apr 1 - 8:00 - +08 1953 Nov 9 7:00 - +07 # Israel @@ -646,7 +662,7 @@ Zone Europe/Tiraspol 1:58:32 - LMT 1880 # Liechtenstein Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun - 1:00 - CET 1981 + 1:00 Swiss CE%sT 1981 1:00 EU CE%sT # Croatia Modified: stable/12/contrib/tzdata/europe ============================================================================== --- stable/12/contrib/tzdata/europe Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/europe Sun Sep 15 10:54:18 2019 (r352353) @@ -821,11 +821,16 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. +# From Alois Triendl (2019-07-22): +# In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. +# Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Austria 1920 only - Apr 5 2:00s 1:00 S Rule Austria 1920 only - Sep 13 2:00s 0 - Rule Austria 1946 only - Apr 14 2:00s 1:00 S -Rule Austria 1946 1948 - Oct Sun>=1 2:00s 0 - +Rule Austria 1946 only - Oct 7 2:00s 0 - +Rule Austria 1947 1948 - Oct Sun>=1 2:00s 0 - Rule Austria 1947 only - Apr 6 2:00s 1:00 S Rule Austria 1948 only - Apr 18 2:00s 1:00 S Rule Austria 1980 only - Apr 6 0:00 1:00 S @@ -875,15 +880,35 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 # Belgium # -# From Paul Eggert (1997-07-02): +# From Michael Deckers (2019-08-25): +# The exposition in the web page +# https://www.bestor.be/wiki/index.php/Voyager_dans_le_temps._L%E2%80%99introduction_de_la_norme_de_Greenwich_en_Belgique +# gives several contemporary sources from which one can conclude that +# the switch in Europe/Brussels on 1892-05-01 was from 00:17:30 to 00:00:00. +# +# From Paul Eggert (2019-08-28): +# This quote helps explain the late-1914 situation: +# In early November 1914, the Germans imposed the time zone used in central +# Europe and forced the inhabitants to set their watches and public clocks +# sixty minutes ahead. Many were reluctant to accept "German time" and +# continued to use "Belgian time" among themselves. Reflecting the spirit of +# resistance that arose in the population, a song made fun of this change.... +# The song ended: +# Putting your clock forward +# Will but hasten the happy hour +# When we kick out the Boches! +# See: Pluvinage G. Brussels on German time. Cahiers Bruxellois - +# Brusselse Cahiers. 2014;XLVI(1E):15-38. +# https://www.cairn.info/revue-cahiers-bruxellois-2014-1E-page-15.htm +# +# Entries from 1914 through 1917 are taken from "De tijd in België" +# . # Entries from 1918 through 1991 are taken from: # Annuaire de L'Observatoire Royal de Belgique, # Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991 # (Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC), # pp 8-9. -# LMT before 1892 was 0:17:30, according to the official journal of Belgium: -# Moniteur Belge, Samedi 30 Avril 1892, N.121. -# Thanks to Pascal Delmoitie for these references. +# Thanks to Pascal Delmoitie for the 1918/1991 references. # The 1918 rules are listed for completeness; they apply to unoccupied Belgium. # Assume Brussels switched to WET in 1918 when the armistice took effect. # @@ -928,7 +953,7 @@ Rule Belgium 1946 only - May 19 2:00s 1:00 S Rule Belgium 1946 only - Oct 7 2:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Brussels 0:17:30 - LMT 1880 - 0:17:30 - BMT 1892 May 1 12:00 # Brussels MT + 0:17:30 - BMT 1892 May 1 00:17:30 0:00 - WET 1914 Nov 8 1:00 - CET 1916 May 1 0:00 1:00 C-Eur CE%sT 1918 Nov 11 11:00u @@ -1627,6 +1652,13 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # +# From Alois Triendl (2019-07-02): +# I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, +# for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 +# am, put forward the clock by one hour. Remember that in the night between +# today and Monday the 'ora legale' will come in force again." That makes it +# clear that in Rome the change was on Monday, 3 April 1944 at 2 am. +# # From Paul Eggert (2016-10-27): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. @@ -1774,15 +1806,10 @@ Zone Europe/Riga 1:36:34 - LMT 1880 # From Paul Eggert (2013-09-09): # Shanks & Pottenger say Vaduz is like Zurich. -# From Alois Treindl (2013-09-18): -# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf -# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942. -# I ... translate only the last two paragraphs: -# ... during second world war, in the years 1941 and 1942, Liechtenstein -# introduced daylight saving time, adapting to Switzerland. From 1943 on -# central European time was in force throughout the year. -# From a report of the duke's government to the high council, -# regarding the introduction of a time law, of 31 May 1977. +# From Alois Treindl (2019-07-04): +# I was able to access the online archive of the Vaduz paper Vaterland ... +# I could confirm from the paper that Liechtenstein did in fact follow +# the same DST in 1941 and 1942 as Switzerland did. Link Europe/Zurich Europe/Vaduz @@ -2490,6 +2517,12 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast +# From Paul Eggert (2019-07-25): +# Although Shanks lists 1945-01-01 as the date for transition from +# +01/+02 to +02/+03, more likely this is a placeholder. Guess that +# the transition occurred at 1945-04-10 00:00, which is about when +# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) + # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). @@ -2506,8 +2539,8 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Moscow on 1991-11-03, switched to Moscow-1 on 1992-01-19. Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr - 1:00 C-Eur CE%sT 1945 - 2:00 Poland CE%sT 1946 + 1:00 C-Eur CE%sT 1945 Apr 10 + 2:00 Poland EE%sT 1946 Apr 7 3:00 Russia MSK/MSD 1989 Mar 26 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s 3:00 - +03 2014 Oct 26 2:00s @@ -3650,20 +3683,75 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # Turkey +# From Alois Treindl (2019-08-12): +# http://www.astrolojidergisi.com/yazsaati.htm has researched the time zone +# history of Turkey, based on newspaper archives and official documents. +# From Paul Eggert (2019-08-28): +# That source (Oya Vulaş, "Türkiye'de Yaz Saati Uygulamaları") +# is used for 1940/1972, where it seems more reliable than our other +# sources. + +# From Kıvanç Yazan (2019-08-12): +# http://www.resmigazete.gov.tr/arsiv/14539.pdf#page=24 +# 1973-06-03 01:00 -> 02:00, 1973-11-04 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/14829.pdf#page=1 +# 1974-03-31 02:00 -> 03:00, 1974-11-03 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15161.pdf#page=1 +# 1975-03-22 02:00 -> 03:00, 1975-11-02 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15535_1.pdf#page=1 +# 1976-03-21 02:00 -> 03:00, 1976-10-31 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15778.pdf#page=5 +# 1977-04-03 02:00 -> 03:00, 1977-10-16 02:00 -> 01:00, +# 1978-04-02 02:00 -> 03:00 (not applied, see below) +# 1978-10-15 02:00 -> 01:00 (not applied, see below) +# 1979-04-01 02:00 -> 03:00 (not applied, see below) +# 1979-10-14 02:00 -> 01:00 (not applied, see below) +# +# http://www.resmigazete.gov.tr/arsiv/16245.pdf#page=17 +# This cancels the previous decision, and repeats it only for 1978. +# 1978-04-02 02:00 -> 03:00, 1978-10-15 02:00 -> 01:00 +# (not applied due to standard TZ change below) +# +# http://www.resmigazete.gov.tr/arsiv/16331.pdf#page=3 +# This decision changes the default longitude for Turkish time zone from 30 +# degrees East to 45 degrees East. This means a standard TZ change, from +2 +# to +3. This is published & applied on 1978-06-29. At that time, Turkey was +# already on summer time (already on 45E). Hence, this new law just meant an +# "continuous summer time". Note that this was reversed in a few years. +# +# http://www.resmigazete.gov.tr/arsiv/18119_1.pdf#page=1 +# 1983-07-31 02:00 -> 03:00 (note that this jumps TZ to +4) +# 1983-10-02 02:00 -> 01:00 (back to +3) +# +# http://www.resmigazete.gov.tr/arsiv/18561.pdf (page 1 and 34) +# At this time, Turkey is still on +3 with no spring-forward on early +# 1984. This decision is published on 10/31/1984. Page 1 declares +# the decision of reverting the "default longitude change". So the +# standard time should go back to +3 (30E). And page 34 explains when +# that will happen: 1984-11-01 02:00 -> 01:00. You can think of this +# as "end of continuous summer time, change of standard time zone". +# +# http://www.resmigazete.gov.tr/arsiv/18713.pdf#page=1 +# 1985-04-20 01:00 -> 02:00, 1985-09-28 02:00 -> 01:00 + # From Kıvanç Yazan (2016-09-25): # 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with # no exceptions. # 2) 1994's lastSun was overridden with Mar 20 ... # Here are official papers: -# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 -# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 -# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 -# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 -# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 -# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 -# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 -# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 -# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/arsiv/19032.pdf#page=2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf#page=4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf#page=15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf#page=6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf#page=1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf#page=15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf#page=1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf#page=1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf#page=10 for 1998 - 2000 # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): @@ -3747,46 +3835,36 @@ Rule Turkey 1922 only - Oct 8 0:00 0 - Rule Turkey 1924 only - May 13 0:00 1:00 S Rule Turkey 1924 1925 - Oct 1 0:00 0 - Rule Turkey 1925 only - May 1 0:00 1:00 S -Rule Turkey 1940 only - Jun 30 0:00 1:00 S -Rule Turkey 1940 only - Oct 5 0:00 0 - +Rule Turkey 1940 only - Jul 1 0:00 1:00 S +Rule Turkey 1940 only - Oct 6 0:00 0 - Rule Turkey 1940 only - Dec 1 0:00 1:00 S Rule Turkey 1941 only - Sep 21 0:00 0 - Rule Turkey 1942 only - Apr 1 0:00 1:00 S -# Whitman omits the next two transition and gives 1945 Oct 1; -# go with Shanks & Pottenger. -Rule Turkey 1942 only - Nov 1 0:00 0 - -Rule Turkey 1945 only - Apr 2 0:00 1:00 S Rule Turkey 1945 only - Oct 8 0:00 0 - Rule Turkey 1946 only - Jun 1 0:00 1:00 S Rule Turkey 1946 only - Oct 1 0:00 0 - Rule Turkey 1947 1948 - Apr Sun>=16 0:00 1:00 S -Rule Turkey 1947 1950 - Oct Sun>=2 0:00 0 - +Rule Turkey 1947 1951 - Oct Sun>=2 0:00 0 - Rule Turkey 1949 only - Apr 10 0:00 1:00 S -Rule Turkey 1950 only - Apr 19 0:00 1:00 S +Rule Turkey 1950 only - Apr 16 0:00 1:00 S Rule Turkey 1951 only - Apr 22 0:00 1:00 S -Rule Turkey 1951 only - Oct 8 0:00 0 - +# DST for 15 months; unusual but we'll let it pass. Rule Turkey 1962 only - Jul 15 0:00 1:00 S -Rule Turkey 1962 only - Oct 8 0:00 0 - +Rule Turkey 1963 only - Oct 30 0:00 0 - Rule Turkey 1964 only - May 15 0:00 1:00 S Rule Turkey 1964 only - Oct 1 0:00 0 - -Rule Turkey 1970 1972 - May Sun>=2 0:00 1:00 S -Rule Turkey 1970 1972 - Oct Sun>=2 0:00 0 - Rule Turkey 1973 only - Jun 3 1:00 1:00 S -Rule Turkey 1973 only - Nov 4 3:00 0 - +Rule Turkey 1973 1976 - Oct Sun>=31 2:00 0 - Rule Turkey 1974 only - Mar 31 2:00 1:00 S -Rule Turkey 1974 only - Nov 3 5:00 0 - -Rule Turkey 1975 only - Mar 30 0:00 1:00 S -Rule Turkey 1975 1976 - Oct lastSun 0:00 0 - -Rule Turkey 1976 only - Jun 1 0:00 1:00 S -Rule Turkey 1977 1978 - Apr Sun>=1 0:00 1:00 S -Rule Turkey 1977 only - Oct 16 0:00 0 - -Rule Turkey 1979 1980 - Apr Sun>=1 3:00 1:00 S -Rule Turkey 1979 1982 - Oct Mon>=11 0:00 0 - -Rule Turkey 1981 1982 - Mar lastSun 3:00 1:00 S -Rule Turkey 1983 only - Jul 31 0:00 1:00 S -Rule Turkey 1983 only - Oct 2 0:00 0 - -Rule Turkey 1985 only - Apr 20 0:00 1:00 S -Rule Turkey 1985 only - Sep 28 0:00 0 - +Rule Turkey 1975 only - Mar 22 2:00 1:00 S +Rule Turkey 1976 only - Mar 21 2:00 1:00 S +Rule Turkey 1977 1978 - Apr Sun>=1 2:00 1:00 S +Rule Turkey 1977 1978 - Oct Sun>=15 2:00 0 - +Rule Turkey 1978 only - Jun 29 0:00 0 - +Rule Turkey 1983 only - Jul 31 2:00 1:00 S +Rule Turkey 1983 only - Oct 2 2:00 0 - +Rule Turkey 1985 only - Apr 20 1:00s 1:00 S +Rule Turkey 1985 only - Sep 28 1:00s 0 - Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - Rule Turkey 1994 only - Mar 20 1:00s 1:00 S @@ -3795,8 +3873,8 @@ Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 1:56:56 - IMT 1910 Oct # Istanbul Mean Time? - 2:00 Turkey EE%sT 1978 Oct 15 - 3:00 Turkey +03/+04 1985 Apr 20 + 2:00 Turkey EE%sT 1978 Jun 29 + 3:00 Turkey +03/+04 1984 Nov 1 2:00 2:00 Turkey EE%sT 2007 2:00 EU EE%sT 2011 Mar 27 1:00u 2:00 - EET 2011 Mar 28 1:00u Modified: stable/12/contrib/tzdata/leap-seconds.list ============================================================================== --- stable/12/contrib/tzdata/leap-seconds.list Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/leap-seconds.list Sun Sep 15 10:54:18 2019 (r352353) @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 # -#@ 3786480000 +#@ 3802291200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a +#h f28827d2 f263b6c3 ec0f19eb a3e0dbf0 97f3fa30 Modified: stable/12/contrib/tzdata/leapseconds ============================================================================== --- stable/12/contrib/tzdata/leapseconds Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/leapseconds Sun Sep 15 10:54:18 2019 (r352353) @@ -3,36 +3,39 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which can be copied from +# NIST format leap-seconds.list file, which can be copied from # -# or -# or . +# or . # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds # . -# The International Earth Rotation and Reference Systems Service +# The rules for leap seconds are specified in Annex 1 (Time scales) of: +# Standard-frequency and time-signal emissions. +# International Telecommunication Union - Radiocommunication Sector +# (ITU-R) Recommendation TF.460-6 (02/2002) +# . +# The International Earth Rotation and Reference Systems Service (IERS) # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space) +# (a proxy for Earth's angle in space as measured by astronomers) # and publishes leap second data in a copyrighted file # . # See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 # . -# There were no leap seconds before 1972, because the official mechanism -# accounting for the discrepancy between atomic time and the earth's rotation -# did not exist. The first ("1 Jan 1972") data line in leap-seconds.list +# There were no leap seconds before 1972, as no official mechanism +# accounted for the discrepancy between atomic time (TAI) and the earth's +# rotation. The first ("1 Jan 1972") data line in leap-seconds.list # does not denote a leap second; it denotes the start of the current definition # of UTC. -# The correction (+ or -) is made at the given time, so lines -# will typically look like: -# Leap YEAR MON DAY 23:59:60 + R/S -# or -# Leap YEAR MON DAY 23:59:59 - R/S - -# If the leap second is Rolling (R) the given time is local time (unused here). +# All leap-seconds are Stationary (S) at the given UTC time. +# The correction (+ or -) is made at the given time, so in the unlikely +# event of a negative leap second, a line would look like this: +# Leap YEAR MON DAY 23:59:59 - S +# Typical lines look like this: +# Leap YEAR MON DAY 23:59:60 + S Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -62,8 +65,8 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S # POSIX timestamps for the data in this file: -#updated 1467936000 -#expires 1577491200 +#updated 1467936000 (2016-07-08 00:00:00 UTC) +#expires 1593302400 (2020-06-28 00:00:00 UTC) -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 Modified: stable/12/contrib/tzdata/leapseconds.awk ============================================================================== --- stable/12/contrib/tzdata/leapseconds.awk Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/leapseconds.awk Sun Sep 15 10:54:18 2019 (r352353) @@ -1,43 +1,59 @@ -# Generate the 'leapseconds' file from 'leap-seconds.list'. +# Generate zic format 'leapseconds' from NIST format 'leap-seconds.list'. # This file is in the public domain. +# This program uses awk arithmetic. POSIX requires awk to support +# exact integer arithmetic only through 10**10, which means for NTP +# timestamps this program works only to the year 2216, which is the +# year 1900 plus 10**10 seconds. However, in practice +# POSIX-conforming awk implementations invariably use IEEE-754 double +# and so support exact integers through 2**53. By the year 2216, +# POSIX will almost surely require at least 2**53 for awk, so for NTP +# timestamps this program should be good until the year 285,428,681 +# (the year 1900 plus 2**53 seconds). By then leap seconds will be +# long obsolete, as the Earth will likely slow down so much that +# there will be more than 25 hours per day and so some other scheme +# will be needed. + BEGIN { print "# Allowance for leap seconds added to each time zone file." print "" print "# This file is in the public domain." print "" print "# This file is generated automatically from the data in the public-domain" - print "# leap-seconds.list file, which can be copied from" + print "# NIST format leap-seconds.list file, which can be copied from" print "# " - print "# or " - print "# or ." + print "# or ." print "# For more about leap-seconds.list, please see" print "# The NTP Timescale and Leap Seconds" print "# ." print "" - print "# The International Earth Rotation and Reference Systems Service" + print "# The rules for leap seconds are specified in Annex 1 (Time scales) of:" + print "# Standard-frequency and time-signal emissions." + print "# International Telecommunication Union - Radiocommunication Sector" + print "# (ITU-R) Recommendation TF.460-6 (02/2002)" + print "# ." + print "# The International Earth Rotation and Reference Systems Service (IERS)" print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1" - print "# (which measures the true angular orientation of the earth in space)" + print "# (a proxy for Earth's angle in space as measured by astronomers)" print "# and publishes leap second data in a copyrighted file" print "# ." print "# See: Levine J. Coordinated Universal Time and the leap second." print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995" print "# ." print "" - print "# There were no leap seconds before 1972, because the official mechanism" - print "# accounting for the discrepancy between atomic time and the earth's rotation" - print "# did not exist. The first (\"1 Jan 1972\") data line in leap-seconds.list" + print "# There were no leap seconds before 1972, as no official mechanism" + print "# accounted for the discrepancy between atomic time (TAI) and the earth's" + print "# rotation. The first (\"1 Jan 1972\") data line in leap-seconds.list" print "# does not denote a leap second; it denotes the start of the current definition" - print"# of UTC." + print "# of UTC." print "" - print "# The correction (+ or -) is made at the given time, so lines" - print "# will typically look like:" - print "# Leap YEAR MON DAY 23:59:60 + R/S" - print "# or" - print "# Leap YEAR MON DAY 23:59:59 - R/S" - print "" - print "# If the leap second is Rolling (R) the given time is local time (unused here)." + print "# All leap-seconds are Stationary (S) at the given UTC time." + print "# The correction (+ or -) is made at the given time, so in the unlikely" + print "# event of a negative leap second, a line would look like this:" + print "# Leap YEAR MON DAY 23:59:59 - S" + print "# Typical lines look like this:" + print "# Leap YEAR MON DAY 23:59:60 + S" monthabbr[ 1] = "Jan" monthabbr[ 2] = "Feb" @@ -51,45 +67,34 @@ BEGIN { monthabbr[10] = "Oct" monthabbr[11] = "Nov" monthabbr[12] = "Dec" - for (i in monthabbr) { - monthnum[monthabbr[i]] = i - monthlen[i] = 31 - } - monthlen[2] = 28 - monthlen[4] = monthlen[6] = monthlen[9] = monthlen[11] = 30 + + # Strip trailing CR, in case the input has CRLF form a la NIST. + RS = "\r?\n" + + sstamp_init() } -/^#\tUpdated through/ || /^#\tFile expires on:/ { +/^#[ \t]*[Uu]pdated through/ || /^#[ \t]*[Ff]ile expires on/ { last_lines = last_lines $0 "\n" } /^#[$][ \t]/ { updated = $2 } /^#[@][ \t]/ { expires = $2 } -/^#/ { next } +/^[ \t]*#/ { next } { NTP_timestamp = $1 TAI_minus_UTC = $2 - hash_mark = $3 - one = $4 - month = $5 - year = $6 if (old_TAI_minus_UTC) { if (old_TAI_minus_UTC < TAI_minus_UTC) { sign = "23:59:60\t+" } else { sign = "23:59:59\t-" } - m = monthnum[month] - 1 - if (m == 0) { - year--; - m = 12 - } - month = monthabbr[m] - day = monthlen[m] - day += m == 2 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) - printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign + sstamp_to_ymdhMs(NTP_timestamp - 1, ss_NTP) + printf "Leap\t%d\t%s\t%d\t%s\tS\n", \ + ss_year, monthabbr[ss_month], ss_mday, sign } old_TAI_minus_UTC = TAI_minus_UTC } @@ -102,7 +107,117 @@ END { print "" print "# POSIX timestamps for the data in this file:" - printf "#updated %s\n", updated - epoch_minus_NTP - printf "#expires %s\n", expires - epoch_minus_NTP + sstamp_to_ymdhMs(updated, ss_NTP) + printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + updated - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + sstamp_to_ymdhMs(expires, ss_NTP) + printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + expires - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + printf "\n%s", last_lines +} + +# sstamp_to_ymdhMs - convert seconds timestamp to date and time +# +# Call as: +# +# sstamp_to_ymdhMs(sstamp, epoch_days) +# +# where: +# +# sstamp - is the seconds timestamp. +# epoch_days - is the timestamp epoch in Gregorian days since 1600-03-01. +# ss_NTP is appropriate for an NTP sstamp. +# +# Both arguments should be nonnegative integers. +# On return, the following variables are set based on sstamp: +# +# ss_year - Gregorian calendar year +# ss_month - month of the year (1-January to 12-December) +# ss_mday - day of the month (1-31) +# ss_hour - hour (0-23) +# ss_min - minute (0-59) +# ss_sec - second (0-59) +# ss_wday - day of week (0-Sunday to 6-Saturday) +# +# The function sstamp_init should be called prior to using sstamp_to_ymdhMs. + +function sstamp_init() +{ + # Days in month N, where March is month 0 and January month 10. + ss_mon_days[ 0] = 31 + ss_mon_days[ 1] = 30 + ss_mon_days[ 2] = 31 + ss_mon_days[ 3] = 30 + ss_mon_days[ 4] = 31 + ss_mon_days[ 5] = 31 + ss_mon_days[ 6] = 30 + ss_mon_days[ 7] = 31 + ss_mon_days[ 8] = 30 + ss_mon_days[ 9] = 31 + ss_mon_days[10] = 31 + + # Counts of days in a Gregorian year, quad-year, century, and quad-century. + ss_year_days = 365 + ss_quadyear_days = ss_year_days * 4 + 1 + ss_century_days = ss_quadyear_days * 25 - 1 + ss_quadcentury_days = ss_century_days * 4 + 1 + + # Standard day epochs, suitable for epoch_days. + # ss_MJD = 94493 + # ss_POSIX = 135080 + ss_NTP = 109513 +} + +function sstamp_to_ymdhMs(sstamp, epoch_days, \ + quadcentury, century, quadyear, year, month, day) +{ + ss_hour = int(sstamp / 3600) % 24 + ss_min = int(sstamp / 60) % 60 + ss_sec = sstamp % 60 + + # Start with a count of days since 1600-03-01 Gregorian. + day = epoch_days + int(sstamp / (24 * 60 * 60)) + + # Compute a year-month-day date with days of the month numbered + # 0-30, months (March-February) numbered 0-11, and years that start + # start March 1 and end after the last day of February. A quad-year + # starts on March 1 of a year evenly divisible by 4 and ends after + # the last day of February 4 years later. A century starts on and + # ends before March 1 in years evenly divisible by 100. + # A quad-century starts on and ends before March 1 in years divisible + # by 400. While the number of days in a quad-century is a constant, + # the number of days in each other time period can vary by 1. + # Any variation is in the last day of the time period (there might + # or might not be a February 29) where it is easy to deal with. + + quadcentury = int(day / ss_quadcentury_days) + day -= quadcentury * ss_quadcentury_days + ss_wday = (day + 3) % 7 + century = int(day / ss_century_days) + century -= century == 4 + day -= century * ss_century_days + quadyear = int(day / ss_quadyear_days) + day -= quadyear * ss_quadyear_days + year = int(day / ss_year_days) + year -= year == 4 + day -= year * ss_year_days + for (month = 0; month < 11; month++) { + if (day < ss_mon_days[month]) + break + day -= ss_mon_days[month] + } + + # Convert the date to a conventional day of month (1-31), + # month (1-12, January-December) and Gregorian year. + ss_mday = day + 1 + if (month <= 9) { + ss_month = month + 3 + } else { + ss_month = month - 9 + year++ + } + ss_year = 1600 + quadcentury * 400 + century * 100 + quadyear * 4 + year } Modified: stable/12/contrib/tzdata/northamerica ============================================================================== --- stable/12/contrib/tzdata/northamerica Sun Sep 15 08:16:28 2019 (r352352) +++ stable/12/contrib/tzdata/northamerica Sun Sep 15 10:54:18 2019 (r352353) @@ -406,6 +406,31 @@ Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03 # From Paul Eggert (2015-12-25): # Assume this practice predates 1970, so Fort Pierre can use America/Chicago. +# From Paul Eggert (2015-04-06): +# In 1950s Nashville a public clock had dueling faces, one for conservatives +# and the other for liberals; the two sides didn't agree about the time of day. +# I haven't found a photo of this clock, nor have I tracked down the TIME +# magazine report cited below, but here's the story as told by the late +# American journalist John Seigenthaler, who was there: +# +# "The two [newspaper] owners held strongly contrasting political and +# ideological views. Evans was a New South liberal, Stahlman an Old South +# conservative, and their two papers frequently clashed editorially, often on +# the same day.... In the 1950s as the state legislature was grappling with +# the question of whether to approve daylight saving time for the entire state, +# TIME magazine reported: +# +# "'The Nashville Banner and The Nashville Tennessean rarely agree on anything +# but the time of day - and last week they couldn't agree on that.' +# +# "It was all too true. The clock on the front of the building had two faces - +# The Tennessean side of the building facing west, the other, east. When it +# was high noon Banner time, it was 11 a.m. Tennessean time." +# +# Seigenthaler J. For 100 years, Tennessean had it covered. +# The Tennessean 2007-05-11, republished 2015-04-06. +# https://www.tennessean.com/story/insider/extras/2015/04/06/archives-seigenthaler-for-100-years-the-tennessean-had-it-covered/25348545/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Chicago 1920 only - Jun 13 2:00 1:00 D Rule Chicago 1920 1921 - Oct lastSun 2:00 0 S @@ -945,21 +970,21 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. +# From Alois Triendl (2019-07-09): +# The Indianapolis News, Friday 27 October 1967 states that Perry County +# returned to CST. It went again to EST on 27 April 1969, as documented by the +# Indianapolis star of Saturday 26 April. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER -Rule Perry 1946 only - Apr lastSun 2:00 1:00 D -Rule Perry 1946 only - Sep lastSun 2:00 0 S -Rule Perry 1953 1954 - Apr lastSun 2:00 1:00 D -Rule Perry 1953 1959 - Sep lastSun 2:00 0 S Rule Perry 1955 only - May 1 0:00 1:00 D +Rule Perry 1955 1960 - Sep lastSun 2:00 0 S Rule Perry 1956 1963 - Apr lastSun 2:00 1:00 D -Rule Perry 1960 only - Oct lastSun 2:00 0 S -Rule Perry 1961 only - Sep lastSun 2:00 0 S -Rule Perry 1962 1963 - Oct lastSun 2:00 0 S +Rule Perry 1961 1963 - Oct lastSun 2:00 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Tell_City -5:47:03 - LMT 1883 Nov 18 12:12:57 -6:00 US C%sT 1946 -6:00 Perry C%sT 1964 Apr 26 2:00 - -5:00 - EST 1969 + -5:00 - EST 1967 Oct 29 2:00 + -6:00 US C%sT 1969 Apr 27 2:00 -5:00 US E%sT 1971 -5:00 - EST 2006 Apr 2 2:00 -6:00 US C%sT @@ -1035,16 +1060,27 @@ Zone America/Indiana/Vevay -5:40:16 - LMT 1883 Nov 18 # clear how this matched civil time in Louisville, so for now continue # to assume Louisville switched at noon new local time, like New York. # +# From Michael Deckers (2019-08-06): +# From the contemporary source given by Alois Treindl, +# the switch in Louisville on 1946-04-28 was on 00:01 +# From Paul Eggert (2019-08-26): +# That source was the Louisville Courier-Journal, 1946-04-27, p 4. +# Shanks gives 02:00 for all 20th-century transition times in Louisville. +# Evidently this is wrong for spring 1946. Although also likely wrong +# for other dates, we have no data. +# # Part of Kentucky left its clocks alone in 1974. # This also includes Clark, Floyd, and Harrison counties in Indiana. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 15 10:54: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 E35EDEA2B3; Sun, 15 Sep 2019 10:54:35 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46WR8W6TkPz4FDF; Sun, 15 Sep 2019 10:54:35 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C276172B4; Sun, 15 Sep 2019 10:54:35 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FAsZxZ001312; Sun, 15 Sep 2019 10:54:35 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FAsXDQ001295; Sun, 15 Sep 2019 10:54:33 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201909151054.x8FAsXDQ001295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sun, 15 Sep 2019 10:54:33 +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: r352354 - stable/11/contrib/tzdata X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/contrib/tzdata X-SVN-Commit-Revision: 352354 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 10:54:36 -0000 Author: philip Date: Sun Sep 15 10:54:33 2019 New Revision: 352354 URL: https://svnweb.freebsd.org/changeset/base/352354 Log: MFC r352238: Import tzdata 2019c Modified: stable/11/contrib/tzdata/NEWS stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/backzone stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/leap-seconds.list stable/11/contrib/tzdata/leapseconds stable/11/contrib/tzdata/leapseconds.awk stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/southamerica stable/11/contrib/tzdata/theory.html stable/11/contrib/tzdata/version Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/NEWS ============================================================================== --- stable/11/contrib/tzdata/NEWS Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/NEWS Sun Sep 15 10:54:33 2019 (r352354) @@ -1,5 +1,80 @@ News for the tz database +Release 2019c - 2019-09-11 08:59:48 -0700 + + Briefly: + Fiji observes DST from 2019-11-10 to 2020-01-12. + Norfolk Island starts observing Australian-style DST. + + Changes to future timestamps + + Fiji's next DST transitions will be 2019-11-10 and 2020-01-12 + instead of 2019-11-03 and 2020-01-19. (Thanks to Raymond Kumar.) + Adjust future guesses accordingly. + + Norfolk Island will observe Australian-style DST starting in + spring 2019. The first transition is on 2019-10-06. (Thanks to + Kyle Czech and Michael Deckers.) + + Changes to past timestamps + + Many corrections to time in Turkey from 1940 through 1985. + (Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.) + + The Norfolk Island 1975-03-02 transition was at 02:00 standard + time, not 02:00 DST. (Thanks to Michael Deckers.) + + South Korea observed DST from 1948 through 1951. Although this + info was supposed to appear in release 2014j, a typo inadvertently + suppressed the change. (Thanks to Alois Treindl.) + + Detroit observed DST in 1967 and 1968 following the US DST rules, + except that its 1967 DST began on June 14 at 00:01. (Thanks to + Alois Treindl for pointing out that the old data entries were + probably wrong.) + + Fix several errors in pre-1970 transitions in Perry County, IN. + (Thanks to Alois Triendl for pointing out the 1967/9 errors.) + + Edmonton did not observe DST in 1967 or 1969. In 1946 Vancouver + ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not + 10-06. In 1945 Königsberg (now Kaliningrad) switched from +01/+02 + to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated + EET/EEST, not CET/CEST. (Thanks to Alois Triendl.) In 1946 + Königsberg switched to +03 on 04-07 not 01-01. + + In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not + 01-01 at 00:00. (Thanks to Alois Treindl and Michael Deckers.) + Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27. + + The 1892-05-01 transition in Brussels was at 00:17:30, not at noon. + (Thanks to Michael Deckers.) + + Changes to past time zone abbreviations and DST flags + + Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25, + is now flagged as DST and is abbreviated HKWT not HKT. + + Changes to code + + leapseconds.awk now relies only on its input data, rather than + also relying on its comments. (Inspired by code from Dennis + Ferguson and Chris Woodbury.) + + The code now defends against CRLFs in leap-seconds.list. + (Thanks to Brian Inglis and Chris Woodbury.) + + Changes to documentation and commentary + + theory.html discusses leap seconds. (Thanks to Steve Summit.) + + Nashville's newspapers dueled about the time of day in the 1950s. + (Thanks to John Seigenthaler.) + + Liechtenstein observed Swiss DST in 1941/2. + (Thanks to Alois Treindl.) + + Release 2019b - 2019-07-01 00:09:53 -0700 Briefly: Modified: stable/11/contrib/tzdata/asia ============================================================================== --- stable/11/contrib/tzdata/asia Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/asia Sun Sep 15 10:54:33 2019 (r352354) @@ -8,7 +8,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2018-06-19): +# From Paul Eggert (2019-07-11): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -47,13 +47,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China -# 8:00 PST PDT* Philippine Standard Time +# 8:00 HKT HKST Hong Kong (HKWT* for Winter Time in late 1941) +# 8:00 PST PDT* Philippines # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 -# 9:30 ACST Australian Central Standard Time -# *I invented the abbreviation PDT; see "Philippines" below. +# *I invented the abbreviations HKWT and PDT; see below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -653,6 +653,15 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # * 1941-09-30, Hong Kong Daily Press, Winter Time Warning. # https://i.imgur.com/dge4kFJ.png +# From Paul Eggert (2019-07-11): +# "Hong Kong winter time" is considered to be daylight saving. +# "Hong Kong had adopted daylight saving on June 15 as a wartime measure, +# clocks moving forward one hour until October 1, when they would be put back +# by just half an hour for 'Hong Kong Winter time', so that daylight saving +# operated year round." -- Low Z. The longest day: when wartime Hong Kong +# introduced daylight saving. South China Morning Post. 2019-06-28. +# https://www.scmp.com/magazines/post-magazine/short-reads/article/3016281/longest-day-when-wartime-hong-kong-introduced + # From P Chan (2018-12-31): # * According to the Hong Kong Daylight-Saving Regulations, 1941, the # 1941 spring-forward transition was at 03:00. @@ -754,7 +763,7 @@ Rule HK 1979 only - Oct 21 3:30 0 - Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 0:36:42 8:00 - HKT 1941 Jun 15 3:00 8:00 1:00 HKST 1941 Oct 1 4:00 - 8:30 - HKT 1941 Dec 25 + 8:00 0:30 HKWT 1941 Dec 25 9:00 - JST 1945 Nov 18 2:00 8:00 HK HK%sT @@ -2419,7 +2428,7 @@ Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Sep 8 - 9:00 - KST 1954 Mar 21 + 9:00 ROK K%sT 1954 Mar 21 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 @@ -3604,7 +3613,7 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and in South Vietnam in particular (after 1954): # To 07:00 on 1911-05-01. # To 08:00 on 1942-12-31 at 23:00. -# To 09:00 in 1945-03-14 at 23:00. +# To 09:00 on 1945-03-14 at 23:00. # To 07:00 on 1945-09-02 in Vietnam. # To 08:00 on 1947-04-01 in French-controlled Indochina. # To 07:00 on 1955-07-01 in South Vietnam. Modified: stable/11/contrib/tzdata/australasia ============================================================================== --- stable/11/contrib/tzdata/australasia Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/australasia Sun Sep 15 10:54:33 2019 (r352354) @@ -367,13 +367,18 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # From Raymond Kumar (2018-07-13): # http://www.fijitimes.com/government-approves-2018-daylight-saving/ # ... The daylight saving period will end at 3am on Sunday January 13, 2019. -# -# From Paul Eggert (2018-07-15): -# For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 13. January transitions reportedly + +# From Paul Eggert (2019-08-06): +# Today Raymond Kumar reported the Government of Fiji Gazette Supplement No. 27 +# (2019-08-02) said that Fiji observes DST "commencing at 2.00 am on +# Sunday, 10 November 2019 and ending at 3.00 am on Sunday, 12 January 2020." +# For now, guess DST from 02:00 the second Sunday in November to 03:00 +# the first Sunday on or after January 12. January transitions reportedly # depend on when school terms start. Although the guess is ad hoc, it matches -# transitions since late 2014 and seems more likely to match future -# practice than guessing no DST. +# transitions planned this year and seems more likely to match future practice +# than guessing no DST. +# From Michael Deckers (2019-08-06): +# https://www.laws.gov.fj/LawsAsMade/downloadfile/848 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -384,8 +389,9 @@ Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - +Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - +Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2019 max - Nov Sun>=8 2:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 @@ -604,10 +610,11 @@ Zone Pacific/Niue -11:19:40 - LMT 1901 # Alofi # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston 11:12 - +1112 1951 - 11:30 - +1130 1974 Oct 27 02:00 - 11:30 1:00 +1230 1975 Mar 2 02:00 - 11:30 - +1130 2015 Oct 4 02:00 - 11:00 - +11 + 11:30 - +1130 1974 Oct 27 02:00s + 11:30 1:00 +1230 1975 Mar 2 02:00s + 11:30 - +1130 2015 Oct 4 02:00s + 11:00 - +11 2019 Jul + 11:00 AN +11/+12 # Palau (Belau) # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -1875,12 +1882,21 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # ... at 12.30 am (by legal time in New South Wales) on 4 October 2015. # http://www.norfolkisland.gov.nf/nia/MediaRelease/Media%20Release%20Norfolk%20Island%20Standard%20Time%20Change.pdf -# From Paul Eggert (2015-09-23): +# From Paul Eggert (2019-08-28): # Transitions before 2015 are from timeanddate.com, which consulted # the Norfolk Island Museum and the Australian Bureau of Meteorology's # Norfolk Island station, and found no record of Norfolk observing DST # other than in 1974/5. See: # https://www.timeanddate.com/time/australia/norfolk-island.html +# However, disagree with timeanddate about the 1975-03-02 transition; +# timeanddate has 02:00 but 02:00s corresponds to what the NSW law said +# (thanks to Michael Deckers). + +# Norfolk started observing Australian DST in spring 2019. +# From Kyle Czech (2019-08-13): +# https://www.legislation.gov.au/Details/F2018L01702 +# From Michael Deckers (2019-08-14): +# https://www.legislation.gov.au/Details/F2019C00010 # Palau # See commentary for Micronesia. Modified: stable/11/contrib/tzdata/backzone ============================================================================== --- stable/11/contrib/tzdata/backzone Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/backzone Sun Sep 15 10:54:33 2019 (r352354) @@ -507,19 +507,35 @@ Zone Asia/Muscat 3:54:24 - LMT 1920 #Zone Asia/Panaji [not enough info to complete] # Cambodia -# From Paul Eggert (2014-10-11): -# See Asia/Ho_Chi_Minh for the source for most of this data. Also, guess -# (1) Cambodia reverted to UT +07 on 1945-09-02, when Vietnam did, and -# (2) they also reverted to +07 on 1953-11-09, the date of independence. -# These guesses are probably wrong but they're better than guessing no -# transitions there. + +# From an adoptive daughter of the late Cambodian ruler Prince Sihanouk, +# via Alois Treindl (2019-08-08): +# +# King Sihanouk said that, during the Japanese occupation, starting with +# what historians refer to as "le coup de force du 9 mars 1945", Cambodia, +# like the entire French Indochina, used Tokyo time zone. After Japan +# surrendered, 2 September 1945, Cambodia fell under French rule again and +# adopted Hanoi time zone again. +# +# However, on 7 January 1946, Sihanouk and Tioulong managed to obtain a +# status of "internal autonomy" from the government of Charles de Gaulle. +# Although many fields remained under the administration of the French +# (customs, taxes, justice, defence, foreign affairs, etc.), the Cambodian +# administration was responsible for religious matters and traditional +# celebrations, which included our calendar and time. The time zone was GMT +# + 7 and _no_ DST was applied. +# +# After Sihanouk and Tioulong achieved full independence, on 9 November 1953, +# GMT + 7 was maintained. + +# From Paul Eggert (2019-08-26): +# See Asia/Ho_Chi_Minh for the source for most of rest of this data. + Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jul 1 7:06:30 - PLMT 1911 May 1 7:00 - +07 1942 Dec 31 23:00 8:00 - +08 1945 Mar 14 23:00 9:00 - +09 1945 Sep 2 - 7:00 - +07 1947 Apr 1 - 8:00 - +08 1953 Nov 9 7:00 - +07 # Israel @@ -646,7 +662,7 @@ Zone Europe/Tiraspol 1:58:32 - LMT 1880 # Liechtenstein Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun - 1:00 - CET 1981 + 1:00 Swiss CE%sT 1981 1:00 EU CE%sT # Croatia Modified: stable/11/contrib/tzdata/europe ============================================================================== --- stable/11/contrib/tzdata/europe Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/europe Sun Sep 15 10:54:33 2019 (r352354) @@ -821,11 +821,16 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. +# From Alois Triendl (2019-07-22): +# In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. +# Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Austria 1920 only - Apr 5 2:00s 1:00 S Rule Austria 1920 only - Sep 13 2:00s 0 - Rule Austria 1946 only - Apr 14 2:00s 1:00 S -Rule Austria 1946 1948 - Oct Sun>=1 2:00s 0 - +Rule Austria 1946 only - Oct 7 2:00s 0 - +Rule Austria 1947 1948 - Oct Sun>=1 2:00s 0 - Rule Austria 1947 only - Apr 6 2:00s 1:00 S Rule Austria 1948 only - Apr 18 2:00s 1:00 S Rule Austria 1980 only - Apr 6 0:00 1:00 S @@ -875,15 +880,35 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 # Belgium # -# From Paul Eggert (1997-07-02): +# From Michael Deckers (2019-08-25): +# The exposition in the web page +# https://www.bestor.be/wiki/index.php/Voyager_dans_le_temps._L%E2%80%99introduction_de_la_norme_de_Greenwich_en_Belgique +# gives several contemporary sources from which one can conclude that +# the switch in Europe/Brussels on 1892-05-01 was from 00:17:30 to 00:00:00. +# +# From Paul Eggert (2019-08-28): +# This quote helps explain the late-1914 situation: +# In early November 1914, the Germans imposed the time zone used in central +# Europe and forced the inhabitants to set their watches and public clocks +# sixty minutes ahead. Many were reluctant to accept "German time" and +# continued to use "Belgian time" among themselves. Reflecting the spirit of +# resistance that arose in the population, a song made fun of this change.... +# The song ended: +# Putting your clock forward +# Will but hasten the happy hour +# When we kick out the Boches! +# See: Pluvinage G. Brussels on German time. Cahiers Bruxellois - +# Brusselse Cahiers. 2014;XLVI(1E):15-38. +# https://www.cairn.info/revue-cahiers-bruxellois-2014-1E-page-15.htm +# +# Entries from 1914 through 1917 are taken from "De tijd in België" +# . # Entries from 1918 through 1991 are taken from: # Annuaire de L'Observatoire Royal de Belgique, # Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991 # (Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC), # pp 8-9. -# LMT before 1892 was 0:17:30, according to the official journal of Belgium: -# Moniteur Belge, Samedi 30 Avril 1892, N.121. -# Thanks to Pascal Delmoitie for these references. +# Thanks to Pascal Delmoitie for the 1918/1991 references. # The 1918 rules are listed for completeness; they apply to unoccupied Belgium. # Assume Brussels switched to WET in 1918 when the armistice took effect. # @@ -928,7 +953,7 @@ Rule Belgium 1946 only - May 19 2:00s 1:00 S Rule Belgium 1946 only - Oct 7 2:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Brussels 0:17:30 - LMT 1880 - 0:17:30 - BMT 1892 May 1 12:00 # Brussels MT + 0:17:30 - BMT 1892 May 1 00:17:30 0:00 - WET 1914 Nov 8 1:00 - CET 1916 May 1 0:00 1:00 C-Eur CE%sT 1918 Nov 11 11:00u @@ -1627,6 +1652,13 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # +# From Alois Triendl (2019-07-02): +# I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, +# for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 +# am, put forward the clock by one hour. Remember that in the night between +# today and Monday the 'ora legale' will come in force again." That makes it +# clear that in Rome the change was on Monday, 3 April 1944 at 2 am. +# # From Paul Eggert (2016-10-27): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. @@ -1774,15 +1806,10 @@ Zone Europe/Riga 1:36:34 - LMT 1880 # From Paul Eggert (2013-09-09): # Shanks & Pottenger say Vaduz is like Zurich. -# From Alois Treindl (2013-09-18): -# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf -# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942. -# I ... translate only the last two paragraphs: -# ... during second world war, in the years 1941 and 1942, Liechtenstein -# introduced daylight saving time, adapting to Switzerland. From 1943 on -# central European time was in force throughout the year. -# From a report of the duke's government to the high council, -# regarding the introduction of a time law, of 31 May 1977. +# From Alois Treindl (2019-07-04): +# I was able to access the online archive of the Vaduz paper Vaterland ... +# I could confirm from the paper that Liechtenstein did in fact follow +# the same DST in 1941 and 1942 as Switzerland did. Link Europe/Zurich Europe/Vaduz @@ -2490,6 +2517,12 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast +# From Paul Eggert (2019-07-25): +# Although Shanks lists 1945-01-01 as the date for transition from +# +01/+02 to +02/+03, more likely this is a placeholder. Guess that +# the transition occurred at 1945-04-10 00:00, which is about when +# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) + # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). @@ -2506,8 +2539,8 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Moscow on 1991-11-03, switched to Moscow-1 on 1992-01-19. Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr - 1:00 C-Eur CE%sT 1945 - 2:00 Poland CE%sT 1946 + 1:00 C-Eur CE%sT 1945 Apr 10 + 2:00 Poland EE%sT 1946 Apr 7 3:00 Russia MSK/MSD 1989 Mar 26 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s 3:00 - +03 2014 Oct 26 2:00s @@ -3650,20 +3683,75 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # Turkey +# From Alois Treindl (2019-08-12): +# http://www.astrolojidergisi.com/yazsaati.htm has researched the time zone +# history of Turkey, based on newspaper archives and official documents. +# From Paul Eggert (2019-08-28): +# That source (Oya Vulaş, "Türkiye'de Yaz Saati Uygulamaları") +# is used for 1940/1972, where it seems more reliable than our other +# sources. + +# From Kıvanç Yazan (2019-08-12): +# http://www.resmigazete.gov.tr/arsiv/14539.pdf#page=24 +# 1973-06-03 01:00 -> 02:00, 1973-11-04 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/14829.pdf#page=1 +# 1974-03-31 02:00 -> 03:00, 1974-11-03 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15161.pdf#page=1 +# 1975-03-22 02:00 -> 03:00, 1975-11-02 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15535_1.pdf#page=1 +# 1976-03-21 02:00 -> 03:00, 1976-10-31 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15778.pdf#page=5 +# 1977-04-03 02:00 -> 03:00, 1977-10-16 02:00 -> 01:00, +# 1978-04-02 02:00 -> 03:00 (not applied, see below) +# 1978-10-15 02:00 -> 01:00 (not applied, see below) +# 1979-04-01 02:00 -> 03:00 (not applied, see below) +# 1979-10-14 02:00 -> 01:00 (not applied, see below) +# +# http://www.resmigazete.gov.tr/arsiv/16245.pdf#page=17 +# This cancels the previous decision, and repeats it only for 1978. +# 1978-04-02 02:00 -> 03:00, 1978-10-15 02:00 -> 01:00 +# (not applied due to standard TZ change below) +# +# http://www.resmigazete.gov.tr/arsiv/16331.pdf#page=3 +# This decision changes the default longitude for Turkish time zone from 30 +# degrees East to 45 degrees East. This means a standard TZ change, from +2 +# to +3. This is published & applied on 1978-06-29. At that time, Turkey was +# already on summer time (already on 45E). Hence, this new law just meant an +# "continuous summer time". Note that this was reversed in a few years. +# +# http://www.resmigazete.gov.tr/arsiv/18119_1.pdf#page=1 +# 1983-07-31 02:00 -> 03:00 (note that this jumps TZ to +4) +# 1983-10-02 02:00 -> 01:00 (back to +3) +# +# http://www.resmigazete.gov.tr/arsiv/18561.pdf (page 1 and 34) +# At this time, Turkey is still on +3 with no spring-forward on early +# 1984. This decision is published on 10/31/1984. Page 1 declares +# the decision of reverting the "default longitude change". So the +# standard time should go back to +3 (30E). And page 34 explains when +# that will happen: 1984-11-01 02:00 -> 01:00. You can think of this +# as "end of continuous summer time, change of standard time zone". +# +# http://www.resmigazete.gov.tr/arsiv/18713.pdf#page=1 +# 1985-04-20 01:00 -> 02:00, 1985-09-28 02:00 -> 01:00 + # From Kıvanç Yazan (2016-09-25): # 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with # no exceptions. # 2) 1994's lastSun was overridden with Mar 20 ... # Here are official papers: -# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 -# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 -# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 -# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 -# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 -# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 -# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 -# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 -# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/arsiv/19032.pdf#page=2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf#page=4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf#page=15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf#page=6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf#page=1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf#page=15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf#page=1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf#page=1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf#page=10 for 1998 - 2000 # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): @@ -3747,46 +3835,36 @@ Rule Turkey 1922 only - Oct 8 0:00 0 - Rule Turkey 1924 only - May 13 0:00 1:00 S Rule Turkey 1924 1925 - Oct 1 0:00 0 - Rule Turkey 1925 only - May 1 0:00 1:00 S -Rule Turkey 1940 only - Jun 30 0:00 1:00 S -Rule Turkey 1940 only - Oct 5 0:00 0 - +Rule Turkey 1940 only - Jul 1 0:00 1:00 S +Rule Turkey 1940 only - Oct 6 0:00 0 - Rule Turkey 1940 only - Dec 1 0:00 1:00 S Rule Turkey 1941 only - Sep 21 0:00 0 - Rule Turkey 1942 only - Apr 1 0:00 1:00 S -# Whitman omits the next two transition and gives 1945 Oct 1; -# go with Shanks & Pottenger. -Rule Turkey 1942 only - Nov 1 0:00 0 - -Rule Turkey 1945 only - Apr 2 0:00 1:00 S Rule Turkey 1945 only - Oct 8 0:00 0 - Rule Turkey 1946 only - Jun 1 0:00 1:00 S Rule Turkey 1946 only - Oct 1 0:00 0 - Rule Turkey 1947 1948 - Apr Sun>=16 0:00 1:00 S -Rule Turkey 1947 1950 - Oct Sun>=2 0:00 0 - +Rule Turkey 1947 1951 - Oct Sun>=2 0:00 0 - Rule Turkey 1949 only - Apr 10 0:00 1:00 S -Rule Turkey 1950 only - Apr 19 0:00 1:00 S +Rule Turkey 1950 only - Apr 16 0:00 1:00 S Rule Turkey 1951 only - Apr 22 0:00 1:00 S -Rule Turkey 1951 only - Oct 8 0:00 0 - +# DST for 15 months; unusual but we'll let it pass. Rule Turkey 1962 only - Jul 15 0:00 1:00 S -Rule Turkey 1962 only - Oct 8 0:00 0 - +Rule Turkey 1963 only - Oct 30 0:00 0 - Rule Turkey 1964 only - May 15 0:00 1:00 S Rule Turkey 1964 only - Oct 1 0:00 0 - -Rule Turkey 1970 1972 - May Sun>=2 0:00 1:00 S -Rule Turkey 1970 1972 - Oct Sun>=2 0:00 0 - Rule Turkey 1973 only - Jun 3 1:00 1:00 S -Rule Turkey 1973 only - Nov 4 3:00 0 - +Rule Turkey 1973 1976 - Oct Sun>=31 2:00 0 - Rule Turkey 1974 only - Mar 31 2:00 1:00 S -Rule Turkey 1974 only - Nov 3 5:00 0 - -Rule Turkey 1975 only - Mar 30 0:00 1:00 S -Rule Turkey 1975 1976 - Oct lastSun 0:00 0 - -Rule Turkey 1976 only - Jun 1 0:00 1:00 S -Rule Turkey 1977 1978 - Apr Sun>=1 0:00 1:00 S -Rule Turkey 1977 only - Oct 16 0:00 0 - -Rule Turkey 1979 1980 - Apr Sun>=1 3:00 1:00 S -Rule Turkey 1979 1982 - Oct Mon>=11 0:00 0 - -Rule Turkey 1981 1982 - Mar lastSun 3:00 1:00 S -Rule Turkey 1983 only - Jul 31 0:00 1:00 S -Rule Turkey 1983 only - Oct 2 0:00 0 - -Rule Turkey 1985 only - Apr 20 0:00 1:00 S -Rule Turkey 1985 only - Sep 28 0:00 0 - +Rule Turkey 1975 only - Mar 22 2:00 1:00 S +Rule Turkey 1976 only - Mar 21 2:00 1:00 S +Rule Turkey 1977 1978 - Apr Sun>=1 2:00 1:00 S +Rule Turkey 1977 1978 - Oct Sun>=15 2:00 0 - +Rule Turkey 1978 only - Jun 29 0:00 0 - +Rule Turkey 1983 only - Jul 31 2:00 1:00 S +Rule Turkey 1983 only - Oct 2 2:00 0 - +Rule Turkey 1985 only - Apr 20 1:00s 1:00 S +Rule Turkey 1985 only - Sep 28 1:00s 0 - Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - Rule Turkey 1994 only - Mar 20 1:00s 1:00 S @@ -3795,8 +3873,8 @@ Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 1:56:56 - IMT 1910 Oct # Istanbul Mean Time? - 2:00 Turkey EE%sT 1978 Oct 15 - 3:00 Turkey +03/+04 1985 Apr 20 + 2:00 Turkey EE%sT 1978 Jun 29 + 3:00 Turkey +03/+04 1984 Nov 1 2:00 2:00 Turkey EE%sT 2007 2:00 EU EE%sT 2011 Mar 27 1:00u 2:00 - EET 2011 Mar 28 1:00u Modified: stable/11/contrib/tzdata/leap-seconds.list ============================================================================== --- stable/11/contrib/tzdata/leap-seconds.list Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/leap-seconds.list Sun Sep 15 10:54:33 2019 (r352354) @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 # -#@ 3786480000 +#@ 3802291200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a +#h f28827d2 f263b6c3 ec0f19eb a3e0dbf0 97f3fa30 Modified: stable/11/contrib/tzdata/leapseconds ============================================================================== --- stable/11/contrib/tzdata/leapseconds Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/leapseconds Sun Sep 15 10:54:33 2019 (r352354) @@ -3,36 +3,39 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which can be copied from +# NIST format leap-seconds.list file, which can be copied from # -# or -# or . +# or . # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds # . -# The International Earth Rotation and Reference Systems Service +# The rules for leap seconds are specified in Annex 1 (Time scales) of: +# Standard-frequency and time-signal emissions. +# International Telecommunication Union - Radiocommunication Sector +# (ITU-R) Recommendation TF.460-6 (02/2002) +# . +# The International Earth Rotation and Reference Systems Service (IERS) # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space) +# (a proxy for Earth's angle in space as measured by astronomers) # and publishes leap second data in a copyrighted file # . # See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 # . -# There were no leap seconds before 1972, because the official mechanism -# accounting for the discrepancy between atomic time and the earth's rotation -# did not exist. The first ("1 Jan 1972") data line in leap-seconds.list +# There were no leap seconds before 1972, as no official mechanism +# accounted for the discrepancy between atomic time (TAI) and the earth's +# rotation. The first ("1 Jan 1972") data line in leap-seconds.list # does not denote a leap second; it denotes the start of the current definition # of UTC. -# The correction (+ or -) is made at the given time, so lines -# will typically look like: -# Leap YEAR MON DAY 23:59:60 + R/S -# or -# Leap YEAR MON DAY 23:59:59 - R/S - -# If the leap second is Rolling (R) the given time is local time (unused here). +# All leap-seconds are Stationary (S) at the given UTC time. +# The correction (+ or -) is made at the given time, so in the unlikely +# event of a negative leap second, a line would look like this: +# Leap YEAR MON DAY 23:59:59 - S +# Typical lines look like this: +# Leap YEAR MON DAY 23:59:60 + S Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -62,8 +65,8 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S # POSIX timestamps for the data in this file: -#updated 1467936000 -#expires 1577491200 +#updated 1467936000 (2016-07-08 00:00:00 UTC) +#expires 1593302400 (2020-06-28 00:00:00 UTC) -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 Modified: stable/11/contrib/tzdata/leapseconds.awk ============================================================================== --- stable/11/contrib/tzdata/leapseconds.awk Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/leapseconds.awk Sun Sep 15 10:54:33 2019 (r352354) @@ -1,43 +1,59 @@ -# Generate the 'leapseconds' file from 'leap-seconds.list'. +# Generate zic format 'leapseconds' from NIST format 'leap-seconds.list'. # This file is in the public domain. +# This program uses awk arithmetic. POSIX requires awk to support +# exact integer arithmetic only through 10**10, which means for NTP +# timestamps this program works only to the year 2216, which is the +# year 1900 plus 10**10 seconds. However, in practice +# POSIX-conforming awk implementations invariably use IEEE-754 double +# and so support exact integers through 2**53. By the year 2216, +# POSIX will almost surely require at least 2**53 for awk, so for NTP +# timestamps this program should be good until the year 285,428,681 +# (the year 1900 plus 2**53 seconds). By then leap seconds will be +# long obsolete, as the Earth will likely slow down so much that +# there will be more than 25 hours per day and so some other scheme +# will be needed. + BEGIN { print "# Allowance for leap seconds added to each time zone file." print "" print "# This file is in the public domain." print "" print "# This file is generated automatically from the data in the public-domain" - print "# leap-seconds.list file, which can be copied from" + print "# NIST format leap-seconds.list file, which can be copied from" print "# " - print "# or " - print "# or ." + print "# or ." print "# For more about leap-seconds.list, please see" print "# The NTP Timescale and Leap Seconds" print "# ." print "" - print "# The International Earth Rotation and Reference Systems Service" + print "# The rules for leap seconds are specified in Annex 1 (Time scales) of:" + print "# Standard-frequency and time-signal emissions." + print "# International Telecommunication Union - Radiocommunication Sector" + print "# (ITU-R) Recommendation TF.460-6 (02/2002)" + print "# ." + print "# The International Earth Rotation and Reference Systems Service (IERS)" print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1" - print "# (which measures the true angular orientation of the earth in space)" + print "# (a proxy for Earth's angle in space as measured by astronomers)" print "# and publishes leap second data in a copyrighted file" print "# ." print "# See: Levine J. Coordinated Universal Time and the leap second." print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995" print "# ." print "" - print "# There were no leap seconds before 1972, because the official mechanism" - print "# accounting for the discrepancy between atomic time and the earth's rotation" - print "# did not exist. The first (\"1 Jan 1972\") data line in leap-seconds.list" + print "# There were no leap seconds before 1972, as no official mechanism" + print "# accounted for the discrepancy between atomic time (TAI) and the earth's" + print "# rotation. The first (\"1 Jan 1972\") data line in leap-seconds.list" print "# does not denote a leap second; it denotes the start of the current definition" - print"# of UTC." + print "# of UTC." print "" - print "# The correction (+ or -) is made at the given time, so lines" - print "# will typically look like:" - print "# Leap YEAR MON DAY 23:59:60 + R/S" - print "# or" - print "# Leap YEAR MON DAY 23:59:59 - R/S" - print "" - print "# If the leap second is Rolling (R) the given time is local time (unused here)." + print "# All leap-seconds are Stationary (S) at the given UTC time." + print "# The correction (+ or -) is made at the given time, so in the unlikely" + print "# event of a negative leap second, a line would look like this:" + print "# Leap YEAR MON DAY 23:59:59 - S" + print "# Typical lines look like this:" + print "# Leap YEAR MON DAY 23:59:60 + S" monthabbr[ 1] = "Jan" monthabbr[ 2] = "Feb" @@ -51,45 +67,34 @@ BEGIN { monthabbr[10] = "Oct" monthabbr[11] = "Nov" monthabbr[12] = "Dec" - for (i in monthabbr) { - monthnum[monthabbr[i]] = i - monthlen[i] = 31 - } - monthlen[2] = 28 - monthlen[4] = monthlen[6] = monthlen[9] = monthlen[11] = 30 + + # Strip trailing CR, in case the input has CRLF form a la NIST. + RS = "\r?\n" + + sstamp_init() } -/^#\tUpdated through/ || /^#\tFile expires on:/ { +/^#[ \t]*[Uu]pdated through/ || /^#[ \t]*[Ff]ile expires on/ { last_lines = last_lines $0 "\n" } /^#[$][ \t]/ { updated = $2 } /^#[@][ \t]/ { expires = $2 } -/^#/ { next } +/^[ \t]*#/ { next } { NTP_timestamp = $1 TAI_minus_UTC = $2 - hash_mark = $3 - one = $4 - month = $5 - year = $6 if (old_TAI_minus_UTC) { if (old_TAI_minus_UTC < TAI_minus_UTC) { sign = "23:59:60\t+" } else { sign = "23:59:59\t-" } - m = monthnum[month] - 1 - if (m == 0) { - year--; - m = 12 - } - month = monthabbr[m] - day = monthlen[m] - day += m == 2 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) - printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign + sstamp_to_ymdhMs(NTP_timestamp - 1, ss_NTP) + printf "Leap\t%d\t%s\t%d\t%s\tS\n", \ + ss_year, monthabbr[ss_month], ss_mday, sign } old_TAI_minus_UTC = TAI_minus_UTC } @@ -102,7 +107,117 @@ END { print "" print "# POSIX timestamps for the data in this file:" - printf "#updated %s\n", updated - epoch_minus_NTP - printf "#expires %s\n", expires - epoch_minus_NTP + sstamp_to_ymdhMs(updated, ss_NTP) + printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + updated - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + sstamp_to_ymdhMs(expires, ss_NTP) + printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + expires - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + printf "\n%s", last_lines +} + +# sstamp_to_ymdhMs - convert seconds timestamp to date and time +# +# Call as: +# +# sstamp_to_ymdhMs(sstamp, epoch_days) +# +# where: +# +# sstamp - is the seconds timestamp. +# epoch_days - is the timestamp epoch in Gregorian days since 1600-03-01. +# ss_NTP is appropriate for an NTP sstamp. +# +# Both arguments should be nonnegative integers. +# On return, the following variables are set based on sstamp: +# +# ss_year - Gregorian calendar year +# ss_month - month of the year (1-January to 12-December) +# ss_mday - day of the month (1-31) +# ss_hour - hour (0-23) +# ss_min - minute (0-59) +# ss_sec - second (0-59) +# ss_wday - day of week (0-Sunday to 6-Saturday) +# +# The function sstamp_init should be called prior to using sstamp_to_ymdhMs. + +function sstamp_init() +{ + # Days in month N, where March is month 0 and January month 10. + ss_mon_days[ 0] = 31 + ss_mon_days[ 1] = 30 + ss_mon_days[ 2] = 31 + ss_mon_days[ 3] = 30 + ss_mon_days[ 4] = 31 + ss_mon_days[ 5] = 31 + ss_mon_days[ 6] = 30 + ss_mon_days[ 7] = 31 + ss_mon_days[ 8] = 30 + ss_mon_days[ 9] = 31 + ss_mon_days[10] = 31 + + # Counts of days in a Gregorian year, quad-year, century, and quad-century. + ss_year_days = 365 + ss_quadyear_days = ss_year_days * 4 + 1 + ss_century_days = ss_quadyear_days * 25 - 1 + ss_quadcentury_days = ss_century_days * 4 + 1 + + # Standard day epochs, suitable for epoch_days. + # ss_MJD = 94493 + # ss_POSIX = 135080 + ss_NTP = 109513 +} + +function sstamp_to_ymdhMs(sstamp, epoch_days, \ + quadcentury, century, quadyear, year, month, day) +{ + ss_hour = int(sstamp / 3600) % 24 + ss_min = int(sstamp / 60) % 60 + ss_sec = sstamp % 60 + + # Start with a count of days since 1600-03-01 Gregorian. + day = epoch_days + int(sstamp / (24 * 60 * 60)) + + # Compute a year-month-day date with days of the month numbered + # 0-30, months (March-February) numbered 0-11, and years that start + # start March 1 and end after the last day of February. A quad-year + # starts on March 1 of a year evenly divisible by 4 and ends after + # the last day of February 4 years later. A century starts on and + # ends before March 1 in years evenly divisible by 100. + # A quad-century starts on and ends before March 1 in years divisible + # by 400. While the number of days in a quad-century is a constant, + # the number of days in each other time period can vary by 1. + # Any variation is in the last day of the time period (there might + # or might not be a February 29) where it is easy to deal with. + + quadcentury = int(day / ss_quadcentury_days) + day -= quadcentury * ss_quadcentury_days + ss_wday = (day + 3) % 7 + century = int(day / ss_century_days) + century -= century == 4 + day -= century * ss_century_days + quadyear = int(day / ss_quadyear_days) + day -= quadyear * ss_quadyear_days + year = int(day / ss_year_days) + year -= year == 4 + day -= year * ss_year_days + for (month = 0; month < 11; month++) { + if (day < ss_mon_days[month]) + break + day -= ss_mon_days[month] + } + + # Convert the date to a conventional day of month (1-31), + # month (1-12, January-December) and Gregorian year. + ss_mday = day + 1 + if (month <= 9) { + ss_month = month + 3 + } else { + ss_month = month - 9 + year++ + } + ss_year = 1600 + quadcentury * 400 + century * 100 + quadyear * 4 + year } Modified: stable/11/contrib/tzdata/northamerica ============================================================================== --- stable/11/contrib/tzdata/northamerica Sun Sep 15 10:54:18 2019 (r352353) +++ stable/11/contrib/tzdata/northamerica Sun Sep 15 10:54:33 2019 (r352354) @@ -406,6 +406,31 @@ Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03 # From Paul Eggert (2015-12-25): # Assume this practice predates 1970, so Fort Pierre can use America/Chicago. +# From Paul Eggert (2015-04-06): +# In 1950s Nashville a public clock had dueling faces, one for conservatives +# and the other for liberals; the two sides didn't agree about the time of day. +# I haven't found a photo of this clock, nor have I tracked down the TIME +# magazine report cited below, but here's the story as told by the late +# American journalist John Seigenthaler, who was there: +# +# "The two [newspaper] owners held strongly contrasting political and +# ideological views. Evans was a New South liberal, Stahlman an Old South +# conservative, and their two papers frequently clashed editorially, often on +# the same day.... In the 1950s as the state legislature was grappling with +# the question of whether to approve daylight saving time for the entire state, +# TIME magazine reported: +# +# "'The Nashville Banner and The Nashville Tennessean rarely agree on anything +# but the time of day - and last week they couldn't agree on that.' +# +# "It was all too true. The clock on the front of the building had two faces - +# The Tennessean side of the building facing west, the other, east. When it +# was high noon Banner time, it was 11 a.m. Tennessean time." +# +# Seigenthaler J. For 100 years, Tennessean had it covered. +# The Tennessean 2007-05-11, republished 2015-04-06. +# https://www.tennessean.com/story/insider/extras/2015/04/06/archives-seigenthaler-for-100-years-the-tennessean-had-it-covered/25348545/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Chicago 1920 only - Jun 13 2:00 1:00 D Rule Chicago 1920 1921 - Oct lastSun 2:00 0 S @@ -945,21 +970,21 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. +# From Alois Triendl (2019-07-09): +# The Indianapolis News, Friday 27 October 1967 states that Perry County +# returned to CST. It went again to EST on 27 April 1969, as documented by the +# Indianapolis star of Saturday 26 April. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER -Rule Perry 1946 only - Apr lastSun 2:00 1:00 D -Rule Perry 1946 only - Sep lastSun 2:00 0 S -Rule Perry 1953 1954 - Apr lastSun 2:00 1:00 D -Rule Perry 1953 1959 - Sep lastSun 2:00 0 S Rule Perry 1955 only - May 1 0:00 1:00 D +Rule Perry 1955 1960 - Sep lastSun 2:00 0 S Rule Perry 1956 1963 - Apr lastSun 2:00 1:00 D -Rule Perry 1960 only - Oct lastSun 2:00 0 S -Rule Perry 1961 only - Sep lastSun 2:00 0 S -Rule Perry 1962 1963 - Oct lastSun 2:00 0 S +Rule Perry 1961 1963 - Oct lastSun 2:00 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Tell_City -5:47:03 - LMT 1883 Nov 18 12:12:57 -6:00 US C%sT 1946 -6:00 Perry C%sT 1964 Apr 26 2:00 - -5:00 - EST 1969 + -5:00 - EST 1967 Oct 29 2:00 + -6:00 US C%sT 1969 Apr 27 2:00 -5:00 US E%sT 1971 -5:00 - EST 2006 Apr 2 2:00 -6:00 US C%sT @@ -1035,16 +1060,27 @@ Zone America/Indiana/Vevay -5:40:16 - LMT 1883 Nov 18 # clear how this matched civil time in Louisville, so for now continue # to assume Louisville switched at noon new local time, like New York. # +# From Michael Deckers (2019-08-06): +# From the contemporary source given by Alois Treindl, +# the switch in Louisville on 1946-04-28 was on 00:01 +# From Paul Eggert (2019-08-26): +# That source was the Louisville Courier-Journal, 1946-04-27, p 4. +# Shanks gives 02:00 for all 20th-century transition times in Louisville. +# Evidently this is wrong for spring 1946. Although also likely wrong +# for other dates, we have no data. +# # Part of Kentucky left its clocks alone in 1974. # This also includes Clark, Floyd, and Harrison counties in Indiana. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 15 14:26: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 15CECEE66B; Sun, 15 Sep 2019 14:26:21 +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 46WWrs0VGMz4NTq; Sun, 15 Sep 2019 14:26:21 +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 CDEAE9751; Sun, 15 Sep 2019 14:26:20 +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 x8FEQKCC024404; Sun, 15 Sep 2019 14:26:20 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FEQJDd024398; Sun, 15 Sep 2019 14:26:19 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201909151426.x8FEQJDd024398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 15 Sep 2019 14:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352355 - in stable/12/sys: dev/netmap net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12/sys: dev/netmap net X-SVN-Commit-Revision: 352355 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 14:26:21 -0000 Author: vmaffione Date: Sun Sep 15 14:26:19 2019 New Revision: 352355 URL: https://svnweb.freebsd.org/changeset/base/352355 Log: MFC r351657 netmap: import changes from upstream (SHA 137f537eae513) - Rework option processing. - Use larger integers for memory size values in the memory management code. Modified: stable/12/sys/dev/netmap/netmap.c stable/12/sys/dev/netmap/netmap_kern.h stable/12/sys/dev/netmap/netmap_kloop.c stable/12/sys/dev/netmap/netmap_mem2.c stable/12/sys/net/netmap.h stable/12/sys/net/netmap_user.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap.c ============================================================================== --- stable/12/sys/dev/netmap/netmap.c Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/dev/netmap/netmap.c Sun Sep 15 14:26:19 2019 (r352355) @@ -1037,8 +1037,13 @@ netmap_do_unregif(struct netmap_priv_d *priv) na->nm_krings_delete(na); /* restore the default number of host tx and rx rings */ - na->num_host_tx_rings = 1; - na->num_host_rx_rings = 1; + if (na->na_flags & NAF_HOST_RINGS) { + na->num_host_tx_rings = 1; + na->num_host_rx_rings = 1; + } else { + na->num_host_tx_rings = 0; + na->num_host_rx_rings = 0; + } } /* possibily decrement counter of tx_si/rx_si users */ @@ -2505,17 +2510,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c } #ifdef WITH_EXTMEM - opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, - NETMAP_REQ_OPT_EXTMEM); + opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_EXTMEM); if (opt != NULL) { struct nmreq_opt_extmem *e = (struct nmreq_opt_extmem *)opt; - error = nmreq_checkduplicate(opt); - if (error) { - opt->nro_status = error; - break; - } nmd = netmap_mem_ext_create(e->nro_usrptr, &e->nro_info, &error); opt->nro_status = error; @@ -2559,15 +2558,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c break; } - opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, - NETMAP_REQ_OPT_CSB); + opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_CSB); if (opt != NULL) { struct nmreq_opt_csb *csbo = (struct nmreq_opt_csb *)opt; - error = nmreq_checkduplicate(opt); - if (!error) { - error = netmap_csb_validate(priv, csbo); - } + error = netmap_csb_validate(priv, csbo); opt->nro_status = error; if (error) { netmap_do_unregif(priv); @@ -2841,19 +2836,15 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c case NETMAP_REQ_CSB_ENABLE: { struct nmreq_option *opt; - opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, - NETMAP_REQ_OPT_CSB); + opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_CSB); if (opt == NULL) { error = EINVAL; } else { struct nmreq_opt_csb *csbo = (struct nmreq_opt_csb *)opt; - error = nmreq_checkduplicate(opt); - if (!error) { - NMG_LOCK(); - error = netmap_csb_validate(priv, csbo); - NMG_UNLOCK(); - } + NMG_LOCK(); + error = netmap_csb_validate(priv, csbo); + NMG_UNLOCK(); opt->nro_status = error; } break; @@ -3021,13 +3012,72 @@ nmreq_opt_size_by_type(uint32_t nro_reqtype, uint64_t return rv - sizeof(struct nmreq_option); } +/* + * nmreq_copyin: create an in-kernel version of the request. + * + * We build the following data structure: + * + * hdr -> +-------+ buf + * | | +---------------+ + * +-------+ |usr body ptr | + * |options|-. +---------------+ + * +-------+ | |usr options ptr| + * |body |--------->+---------------+ + * +-------+ | | | + * | | copy of body | + * | | | + * | +---------------+ + * | | NULL | + * | +---------------+ + * | .---| |\ + * | | +---------------+ | + * | .------| | | + * | | | +---------------+ \ option table + * | | | | ... | / indexed by option + * | | | +---------------+ | type + * | | | | | | + * | | | +---------------+/ + * | | | |usr next ptr 1 | + * `-|----->+---------------+ + * | | | copy of opt 1 | + * | | | | + * | | .-| nro_next | + * | | | +---------------+ + * | | | |usr next ptr 2 | + * | `-`>+---------------+ + * | | copy of opt 2 | + * | | | + * | .-| nro_next | + * | | +---------------+ + * | | | | + * ~ ~ ~ ... ~ + * | .-| | + * `----->+---------------+ + * | |usr next ptr n | + * `>+---------------+ + * | copy of opt n | + * | | + * | nro_next(NULL)| + * +---------------+ + * + * The options and body fields of the hdr structure are overwritten + * with in-kernel valid pointers inside the buf. The original user + * pointers are saved in the buf and restored on copyout. + * The list of options is copied and the pointers adjusted. The + * original pointers are saved before the option they belonged. + * + * The option table has an entry for every availabe option. Entries + * for options that have not been passed contain NULL. + * + */ + int nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_user) { size_t rqsz, optsz, bufsz; - int error; + int error = 0; char *ker = NULL, *p; - struct nmreq_option **next, *src; + struct nmreq_option **next, *src, **opt_tab; struct nmreq_option buf; uint64_t *ptrs; @@ -3058,7 +3108,13 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_ goto out_err; } - bufsz = 2 * sizeof(void *) + rqsz; + bufsz = 2 * sizeof(void *) + rqsz + + NETMAP_REQ_OPT_MAX * sizeof(opt_tab); + /* compute the size of the buf below the option table. + * It must contain a copy of every received option structure. + * For every option we also need to store a copy of the user + * list pointer. + */ optsz = 0; for (src = (struct nmreq_option *)(uintptr_t)hdr->nr_options; src; src = (struct nmreq_option *)(uintptr_t)buf.nro_next) @@ -3072,15 +3128,16 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_ error = EMSGSIZE; goto out_err; } - bufsz += optsz + sizeof(void *); + bufsz += sizeof(void *); } + bufsz += optsz; ker = nm_os_malloc(bufsz); if (ker == NULL) { error = ENOMEM; goto out_err; } - p = ker; + p = ker; /* write pointer into the buffer */ /* make a copy of the user pointers */ ptrs = (uint64_t*)p; @@ -3095,6 +3152,9 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_ /* overwrite the user pointer with the in-kernel one */ hdr->nr_body = (uintptr_t)p; p += rqsz; + /* start of the options table */ + opt_tab = (struct nmreq_option **)p; + p += sizeof(opt_tab) * NETMAP_REQ_OPT_MAX; /* copy the options */ next = (struct nmreq_option **)&hdr->nr_options; @@ -3118,6 +3178,34 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_ */ opt->nro_status = EOPNOTSUPP; + /* check for invalid types */ + if (opt->nro_reqtype < 1) { + if (netmap_verbose) + nm_prinf("invalid option type: %u", opt->nro_reqtype); + opt->nro_status = EINVAL; + error = EINVAL; + goto next; + } + + if (opt->nro_reqtype >= NETMAP_REQ_OPT_MAX) { + /* opt->nro_status is already EOPNOTSUPP */ + error = EOPNOTSUPP; + goto next; + } + + /* if the type is valid, index the option in the table + * unless it is a duplicate. + */ + if (opt_tab[opt->nro_reqtype] != NULL) { + if (netmap_verbose) + nm_prinf("duplicate option: %u", opt->nro_reqtype); + opt->nro_status = EINVAL; + opt_tab[opt->nro_reqtype]->nro_status = EINVAL; + error = EINVAL; + goto next; + } + opt_tab[opt->nro_reqtype] = opt; + p = (char *)(opt + 1); /* copy the option body */ @@ -3131,11 +3219,14 @@ nmreq_copyin(struct nmreq_header *hdr, int nr_body_is_ p += optsz; } + next: /* move to next option */ next = (struct nmreq_option **)&opt->nro_next; src = *next; } - return 0; + if (error) + nmreq_copyout(hdr, error); + return error; out_restore: ptrs = (uint64_t *)ker; @@ -3218,25 +3309,15 @@ out: } struct nmreq_option * -nmreq_findoption(struct nmreq_option *opt, uint16_t reqtype) +nmreq_getoption(struct nmreq_header *hdr, uint16_t reqtype) { - for ( ; opt; opt = (struct nmreq_option *)(uintptr_t)opt->nro_next) - if (opt->nro_reqtype == reqtype) - return opt; - return NULL; -} + struct nmreq_option **opt_tab; -int -nmreq_checkduplicate(struct nmreq_option *opt) { - uint16_t type = opt->nro_reqtype; - int dup = 0; + if (!hdr->nr_options) + return NULL; - while ((opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)opt->nro_next, - type))) { - dup++; - opt->nro_status = EINVAL; - } - return (dup ? EINVAL : 0); + opt_tab = (struct nmreq_option **)(hdr->nr_options) - (NETMAP_REQ_OPT_MAX + 1); + return opt_tab[reqtype]; } static int Modified: stable/12/sys/dev/netmap/netmap_kern.h ============================================================================== --- stable/12/sys/dev/netmap/netmap_kern.h Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/dev/netmap/netmap_kern.h Sun Sep 15 14:26:19 2019 (r352355) @@ -2390,8 +2390,7 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) #endif /* __FreeBSD_version >= 1100000 */ #endif /* __FreeBSD__ */ -struct nmreq_option * nmreq_findoption(struct nmreq_option *, uint16_t); -int nmreq_checkduplicate(struct nmreq_option *); +struct nmreq_option * nmreq_getoption(struct nmreq_header *, uint16_t); int netmap_init_bridges(void); void netmap_uninit_bridges(void); Modified: stable/12/sys/dev/netmap/netmap_kloop.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_kloop.c Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/dev/netmap/netmap_kloop.c Sun Sep 15 14:26:19 2019 (r352355) @@ -649,8 +649,7 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct n } /* Validate notification options. */ - opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, - NETMAP_REQ_OPT_SYNC_KLOOP_MODE); + opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_SYNC_KLOOP_MODE); if (opt != NULL) { struct nmreq_opt_sync_kloop_mode *mode_opt = (struct nmreq_opt_sync_kloop_mode *)opt; @@ -664,14 +663,8 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct n } opt->nro_status = 0; } - opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, - NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS); + opt = nmreq_getoption(hdr, NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS); if (opt != NULL) { - err = nmreq_checkduplicate(opt); - if (err) { - opt->nro_status = err; - goto out; - } if (opt->nro_size != sizeof(*eventfds_opt) + sizeof(eventfds_opt->eventfds[0]) * num_rings) { /* Option size not consistent with the number of Modified: stable/12/sys/dev/netmap/netmap_mem2.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_mem2.c Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/dev/netmap/netmap_mem2.c Sun Sep 15 14:26:19 2019 (r352355) @@ -100,16 +100,17 @@ struct netmap_obj_pool { /* ---------------------------------------------------*/ /* these are only meaningful if the pool is finalized */ /* (see 'finalized' field in netmap_mem_d) */ - u_int objtotal; /* actual total number of objects. */ - u_int memtotal; /* actual total memory space */ - u_int numclusters; /* actual number of clusters */ + size_t memtotal; /* actual total memory space */ - u_int objfree; /* number of free objects. */ - struct lut_entry *lut; /* virt,phys addresses, objtotal entries */ uint32_t *bitmap; /* one bit per buffer, 1 means free */ uint32_t *invalid_bitmap;/* one bit per buffer, 1 means invalid */ uint32_t bitmap_slots; /* number of uint32 entries in bitmap */ + + u_int objtotal; /* actual total number of objects. */ + u_int numclusters; /* actual number of clusters */ + u_int objfree; /* number of free objects. */ + int alloc_done; /* we have allocated the memory */ /* ---------------------------------------------------*/ @@ -159,7 +160,7 @@ struct netmap_mem_ops { struct netmap_mem_d { NMA_LOCK_T nm_mtx; /* protect the allocator */ - u_int nm_totalsize; /* shorthand */ + size_t nm_totalsize; /* shorthand */ u_int flags; #define NETMAP_MEM_FINALIZED 0x1 /* preallocation done */ @@ -817,7 +818,7 @@ netmap_mem2_ofstophys(struct netmap_mem_d* nmd, vm_oof return pa; } /* this is only in case of errors */ - nm_prerr("invalid ofs 0x%x out of 0x%x 0x%x 0x%x", (u_int)o, + nm_prerr("invalid ofs 0x%x out of 0x%zx 0x%zx 0x%zx", (u_int)o, p[NETMAP_IF_POOL].memtotal, p[NETMAP_IF_POOL].memtotal + p[NETMAP_RING_POOL].memtotal, @@ -947,7 +948,7 @@ netmap_mem2_get_info(struct netmap_mem_d* nmd, uint64_ *size = 0; for (i = 0; i < NETMAP_POOLS_NR; i++) { struct netmap_obj_pool *p = nmd->pools + i; - *size += (p->_numclusters * p->_clustsize); + *size += ((size_t)p->_numclusters * (size_t)p->_clustsize); } } } @@ -1476,9 +1477,9 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool * #endif } } - p->memtotal = p->numclusters * p->_clustsize; + p->memtotal = (size_t)p->numclusters * (size_t)p->_clustsize; if (netmap_verbose) - nm_prinf("Pre-allocated %d clusters (%d/%dKB) for '%s'", + nm_prinf("Pre-allocated %d clusters (%d/%zuKB) for '%s'", p->numclusters, p->_clustsize >> 10, p->memtotal >> 10, p->name); @@ -1639,7 +1640,7 @@ netmap_mem_finalize_all(struct netmap_mem_d *nmd) nmd->flags |= NETMAP_MEM_FINALIZED; if (netmap_verbose) - nm_prinf("interfaces %d KB, rings %d KB, buffers %d MB", + nm_prinf("interfaces %zd KB, rings %zd KB, buffers %zd MB", nmd->pools[NETMAP_IF_POOL].memtotal >> 10, nmd->pools[NETMAP_RING_POOL].memtotal >> 10, nmd->pools[NETMAP_BUF_POOL].memtotal >> 20); @@ -2341,8 +2342,8 @@ netmap_mem_ext_create(uint64_t usrptr, struct nmreq_po } p->objtotal = j; p->numclusters = p->objtotal; - p->memtotal = j * p->_objsize; - nm_prdis("%d memtotal %u", j, p->memtotal); + p->memtotal = j * (size_t)p->_objsize; + nm_prdis("%d memtotal %zu", j, p->memtotal); } netmap_mem_ext_register(nme); @@ -2446,8 +2447,8 @@ netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *nmd, } else { ptnmd->pt_ifs = curr->next; } - nm_prinf("removed (ifp=%s,nifp_offset=%u)", - curr->ifp->if_xname, curr->nifp_offset); + nm_prinf("removed (ifp=%p,nifp_offset=%u)", + curr->ifp, curr->nifp_offset); nm_os_free(curr); ret = 0; break; @@ -2573,7 +2574,7 @@ netmap_mem_pt_guest_finalize(struct netmap_mem_d *nmd) ptnmd->buf_lut.objtotal = nbuffers; ptnmd->buf_lut.objsize = bufsize; - nmd->nm_totalsize = (unsigned int)mem_size; + nmd->nm_totalsize = mem_size; /* Initialize these fields as are needed by * netmap_mem_bufsize(). Modified: stable/12/sys/net/netmap.h ============================================================================== --- stable/12/sys/net/netmap.h Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/net/netmap.h Sun Sep 15 14:26:19 2019 (r352355) @@ -562,6 +562,10 @@ enum { * This requires the 'ioeventfd' fields to be valid (cannot be < 0). */ NETMAP_REQ_OPT_SYNC_KLOOP_MODE, + + /* This is a marker to count the number of available options. + * New options must be added above it. */ + NETMAP_REQ_OPT_MAX, }; /* Modified: stable/12/sys/net/netmap_user.h ============================================================================== --- stable/12/sys/net/netmap_user.h Sun Sep 15 10:54:33 2019 (r352354) +++ stable/12/sys/net/netmap_user.h Sun Sep 15 14:26:19 2019 (r352355) @@ -117,7 +117,7 @@ (nifp)->ni_host_tx_rings] ) #define NETMAP_BUF(ring, index) \ - ((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size)) + ((char *)(ring) + (ring)->buf_ofs + ((size_t)(index)*(ring)->nr_buf_size)) #define NETMAP_BUF_IDX(ring, buf) \ ( ((char *)(buf) - ((char *)(ring) + (ring)->buf_ofs) ) / \ @@ -254,7 +254,7 @@ struct nm_desc { struct nm_desc *self; /* point to self if netmap. */ int fd; void *mem; - uint32_t memsize; + size_t memsize; int done_mmap; /* set if mem is the result of mmap */ struct netmap_if * const nifp; uint16_t first_tx_ring, last_tx_ring, cur_tx_ring; From owner-svn-src-all@freebsd.org Sun Sep 15 14:37: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 6A188EEBEC; Sun, 15 Sep 2019 14:37:51 +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 46WX672DMbz4P1R; Sun, 15 Sep 2019 14:37:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 300109920; Sun, 15 Sep 2019 14:37:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FEbpSg030208; Sun, 15 Sep 2019 14:37:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FEbpfB030207; Sun, 15 Sep 2019 14:37:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909151437.x8FEbpfB030207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 15 Sep 2019 14:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352356 - stable/12/tests/sys/fs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/tests/sys/fs X-SVN-Commit-Revision: 352356 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 14:37:51 -0000 Author: kevans Date: Sun Sep 15 14:37:50 2019 New Revision: 352356 URL: https://svnweb.freebsd.org/changeset/base/352356 Log: MFC r351399: Fix the build with WITHOUT_GOOGLETEST Attempting to build the fusefs tests WITHOUT_GOOGLETEST will result in an error if the host system or sysroot doesn't already have googletest headers in /usr/include/private (e.g. host built/installed WITHOUT_GOOGLETEST, clean cross-buildworld WITHOUT_GOOGLETEST). Modified: stable/12/tests/sys/fs/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/fs/Makefile ============================================================================== --- stable/12/tests/sys/fs/Makefile Sun Sep 15 14:26:19 2019 (r352355) +++ stable/12/tests/sys/fs/Makefile Sun Sep 15 14:37:50 2019 (r352356) @@ -1,5 +1,6 @@ # $FreeBSD$ +.include .include PACKAGE= tests @@ -9,7 +10,8 @@ TESTSDIR= ${TESTSBASE}/sys/fs TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs #TESTS_SUBDIRS+= nullfs # XXX: needs rump -.if ${COMPILER_FEATURES:Mc++14} +# fusefs tests cannot be compiled/used without the googletest infrastructure. +.if ${COMPILER_FEATURES:Mc++14} && ${MK_GOOGLETEST} != "no" TESTS_SUBDIRS+= fusefs .endif TESTS_SUBDIRS+= tmpfs From owner-svn-src-all@freebsd.org Sun Sep 15 16:53: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 ECC7DF1694; Sun, 15 Sep 2019 16:53:03 +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 46Wb676k6Fz4VHJ; Sun, 15 Sep 2019 16:53:03 +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 CB180B162; Sun, 15 Sep 2019 16:53:03 +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 x8FGr3WL013313; Sun, 15 Sep 2019 16:53:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FGr39l013307; Sun, 15 Sep 2019 16:53:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909151653.x8FGr39l013307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 15 Sep 2019 16:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352357 - stable/12/sbin/ping X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sbin/ping X-SVN-Commit-Revision: 352357 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 16:53:04 -0000 Author: asomers Date: Sun Sep 15 16:53:02 2019 New Revision: 352357 URL: https://svnweb.freebsd.org/changeset/base/352357 Log: MFC r350994, r350998, r351030, r351033, r351171, r351223, r351226, r351424 r350994: ping: fix data type of a variable for a packet sequence number Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21244 r350998: ping: use the monotonic clock to measure durations Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21245 r351030: ping: fix triptime calculation after r350998 That revision changed the internal clock to the monotonic, but neglected to change the datagram's timestamp source. Reported by: Oliver Hartmann, Michael Butler Reviewed by: Ján Sučan , allanjude MFC-With: r350998 Differential Revision: https://reviews.freebsd.org/D21258 r351033: ping: Make in_cksum() operate on u_char buffer This fixes -Wcast-align errors for in_cksum() calls when compiled with WARNS=6. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21261 r351171: ping: Move in_cksum() to a separate source file This is a preparation step for adding ATF tests of in_cksum(), which has been modified to operate on unaligned data. ping.o cannot be linked to the test executable because both of them contain 'main' symbol. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21288 r351223: ping: fix -Wformat-truncating warning with GCC Increase buffer size for the string representation of n_time ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes and seconds is always 2 characters wide. Max. number of hours is 4 characters wide. The buffer size should be at least: 4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11 Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21325 r351226: Fix uninitialized variable warnings when MK_CASPER=no Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21322 r351424: ping: fix include guard symbol name to reflect the header file name Submitted by: Ján Sučan MFC-With: 351171 Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21374 Added: stable/12/sbin/ping/utils.c - copied unchanged from r351171, head/sbin/ping/utils.c stable/12/sbin/ping/utils.h - copied, changed from r351171, head/sbin/ping/utils.h Modified: stable/12/sbin/ping/Makefile stable/12/sbin/ping/ping.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ping/Makefile ============================================================================== --- stable/12/sbin/ping/Makefile Sun Sep 15 14:37:50 2019 (r352356) +++ stable/12/sbin/ping/Makefile Sun Sep 15 16:53:02 2019 (r352357) @@ -5,6 +5,7 @@ PACKAGE=runtime PROG= ping +SRCS= ping.c utils.c MAN= ping.8 BINOWN= root BINMODE=4555 Modified: stable/12/sbin/ping/ping.c ============================================================================== --- stable/12/sbin/ping/ping.c Sun Sep 15 14:37:50 2019 (r352356) +++ stable/12/sbin/ping/ping.c Sun Sep 15 16:53:02 2019 (r352357) @@ -95,8 +95,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include "utils.h" + #define INADDR_LEN ((int)sizeof(in_addr_t)) #define TIMEVAL_LEN ((int)sizeof(struct tv32)) #define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN) @@ -118,7 +121,7 @@ __FBSDID("$FreeBSD$"); struct tv32 { int32_t tv32_sec; - int32_t tv32_usec; + int32_t tv32_nsec; }; /* various options */ @@ -207,7 +210,6 @@ static volatile sig_atomic_t siginfo_p; static cap_channel_t *capdns; static void fill(char *, char *); -static u_short in_cksum(u_short *, int); static cap_channel_t *capdns_setup(void); static void check_status(void); static void finish(void) __dead2; @@ -216,11 +218,10 @@ static char *pr_addr(struct in_addr); static char *pr_ntime(n_time); static void pr_icmph(struct icmp *); static void pr_iph(struct ip *); -static void pr_pack(char *, int, struct sockaddr_in *, struct timeval *); +static void pr_pack(char *, int, struct sockaddr_in *, struct timespec *); static void pr_retip(struct ip *); static void status(int); static void stopit(int); -static void tvsub(struct timeval *, const struct timeval *); static void usage(void) __dead2; int @@ -228,7 +229,7 @@ main(int argc, char *const *argv) { struct sockaddr_in from, sock_in; struct in_addr ifaddr; - struct timeval last, intvl; + struct timespec last, intvl; struct iovec iov; struct ip *ip; struct msghdr msg; @@ -246,7 +247,7 @@ main(int argc, char *const *argv) long ltmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload; int ssend_errno, srecv_errno, tos, ttl; - char ctrl[CMSG_SPACE(sizeof(struct timeval))]; + char ctrl[CMSG_SPACE(sizeof(struct timespec))]; char hnamebuf[MAXHOSTNAMELEN], snamebuf[MAXHOSTNAMELEN]; #ifdef IP_OPTIONS char rspace[MAX_IPOPTLEN]; /* record route space */ @@ -616,6 +617,7 @@ main(int argc, char *const *argv) } /* From now on we will use only reverse DNS lookups. */ +#ifdef WITH_CASPER if (capdns != NULL) { const char *types[1]; @@ -623,7 +625,7 @@ main(int argc, char *const *argv) if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } - +#endif if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); @@ -774,9 +776,15 @@ main(int argc, char *const *argv) } } #ifdef SO_TIMESTAMP - { int on = 1; - if (setsockopt(srecv, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)) < 0) - err(EX_OSERR, "setsockopt SO_TIMESTAMP"); + { + int on = 1; + int ts_clock = SO_TS_MONOTONIC; + if (setsockopt(srecv, SOL_SOCKET, SO_TIMESTAMP, &on, + sizeof(on)) < 0) + err(EX_OSERR, "setsockopt SO_TIMESTAMP"); + if (setsockopt(srecv, SOL_SOCKET, SO_TS_CLOCK, &ts_clock, + sizeof(ts_clock)) < 0) + err(EX_OSERR, "setsockopt SO_TS_CLOCK"); } #endif if (sweepmax) { @@ -885,19 +893,19 @@ main(int argc, char *const *argv) while (preload--) /* fire off them quickies */ pinger(); } - (void)gettimeofday(&last, NULL); + (void)clock_gettime(CLOCK_MONOTONIC, &last); if (options & F_FLOOD) { intvl.tv_sec = 0; - intvl.tv_usec = 10000; + intvl.tv_nsec = 10000000; } else { intvl.tv_sec = interval / 1000; - intvl.tv_usec = interval % 1000 * 1000; + intvl.tv_nsec = interval % 1000 * 1000000; } almost_done = 0; while (!finish_up) { - struct timeval now, timeout; + struct timespec now, timeout; fd_set rfds; int cc, n; @@ -906,24 +914,16 @@ main(int argc, char *const *argv) errx(EX_OSERR, "descriptor too large"); FD_ZERO(&rfds); FD_SET(srecv, &rfds); - (void)gettimeofday(&now, NULL); - timeout.tv_sec = last.tv_sec + intvl.tv_sec - now.tv_sec; - timeout.tv_usec = last.tv_usec + intvl.tv_usec - now.tv_usec; - while (timeout.tv_usec < 0) { - timeout.tv_usec += 1000000; - timeout.tv_sec--; - } - while (timeout.tv_usec >= 1000000) { - timeout.tv_usec -= 1000000; - timeout.tv_sec++; - } + (void)clock_gettime(CLOCK_MONOTONIC, &now); + timespecadd(&last, &intvl, &timeout); + timespecsub(&timeout, &now, &timeout); if (timeout.tv_sec < 0) - timerclear(&timeout); - n = select(srecv + 1, &rfds, NULL, NULL, &timeout); + timespecclear(&timeout); + n = pselect(srecv + 1, &rfds, NULL, NULL, &timeout, NULL); if (n < 0) continue; /* Must be EINTR. */ if (n == 1) { - struct timeval *tv = NULL; + struct timespec *tv = NULL; #ifdef SO_TIMESTAMP struct cmsghdr *cmsg = (struct cmsghdr *)&ctrl; @@ -946,7 +946,7 @@ main(int argc, char *const *argv) } #endif if (tv == NULL) { - (void)gettimeofday(&now, NULL); + (void)clock_gettime(CLOCK_MONOTONIC, &now); tv = &now; } pr_pack((char *)packet, cc, &from, tv); @@ -970,17 +970,17 @@ main(int argc, char *const *argv) if (almost_done) break; almost_done = 1; - intvl.tv_usec = 0; + intvl.tv_nsec = 0; if (nreceived) { intvl.tv_sec = 2 * tmax / 1000; if (!intvl.tv_sec) intvl.tv_sec = 1; } else { intvl.tv_sec = waittime / 1000; - intvl.tv_usec = waittime % 1000 * 1000; + intvl.tv_nsec = waittime % 1000 * 1000000; } } - (void)gettimeofday(&last, NULL); + (void)clock_gettime(CLOCK_MONOTONIC, &last); if (ntransmitted - nreceived - 1 > nmissedmax) { nmissedmax = ntransmitted - nreceived - 1; if (options & F_MISSED) @@ -1017,13 +1017,13 @@ stopit(int sig __unused) * Compose and transmit an ICMP ECHO REQUEST packet. The IP packet * will be added on by the kernel. The ID field is our UNIX process ID, * and the sequence number is an ascending integer. The first TIMEVAL_LEN - * bytes of the data portion are used to hold a UNIX "timeval" struct in + * bytes of the data portion are used to hold a UNIX "timespec" struct in * host byte-order, to compute the round-trip time. */ static void pinger(void) { - struct timeval now; + struct timespec now; struct tv32 tv32; struct ip *ip; struct icmp *icp; @@ -1041,13 +1041,18 @@ pinger(void) CLR(ntransmitted % mx_dup_ck); if ((options & F_TIME) || timing) { - (void)gettimeofday(&now, NULL); - - tv32.tv32_sec = htonl(now.tv_sec); - tv32.tv32_usec = htonl(now.tv_usec); + (void)clock_gettime(CLOCK_MONOTONIC, &now); + /* + * Truncate seconds down to 32 bits in order + * to fit the timestamp within 8 bytes of the + * packet. We're only concerned with + * durations, not absolute times. + */ + tv32.tv32_sec = (uint32_t)htonl(now.tv_sec); + tv32.tv32_nsec = (uint32_t)htonl(now.tv_nsec); if (options & F_TIME) icp->icmp_otime = htonl((now.tv_sec % (24*60*60)) - * 1000 + now.tv_usec / 1000); + * 1000 + now.tv_nsec / 1000000); if (timing) bcopy((void *)&tv32, (void *)&outpack[ICMP_MINLEN + phdr_len], @@ -1057,13 +1062,13 @@ pinger(void) cc = ICMP_MINLEN + phdr_len + datalen; /* compute ICMP checksum here */ - icp->icmp_cksum = in_cksum((u_short *)icp, cc); + icp->icmp_cksum = in_cksum((u_char *)icp, cc); if (options & F_HDRINCL) { cc += sizeof(struct ip); ip = (struct ip *)outpackhdr; ip->ip_len = htons(cc); - ip->ip_sum = in_cksum((u_short *)outpackhdr, cc); + ip->ip_sum = in_cksum(outpackhdr, cc); packet = outpackhdr; } i = send(ssend, (char *)packet, cc, 0); @@ -1093,7 +1098,7 @@ pinger(void) * program to be run without having intermingled output (or statistics!). */ static void -pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timeval *tv) +pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timespec *tv) { struct in_addr ina; u_char *cp, *dp; @@ -1101,7 +1106,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s struct ip *ip; const void *tp; double triptime; - int dupflag, hlen, i, j, recv_len, seq; + int dupflag, hlen, i, j, recv_len; + uint16_t seq; static int old_rrlen; static char old_rr[MAX_IPOPTLEN]; @@ -1125,7 +1131,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s ++nreceived; triptime = 0.0; if (timing) { - struct timeval tv1; + struct timespec tv1; struct tv32 tv32; #ifndef icmp_data tp = &icp->icmp_ip; @@ -1139,10 +1145,10 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s /* Copy to avoid alignment problems: */ memcpy(&tv32, tp, sizeof(tv32)); tv1.tv_sec = ntohl(tv32.tv32_sec); - tv1.tv_usec = ntohl(tv32.tv32_usec); - tvsub(tv, &tv1); + tv1.tv_nsec = ntohl(tv32.tv32_nsec); + timespecsub(tv, &tv1, tv); triptime = ((double)tv->tv_sec) * 1000.0 + - ((double)tv->tv_usec) / 1000.0; + ((double)tv->tv_nsec) / 1000000.0; tsum += triptime; tsumsq += triptime * triptime; if (triptime < tmin) @@ -1354,65 +1360,6 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s } /* - * in_cksum -- - * Checksum routine for Internet Protocol family headers (C Version) - */ -u_short -in_cksum(u_short *addr, int len) -{ - int nleft, sum; - u_short *w; - union { - u_short us; - u_char uc[2]; - } last; - u_short answer; - - nleft = len; - sum = 0; - w = addr; - - /* - * Our algorithm is simple, using a 32 bit accumulator (sum), we add - * sequential 16 bit words to it, and at the end, fold back all the - * carry bits from the top 16 bits into the lower 16 bits. - */ - while (nleft > 1) { - sum += *w++; - nleft -= 2; - } - - /* mop up an odd byte, if necessary */ - if (nleft == 1) { - last.uc[0] = *(u_char *)w; - last.uc[1] = 0; - sum += last.us; - } - - /* add back carry outs from top 16 bits to low 16 bits */ - sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ - sum += (sum >> 16); /* add carry */ - answer = ~sum; /* truncate to 16 bits */ - return(answer); -} - -/* - * tvsub -- - * Subtract 2 timeval structs: out = out - in. Out is assumed to - * be >= in. - */ -static void -tvsub(struct timeval *out, const struct timeval *in) -{ - - if ((out->tv_usec -= in->tv_usec) < 0) { - --out->tv_sec; - out->tv_usec += 1000000; - } - out->tv_sec -= in->tv_sec; -} - -/* * status -- * Print out statistics when SIGINFO is received. */ @@ -1732,7 +1679,7 @@ pr_retip(struct ip *ip) static char * pr_ntime(n_time timestamp) { - static char buf[10]; + static char buf[11]; int hour, min, sec; sec = ntohl(timestamp) / 1000; @@ -1780,9 +1727,10 @@ static cap_channel_t * capdns_setup(void) { cap_channel_t *capcas, *capdnsloc; +#ifdef WITH_CASPER const char *types[2]; int families[1]; - +#endif capcas = cap_init(); if (capcas == NULL) err(1, "unable to create casper process"); @@ -1791,6 +1739,7 @@ capdns_setup(void) cap_close(capcas); if (capdnsloc == NULL) err(1, "unable to open system.dns service"); +#ifdef WITH_CASPER types[0] = "NAME2ADDR"; types[1] = "ADDR2NAME"; if (cap_dns_type_limit(capdnsloc, types, 2) < 0) @@ -1798,7 +1747,7 @@ capdns_setup(void) families[0] = AF_INET; if (cap_dns_family_limit(capdnsloc, families, 1) < 0) err(1, "unable to limit access to system.dns service"); - +#endif return (capdnsloc); } Copied: stable/12/sbin/ping/utils.c (from r351171, head/sbin/ping/utils.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sbin/ping/utils.c Sun Sep 15 16:53:02 2019 (r352357, copy of r351171, head/sbin/ping/utils.c) @@ -0,0 +1,98 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Mike Muuss. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University 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 REGENTS 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. + */ + +#if 0 +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1989, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; +#endif /* not lint */ +#endif +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "utils.h" + +/* + * in_cksum -- + * Checksum routine for Internet Protocol family headers (C Version) + */ +u_short +in_cksum(u_char *addr, int len) +{ + int nleft, sum; + u_char *w; + union { + u_short us; + u_char uc[2]; + } last; + u_short answer; + + nleft = len; + sum = 0; + w = addr; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), we add + * sequential 16 bit words to it, and at the end, fold back all the + * carry bits from the top 16 bits into the lower 16 bits. + */ + while (nleft > 1) { + u_short data; + + memcpy(&data, w, sizeof(data)); + sum += data; + w += sizeof(data); + nleft -= sizeof(data); + } + + /* mop up an odd byte, if necessary */ + if (nleft == 1) { + last.uc[0] = *w; + last.uc[1] = 0; + sum += last.us; + } + + /* add back carry outs from top 16 bits to low 16 bits */ + sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return(answer); +} Copied and modified: stable/12/sbin/ping/utils.h (from r351171, head/sbin/ping/utils.h) ============================================================================== --- head/sbin/ping/utils.h Sat Aug 17 15:25:01 2019 (r351171, copy source) +++ stable/12/sbin/ping/utils.h Sun Sep 15 16:53:02 2019 (r352357) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef PING_H -#define PING_H 1 +#ifndef UTILS_H +#define UTILS_H 1 #include From owner-svn-src-all@freebsd.org Sun Sep 15 17:22: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 F2EC9F28FA; Sun, 15 Sep 2019 17:22:30 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Wbm66xtdz4XPM; Sun, 15 Sep 2019 17:22:30 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1AE8B6DB; Sun, 15 Sep 2019 17:22:30 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FHMUmS032152; Sun, 15 Sep 2019 17:22:30 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FHMU5e032148; Sun, 15 Sep 2019 17:22:30 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909151722.x8FHMU5e032148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 15 Sep 2019 17:22: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: r352358 - in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv X-SVN-Commit-Revision: 352358 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 17:22:31 -0000 Author: alc Date: Sun Sep 15 17:22:29 2019 New Revision: 352358 URL: https://svnweb.freebsd.org/changeset/base/352358 Log: MFC r348828 Implement an alternative solution to the amd64 and i386 pmap problem that we previously addressed in r348246 (and MFCed in r348479). This pmap problem also exists on arm64 and riscv. However, the original solution developed for amd64 and i386 cannot be used on arm64 and riscv. In particular, arm64 and riscv do not define a PG_PROMOTED flag in their level 2 PTEs. (A PG_PROMOTED flag makes no sense on arm64, where unlike x86 or riscv we are required to break the old 4KB mappings before making the 2MB mapping; and on riscv there are no unused bits in the PTE to define a PG_PROMOTED flag.) This commit implements an alternative solution that can be used on all four architectures. Moreover, this solution has two other advantages. First, on older AMD processors that required the Erratum 383 workaround, it is less costly. Specifically, it avoids unnecessary calls to pmap_fill_ptp() on a superpage demotion. Second, it enables the elimination of some calls to pagezero() in pmap_kernel_remove_{l2,pde}(). In addition, remove a related stale comment from pmap_enter_{l2,pde}(). Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/arm64/arm64/pmap.c stable/12/sys/i386/i386/pmap.c stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Sun Sep 15 16:53:02 2019 (r352357) +++ stable/12/sys/amd64/amd64/pmap.c Sun Sep 15 17:22:29 2019 (r352358) @@ -1142,7 +1142,7 @@ static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp); static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); -static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); +static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted); static void pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, vm_offset_t eva); static void pmap_invalidate_cache_range_all(vm_offset_t sva, @@ -1846,8 +1846,13 @@ pmap_init(void) mpte->pindex = pmap_pde_pindex(KERNBASE) + i; mpte->phys_addr = KPTphys + (i << PAGE_SHIFT); mpte->wire_count = 1; + + /* + * Collect the page table pages that were replaced by a 2MB + * page in create_pagetables(). They are zero filled. + */ if (i << PDRSHIFT < KERNend && - pmap_insert_pt_page(kernel_pmap, mpte)) + pmap_insert_pt_page(kernel_pmap, mpte, false)) panic("pmap_init: pmap_insert_pt_page failed"); } PMAP_UNLOCK(kernel_pmap); @@ -3219,12 +3224,15 @@ pmap_add_delayed_free_list(vm_page_t m, struct spglist * of idle page table pages. Each of a pmap's page table pages is responsible * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. + * + * If "promoted" is false, then the page table page "mpte" must be zero filled. */ static __inline int -pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) +pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + mpte->valid = promoted ? VM_PAGE_BITS_ALL : 0; return (vm_radix_insert(&pmap->pm_root, mpte)); } @@ -4716,7 +4724,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v * If the page table page is not leftover from an earlier promotion, * initialize it. */ - if ((oldpde & PG_PROMOTED) == 0) + if (mpte->valid == 0) pmap_fill_ptp(firstpte, newpte); pmap_demote_pde_check(firstpte, newpte); @@ -4789,9 +4797,11 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, v newpde = mptepa | X86_PG_M | X86_PG_A | X86_PG_RW | X86_PG_V; /* - * Initialize the page table page. + * If this page table page was unmapped by a promotion, then it + * contains valid mappings. Zero it to invalidate those mappings. */ - pagezero((void *)PHYS_TO_DMAP(mptepa)); + if (mpte->valid != 0) + pagezero((void *)PHYS_TO_DMAP(mptepa)); /* * Demote the mapping. @@ -4856,6 +4866,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse } else { mpte = pmap_remove_pt_page(pmap, sva); if (mpte != NULL) { + KASSERT(mpte->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pde: pte page not promoted")); pmap_resident_count_dec(pmap, 1); KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); @@ -5489,7 +5501,7 @@ setpte: ("pmap_promote_pde: page table page is out of range")); KASSERT(mpte->pindex == pmap_pde_pindex(va), ("pmap_promote_pde: page table page's pindex is wrong")); - if (pmap_insert_pt_page(pmap, mpte)) { + if (pmap_insert_pt_page(pmap, mpte, true)) { atomic_add_long(&pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx in pmap %p", va, @@ -5914,15 +5926,13 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t } vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { + /* + * Both pmap_remove_pde() and pmap_remove_ptes() will + * leave the kernel page table page zero filled. + */ mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); - if (pmap_insert_pt_page(pmap, mt)) { - /* - * XXX Currently, this can't happen because - * we do not perform pmap_enter(psind == 1) - * on the kernel pmap. - */ + if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_pde: trie insert failed"); - } } else KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", pde)); @@ -6912,6 +6922,8 @@ pmap_remove_pages(pmap_t pmap) } mpte = pmap_remove_pt_page(pmap, pv->pv_va); if (mpte != NULL) { + KASSERT(mpte->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pages: pte page not promoted")); pmap_resident_count_dec(pmap, 1); KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 16:53:02 2019 (r352357) +++ stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 17:22:29 2019 (r352358) @@ -2401,9 +2401,11 @@ pmap_remove_kernel_l2(pmap_t pmap, pt_entry_t *l2, vm_ newl2 = ml3pa | L2_TABLE; /* - * Initialize the page table page. + * If this page table page was unmapped by a promotion, then it + * contains valid mappings. Zero it to invalidate those mappings. */ - pagezero((void *)PHYS_TO_DMAP(ml3pa)); + if (ml3->valid != 0) + pagezero((void *)PHYS_TO_DMAP(ml3pa)); /* * Demote the mapping. The caller must have already invalidated the @@ -2456,6 +2458,8 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ } else { ml3 = pmap_remove_pt_page(pmap, sva); if (ml3 != NULL) { + KASSERT(ml3->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_l2: l3 page not promoted")); pmap_resident_count_dec(pmap, 1); KASSERT(ml3->wire_count == NL3PG, ("pmap_remove_l2: l3 page wire count error")); @@ -2812,12 +2816,15 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t * of idle page table pages. Each of a pmap's page table pages is responsible * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. + * + * If "promoted" is false, then the page table page "mpte" must be zero filled. */ static __inline int -pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) +pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + mpte->valid = promoted ? VM_PAGE_BITS_ALL : 0; return (vm_radix_insert(&pmap->pm_root, mpte)); } @@ -2961,7 +2968,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset ("pmap_promote_l2: page table page is out of range")); KASSERT(mpte->pindex == pmap_l2_pindex(va), ("pmap_promote_l2: page table page's pindex is wrong")); - if (pmap_insert_pt_page(pmap, mpte)) { + if (pmap_insert_pt_page(pmap, mpte, true)) { atomic_add_long(&pmap_l2_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx in pmap %p", va, @@ -3384,15 +3391,13 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t } vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { + /* + * Both pmap_remove_l2() and pmap_remove_l3() will + * leave the kernel page table page zero filled. + */ mt = PHYS_TO_VM_PAGE(pmap_load(l2) & ~ATTR_MASK); - if (pmap_insert_pt_page(pmap, mt)) { - /* - * XXX Currently, this can't happen bacuse - * we do not perform pmap_enter(psind == 1) - * on the kernel pmap. - */ + if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_l2: trie insert failed"); - } } else KASSERT(pmap_load(l2) == 0, ("pmap_enter_l2: non-zero L2 entry %p", l2)); @@ -4078,6 +4083,8 @@ pmap_remove_pages(pmap_t pmap) ml3 = pmap_remove_pt_page(pmap, pv->pv_va); if (ml3 != NULL) { + KASSERT(ml3->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pages: l3 page not promoted")); pmap_resident_count_dec(pmap,1); KASSERT(ml3->wire_count == NL3PG, ("pmap_remove_pages: l3 page wire count error")); @@ -5020,8 +5027,10 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ " in pmap %p", va, pmap); goto fail; } - if (va < VM_MAXUSER_ADDRESS) + if (va < VM_MAXUSER_ADDRESS) { + ml3->wire_count = NL3PG; pmap_resident_count_inc(pmap, 1); + } } l3phys = VM_PAGE_TO_PHYS(ml3); @@ -5033,10 +5042,10 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ newl3 = (oldl2 & (ATTR_MASK & ~ATTR_DESCR_MASK)) | L3_PAGE; /* - * If the page table page is new, initialize it. + * If the page table page is not leftover from an earlier promotion, + * initialize it. */ - if (ml3->wire_count == 1) { - ml3->wire_count = NL3PG; + if (ml3->valid == 0) { for (i = 0; i < Ln_ENTRIES; i++) { l3[i] = newl3 | phys; phys += L3_SIZE; Modified: stable/12/sys/i386/i386/pmap.c ============================================================================== --- stable/12/sys/i386/i386/pmap.c Sun Sep 15 16:53:02 2019 (r352357) +++ stable/12/sys/i386/i386/pmap.c Sun Sep 15 17:22:29 2019 (r352358) @@ -319,7 +319,7 @@ static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static void pmap_flush_page(vm_page_t m); -static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); +static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted); static void pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, vm_offset_t eva); static void pmap_invalidate_cache_range_all(vm_offset_t sva, @@ -956,9 +956,14 @@ pmap_init(void) mpte->pindex = i + KPTDI; mpte->phys_addr = KPTphys + ptoa(i); mpte->wire_count = 1; + + /* + * Collect the page table pages that were replaced by a 2/4MB + * page. They are filled with equivalent 4KB page mappings. + */ if (pseflag != 0 && KERNBASE <= i << PDRSHIFT && i << PDRSHIFT < KERNend && - pmap_insert_pt_page(kernel_pmap, mpte)) + pmap_insert_pt_page(kernel_pmap, mpte, true)) panic("pmap_init: pmap_insert_pt_page failed"); } PMAP_UNLOCK(kernel_pmap); @@ -1945,12 +1950,15 @@ pmap_add_delayed_free_list(vm_page_t m, struct spglist * of idle page table pages. Each of a pmap's page table pages is responsible * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. + * + * If "promoted" is false, then the page table page "mpte" must be zero filled. */ static __inline int -pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) +pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte, bool promoted) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + mpte->valid = promoted ? VM_PAGE_BITS_ALL : 0; return (vm_radix_insert(&pmap->pm_root, mpte)); } @@ -2904,7 +2912,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offse * If the page table page is not leftover from an earlier promotion, * initialize it. */ - if ((oldpde & PG_PROMOTED) == 0) + if (mpte->valid == 0) pmap_fill_ptp(firstpte, newpte); KASSERT((*firstpte & PG_FRAME) == (newpte & PG_FRAME), @@ -2976,9 +2984,11 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, v newpde = mptepa | PG_M | PG_A | PG_RW | PG_V; /* - * Initialize the page table page. + * If this page table page was unmapped by a promotion, then it + * contains valid mappings. Zero it to invalidate those mappings. */ - pagezero((void *)&KPTmap[i386_btop(trunc_4mpage(va))]); + if (mpte->valid != 0) + pagezero((void *)&KPTmap[i386_btop(trunc_4mpage(va))]); /* * Remove the mapping. @@ -3041,6 +3051,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse } else { mpte = pmap_remove_pt_page(pmap, sva); if (mpte != NULL) { + KASSERT(mpte->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pde: pte page not promoted")); pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); @@ -3613,7 +3625,7 @@ setpte: ("pmap_promote_pde: page table page is out of range")); KASSERT(mpte->pindex == va >> PDRSHIFT, ("pmap_promote_pde: page table page's pindex is wrong")); - if (pmap_insert_pt_page(pmap, mpte)) { + if (pmap_insert_pt_page(pmap, mpte, true)) { pmap_pde_p_failures++; CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#x in pmap %p", va, @@ -3989,15 +4001,13 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t } vm_page_free_pages_toq(&free, true); if (pmap == kernel_pmap) { + /* + * Both pmap_remove_pde() and pmap_remove_ptes() will + * leave the kernel page table page zero filled. + */ mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); - if (pmap_insert_pt_page(pmap, mt)) { - /* - * XXX Currently, this can't happen because - * we do not perform pmap_enter(psind == 1) - * on the kernel pmap. - */ + if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_pde: trie insert failed"); - } } else KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", pde)); @@ -4876,6 +4886,8 @@ pmap_remove_pages(pmap_t pmap) } mpte = pmap_remove_pt_page(pmap, pv->pv_va); if (mpte != NULL) { + KASSERT(mpte->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pages: pte page not promoted")); pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); Modified: stable/12/sys/riscv/riscv/pmap.c ============================================================================== --- stable/12/sys/riscv/riscv/pmap.c Sun Sep 15 16:53:02 2019 (r352357) +++ stable/12/sys/riscv/riscv/pmap.c Sun Sep 15 17:22:29 2019 (r352358) @@ -1105,12 +1105,15 @@ pmap_add_delayed_free_list(vm_page_t m, struct spglist * of idle page table pages. Each of a pmap's page table pages is responsible * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. + * + * If "promoted" is false, then the page table page "ml3" must be zero filled. */ static __inline int -pmap_insert_pt_page(pmap_t pmap, vm_page_t ml3) +pmap_insert_pt_page(pmap_t pmap, vm_page_t ml3, bool promoted) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + ml3->valid = promoted ? VM_PAGE_BITS_ALL : 0; return (vm_radix_insert(&pmap->pm_root, ml3)); } @@ -2003,9 +2006,11 @@ pmap_remove_kernel_l2(pmap_t pmap, pt_entry_t *l2, vm_ newl2 = ml3pa | PTE_V; /* - * Initialize the page table page. + * If this page table page was unmapped by a promotion, then it + * contains valid mappings. Zero it to invalidate those mappings. */ - pagezero((void *)PHYS_TO_DMAP(ml3pa)); + if (ml3->valid != 0) + pagezero((void *)PHYS_TO_DMAP(ml3pa)); /* * Demote the mapping. @@ -2065,6 +2070,8 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ } else { ml3 = pmap_remove_pt_page(pmap, sva); if (ml3 != NULL) { + KASSERT(ml3->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_l2: l3 page not promoted")); pmap_resident_count_dec(pmap, 1); KASSERT(ml3->wire_count == Ln_ENTRIES, ("pmap_remove_l2: l3 page wire count error")); @@ -2483,8 +2490,10 @@ pmap_demote_l2_locked(pmap_t pmap, pd_entry_t *l2, vm_ "failure for va %#lx in pmap %p", va, pmap); return (false); } - if (va < VM_MAXUSER_ADDRESS) + if (va < VM_MAXUSER_ADDRESS) { + mpte->wire_count = Ln_ENTRIES; pmap_resident_count_inc(pmap, 1); + } } mptepa = VM_PAGE_TO_PHYS(mpte); firstl3 = (pt_entry_t *)PHYS_TO_DMAP(mptepa); @@ -2496,10 +2505,10 @@ pmap_demote_l2_locked(pmap_t pmap, pd_entry_t *l2, vm_ newl3 = oldl2; /* - * If the page table page is new, initialize it. + * If the page table page is not leftover from an earlier promotion, + * initialize it. */ - if (mpte->wire_count == 1) { - mpte->wire_count = Ln_ENTRIES; + if (mpte->valid == 0) { for (i = 0; i < Ln_ENTRIES; i++) pmap_store(firstl3 + i, newl3 + (i << PTE_PPN0_S)); } @@ -2590,7 +2599,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset ml3 = PHYS_TO_VM_PAGE(PTE_TO_PHYS(pmap_load(l2))); KASSERT(ml3->pindex == pmap_l2_pindex(va), ("pmap_promote_l2: page table page's pindex is wrong")); - if (pmap_insert_pt_page(pmap, ml3)) { + if (pmap_insert_pt_page(pmap, ml3, true)) { CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); @@ -2973,15 +2982,13 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t } vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { + /* + * Both pmap_remove_l2() and pmap_remove_l3() will + * leave the kernel page table page zero filled. + */ mt = PHYS_TO_VM_PAGE(PTE_TO_PHYS(pmap_load(l2))); - if (pmap_insert_pt_page(pmap, mt)) { - /* - * XXX Currently, this can't happen bacuse - * we do not perform pmap_enter(psind == 1) - * on the kernel pmap. - */ + if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_l2: trie insert failed"); - } } else KASSERT(pmap_load(l2) == 0, ("pmap_enter_l2: non-zero L2 entry %p", l2)); @@ -3558,6 +3565,8 @@ pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entr } mpte = pmap_remove_pt_page(pmap, pv->pv_va); if (mpte != NULL) { + KASSERT(ml3->valid == VM_PAGE_BITS_ALL, + ("pmap_remove_pages: l3 page not promoted")); pmap_resident_count_dec(pmap, 1); KASSERT(mpte->wire_count == Ln_ENTRIES, ("pmap_remove_pages: pte page wire count error")); From owner-svn-src-all@freebsd.org Sun Sep 15 17:58: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 2CE6FF340D; Sun, 15 Sep 2019 17:58:40 +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 46WcYr0LfHz4Yhk; Sun, 15 Sep 2019 17:58:40 +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 E3740BE0B; Sun, 15 Sep 2019 17:58: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 x8FHwddI057876; Sun, 15 Sep 2019 17:58:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FHwdYA057875; Sun, 15 Sep 2019 17:58:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909151758.x8FHwdYA057875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 15 Sep 2019 17:58:39 +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: r352359 - 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: 352359 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 17:58:40 -0000 Author: mav Date: Sun Sep 15 17:58:39 2019 New Revision: 352359 URL: https://svnweb.freebsd.org/changeset/base/352359 Log: MFC r352258: Remove Tagged Command Queuing feature reporting. I never saw those devices myself, FreeBSD never supported them, and it is officially obsolete since ACS-2 specification. Modified: stable/12/sbin/camcontrol/camcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Sun Sep 15 17:22:29 2019 (r352358) +++ stable/12/sbin/camcontrol/camcontrol.c Sun Sep 15 17:58:39 2019 (r352359) @@ -1619,16 +1619,6 @@ atacapprint(struct ata_params *parm) printf("flush cache %s %s\n", parm->support.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no"); - printf("overlap %s\n", - parm->capabilities1 & ATA_SUPPORT_OVERLAP ? "yes" : "no"); - printf("Tagged Command Queuing (TCQ) %s %s", - parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no"); - if (parm->support.command2 & ATA_SUPPORT_QUEUED) { - printf(" %d tags\n", - ATA_QUEUE_LEN(parm->queue) + 1); - } else - printf("\n"); printf("Native Command Queuing (NCQ) "); if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) { printf("yes %d tags\n", From owner-svn-src-all@freebsd.org Sun Sep 15 17:59: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 015EFF3493; Sun, 15 Sep 2019 17:59:04 +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 46WcZH6732z4Ypj; Sun, 15 Sep 2019 17:59: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 B6AAFBE0C; Sun, 15 Sep 2019 17:59: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 x8FHx37c057964; Sun, 15 Sep 2019 17:59:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FHx3LQ057963; Sun, 15 Sep 2019 17:59:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909151759.x8FHx3LQ057963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 15 Sep 2019 17:59:03 +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: r352360 - 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: 352360 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 17:59:04 -0000 Author: mav Date: Sun Sep 15 17:59:03 2019 New Revision: 352360 URL: https://svnweb.freebsd.org/changeset/base/352360 Log: MFC r352258: Remove Tagged Command Queuing feature reporting. I never saw those devices myself, FreeBSD never supported them, and it is officially obsolete since ACS-2 specification. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Sun Sep 15 17:58:39 2019 (r352359) +++ stable/11/sbin/camcontrol/camcontrol.c Sun Sep 15 17:59:03 2019 (r352360) @@ -1452,16 +1452,6 @@ atacapprint(struct ata_params *parm) printf("flush cache %s %s\n", parm->support.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no"); - printf("overlap %s\n", - parm->capabilities1 & ATA_SUPPORT_OVERLAP ? "yes" : "no"); - printf("Tagged Command Queuing (TCQ) %s %s", - parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no"); - if (parm->support.command2 & ATA_SUPPORT_QUEUED) { - printf(" %d tags\n", - ATA_QUEUE_LEN(parm->queue) + 1); - } else - printf("\n"); printf("Native Command Queuing (NCQ) "); if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) { printf("yes %d tags\n", From owner-svn-src-all@freebsd.org Sun Sep 15 18:29: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 66C04F439B; Sun, 15 Sep 2019 18:29:46 +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 46WdFk20MBz4b4q; Sun, 15 Sep 2019 18:29:46 +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 27DB7C35C; Sun, 15 Sep 2019 18:29:46 +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 x8FITkga075570; Sun, 15 Sep 2019 18:29:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FITkE6075569; Sun, 15 Sep 2019 18:29:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909151829.x8FITkE6075569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 15 Sep 2019 18:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352361 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 352361 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 18:29:46 -0000 Author: tuexen Date: Sun Sep 15 18:29:45 2019 New Revision: 352361 URL: https://svnweb.freebsd.org/changeset/base/352361 Log: When the IP layer calls back into the SCTP layer to perform the SCTP checksum computation, do not assume that the IP header chain and the SCTP common header are in contiguous memory although the SCTP lays out the mbuf chains that way. If there are IP-level options inserted by the IP layer, the constraint is not fulfilled anymore. This issues was found by running syzkaller. Thanks to markj@ who is running an instance which also provides kernel dumps. This allowed me to find this issue. MFC after: 3 days Modified: head/sys/netinet/sctp_crc32.c Modified: head/sys/netinet/sctp_crc32.c ============================================================================== --- head/sys/netinet/sctp_crc32.c Sun Sep 15 17:59:03 2019 (r352360) +++ head/sys/netinet/sctp_crc32.c Sun Sep 15 18:29:45 2019 (r352361) @@ -132,16 +132,16 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) SCTP_STAT_INCR(sctps_sendswcrc); offset += offsetof(struct sctphdr, checksum); - if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) { + if (offset + sizeof(uint32_t) > (uint32_t)(m->m_pkthdr.len)) { #ifdef INVARIANTS - panic("sctp_delayed_cksum(): m->m_len: %d, offset: %u.", - m->m_len, offset); + panic("sctp_delayed_cksum(): m->m_pkthdr.len: %d, offset: %u.", + m->m_pkthdr.len, offset); #else - SCTP_PRINTF("sctp_delayed_cksum(): m->m_len: %d, offset: %u.\n", - m->m_len, offset); + SCTP_PRINTF("sctp_delayed_cksum(): m->m_pkthdr.len: %d, offset: %u.\n", + m->m_pkthdr.len, offset); #endif return; } - *(uint32_t *)(m->m_data + offset) = checksum; + m_copyback(m, (int)offset, (int)sizeof(uint32_t), (caddr_t)&checksum); } #endif From owner-svn-src-all@freebsd.org Sun Sep 15 19:16: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 BCA01F4FAD; Sun, 15 Sep 2019 19:16:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46WfHt4bYQz4cXh; Sun, 15 Sep 2019 19:16:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD9CCBFD; Sun, 15 Sep 2019 19:16:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FJGgIb004824; Sun, 15 Sep 2019 19:16:42 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FJGg1A004823; Sun, 15 Sep 2019 19:16:42 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201909151916.x8FJGg1A004823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 15 Sep 2019 19: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: r352362 - stable/12/sys/dev/ichiic X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/12/sys/dev/ichiic X-SVN-Commit-Revision: 352362 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 19:16:42 -0000 Author: wulf Date: Sun Sep 15 19:16:42 2019 New Revision: 352362 URL: https://svnweb.freebsd.org/changeset/base/352362 Log: ig4(4): Fix SDA HOLD time set too low on Skylake controllers Execution of "Soft reset" command (IG4_REG_RESETS_SKL) at controller init stage sets SDA_HOLD register value to 0x0001 which is often too low for normal operation. Set SDA_HOLD back to 28 after reset to restore controller functionality. PR: 240339 Reported by: imp, GregV, et al. Modified: stable/12/sys/dev/ichiic/ig4_iic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ichiic/ig4_iic.c ============================================================================== --- stable/12/sys/dev/ichiic/ig4_iic.c Sun Sep 15 18:29:45 2019 (r352361) +++ stable/12/sys/dev/ichiic/ig4_iic.c Sun Sep 15 19:16:42 2019 (r352362) @@ -590,6 +590,8 @@ ig4iic_attach(ig4iic_softc_t *sc) reg_write(sc, IG4_REG_SS_SCL_LCNT, 125); reg_write(sc, IG4_REG_FS_SCL_HCNT, 100); reg_write(sc, IG4_REG_FS_SCL_LCNT, 125); + if (sc->version == IG4_SKYLAKE) + reg_write(sc, IG4_REG_SDA_HOLD, 28); /* * Use a threshold of 1 so we get interrupted on each character, From owner-svn-src-all@freebsd.org Sun Sep 15 19:38: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 EDAF3F56C2; Sun, 15 Sep 2019 19:38:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Wfml5qZ7z4dPS; Sun, 15 Sep 2019 19:38:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A688ACF79; Sun, 15 Sep 2019 19:38:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FJcFUg016910; Sun, 15 Sep 2019 19:38:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FJcFLA016909; Sun, 15 Sep 2019 19:38:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201909151938.x8FJcFLA016909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 15 Sep 2019 19:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352363 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 352363 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 19:38:16 -0000 Author: ian Date: Sun Sep 15 19:38:15 2019 New Revision: 352363 URL: https://svnweb.freebsd.org/changeset/base/352363 Log: Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems. The latest imported FDT data defines a node for an iomuxc-gpr device, which we don't support (or need, right now) in addition to the usual iomuxc device. Unfortunately, the dts improperly assigns overlapping ranges of mmio space to both devices. The -gpr device is also a syscon and simple_mfd device. At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then when the real iomuxc driver comes along later, it fails to attach because it tries to allocate its register space, and it's already partially in use by the bogus instance of simple_mfd. This change works around the problem by simply disabling the node for the iomuxc-gpr device, since we don't need it for anything. Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 15 19:16:42 2019 (r352362) +++ head/sys/arm/freescale/imx/imx6_machdep.c Sun Sep 15 19:38:15 2019 (r352363) @@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void) OF_setprop(socnode, "interrupt-parent", &gicxref, sizeof(gicxref)); } +static void +fix_fdt_iomuxc_data(void) +{ + phandle_t node; + + /* + * The linux dts defines two nodes with the same mmio address range, + * iomuxc-gpr and the regular iomuxc. The -grp node is a simple_mfd and + * a syscon, but it only has access to a small subset of the iomuxc + * registers, so it can't serve as the accessor for the iomuxc driver's + * register IO. But right now, the simple_mfd driver attaches first, + * preventing the real iomuxc driver from allocating its mmio register + * range because it partially overlaps with the -gpr range. + * + * For now, by far the easiest thing to do to keep imx6 working is to + * just disable the iomuxc-gpr node because we don't have a driver for + * it anyway, we just need to prevent attachment of simple_mfd. + * + * If we ever write a -gpr driver, this code should probably switch to + * modifying the reg property so that the range covers all the iomuxc + * regs, then the -gpr driver can be a regular syscon driver that iomuxc + * uses for register access. + */ + node = OF_finddevice("/soc/aips-bus@2000000/iomuxc-gpr@20e0000"); + if (node != -1) + OF_setprop(node, "status", "disabled", sizeof("disabled")); +} + static int imx6_attach(platform_t plat) { /* Fix soc interrupt-parent property. */ fix_fdt_interrupt_data(); + + /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */ + fix_fdt_iomuxc_data(); /* Inform the MPCore timer driver that its clock is variable. */ arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES); From owner-svn-src-all@freebsd.org Sun Sep 15 19:41: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 8A730F590B; Sun, 15 Sep 2019 19:41:55 +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 46Wfrz39hBz4djr; Sun, 15 Sep 2019 19:41:55 +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 5146AD0EB; Sun, 15 Sep 2019 19:41:55 +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 x8FJftq4019369; Sun, 15 Sep 2019 19:41:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FJfsVf019366; Sun, 15 Sep 2019 19:41:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201909151941.x8FJfsVf019366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 15 Sep 2019 19:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352364 - 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: 352364 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 19:41:55 -0000 Author: delphij Date: Sun Sep 15 19:41:54 2019 New Revision: 352364 URL: https://svnweb.freebsd.org/changeset/base/352364 Log: Avoid mixing cluster numbers and sector numbers. Makes code more readable. Obtained from: NetBSD MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/boot.c head/sbin/fsck_msdosfs/dir.c head/sbin/fsck_msdosfs/dosfs.h Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Sun Sep 15 19:38:15 2019 (r352363) +++ head/sbin/fsck_msdosfs/boot.c Sun Sep 15 19:41:54 2019 (r352364) @@ -259,12 +259,18 @@ readboot(int dosfs, struct bootblock *boot) return FSFATAL; } - boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + + boot->FirstCluster = (boot->bpbRootDirEnts * 32 + boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec + - boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - - CLUST_FIRST * boot->bpbSecPerClust; - boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / - boot->bpbSecPerClust; + boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; + + if (boot->FirstCluster + boot->bpbSecPerClust > boot->NumSectors) { + pfatal("Cluster offset too large (%u clusters)\n", + boot->FirstCluster); + return FSFATAL; + } + + boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust + + CLUST_FIRST; if (boot->flags & FAT32) boot->ClustMask = CLUST32_MASK; Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Sun Sep 15 19:38:15 2019 (r352363) +++ head/sbin/fsck_msdosfs/dir.c Sun Sep 15 19:41:54 2019 (r352364) @@ -317,7 +317,8 @@ delete(int f, struct bootblock *boot, struct fatEntry break; e = delbuf + endoff; } - off = startcl * boot->bpbSecPerClust + boot->ClusterOffset; + off = (startcl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; + off *= boot->bpbBytesPerSec; if (lseek(f, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); @@ -457,7 +458,7 @@ check_subdirectory(int f, struct bootblock *boot, stru off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; } else { - off = cl * boot->bpbSecPerClust + boot->ClusterOffset; + off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; } /* @@ -538,7 +539,7 @@ readDosDirSection(int f, struct bootblock *boot, struc boot->FATsecs; } else { last = boot->bpbSecPerClust * boot->bpbBytesPerSec; - off = cl * boot->bpbSecPerClust + boot->ClusterOffset; + off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; } off *= boot->bpbBytesPerSec; @@ -1069,8 +1070,9 @@ reconnect(int dosfs, struct bootblock *boot, struct fa lfcl = (lostDir->head < boot->NumClusters) ? lostDir->head : 0; return FSERROR; } - lfoff = lfcl * boot->ClusterSize - + boot->ClusterOffset * boot->bpbBytesPerSec; + lfoff = (lfcl - CLUST_FIRST) * boot->ClusterSize + + boot->FirstCluster * boot->bpbBytesPerSec; + if (lseek(dosfs, lfoff, SEEK_SET) != lfoff || (size_t)read(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) { perr("could not read LOST.DIR"); Modified: head/sbin/fsck_msdosfs/dosfs.h ============================================================================== --- head/sbin/fsck_msdosfs/dosfs.h Sun Sep 15 19:38:15 2019 (r352363) +++ head/sbin/fsck_msdosfs/dosfs.h Sun Sep 15 19:41:54 2019 (r352364) @@ -74,7 +74,7 @@ struct bootblock { u_int32_t NumSectors; /* how many sectors are there */ u_int32_t FATsecs; /* how many sectors are in FAT */ u_int32_t NumFatEntries; /* how many entries really are there */ - u_int ClusterOffset; /* at what sector would sector 0 start */ + u_int FirstCluster; /* at what sector is Cluster CLUST_FIRST */ u_int ClusterSize; /* Cluster size in bytes */ /* Now some statistics: */ From owner-svn-src-all@freebsd.org Sun Sep 15 19:51: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 292D0F5B30; Sun, 15 Sep 2019 19:51:28 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 46Wg400KRwz4f1M; Sun, 15 Sep 2019 19:51:27 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id q17so32051176wrx.10; Sun, 15 Sep 2019 12:51:27 -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:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=KzjvpXZG64egbQj8VLds/UlPe8g1aEn1lsg+BKn33H8=; b=Oesxu/L1RAI0O9r+b0NKvGW6nmJZZRxeRYC0yzkUKdoWsybLKnH6tl7o0oNU6u6yHA qe09CTH2o9U4ZZzQDHVXuzzCALSYjRsHe2qU1vTogryYbRUPH1WtB5MOIcMm4e8pm45B 9qM8HTnl8g8IuBxK3lR4gYxmwVfUCcDURmAZKoVRrrL+zsnmSP9m14OiM5NthFsNyhuk AJaSYVt2MdPxVHxX8w+ptc2QFdIZUKyEDwUiUK1dP+4q/yKyccwBtVglKnze1AhHyXLE dhqHQ5g4LfbNAIxae9CPZLErGXMXJMfZeurkWKAxmjh+PhG9e+wto06s/90QVzPGsdFE epsg== 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=KzjvpXZG64egbQj8VLds/UlPe8g1aEn1lsg+BKn33H8=; b=Psu8F3pLRFjUva2FoAFCu+lF8JWDjhI3iQppmG0n735O0pMkn9X1OV2qicl2vYIcpP i/WpsW+7dSRrG3toiv5JcOoW3RCD5Z32lMZhfuM2kGLXwUywTUlsL2aiwsJQ8uNHQrRs I3Uu518Li25m9JvsXVlGhV3DIVkr8SRWlSiLcy+WpSmOYIWcNls7/ajvV+uCJgtJ+Zxj EU8mA9VRoRAcYbpbHqDGLg3wU7OeHRxpb4tlZZqZgqLyrob/wev5Xu7Ye3fR5+lhEsDP FFYAHHeHku8J68vyXFJouu3s+LspUMPx0O3bokCMMsc/1H5VUw/Sq12UHZ5A9by7rG3m +AWg== X-Gm-Message-State: APjAAAXqUGSF1H0fnZF5j8W2+YUImXqdZ3Vp/Ttvzs3Et0nD5Z3Rzge+ b5Lp1uLebkdLPen8QoILr3pR+TF5 X-Google-Smtp-Source: APXvYqzL98rRSoId7iHUMNoe/UneNczVyG1aRxdQJKav3KY0StiNi11rYfic6OXrCgYLss+oRHvjCA== X-Received: by 2002:a5d:694e:: with SMTP id r14mr9205175wrw.34.1568577084944; Sun, 15 Sep 2019 12:51:24 -0700 (PDT) Received: from v2 (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id d28sm44274058wrb.95.2019.09.15.12.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2019 12:51:24 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 15 Sep 2019 20:51:22 +0100 From: Edward Tomasz Napierala To: Conrad Meyer Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r352337 - in head: share/man/man3 sys/sys tests/sys/sys Message-ID: <20190915195122.GA60633@v2> Mail-Followup-To: Conrad Meyer , src-committers , svn-src-all , svn-src-head References: <201909141923.x8EJNkVx049506@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: 46Wg400KRwz4f1M X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,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: Sun, 15 Sep 2019 19:51:28 -0000 On 0914T1532, Conrad Meyer wrote: > One correction: > > On Sat, Sep 14, 2019 at 12:23 PM Edward Tomasz Napierala > wrote: > > > > Author: trasz > > Date: Sat Sep 14 19:23:46 2019 > > New Revision: 352337 > > URL: https://svnweb.freebsd.org/changeset/base/352337 > > > > Log: > > Introduce arb(3), the Array-based Red-Black Tree macros: similar > > to the traditional tree(3) RB trees, but using an array (preallocated, > > linear chunk of memory) to store the tree. > > > > This avoids allocation overhead, improves memory locality, > > and makes it trivially easy to share/transfer/copy the entire tree > > without the need for marshalling. The downside is that the size > > is fixed at initialization time; there is no mechanism to resize > > it. > > > > This is one of the dependencies for the new stats(3) framework > > (https://reviews.freebsd.org/D20477). > > > > Reviewed by: bcr (man pages), markj > > Discussed with: cem > > This should read: "Objected to by: cem" Sorry, I misunderstood your last comment as withdrawing your objection, my mistake. From owner-svn-src-all@freebsd.org Sun Sep 15 20:13: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 E58A6F6235; Sun, 15 Sep 2019 20:13:47 +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 46WgYl5m9rz4g1N; Sun, 15 Sep 2019 20:13:47 +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 A8C6ED688; Sun, 15 Sep 2019 20:13:47 +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 x8FKDlqV040411; Sun, 15 Sep 2019 20:13:47 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FKDkad040406; Sun, 15 Sep 2019 20:13:46 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201909152013.x8FKDkad040406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 15 Sep 2019 20:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352365 - in stable/12: sbin/swapon share/man/man5 sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in stable/12: sbin/swapon share/man/man5 sys/vm X-SVN-Commit-Revision: 352365 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 20:13:48 -0000 Author: dougm Date: Sun Sep 15 20:13:46 2019 New Revision: 352365 URL: https://svnweb.freebsd.org/changeset/base/352365 Log: MFC 351064 Don't let swapon trimming wipe the bsd label. Reviewed by: alc Approved by: markj (mentor, implicit) Modified: stable/12/sbin/swapon/swapon.8 stable/12/sbin/swapon/swapon.c stable/12/share/man/man5/fstab.5 stable/12/sys/vm/swap_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/swapon/swapon.8 ============================================================================== --- stable/12/sbin/swapon/swapon.8 Sun Sep 15 19:41:54 2019 (r352364) +++ stable/12/sbin/swapon/swapon.8 Sun Sep 15 20:13:46 2019 (r352365) @@ -90,7 +90,17 @@ The .Fl E option causes each of following devices to receive a .Dv BIO_DELETE -command to mark all blocks as unused. +command. +This command marks the device's blocks as unused, except those that +might store a disk label. +This marking can erase a crash dump. +To delay +.Nm swapon +for a device until after +.Nm savecore +has copied the crash dump to another location, use the +.Dq late +option. .Pp The .Nm swapoff Modified: stable/12/sbin/swapon/swapon.c ============================================================================== --- stable/12/sbin/swapon/swapon.c Sun Sep 15 19:41:54 2019 (r352364) +++ stable/12/sbin/swapon/swapon.c Sun Sep 15 20:13:46 2019 (r352365) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -761,8 +762,8 @@ swapon_trim(const char *name) } else errx(1, "%s has an invalid file type", name); /* Trim the device. */ - ioarg[0] = 0; - ioarg[1] = sz; + ioarg[0] = BBSIZE; + ioarg[1] = sz - BBSIZE; if (ioctl(fd, DIOCGDELETE, ioarg) != 0) warn("ioctl(DIOCGDELETE)"); Modified: stable/12/share/man/man5/fstab.5 ============================================================================== --- stable/12/share/man/man5/fstab.5 Sun Sep 15 19:41:54 2019 (r352364) +++ stable/12/share/man/man5/fstab.5 Sun Sep 15 20:13:46 2019 (r352365) @@ -220,8 +220,17 @@ For swap devices, the keyword .Dq trimonce triggers the delivery of a .Dv BIO_DELETE -command to the device to mark -all blocks as unused. +command to the device. +This command marks the device's blocks as unused, except those that +might store a disk label. +This marking can erase a crash dump. +To delay +.Nm swapon +for a device until after +.Nm savecore +has copied the crash dump to another location, use the +.Dq late +option. For vnode-backed swap spaces, .Dq file is supported in the Modified: stable/12/sys/vm/swap_pager.c ============================================================================== --- stable/12/sys/vm/swap_pager.c Sun Sep 15 19:41:54 2019 (r352364) +++ stable/12/sys/vm/swap_pager.c Sun Sep 15 20:13:46 2019 (r352365) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2240,10 +2241,11 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl sp->sw_blist = blist_create(nblks, M_WAITOK); /* - * Do not free the first two block in order to avoid overwriting + * Do not free the first blocks in order to avoid overwriting * any bsd label at the front of the partition */ - blist_free(sp->sw_blist, 2, nblks - 2); + blist_free(sp->sw_blist, howmany(BBSIZE, PAGE_SIZE), + nblks - howmany(BBSIZE, PAGE_SIZE)); dvbase = 0; mtx_lock(&sw_dev_mtx); @@ -2261,7 +2263,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl sp->sw_end = dvbase + nblks; TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; - swap_pager_avail += nblks - 2; + swap_pager_avail += nblks - howmany(BBSIZE, PAGE_SIZE); swap_total += nblks; swapon_check_swzone(); swp_sizecheck(); From owner-svn-src-all@freebsd.org Sun Sep 15 21:13: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 34B22E8104; Sun, 15 Sep 2019 21:13:14 +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 46WhtL0bycz3Fh9; Sun, 15 Sep 2019 21:13:14 +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 EC063E24D; Sun, 15 Sep 2019 21:13:13 +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 x8FLDDsZ075946; Sun, 15 Sep 2019 21:13:13 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FLDDve075945; Sun, 15 Sep 2019 21:13:13 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201909152113.x8FLDDve075945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 15 Sep 2019 21:13:13 +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: r352366 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 352366 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 21:13:14 -0000 Author: dougm Date: Sun Sep 15 21:13:13 2019 New Revision: 352366 URL: https://svnweb.freebsd.org/changeset/base/352366 Log: MFC r348809, r349767 Let swap_pager_swapoff_object and swp_pager_force_pagein operate on multiple pages per I/O operation. Reviewed by: alc Approved by: markj (implicit, mentor) Modified: stable/12/sys/vm/swap_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/swap_pager.c ============================================================================== --- stable/12/sys/vm/swap_pager.c Sun Sep 15 20:13:46 2019 (r352365) +++ stable/12/sys/vm/swap_pager.c Sun Sep 15 21:13:13 2019 (r352366) @@ -1653,56 +1653,143 @@ swap_pager_nswapdev(void) return (nswapdev); } -/* - * SWP_PAGER_FORCE_PAGEIN() - force a swap block to be paged in - * - * This routine dissociates the page at the given index within an object - * from its backing store, paging it in if it does not reside in memory. - * If the page is paged in, it is marked dirty and placed in the laundry - * queue. The page is marked dirty because it no longer has backing - * store. It is placed in the laundry queue because it has not been - * accessed recently. Otherwise, it would already reside in memory. - * - * We also attempt to swap in all other pages in the swap block. - * However, we only guarantee that the one at the specified index is - * paged in. - * - * XXX - The code to page the whole block in doesn't work, so we - * revert to the one-by-one behavior for now. Sigh. - */ -static inline void -swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex) +static void +swp_pager_force_dirty(vm_page_t m) { - vm_page_t m; - vm_object_pip_add(object, 1); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); - if (m->valid == VM_PAGE_BITS_ALL) { - vm_object_pip_wakeup(object); - vm_page_dirty(m); + vm_page_dirty(m); #ifdef INVARIANTS - vm_page_lock(m); - if (!vm_page_wired(m) && m->queue == PQ_NONE) - panic("page %p is neither wired nor queued", m); - vm_page_unlock(m); + vm_page_lock(m); + if (!vm_page_wired(m) && m->queue == PQ_NONE) + panic("page %p is neither wired nor queued", m); + vm_page_unlock(m); #endif - vm_page_xunbusy(m); - vm_pager_page_unswapped(m); - return; - } + vm_page_xunbusy(m); + swap_pager_unswapped(m); +} - if (swap_pager_getpages(object, &m, 1, NULL, NULL) != VM_PAGER_OK) - panic("swap_pager_force_pagein: read from swap failed");/*XXX*/ - vm_object_pip_wakeup(object); +static void +swp_pager_force_launder(vm_page_t m) +{ + vm_page_dirty(m); vm_page_lock(m); vm_page_launder(m); vm_page_unlock(m); vm_page_xunbusy(m); - vm_pager_page_unswapped(m); + swap_pager_unswapped(m); } /* + * SWP_PAGER_FORCE_PAGEIN() - force swap blocks to be paged in + * + * This routine dissociates pages starting at the given index within an + * object from their backing store, paging them in if they do not reside + * in memory. Pages that are paged in are marked dirty and placed in the + * laundry queue. Pages are marked dirty because they no longer have + * backing store. They are placed in the laundry queue because they have + * not been accessed recently. Otherwise, they would already reside in + * memory. + */ +static void +swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex, int npages) +{ + vm_page_t ma[npages]; + int i, j; + + KASSERT(npages > 0, ("%s: No pages", __func__)); + KASSERT(npages <= MAXPHYS / PAGE_SIZE, + ("%s: Too many pages: %d", __func__, npages)); + vm_object_pip_add(object, npages); + vm_page_grab_pages(object, pindex, VM_ALLOC_NORMAL, ma, npages); + for (i = j = 0;; i++) { + /* Count nonresident pages, to page-in all at once. */ + if (i < npages && ma[i]->valid != VM_PAGE_BITS_ALL) + continue; + if (j < i) { + /* Page-in nonresident pages. Mark for laundering. */ + if (swap_pager_getpages(object, &ma[j], i - j, NULL, + NULL) != VM_PAGER_OK) + panic("%s: read from swap failed", __func__); + do { + swp_pager_force_launder(ma[j]); + } while (++j < i); + } + if (i == npages) + break; + /* Mark dirty a resident page. */ + swp_pager_force_dirty(ma[j++]); + } + vm_object_pip_wakeupn(object, npages); +} + +/* + * swap_pager_swapoff_object: + * + * Page in all of the pages that have been paged out for an object + * to a swap device. + */ +static void +swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) +{ + struct swblk *sb; + vm_pindex_t pi, s_pindex; + daddr_t blk, n_blks, s_blk; + int i; + + n_blks = 0; + for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi)) != NULL; ) { + for (i = 0; i < SWAP_META_PAGES; i++) { + blk = sb->d[i]; + if (!swp_pager_isondev(blk, sp)) + blk = SWAPBLK_NONE; + + /* + * If there are no blocks/pages accumulated, start a new + * accumulation here. + */ + if (n_blks == 0) { + if (blk != SWAPBLK_NONE) { + s_blk = blk; + s_pindex = sb->p + i; + n_blks = 1; + } + continue; + } + + /* + * If the accumulation can be extended without breaking + * the sequence of consecutive blocks and pages that + * swp_pager_force_pagein() depends on, do so. + */ + if (n_blks < MAXPHYS / PAGE_SIZE && + s_blk + n_blks == blk && + s_pindex + n_blks == sb->p + i) { + ++n_blks; + continue; + } + + /* + * The sequence of consecutive blocks and pages cannot + * be extended, so page them all in here. Then, + * because doing so involves releasing and reacquiring + * a lock that protects the swap block pctrie, do not + * rely on the current swap block. Break this loop and + * re-fetch the same pindex from the pctrie again. + */ + swp_pager_force_pagein(object, s_pindex, n_blks); + n_blks = 0; + break; + } + if (i == SWAP_META_PAGES) + pi = sb->p + SWAP_META_PAGES; + } + if (n_blks > 0) + swp_pager_force_pagein(object, s_pindex, n_blks); +} + +/* * swap_pager_swapoff: * * Page in all of the pages that have been paged out to the @@ -1715,10 +1802,8 @@ swp_pager_force_pagein(vm_object_t object, vm_pindex_t static void swap_pager_swapoff(struct swdevt *sp) { - struct swblk *sb; vm_object_t object; - vm_pindex_t pi; - int i, retries; + int retries; sx_assert(&swdev_syscall_lock, SA_XLOCKED); @@ -1748,17 +1833,7 @@ full_rescan: if (object->type != OBJT_SWAP) goto next_obj; - for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( - &object->un_pager.swp.swp_blks, pi)) != NULL; ) { - pi = sb->p + SWAP_META_PAGES; - for (i = 0; i < SWAP_META_PAGES; i++) { - if (sb->d[i] == SWAPBLK_NONE) - continue; - if (swp_pager_isondev(sb->d[i], sp)) - swp_pager_force_pagein(object, - sb->p + i); - } - } + swap_pager_swapoff_object(sp, object); next_obj: VM_OBJECT_WUNLOCK(object); mtx_lock(&vm_object_list_mtx); From owner-svn-src-all@freebsd.org Sun Sep 15 21: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 1D514E8613; Sun, 15 Sep 2019 21:27:15 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WjBV73sMz3GGD; Sun, 15 Sep 2019 21:27:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1705E3FE; Sun, 15 Sep 2019 21:27:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FLRECJ081900; Sun, 15 Sep 2019 21:27:14 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FLREOa081899; Sun, 15 Sep 2019 21:27:14 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909152127.x8FLREOa081899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 15 Sep 2019 21:27: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: r352367 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352367 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 21:27:15 -0000 Author: alc Date: Sun Sep 15 21:27:14 2019 New Revision: 352367 URL: https://svnweb.freebsd.org/changeset/base/352367 Log: MFC r349905 According to Section D5.10.3 "Maintenance requirements on changing System register values" of the architecture manual, an isb instruction should be executed after updating ttbr0_el1 and before invalidating the TLB. Modified: stable/12/sys/arm64/arm64/efirt_machdep.c stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/efirt_machdep.c Sun Sep 15 21:13:13 2019 (r352366) +++ stable/12/sys/arm64/arm64/efirt_machdep.c Sun Sep 15 21:27:14 2019 (r352367) @@ -245,6 +245,7 @@ efi_arch_enter(void) __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" @@ -262,6 +263,7 @@ efi_arch_leave(void) td = curthread; __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 21:13:13 2019 (r352366) +++ stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 21:27:14 2019 (r352367) @@ -5175,8 +5175,10 @@ pmap_activate(struct thread *td) critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); - __asm __volatile("msr ttbr0_el1, %0" : : - "r"(td->td_proc->p_md.md_l0addr)); + __asm __volatile( + "msr ttbr0_el1, %0 \n" + "isb \n" + : : "r"(td->td_proc->p_md.md_l0addr)); pmap_invalidate_all(pmap); critical_exit(); } From owner-svn-src-all@freebsd.org Sun Sep 15 21:32: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 19DA9E886B; Sun, 15 Sep 2019 21:32:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WjJM71X3z3Ggn; Sun, 15 Sep 2019 21:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4343E5AF; Sun, 15 Sep 2019 21:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8FLWJ0u084453; Sun, 15 Sep 2019 21:32:19 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FLWJhQ084452; Sun, 15 Sep 2019 21:32:19 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909152132.x8FLWJhQ084452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 15 Sep 2019 21:32: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: r352368 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352368 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 21:32:20 -0000 Author: alc Date: Sun Sep 15 21:32:19 2019 New Revision: 352368 URL: https://svnweb.freebsd.org/changeset/base/352368 Log: MFC r349070 Previously, when pmap_remove_pages() destroyed a dirty superpage mapping, it only called vm_page_dirty() on the first of the superpage's constituent 4KB pages. This revision corrects that error, calling vm_page_dirty() on all of superpage's constituent 4KB pages. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 21:27:14 2019 (r352367) +++ stable/12/sys/arm64/arm64/pmap.c Sun Sep 15 21:32:19 2019 (r352368) @@ -4055,7 +4055,7 @@ pmap_remove_pages(pmap_t pmap) switch (lvl) { case 1: for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) - vm_page_dirty(m); + vm_page_dirty(mt); break; case 2: vm_page_dirty(m); From owner-svn-src-all@freebsd.org Sun Sep 15 23: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 964C7EBE92; Sun, 15 Sep 2019 23:56:40 +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 46WmVw3VX1z3NYf; Sun, 15 Sep 2019 23:56:40 +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 5B321FEB7; Sun, 15 Sep 2019 23:56:40 +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 x8FNueld070713; Sun, 15 Sep 2019 23:56:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8FNuen4070712; Sun, 15 Sep 2019 23:56:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909152356.x8FNuen4070712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 15 Sep 2019 23:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352369 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 352369 X-SVN-Commit-Repository: base MIME-Version: 1.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, 15 Sep 2019 23:56:40 -0000 Author: mav Date: Sun Sep 15 23:56:39 2019 New Revision: 352369 URL: https://svnweb.freebsd.org/changeset/base/352369 Log: Relax TX draining in ns8250_bus_transmit(). Since TX interrupt is generated when THRE is set, wait for TEMT set means wait for full character transmission time. At low speeds that may take awhile, burning CPU time while holding sc_hwmtx lock, also congested. This is partial revert of r317659. PR: 240121 MFC after: 2 weeks Modified: head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Sun Sep 15 21:32:19 2019 (r352368) +++ head/sys/dev/uart/uart_dev_ns8250.c Sun Sep 15 23:56:39 2019 (r352369) @@ -1029,13 +1029,8 @@ ns8250_bus_transmit(struct uart_softc *sc) bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - if (sc->sc_txdatasz > 1) { - if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) - ns8250_drain(bas, UART_DRAIN_TRANSMITTER); - } else { - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) - DELAY(4); - } + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) + DELAY(4); for (i = 0; i < sc->sc_txdatasz; i++) { uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); From owner-svn-src-all@freebsd.org Mon Sep 16 00:32: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 3E517ED00E; Mon, 16 Sep 2019 00:32:24 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WnJ80xfdz3Q19; Mon, 16 Sep 2019 00:32:24 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 035E7185C0; Mon, 16 Sep 2019 00:32:24 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G0WNT3093990; Mon, 16 Sep 2019 00:32:23 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G0WNNY093989; Mon, 16 Sep 2019 00:32:23 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201909160032.x8G0WNNY093989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 16 Sep 2019 00:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352370 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 352370 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 00:32:24 -0000 Author: sjg Date: Mon Sep 16 00:32:23 2019 New Revision: 352370 URL: https://svnweb.freebsd.org/changeset/base/352370 Log: Document logic for __DEFAULT_DEPENDENT_OPTIONS Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D21640 Modified: head/share/mk/bsd.mkopt.mk Modified: head/share/mk/bsd.mkopt.mk ============================================================================== --- head/share/mk/bsd.mkopt.mk Sun Sep 15 23:56:39 2019 (r352369) +++ head/share/mk/bsd.mkopt.mk Mon Sep 16 00:32:23 2019 (r352370) @@ -11,12 +11,16 @@ # For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no", # unless WITH_FOO is defined, in which case it is set to "yes". # +# For each entry FOO/BAR in __DEFAULT_DEPENDENT_OPTIONS, +# MK_FOO is set to "no" if WITHOUT_FOO is defined, +# "yes" if WITH_FOO is defined, otherwise the value of MK_BAR. +# # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and # MK_FOO is set to "no" regardless of which list it was in. # -# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd -# after all this processing, allowing this file to be included -# multiple times with different lists. +# All of __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and +# __DEFAULT_DEPENDENT_OPTIONS are undef'd after all this processing, +# allowing this file to be included multiple times with different lists. # # Other parts of the build system will set BROKEN_OPTIONS to a list # of options that are broken on this platform. This will not be unset From owner-svn-src-all@freebsd.org Mon Sep 16 00: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 6864AED271; Mon, 16 Sep 2019 00:36:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 46WnP920V2z3QGP; Mon, 16 Sep 2019 00:36:44 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f54.google.com with SMTP id r26so74649591ioh.8; Sun, 15 Sep 2019 17:36:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=re6LHFQDMlTUnSirnF1PaeXdZMPt5ZQJ2vC7hiiqHik=; b=qS9V7EZnuVXJ1DTIt77OrhDuGk0fkAaGKuNgkxsB+npc0tLtxl1jnwSUqji+9gS3ov iah3LtrYxrVKNb9czs7DNx1/nPLXH5xXfj/+k3nddKqKUz5YpfbjUOsIZ/xwMwPFZxx4 +t2zPHD+jox7jZepcw1ZW3K0VfC0vlDT9nR1d0E+VMSbZuso4IFmPOozozb3+TXC9XRn UzY/H7Myj9zEVctgmmfJCjJQ8yG3PbUNDwBJhxdyU1XVpL60ikd3vHLmnzFLQYbjHUNj 0OJ3zOZY0il4Hcu/ZyIYLFKsyQJN6yWJ5IlIlakcdDPzmpnt6kON/A9r6LEIS1ekaNl5 VbBQ== X-Gm-Message-State: APjAAAXilyu69st1Hws5RaK4f2TbyrvETPqhqjm1dlvLd1wQcR1TZF/J Hl9RJoiYWSpsAILoY1wsewxIofnE X-Google-Smtp-Source: APXvYqzUoS4GYIAhE+lHD0uNUH4Z2c4m7yD0FM5I0N0F8FJHxxle7DE315l2FytFUMbC2JoSrgsLzA== X-Received: by 2002:a6b:f40f:: with SMTP id i15mr3148740iog.244.1568594203467; Sun, 15 Sep 2019 17:36:43 -0700 (PDT) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com. [209.85.166.45]) by smtp.gmail.com with ESMTPSA id z11sm31731372ioi.88.2019.09.15.17.36.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Sep 2019 17:36:43 -0700 (PDT) Received: by mail-io1-f45.google.com with SMTP id b136so74866491iof.3; Sun, 15 Sep 2019 17:36:43 -0700 (PDT) X-Received: by 2002:a02:8502:: with SMTP id g2mr17879917jai.87.1568594202946; Sun, 15 Sep 2019 17:36:42 -0700 (PDT) MIME-Version: 1.0 References: <201909141923.x8EJNkVx049506@repo.freebsd.org> <20190915195122.GA60633@v2> In-Reply-To: <20190915195122.GA60633@v2> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sun, 15 Sep 2019 17:36:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352337 - in head: share/man/man3 sys/sys tests/sys/sys To: Edward Tomasz Napierala Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46WnP920V2z3QGP X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,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: Mon, 16 Sep 2019 00:36:45 -0000 On Sun, Sep 15, 2019 at 12:51 PM Edward Tomasz Napierala wrote: > On 0914T1532, Conrad Meyer wrote: > > On Sat, Sep 14, 2019 at 12:23 PM Edward Tomasz Napierala > > wrote: > > > URL: https://svnweb.freebsd.org/changeset/base/352337 > > > > > > Log: > > > Introduce arb(3), the Array-based Red-Black Tree macros: similar > > > to the traditional tree(3) RB trees, but using an array (preallocated, > > > linear chunk of memory) to store the tree. > > > ... > > > > > > Reviewed by: bcr (man pages), markj > > > Discussed with: cem > > > ... > > > Differential Revision: https://reviews.freebsd.org/D20324 > > > > This should read: "Objected to by: cem" > > Sorry, I misunderstood your last comment as withdrawing your objection, > my mistake. The comment that starts with "I'm still skeptical?" "Less objectionable" doesn't mean "not objectionable." Maybe I could have been more explicit, sorry for the confusion. Conrad From owner-svn-src-all@freebsd.org Mon Sep 16 00: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 5CB1DEDB98; Mon, 16 Sep 2019 00:56:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Wnr32W5gz3RDs; Mon, 16 Sep 2019 00:56:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3916018966; Mon, 16 Sep 2019 00:56:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G0uZej006202; Mon, 16 Sep 2019 00:56:35 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G0uXTI006195; Mon, 16 Sep 2019 00:56:33 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909160056.x8G0uXTI006195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 00:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352371 - in stable/12: etc/mtree sbin/ping sbin/ping/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: etc/mtree sbin/ping sbin/ping/tests X-SVN-Commit-Revision: 352371 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 00:56:35 -0000 Author: asomers Date: Mon Sep 16 00:56:33 2019 New Revision: 352371 URL: https://svnweb.freebsd.org/changeset/base/352371 Log: MFC r351318, r351330, r351393, r351398, r351440, r351461, r351548, r352226, r352229 r351318: ping: Add tests of the Internet checksum function Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21340 r351330: ping: do reverse DNS lookup of the target address When printing replies, ping will now attempt a reverse DNS lookup of the target. That can be suppressed by using the "-n" option. Curiously, ping has always done reverse lookups in certain error paths, but never in the success path. Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21351 r351393: ping: add a basic functional test Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21289 r351398: ping: By default, don't reverse lookup IP addresses ping's default is now not to attempt reverse DNS lookups. The -H flag will enable them. This change is not quite a reversion of r351330. That change made the happy path and error path do reverse lookups consistently; this change changes the default for both paths. Submitted by: Ján Sučan Discussed with: cem MFC-With: 351330 Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21364 r351440: ping: Fix alignment errors This fixes -Wcast-align errors when compiled with WARNS=6. Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21327 r351461: ping: fix unaligned access to ancillary data Use CMSG_FIRSTHDR rather than assume that an array is correctly aligned. Fixes warnings on sparc64 and powerpcspe. Submitted by: Ján Sučan MFH: 2 weeks Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21406 r351548: ping: raise WARNS level to 6 Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21405 r352226: ping: fix a string in an error message r352229: ping: Verify whether a datagram timestamp was actually received. ping(8) uses SO_TIMESTAMP, which attaches a timestamp to each IP datagram at the time it's received by the kernel. Except that occasionally it doesn't. Add a check to see whether such a timestamp was actually set before trying to read it. This fixes segfaults that can happen when the kernel doesn't attach a timestamp. The bug has always existed, but prior to r351461 it manifested as an implausible round-trip-time, not a segfault. Reported by: pho MFC-With: 351461 Added: stable/12/sbin/ping/tests/ - copied from r351318, head/sbin/ping/tests/ stable/12/sbin/ping/tests/ping_c1_s56_t1.out - copied, changed from r351393, head/sbin/ping/tests/ping_c1_s56_t1.out stable/12/sbin/ping/tests/ping_test.sh - copied unchanged from r351393, head/sbin/ping/tests/ping_test.sh Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/sbin/ping/Makefile stable/12/sbin/ping/ping.8 stable/12/sbin/ping/ping.c stable/12/sbin/ping/tests/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 00:32:23 2019 (r352370) +++ stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 00:56:33 2019 (r352371) @@ -428,6 +428,8 @@ files .. .. + ping + .. .. secure lib Modified: stable/12/sbin/ping/Makefile ============================================================================== --- stable/12/sbin/ping/Makefile Mon Sep 16 00:32:23 2019 (r352370) +++ stable/12/sbin/ping/Makefile Mon Sep 16 00:56:33 2019 (r352371) @@ -9,7 +9,6 @@ SRCS= ping.c utils.c MAN= ping.8 BINOWN= root BINMODE=4555 -WARNS?= 3 LIBADD= m .if ${MK_DYNAMICROOT} == "no" @@ -24,5 +23,8 @@ CFLAGS+=-DWITH_CASPER CFLAGS+=-DIPSEC LIBADD+= ipsec .endif + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/12/sbin/ping/ping.8 ============================================================================== --- stable/12/sbin/ping/ping.8 Mon Sep 16 00:32:23 2019 (r352370) +++ stable/12/sbin/ping/ping.8 Mon Sep 16 00:56:33 2019 (r352371) @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd March 11, 2016 +.Dd August 22, 2019 .Dt PING 8 .Os .Sh NAME @@ -157,6 +157,12 @@ Specify the size of .Tn ICMP payload to start with when sending sweeping pings. The default value is 0. +.It Fl H +Hostname output. +Try to do a reverse DNS lookup when displaying addresses. +This is the opposite of the +.Fl n +option. .It Fl h Ar sweepincrsize Specify the number of bytes to increment the size of .Tn ICMP @@ -220,6 +226,9 @@ MIB variable. .It Fl n Numeric output only. No attempt will be made to lookup symbolic names for host addresses. +This is the opposite of +.Fl H , +and it is the default behavior. .It Fl o Exit successfully after receiving one reply packet. .It Fl P Ar policy Modified: stable/12/sbin/ping/ping.c ============================================================================== --- stable/12/sbin/ping/ping.c Mon Sep 16 00:32:23 2019 (r352370) +++ stable/12/sbin/ping/ping.c Mon Sep 16 00:56:33 2019 (r352371) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -216,10 +217,10 @@ static void finish(void) __dead2; static void pinger(void); static char *pr_addr(struct in_addr); static char *pr_ntime(n_time); -static void pr_icmph(struct icmp *); +static void pr_icmph(struct icmp *, struct ip *, const u_char *const); static void pr_iph(struct ip *); -static void pr_pack(char *, int, struct sockaddr_in *, struct timespec *); -static void pr_retip(struct ip *); +static void pr_pack(char *, ssize_t, struct sockaddr_in *, struct timespec *); +static void pr_retip(struct ip *, const u_char *); static void status(int); static void stopit(int); static void usage(void) __dead2; @@ -231,7 +232,6 @@ main(int argc, char *const *argv) struct in_addr ifaddr; struct timespec last, intvl; struct iovec iov; - struct ip *ip; struct msghdr msg; struct sigaction si_sa; size_t sz; @@ -261,6 +261,8 @@ main(int argc, char *const *argv) cap_rights_t rights; bool cansandbox; + options |= F_NUMERIC; + /* * Do the stuff that we need root priv's for *first*, and * then drop our setuid bit. Save error reporting for @@ -689,7 +691,9 @@ main(int argc, char *const *argv) #endif /*IPSEC*/ if (options & F_HDRINCL) { - ip = (struct ip*)outpackhdr; + struct ip ip; + + memcpy(&ip, outpackhdr, sizeof(ip)); if (!(options & (F_TTL | F_MTTL))) { mib[0] = CTL_NET; mib[1] = PF_INET; @@ -700,15 +704,16 @@ main(int argc, char *const *argv) err(1, "sysctl(net.inet.ip.ttl)"); } setsockopt(ssend, IPPROTO_IP, IP_HDRINCL, &hold, sizeof(hold)); - ip->ip_v = IPVERSION; - ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_tos = tos; - ip->ip_id = 0; - ip->ip_off = htons(df ? IP_DF : 0); - ip->ip_ttl = ttl; - ip->ip_p = IPPROTO_ICMP; - ip->ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY; - ip->ip_dst = to->sin_addr; + ip.ip_v = IPVERSION; + ip.ip_hl = sizeof(struct ip) >> 2; + ip.ip_tos = tos; + ip.ip_id = 0; + ip.ip_off = htons(df ? IP_DF : 0); + ip.ip_ttl = ttl; + ip.ip_p = IPPROTO_ICMP; + ip.ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY; + ip.ip_dst = to->sin_addr; + memcpy(outpackhdr, &ip, sizeof(ip)); } if (options & F_NUMERIC) @@ -724,7 +729,7 @@ main(int argc, char *const *argv) * We must connect(2) our socket before this point. */ if (cansandbox && cap_enter() < 0 && errno != ENOSYS) - err(1, "cap_enter"); + err(1, "caph_enter_casper"); cap_rights_init(&rights, CAP_RECV, CAP_EVENT, CAP_SETSOCKOPT); if (cap_rights_limit(srecv, &rights) < 0 && errno != ENOSYS) @@ -881,6 +886,7 @@ main(int argc, char *const *argv) msg.msg_iovlen = 1; #ifdef SO_TIMESTAMP msg.msg_control = (caddr_t)ctrl; + msg.msg_controllen = sizeof(ctrl); #endif iov.iov_base = packet; iov.iov_len = IP_MAXPACKET; @@ -907,7 +913,8 @@ main(int argc, char *const *argv) while (!finish_up) { struct timespec now, timeout; fd_set rfds; - int cc, n; + int n; + ssize_t cc; check_status(); if ((unsigned)srecv >= FD_SETSIZE) @@ -925,9 +932,7 @@ main(int argc, char *const *argv) if (n == 1) { struct timespec *tv = NULL; #ifdef SO_TIMESTAMP - struct cmsghdr *cmsg = (struct cmsghdr *)&ctrl; - - msg.msg_controllen = sizeof(ctrl); + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); #endif msg.msg_namelen = sizeof(from); if ((cc = recvmsg(srecv, &msg, 0)) < 0) { @@ -937,7 +942,8 @@ main(int argc, char *const *argv) continue; } #ifdef SO_TIMESTAMP - if (cmsg->cmsg_level == SOL_SOCKET && + if (cmsg != NULL && + cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP && cmsg->cmsg_len == CMSG_LEN(sizeof *tv)) { /* Copy to avoid alignment problems: */ @@ -1025,18 +1031,17 @@ pinger(void) { struct timespec now; struct tv32 tv32; - struct ip *ip; - struct icmp *icp; + struct icmp icp; int cc, i; u_char *packet; packet = outpack; - icp = (struct icmp *)outpack; - icp->icmp_type = icmp_type; - icp->icmp_code = 0; - icp->icmp_cksum = 0; - icp->icmp_seq = htons(ntransmitted); - icp->icmp_id = ident; /* ID */ + memcpy(&icp, outpack, ICMP_MINLEN + phdr_len); + icp.icmp_type = icmp_type; + icp.icmp_code = 0; + icp.icmp_cksum = 0; + icp.icmp_seq = htons(ntransmitted); + icp.icmp_id = ident; /* ID */ CLR(ntransmitted % mx_dup_ck); @@ -1051,7 +1056,7 @@ pinger(void) tv32.tv32_sec = (uint32_t)htonl(now.tv_sec); tv32.tv32_nsec = (uint32_t)htonl(now.tv_nsec); if (options & F_TIME) - icp->icmp_otime = htonl((now.tv_sec % (24*60*60)) + icp.icmp_otime = htonl((now.tv_sec % (24*60*60)) * 1000 + now.tv_nsec / 1000000); if (timing) bcopy((void *)&tv32, @@ -1059,16 +1064,28 @@ pinger(void) sizeof(tv32)); } + memcpy(outpack, &icp, ICMP_MINLEN + phdr_len); + cc = ICMP_MINLEN + phdr_len + datalen; /* compute ICMP checksum here */ - icp->icmp_cksum = in_cksum((u_char *)icp, cc); + icp.icmp_cksum = in_cksum(outpack, cc); + /* Update icmp_cksum in the raw packet data buffer. */ + memcpy(outpack + offsetof(struct icmp, icmp_cksum), &icp.icmp_cksum, + sizeof(icp.icmp_cksum)); if (options & F_HDRINCL) { + struct ip ip; + cc += sizeof(struct ip); - ip = (struct ip *)outpackhdr; - ip->ip_len = htons(cc); - ip->ip_sum = in_cksum(outpackhdr, cc); + ip.ip_len = htons(cc); + /* Update ip_len in the raw packet data buffer. */ + memcpy(outpackhdr + offsetof(struct ip, ip_len), &ip.ip_len, + sizeof(ip.ip_len)); + ip.ip_sum = in_cksum(outpackhdr, cc); + /* Update ip_sum in the raw packet data buffer. */ + memcpy(outpackhdr + offsetof(struct ip, ip_sum), &ip.ip_sum, + sizeof(ip.ip_sum)); packet = outpackhdr; } i = send(ssend, (char *)packet, cc, 0); @@ -1098,48 +1115,62 @@ pinger(void) * program to be run without having intermingled output (or statistics!). */ static void -pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timespec *tv) +pr_pack(char *buf, ssize_t cc, struct sockaddr_in *from, struct timespec *tv) { struct in_addr ina; - u_char *cp, *dp; - struct icmp *icp; - struct ip *ip; - const void *tp; + u_char *cp, *dp, l; + struct icmp icp; + struct ip ip; + const u_char *icmp_data_raw; double triptime; int dupflag, hlen, i, j, recv_len; uint16_t seq; static int old_rrlen; static char old_rr[MAX_IPOPTLEN]; + struct ip oip; + u_char oip_header_len; + struct icmp oicmp; + const u_char *oicmp_raw; + /* + * Get size of IP header of the received packet. The + * information is contained in the lower four bits of the + * first byte. + */ + memcpy(&l, buf, sizeof(l)); + hlen = (l & 0x0f) << 2; + memcpy(&ip, buf, hlen); + /* Check the IP header */ - ip = (struct ip *)buf; - hlen = ip->ip_hl << 2; recv_len = cc; if (cc < hlen + ICMP_MINLEN) { if (options & F_VERBOSE) - warn("packet too short (%d bytes) from %s", cc, + warn("packet too short (%zd bytes) from %s", cc, inet_ntoa(from->sin_addr)); return; } +#ifndef icmp_data + icmp_data_raw = buf + hlen + offsetof(struct icmp, icmp_ip); +#else + icmp_data_raw = buf + hlen + offsetof(struct icmp, icmp_data); +#endif + /* Now the ICMP part */ cc -= hlen; - icp = (struct icmp *)(buf + hlen); - if (icp->icmp_type == icmp_type_rsp) { - if (icp->icmp_id != ident) + memcpy(&icp, buf + hlen, MIN((ssize_t)sizeof(icp), cc)); + if (icp.icmp_type == icmp_type_rsp) { + if (icp.icmp_id != ident) return; /* 'Twas not our ECHO */ ++nreceived; triptime = 0.0; if (timing) { struct timespec tv1; struct tv32 tv32; -#ifndef icmp_data - tp = &icp->icmp_ip; -#else - tp = icp->icmp_data; -#endif - tp = (const char *)tp + phdr_len; + const u_char *tp; + tp = icmp_data_raw + phdr_len; + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= sizeof(tv1)) { /* Copy to avoid alignment problems: */ @@ -1159,7 +1190,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s timing = 0; } - seq = ntohs(icp->icmp_seq); + seq = ntohs(icp.icmp_seq); if (TST(seq % mx_dup_ck)) { ++nrepeats; @@ -1181,10 +1212,9 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s if (options & F_FLOOD) (void)write(STDOUT_FILENO, &BSPACE, 1); else { - (void)printf("%d bytes from %s: icmp_seq=%u", cc, - inet_ntoa(*(struct in_addr *)&from->sin_addr.s_addr), - seq); - (void)printf(" ttl=%d", ip->ip_ttl); + (void)printf("%zd bytes from %s: icmp_seq=%u", cc, + pr_addr(from->sin_addr), seq); + (void)printf(" ttl=%d", ip.ip_ttl); if (timing) (void)printf(" time=%.3f ms", triptime); if (dupflag) @@ -1194,12 +1224,12 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s if (options & F_MASK) { /* Just prentend this cast isn't ugly */ (void)printf(" mask=%s", - inet_ntoa(*(struct in_addr *)&(icp->icmp_mask))); + inet_ntoa(*(struct in_addr *)&(icp.icmp_mask))); } if (options & F_TIME) { - (void)printf(" tso=%s", pr_ntime(icp->icmp_otime)); - (void)printf(" tsr=%s", pr_ntime(icp->icmp_rtime)); - (void)printf(" tst=%s", pr_ntime(icp->icmp_ttime)); + (void)printf(" tso=%s", pr_ntime(icp.icmp_otime)); + (void)printf(" tsr=%s", pr_ntime(icp.icmp_rtime)); + (void)printf(" tst=%s", pr_ntime(icp.icmp_ttime)); } if (recv_len != send_len) { (void)printf( @@ -1207,7 +1237,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s recv_len, send_len); } /* check the data */ - cp = (u_char*)&icp->icmp_data[phdr_len]; + cp = (u_char*)(buf + hlen + offsetof(struct icmp, + icmp_data) + phdr_len); dp = &outpack[ICMP_MINLEN + phdr_len]; cc -= ICMP_MINLEN + phdr_len; i = 0; @@ -1222,7 +1253,8 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s (void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x", i, *dp, *cp); (void)printf("\ncp:"); - cp = (u_char*)&icp->icmp_data[0]; + cp = (u_char*)(buf + hlen + + offsetof(struct icmp, icmp_data)); for (i = 0; i < datalen; ++i, ++cp) { if ((i % 16) == 8) (void)printf("\n\t"); @@ -1250,22 +1282,22 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, s * as root to avoid leaking information not normally * available to those not running as root. */ -#ifndef icmp_data - struct ip *oip = &icp->icmp_ip; -#else - struct ip *oip = (struct ip *)icp->icmp_data; -#endif - struct icmp *oicmp = (struct icmp *)(oip + 1); + memcpy(&oip_header_len, icmp_data_raw, sizeof(oip_header_len)); + oip_header_len = (oip_header_len & 0x0f) << 2; + memcpy(&oip, icmp_data_raw, oip_header_len); + oicmp_raw = icmp_data_raw + oip_header_len; + memcpy(&oicmp, oicmp_raw, offsetof(struct icmp, icmp_id) + + sizeof(oicmp.icmp_id)); if (((options & F_VERBOSE) && uid == 0) || (!(options & F_QUIET2) && - (oip->ip_dst.s_addr == whereto.sin_addr.s_addr) && - (oip->ip_p == IPPROTO_ICMP) && - (oicmp->icmp_type == ICMP_ECHO) && - (oicmp->icmp_id == ident))) { - (void)printf("%d bytes from %s: ", cc, + (oip.ip_dst.s_addr == whereto.sin_addr.s_addr) && + (oip.ip_p == IPPROTO_ICMP) && + (oicmp.icmp_type == ICMP_ECHO) && + (oicmp.icmp_id == ident))) { + (void)printf("%zd bytes from %s: ", cc, pr_addr(from->sin_addr)); - pr_icmph(icp); + pr_icmph(&icp, &oip, oicmp_raw); } else return; } @@ -1451,7 +1483,7 @@ static char *ttab[] = { * Print a descriptive string about an ICMP header. */ static void -pr_icmph(struct icmp *icp) +pr_icmph(struct icmp *icp, struct ip *oip, const u_char *const oicmp_raw) { switch(icp->icmp_type) { @@ -1489,19 +1521,11 @@ pr_icmph(struct icmp *icp) break; } /* Print returned IP header information */ -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_SOURCEQUENCH: (void)printf("Source Quench\n"); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_REDIRECT: switch(icp->icmp_code) { @@ -1522,11 +1546,7 @@ pr_icmph(struct icmp *icp) break; } (void)printf("(New addr: %s)\n", inet_ntoa(icp->icmp_gwaddr)); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_ECHO: (void)printf("Echo Request\n"); @@ -1545,20 +1565,12 @@ pr_icmph(struct icmp *icp) icp->icmp_code); break; } -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_PARAMPROB: (void)printf("Parameter problem: pointer = 0x%02x\n", icp->icmp_hun.ih_pptr); -#ifndef icmp_data - pr_retip(&icp->icmp_ip); -#else - pr_retip((struct ip *)icp->icmp_data); -#endif + pr_retip(oip, oicmp_raw); break; case ICMP_TSTAMP: (void)printf("Timestamp\n"); @@ -1659,14 +1671,9 @@ pr_addr(struct in_addr ina) * Dump some info on a returned (via ICMP) IP packet. */ static void -pr_retip(struct ip *ip) +pr_retip(struct ip *ip, const u_char *cp) { - u_char *cp; - int hlen; - pr_iph(ip); - hlen = ip->ip_hl << 2; - cp = (u_char *)ip + hlen; if (ip->ip_p == 6) (void)printf("TCP: from port %u, to port %u (decimal)\n", Modified: stable/12/sbin/ping/tests/Makefile ============================================================================== --- head/sbin/ping/tests/Makefile Tue Aug 20 21:59:48 2019 (r351318) +++ stable/12/sbin/ping/tests/Makefile Mon Sep 16 00:56:33 2019 (r352371) @@ -5,4 +5,9 @@ WARNS?= 6 ATF_TESTS_C+= in_cksum_test SRCS.in_cksum_test= in_cksum_test.c ../utils.c +PACKAGE= tests + +ATF_TESTS_SH+= ping_test +${PACKAGE}FILES+= ping_c1_s56_t1.out + .include Copied and modified: stable/12/sbin/ping/tests/ping_c1_s56_t1.out (from r351393, head/sbin/ping/tests/ping_c1_s56_t1.out) ============================================================================== --- head/sbin/ping/tests/ping_c1_s56_t1.out Thu Aug 22 15:00:36 2019 (r351393, copy source) +++ stable/12/sbin/ping/tests/ping_c1_s56_t1.out Mon Sep 16 00:56:33 2019 (r352371) @@ -1,5 +1,5 @@ PING localhost: 56 data bytes -64 bytes from localhost: icmp_seq=0 ttl= time= ms +64 bytes from: icmp_seq=0 ttl= time= ms --- localhost ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss Copied: stable/12/sbin/ping/tests/ping_test.sh (from r351393, head/sbin/ping/tests/ping_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sbin/ping/tests/ping_test.sh Mon Sep 16 00:56:33 2019 (r352371, copy of r351393, head/sbin/ping/tests/ping_test.sh) @@ -0,0 +1,55 @@ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (C) 2019 Jan Sucan +# 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$ + +atf_test_case ping_c1_s56_t1 +ping_c1_s56_t1_head() { + atf_set "descr" "Stop after receiving 1 ECHO_RESPONSE packet" +} +ping_c1_s56_t1_body() { + if ! getaddrinfo -f inet localhost 1>/dev/null 2>&1; then + atf_skip "IPv4 is not configured" + fi + atf_check -s exit:0 -o save:std.out -e empty \ + ping -c 1 -s 56 -t 1 localhost + check_ping_statistics std.out $(atf_get_srcdir)/ping_c1_s56_t1.out +} + +atf_init_test_cases() { + atf_add_test_case ping_c1_s56_t1 +} + +check_ping_statistics() { + sed -e 's/0.[0-9]\{3\}//g' \ + -e 's/[1-9][0-9]*.[0-9]\{3\}//g' \ + -e 's/localhost ([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\})/localhost/' \ + -e 's/from [0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\}/from/' \ + -e 's/ttl=[0-9][0-9]*/ttl=/' \ + "$1" >"$1".filtered + atf_check -s exit:0 diff -u "$1".filtered "$2" +} From owner-svn-src-all@freebsd.org Mon Sep 16 00:59: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 17BB1EDC8A; Mon, 16 Sep 2019 00:59:11 +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 46Wnv26stYz3wb3; Mon, 16 Sep 2019 00:59:10 +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 CF08518968; Mon, 16 Sep 2019 00:59:10 +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 x8G0xASM006385; Mon, 16 Sep 2019 00:59:10 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G0xALQ006384; Mon, 16 Sep 2019 00:59:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909160059.x8G0xALQ006384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 00:59: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: r352372 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 352372 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 00:59:11 -0000 Author: asomers Date: Mon Sep 16 00:59:10 2019 New Revision: 352372 URL: https://svnweb.freebsd.org/changeset/base/352372 Log: MFC r352231: getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable When SO_TIMESTAMP is set, the kernel will attempt to attach a timestamp as ancillary data to each IP datagram that is received on the socket. However, it may fail, for example due to insufficient memory. In that case the packet will still be received but not timestamp will be attached. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D21607 Modified: stable/12/lib/libc/sys/getsockopt.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/12/lib/libc/sys/getsockopt.2 Mon Sep 16 00:56:33 2019 (r352371) +++ stable/12/lib/libc/sys/getsockopt.2 Mon Sep 16 00:59:10 2019 (r352372) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd February 10, 2019 +.Dd September 11, 2019 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -431,7 +431,8 @@ option is enabled on a .Dv SOCK_DGRAM socket, the .Xr recvmsg 2 -call will return a timestamp corresponding to when the datagram was received. +call may return a timestamp corresponding to when the datagram was received. +However, it may not, for example due to a resource shortage. The .Va msg_control field in the From owner-svn-src-all@freebsd.org Mon Sep 16 02:31: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 A606CF0340; Mon, 16 Sep 2019 02:31:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Wqy64jHgz41fk; Mon, 16 Sep 2019 02:31:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84BFF19A8A; Mon, 16 Sep 2019 02:31:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G2Vw8r063984; Mon, 16 Sep 2019 02:31:58 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G2Vwev063983; Mon, 16 Sep 2019 02:31:58 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909160231.x8G2Vwev063983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 16 Sep 2019 02:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352373 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352373 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 02:31:58 -0000 Author: alc Date: Mon Sep 16 02:31:58 2019 New Revision: 352373 URL: https://svnweb.freebsd.org/changeset/base/352373 Log: MFC r349003, r349031, r349042, r349129, r349290, r349618, r349798 Change pmap_demote_l2_locked() so that it removes the superpage mapping on a demotion failure. Otherwise, some callers to pmap_demote_l2_locked(), such as pmap_protect(), may leave an incorrect mapping in place on a demotion failure. Change pmap_demote_l2_locked() so that it handles addresses that are not superpage aligned. Some callers to pmap_demote_l2_locked(), such as pmap_protect(), may not pass a superpage aligned address. Optimize TLB invalidation in pmap_remove_l2(). Change the arm64 pmap so that updates to the global count of wired pages are not performed directly by the pmap. Instead, they are performed by vm_page_free_pages_toq(). Batch the TLB invalidations that are performed by pmap_protect() rather than performing them one at a time. Eliminate a redundant call to pmap_invalidate_page() from pmap_ts_referenced(). Introduce pmap_remove_l3_range() and use it in two places: (1) pmap_remove(), where it eliminates redundant TLB invalidations by pmap_remove() and pmap_remove_l3(), and (2) pmap_enter_l2(), where it may optimize the TLB invalidations by batching them. Implement pmap_copy(). Three changes to pmap_enter(): 1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the possibility that a superpage mapping for "va" was created while we slept. 2. Eliminate code for allocating kernel page table pages. Kernel page table pages are preallocated by pmap_growkernel(). 3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is returned. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 00:59:10 2019 (r352372) +++ stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 02:31:58 2019 (r352373) @@ -1410,8 +1410,6 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t } pmap_invalidate_page(pmap, va); - vm_wire_sub(1); - /* * Put page on a list so that it is released after * *ALL* TLB shootdown is done @@ -2030,9 +2028,8 @@ next_chunk: SLIST_REMOVE_HEAD(&free, plinks.s.ss); /* Recycle a freed page table page. */ m_pc->wire_count = 1; - vm_wire_add(1); } - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); return (m_pc); } @@ -2267,6 +2264,8 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_padd int bit, field; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT((va & L2_OFFSET) == 0, + ("pmap_pv_demote_l2: va is not 2mpage aligned")); KASSERT((pa & L2_OFFSET) == 0, ("pmap_pv_demote_l2: pa is not 2mpage aligned")); CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); @@ -2277,7 +2276,6 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_padd * must not be released until the last pv entry is reinstantiated. */ pvh = pa_to_pvh(pa); - va = va & ~L2_OFFSET; pv = pmap_pvh_remove(pvh, pmap, va); KASSERT(pv != NULL, ("pmap_pv_demote_l2: pv not found")); m = PHYS_TO_VM_PAGE(pa); @@ -2433,7 +2431,13 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ old_l2 = pmap_load_clear(l2); KASSERT((old_l2 & ATTR_DESCR_MASK) == L2_BLOCK, ("pmap_remove_l2: L2e %lx is not a block mapping", old_l2)); - pmap_invalidate_range(pmap, sva, sva + L2_SIZE); + + /* + * Since a promotion must break the 4KB page mappings before making + * the 2MB page mapping, a pmap_invalidate_page() suffices. + */ + pmap_invalidate_page(pmap, sva); + if (old_l2 & ATTR_SW_WIRED) pmap->pm_stats.wired_count -= L2_SIZE / PAGE_SIZE; pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE); @@ -2463,8 +2467,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ pmap_resident_count_dec(pmap, 1); KASSERT(ml3->wire_count == NL3PG, ("pmap_remove_l2: l3 page wire count error")); - ml3->wire_count = 1; - vm_page_unwire_noq(ml3); + ml3->wire_count = 0; pmap_add_delayed_free_list(ml3, free, FALSE); } } @@ -2507,6 +2510,82 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ } /* + * Remove the specified range of addresses from the L3 page table that is + * identified by the given L2 entry. + */ +static void +pmap_remove_l3_range(pmap_t pmap, pd_entry_t l2e, vm_offset_t sva, + vm_offset_t eva, struct spglist *free, struct rwlock **lockp) +{ + struct md_page *pvh; + struct rwlock *new_lock; + pt_entry_t *l3, old_l3; + vm_offset_t va; + vm_page_t m; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT(rounddown2(sva, L2_SIZE) + L2_SIZE == roundup2(eva, L2_SIZE), + ("pmap_remove_l3_range: range crosses an L3 page table boundary")); + va = eva; + for (l3 = pmap_l2_to_l3(&l2e, sva); sva != eva; l3++, sva += L3_SIZE) { + if (!pmap_l3_valid(pmap_load(l3))) { + if (va != eva) { + pmap_invalidate_range(pmap, va, sva); + va = eva; + } + continue; + } + old_l3 = pmap_load_clear(l3); + if ((old_l3 & ATTR_SW_WIRED) != 0) + pmap->pm_stats.wired_count--; + pmap_resident_count_dec(pmap, 1); + if ((old_l3 & ATTR_SW_MANAGED) != 0) { + m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); + if (pmap_page_dirty(old_l3)) + vm_page_dirty(m); + if ((old_l3 & ATTR_AF) != 0) + vm_page_aflag_set(m, PGA_REFERENCED); + new_lock = PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m)); + if (new_lock != *lockp) { + if (*lockp != NULL) { + /* + * Pending TLB invalidations must be + * performed before the PV list lock is + * released. Otherwise, a concurrent + * pmap_remove_all() on a physical page + * could return while a stale TLB entry + * still provides access to that page. + */ + if (va != eva) { + pmap_invalidate_range(pmap, va, + sva); + va = eva; + } + rw_wunlock(*lockp); + } + *lockp = new_lock; + rw_wlock(*lockp); + } + pmap_pvh_free(&m->md, pmap, sva); + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); + } + } + if (va == eva) + va = sva; + if (pmap_unuse_pt(pmap, sva, l2e, free)) { + sva += L3_SIZE; + break; + } + } + if (va != eva) + pmap_invalidate_range(pmap, va, sva); +} + +/* * Remove the given range of addresses from the specified map. * * It is assumed that the start and end are properly @@ -2516,9 +2595,9 @@ void pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { struct rwlock *lock; - vm_offset_t va, va_next; + vm_offset_t va_next; pd_entry_t *l0, *l1, *l2; - pt_entry_t l3_paddr, *l3; + pt_entry_t l3_paddr; struct spglist free; /* @@ -2571,8 +2650,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t pmap_remove_l2(pmap, l2, sva, pmap_load(l1), &free, &lock); continue; - } else if (pmap_demote_l2_locked(pmap, l2, - sva &~L2_OFFSET, &lock) == NULL) + } else if (pmap_demote_l2_locked(pmap, l2, sva, + &lock) == NULL) continue; l3_paddr = pmap_load(l2); } @@ -2591,33 +2670,13 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t if (va_next > eva) va_next = eva; - va = va_next; - for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++, - sva += L3_SIZE) { - if (l3 == NULL) - panic("l3 == NULL"); - if (pmap_load(l3) == 0) { - if (va != va_next) { - pmap_invalidate_range(pmap, va, sva); - va = va_next; - } - continue; - } - if (va == va_next) - va = sva; - if (pmap_remove_l3(pmap, l3, sva, l3_paddr, &free, - &lock)) { - sva += L3_SIZE; - break; - } - } - if (va != va_next) - pmap_invalidate_range(pmap, va, sva); + pmap_remove_l3_range(pmap, l3_paddr, sva, va_next, &free, + &lock); } if (lock != NULL) rw_wunlock(lock); PMAP_UNLOCK(pmap); - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); } /* @@ -2722,7 +2781,7 @@ retry: } vm_page_aflag_clear(m, PGA_WRITEABLE); rw_wunlock(lock); - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); } /* @@ -2788,8 +2847,15 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t for (l3p = pmap_l2_to_l3(l2, sva); sva != va_next; l3p++, sva += L3_SIZE) { l3 = pmap_load(l3p); - if (!pmap_l3_valid(l3)) + if (!pmap_l3_valid(l3)) { + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } continue; + } + if (va == va_next) + va = sva; nbits = 0; if ((prot & VM_PROT_WRITE) == 0) { @@ -2804,9 +2870,9 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t nbits |= ATTR_XN; pmap_set(l3p, nbits); - /* XXX: Use pmap_invalidate_range */ - pmap_invalidate_page(pmap, sva); } + if (va != va_next) + pmap_invalidate_range(pmap, va, sva); } PMAP_UNLOCK(pmap); } @@ -3011,8 +3077,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pt_entry_t new_l3, orig_l3; pt_entry_t *l2, *l3; pv_entry_t pv; - vm_paddr_t opa, pa, l1_pa, l2_pa, l3_pa; - vm_page_t mpte, om, l1_m, l2_m, l3_m; + vm_paddr_t opa, pa; + vm_page_t mpte, om; boolean_t nosleep; int lvl, rv; @@ -3036,7 +3102,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); lock = NULL; - mpte = NULL; PMAP_LOCK(pmap); if (psind == 1) { /* Assert the required virtual and physical alignment. */ @@ -3046,13 +3111,25 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v flags, m, &lock); goto out; } + mpte = NULL; + /* + * In the case that a page table page is not + * resident, we are creating it here. + */ +retry: pde = pmap_pde(pmap, va, &lvl); - if (pde != NULL && lvl == 1) { + if (pde != NULL && lvl == 2) { + l3 = pmap_l2_to_l3(pde, va); + if (va < VM_MAXUSER_ADDRESS && mpte == NULL) { + mpte = PHYS_TO_VM_PAGE(pmap_load(pde) & ~ATTR_MASK); + mpte->wire_count++; + } + goto havel3; + } else if (pde != NULL && lvl == 1) { l2 = pmap_l1_to_l2(pde, va); if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK && - (l3 = pmap_demote_l2_locked(pmap, l2, va & ~L2_OFFSET, - &lock)) != NULL) { + (l3 = pmap_demote_l2_locked(pmap, l2, va, &lock)) != NULL) { l3 = &l3[pmap_l3_index(va)]; if (va < VM_MAXUSER_ADDRESS) { mpte = PHYS_TO_VM_PAGE( @@ -3061,84 +3138,27 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } goto havel3; } + /* We need to allocate an L3 table. */ } - if (va < VM_MAXUSER_ADDRESS) { nosleep = (flags & PMAP_ENTER_NOSLEEP) != 0; - mpte = pmap_alloc_l3(pmap, va, nosleep ? NULL : &lock); + + /* + * We use _pmap_alloc_l3() instead of pmap_alloc_l3() in order + * to handle the possibility that a superpage mapping for "va" + * was created while we slept. + */ + mpte = _pmap_alloc_l3(pmap, pmap_l2_pindex(va), + nosleep ? NULL : &lock); if (mpte == NULL && nosleep) { CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); - if (lock != NULL) - rw_wunlock(lock); - PMAP_UNLOCK(pmap); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + goto out; } - pde = pmap_pde(pmap, va, &lvl); - KASSERT(pde != NULL, - ("pmap_enter: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, - ("pmap_enter: Invalid level %d", lvl)); - } else { - /* - * If we get a level 2 pde it must point to a level 3 entry - * otherwise we will need to create the intermediate tables - */ - if (lvl < 2) { - switch (lvl) { - default: - case -1: - /* Get the l0 pde to update */ - pde = pmap_l0(pmap, va); - KASSERT(pde != NULL, ("...")); + goto retry; + } else + panic("pmap_enter: missing L3 table for kernel va %#lx", va); - l1_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l1_m == NULL) - panic("pmap_enter: l1 pte_m == NULL"); - if ((l1_m->flags & PG_ZERO) == 0) - pmap_zero_page(l1_m); - - l1_pa = VM_PAGE_TO_PHYS(l1_m); - pmap_load_store(pde, l1_pa | L0_TABLE); - /* FALLTHROUGH */ - case 0: - /* Get the l1 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l2_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l2_m == NULL) - panic("pmap_enter: l2 pte_m == NULL"); - if ((l2_m->flags & PG_ZERO) == 0) - pmap_zero_page(l2_m); - - l2_pa = VM_PAGE_TO_PHYS(l2_m); - pmap_load_store(pde, l2_pa | L1_TABLE); - /* FALLTHROUGH */ - case 1: - /* Get the l2 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l3_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l3_m == NULL) - panic("pmap_enter: l3 pte_m == NULL"); - if ((l3_m->flags & PG_ZERO) == 0) - pmap_zero_page(l3_m); - - l3_pa = VM_PAGE_TO_PHYS(l3_m); - pmap_load_store(pde, l3_pa | L2_TABLE); - break; - } - } - } - l3 = pmap_l2_to_l3(pde, va); - havel3: orig_l3 = pmap_load(l3); opa = orig_l3 & ~ATTR_MASK; @@ -3352,8 +3372,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t vm_page_t m, struct rwlock **lockp) { struct spglist free; - pd_entry_t *l2, *l3, old_l2; - vm_offset_t sva; + pd_entry_t *l2, old_l2; vm_page_t l2pg, mt; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -3382,13 +3401,8 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t (void)pmap_remove_l2(pmap, l2, va, pmap_load(pmap_l1(pmap, va)), &free, lockp); else - for (sva = va; sva < va + L2_SIZE; sva += PAGE_SIZE) { - l3 = pmap_l2_to_l3(l2, sva); - if (pmap_l3_valid(pmap_load(l3)) && - pmap_remove_l3(pmap, l3, sva, old_l2, &free, - lockp) != 0) - break; - } + pmap_remove_l3_range(pmap, old_l2, va, va + L2_SIZE, + &free, lockp); vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { /* @@ -3605,7 +3619,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v SLIST_INIT(&free); if (pmap_unwire_l3(pmap, va, mpte, &free)) { pmap_invalidate_page(pmap, va); - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); } mpte = NULL; } @@ -3734,12 +3748,153 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t * in the destination map. * * This routine is only advisory and need not do anything. + * + * Because the executable mappings created by this routine are copied, + * it should not have to flush the instruction cache. */ - void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { + struct rwlock *lock; + struct spglist free; + pd_entry_t *l0, *l1, *l2, srcptepaddr; + pt_entry_t *dst_pte, ptetemp, *src_pte; + vm_offset_t addr, end_addr, va_next; + vm_page_t dst_l2pg, dstmpte, srcmpte; + + if (dst_addr != src_addr) + return; + end_addr = src_addr + len; + lock = NULL; + if (dst_pmap < src_pmap) { + PMAP_LOCK(dst_pmap); + PMAP_LOCK(src_pmap); + } else { + PMAP_LOCK(src_pmap); + PMAP_LOCK(dst_pmap); + } + for (addr = src_addr; addr < end_addr; addr = va_next) { + l0 = pmap_l0(src_pmap, addr); + if (pmap_load(l0) == 0) { + va_next = (addr + L0_SIZE) & ~L0_OFFSET; + if (va_next < addr) + va_next = end_addr; + continue; + } + l1 = pmap_l0_to_l1(l0, addr); + if (pmap_load(l1) == 0) { + va_next = (addr + L1_SIZE) & ~L1_OFFSET; + if (va_next < addr) + va_next = end_addr; + continue; + } + va_next = (addr + L2_SIZE) & ~L2_OFFSET; + if (va_next < addr) + va_next = end_addr; + l2 = pmap_l1_to_l2(l1, addr); + srcptepaddr = pmap_load(l2); + if (srcptepaddr == 0) + continue; + if ((srcptepaddr & ATTR_DESCR_MASK) == L2_BLOCK) { + if ((addr & L2_OFFSET) != 0 || + addr + L2_SIZE > end_addr) + continue; + dst_l2pg = pmap_alloc_l2(dst_pmap, addr, NULL); + if (dst_l2pg == NULL) + break; + l2 = (pd_entry_t *) + PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dst_l2pg)); + l2 = &l2[pmap_l2_index(addr)]; + if (pmap_load(l2) == 0 && + ((srcptepaddr & ATTR_SW_MANAGED) == 0 || + pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, + PMAP_ENTER_NORECLAIM, &lock))) { + (void)pmap_load_store(l2, srcptepaddr & + ~ATTR_SW_WIRED); + pmap_resident_count_inc(dst_pmap, L2_SIZE / + PAGE_SIZE); + atomic_add_long(&pmap_l2_mappings, 1); + } else + dst_l2pg->wire_count--; + continue; + } + KASSERT((srcptepaddr & ATTR_DESCR_MASK) == L2_TABLE, + ("pmap_copy: invalid L2 entry")); + srcptepaddr &= ~ATTR_MASK; + srcmpte = PHYS_TO_VM_PAGE(srcptepaddr); + KASSERT(srcmpte->wire_count > 0, + ("pmap_copy: source page table page is unused")); + if (va_next > end_addr) + va_next = end_addr; + src_pte = (pt_entry_t *)PHYS_TO_DMAP(srcptepaddr); + src_pte = &src_pte[pmap_l3_index(addr)]; + dstmpte = NULL; + for (; addr < va_next; addr += PAGE_SIZE, src_pte++) { + ptetemp = pmap_load(src_pte); + + /* + * We only virtual copy managed pages. + */ + if ((ptetemp & ATTR_SW_MANAGED) == 0) + continue; + + if (dstmpte != NULL) { + KASSERT(dstmpte->pindex == pmap_l2_pindex(addr), + ("dstmpte pindex/addr mismatch")); + dstmpte->wire_count++; + } else if ((dstmpte = pmap_alloc_l3(dst_pmap, addr, + NULL)) == NULL) + goto out; + dst_pte = (pt_entry_t *) + PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); + dst_pte = &dst_pte[pmap_l3_index(addr)]; + if (pmap_load(dst_pte) == 0 && + pmap_try_insert_pv_entry(dst_pmap, addr, + PHYS_TO_VM_PAGE(ptetemp & ~ATTR_MASK), &lock)) { + /* + * Clear the wired, modified, and accessed + * (referenced) bits during the copy. + * + * XXX not yet + */ + (void)pmap_load_store(dst_pte, ptetemp & + ~ATTR_SW_WIRED); + pmap_resident_count_inc(dst_pmap, 1); + } else { + SLIST_INIT(&free); + if (pmap_unwire_l3(dst_pmap, addr, dstmpte, + &free)) { + /* + * Although "addr" is not mapped, + * paging-structure caches could + * nonetheless have entries that refer + * to the freed page table pages. + * Invalidate those entries. + * + * XXX redundant invalidation + */ + pmap_invalidate_page(dst_pmap, addr); + vm_page_free_pages_toq(&free, true); + } + goto out; + } + /* Have we copied all of the valid mappings? */ + if (dstmpte->wire_count >= srcmpte->wire_count) + break; + } + } +out: + /* + * XXX This barrier may not be needed because the destination pmap is + * not active. + */ + dsb(ishst); + + if (lock != NULL) + rw_wunlock(lock); + PMAP_UNLOCK(src_pmap); + PMAP_UNLOCK(dst_pmap); } /* @@ -4088,8 +4243,7 @@ pmap_remove_pages(pmap_t pmap) pmap_resident_count_dec(pmap,1); KASSERT(ml3->wire_count == NL3PG, ("pmap_remove_pages: l3 page wire count error")); - ml3->wire_count = 1; - vm_page_unwire_noq(ml3); + ml3->wire_count = 0; pmap_add_delayed_free_list(ml3, &free, FALSE); } @@ -4127,7 +4281,7 @@ pmap_remove_pages(pmap_t pmap) if (lock != NULL) rw_wunlock(lock); PMAP_UNLOCK(pmap); - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); } /* @@ -4328,8 +4482,7 @@ retry_pv_loop: va = pv->pv_va; pte = pmap_pte(pmap, pv->pv_va, &lvl); if ((pmap_load(pte) & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) - pmap_demote_l2_locked(pmap, pte, va & ~L2_OFFSET, - &lock); + (void)pmap_demote_l2_locked(pmap, pte, va, &lock); KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), ("inconsistent pv lock %p %p for page %p", lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); @@ -4566,7 +4719,6 @@ small_mappings: */ pmap_remove_l3(pmap, pte, pv->pv_va, tpde, &free, &lock); - pmap_invalidate_page(pmap, pv->pv_va); cleared++; if (pvf == pv) pvf = NULL; @@ -4588,7 +4740,7 @@ small_mappings: not_cleared < PMAP_TS_REFERENCED_MAX); out: rw_wunlock(lock); - vm_page_free_pages_toq(&free, false); + vm_page_free_pages_toq(&free, true); return (cleared + not_cleared); } @@ -4891,7 +5043,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pte = pmap_l1_to_l2(pte, tmpva); case 2: newpte = pmap_demote_l2(kernel_pmap, pte, - tmpva & ~L2_OFFSET); + tmpva); if (newpte == NULL) return (EINVAL); pte = pmap_l2_to_l3(pte, tmpva); @@ -4990,6 +5142,18 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_ return (l2); } +static void +pmap_demote_l2_abort(pmap_t pmap, vm_offset_t va, pt_entry_t *l2, + struct rwlock **lockp) +{ + struct spglist free; + + SLIST_INIT(&free); + (void)pmap_remove_l2(pmap, l2, va, pmap_load(pmap_l1(pmap, va)), &free, + lockp); + vm_page_free_pages_toq(&free, true); +} + /* * Create an L3 table to map all addresses within an L2 mapping. */ @@ -5008,8 +5172,7 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ oldl2 = pmap_load(l2); KASSERT((oldl2 & ATTR_DESCR_MASK) == L2_BLOCK, ("pmap_demote_l2: Demoting a non-block entry")); - KASSERT((va & L2_OFFSET) == 0, - ("pmap_demote_l2: Invalid virtual address %#lx", va)); + va &= ~L2_OFFSET; tmpl2 = 0; if (va <= (vm_offset_t)l2 && va + L2_SIZE > (vm_offset_t)l2) { @@ -5018,15 +5181,57 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ return (NULL); } + /* + * Invalidate the 2MB page mapping and return "failure" if the + * mapping was never accessed. + */ + if ((oldl2 & ATTR_AF) == 0) { + KASSERT((oldl2 & ATTR_SW_WIRED) == 0, + ("pmap_demote_l2: a wired mapping is missing ATTR_AF")); + pmap_demote_l2_abort(pmap, va, l2, lockp); + CTR2(KTR_PMAP, "pmap_demote_l2: failure for va %#lx in pmap %p", + va, pmap); + goto fail; + } + if ((ml3 = pmap_remove_pt_page(pmap, va)) == NULL) { + KASSERT((oldl2 & ATTR_SW_WIRED) == 0, + ("pmap_demote_l2: page table page for a wired mapping" + " is missing")); + + /* + * If the page table page is missing and the mapping + * is for a kernel address, the mapping must belong to + * the direct map. Page table pages are preallocated + * for every other part of the kernel address space, + * so the direct map region is the only part of the + * kernel address space that must be handled here. + */ + KASSERT(va < VM_MAXUSER_ADDRESS || VIRT_IN_DMAP(va), + ("pmap_demote_l2: No saved mpte for va %#lx", va)); + + /* + * If the 2MB page mapping belongs to the direct map + * region of the kernel's address space, then the page + * allocation request specifies the highest possible + * priority (VM_ALLOC_INTERRUPT). Otherwise, the + * priority is normal. + */ ml3 = vm_page_alloc(NULL, pmap_l2_pindex(va), (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + + /* + * If the allocation of the new page table page fails, + * invalidate the 2MB page mapping and return "failure". + */ if (ml3 == NULL) { + pmap_demote_l2_abort(pmap, va, l2, lockp); CTR2(KTR_PMAP, "pmap_demote_l2: failure for va %#lx" " in pmap %p", va, pmap); goto fail; } + if (va < VM_MAXUSER_ADDRESS) { ml3->wire_count = NL3PG; pmap_resident_count_inc(pmap, 1); @@ -5075,6 +5280,10 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ if ((oldl2 & ATTR_SW_MANAGED) != 0) reserve_pv_entries(pmap, Ln_ENTRIES - 1, lockp); + /* + * Pass PAGE_SIZE so that a single TLB invalidation is performed on + * the 2MB page mapping. + */ pmap_update_entry(pmap, l2, l3phys | L2_TABLE, va, PAGE_SIZE); /* From owner-svn-src-all@freebsd.org Mon Sep 16 04:54: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 3ADA4F2C06; Mon, 16 Sep 2019 04:54:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Wv6L0ry6z46yy; Mon, 16 Sep 2019 04:54:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA83D1B398; Mon, 16 Sep 2019 04:54:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G4sHY5049337; Mon, 16 Sep 2019 04:54:17 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G4sHVw049336; Mon, 16 Sep 2019 04:54:17 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909160454.x8G4sHVw049336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 16 Sep 2019 04:54:17 +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: r352374 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352374 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 04:54:18 -0000 Author: alc Date: Mon Sep 16 04:54:17 2019 New Revision: 352374 URL: https://svnweb.freebsd.org/changeset/base/352374 Log: MFC r349323, r349442, r349866, r349975 pmap_enter_quick_locked() never replaces a valid mapping, so it need not perform a TLB invalidation. A barrier suffices. (See r343876.) Add a comment to pmap_enter_quick_locked() in order to highlight the fact that it does not replace valid mappings. Correct a typo in one of pmap_enter()'s comments. Introduce pmap_clear(), which zeroes a page table entry, and use it, instead of pmap_load_clear(), in places where we don't care about the page table entry's prior contents. Eliminate an unnecessary pmap_load() from pmap_remove_all(). Instead, use the value returned by the pmap_load_clear() on the very next line. A KASSERT() in pmap_enter(), which originated in the amd64 pmap, was meant to check the value returned by the pmap_load_clear() on the previous line. However, we were ignoring the value returned by the pmap_load_clear(), and so the KASSERT() was not serving its intended purpose. Use the value returned by the pmap_load_clear() in the KASSERT(). Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 02:31:58 2019 (r352373) +++ stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 04:54:17 2019 (r352374) @@ -315,6 +315,7 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p * They need to be atomic as the System MMU may write to the table at * the same time as the CPU. */ +#define pmap_clear(table) atomic_store_64(table, 0) #define pmap_load_store(table, entry) atomic_swap_64(table, entry) #define pmap_set(table, mask) atomic_set_64(table, mask) #define pmap_load_clear(table) atomic_swap_64(table, 0) @@ -1208,7 +1209,7 @@ pmap_kremove(vm_offset_t va) KASSERT(pte != NULL, ("pmap_kremove: Invalid address")); KASSERT(lvl == 3, ("pmap_kremove: Invalid pte level %d", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_page(kernel_pmap, va); } @@ -1230,7 +1231,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size) KASSERT(pte != NULL, ("Invalid page table, va: 0x%lx", va)); KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); va += PAGE_SIZE; size -= PAGE_SIZE; @@ -1315,7 +1316,7 @@ pmap_qremove(vm_offset_t sva, int count) KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); if (pte != NULL) { - pmap_load_clear(pte); + pmap_clear(pte); } va += PAGE_SIZE; @@ -1374,19 +1375,19 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t pd_entry_t *l0; l0 = pmap_l0(pmap, va); - pmap_load_clear(l0); + pmap_clear(l0); } else if (m->pindex >= NUL2E) { /* l2 page */ pd_entry_t *l1; l1 = pmap_l1(pmap, va); - pmap_load_clear(l1); + pmap_clear(l1); } else { /* l3 page */ pd_entry_t *l2; l2 = pmap_l2(pmap, va); - pmap_load_clear(l2); + pmap_clear(l2); } pmap_resident_count_dec(pmap, 1); if (m->pindex < NUL2E) { @@ -2760,8 +2761,7 @@ retry: tpde = pmap_load(pde); pte = pmap_l2_to_l3(pde, pv->pv_va); - tpte = pmap_load(pte); - pmap_load_clear(pte); + tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, pv->pv_va); if (tpte & ATTR_SW_WIRED) pmap->pm_stats.wired_count--; @@ -2930,7 +2930,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent critical_enter(); /* Clear the old mapping */ - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ @@ -3208,9 +3208,10 @@ havel3: } /* - * The physical page has changed. + * The physical page has changed. Temporarily invalidate + * the mapping. */ - (void)pmap_load_clear(l3); + orig_l3 = pmap_load_clear(l3); KASSERT((orig_l3 & ~ATTR_MASK) == opa, ("pmap_enter: unexpected pa update for %#lx", va)); if ((orig_l3 & ATTR_SW_MANAGED) != 0) { @@ -3306,7 +3307,7 @@ validate: __func__, pmap, va, new_l3); } } else { - /* New mappig */ + /* New mapping */ pmap_load_store(l3, new_l3); } @@ -3602,6 +3603,9 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v l3 = pmap_l2_to_l3(pde, va); } + /* + * Abort if a mapping already exists. + */ if (pmap_load(l3) != 0) { if (mpte != NULL) { mpte->wire_count--; @@ -3651,7 +3655,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); pmap_load_store(l3, l3_val); - pmap_invalidate_page(pmap, va); + dsb(ishst); + return (mpte); } @@ -4200,7 +4205,12 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad pte %#jx", (uintmax_t)tpte)); - pmap_load_clear(pte); + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pmap_clear(pte); /* * Update the vm_page_t clean/reference bits. @@ -4911,7 +4921,7 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) KASSERT(pde != NULL, ("pmap_unmapbios: Invalid page entry, va: 0x%lx", va_trunc)); l2 = pmap_l1_to_l2(pde, va_trunc); - pmap_load_clear(l2); + pmap_clear(l2); pmap_invalidate_range(kernel_pmap, va_trunc, va_trunc + L2_SIZE); if (block == (l2_blocks - 1)) From owner-svn-src-all@freebsd.org Mon Sep 16 05:25: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 69C6EF32A4; Mon, 16 Sep 2019 05:25:37 +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 46WvpT2Bwkz47tc; Mon, 16 Sep 2019 05:25:37 +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 15F4D1B8E2; Mon, 16 Sep 2019 05:25:37 +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 x8G5PamI066754; Mon, 16 Sep 2019 05:25:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G5PaqV066753; Mon, 16 Sep 2019 05:25:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909160525.x8G5PaqV066753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 16 Sep 2019 05: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: r352375 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352375 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 05:25:37 -0000 Author: avg Date: Mon Sep 16 05:25:36 2019 New Revision: 352375 URL: https://svnweb.freebsd.org/changeset/base/352375 Log: MFC r351803: ZFS: Always refuse receving non-resume stream when resume state exists Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Sep 16 04:54:17 2019 (r352374) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Sep 16 05:25:36 2019 (r352375) @@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const } } else { /* - * if the fs does not exist, look for it based on the - * fromsnap GUID + * If the fs does not exist, look for it based on the + * fromsnap GUID. */ - (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, - "cannot receive incremental stream")); + if (resuming) { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive resume stream")); + } else { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive incremental stream")); + } (void) strcpy(zc.zc_name, zc.zc_value); *strchr(zc.zc_name, '@') = '\0'; Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 16 04:54:17 2019 (r352374) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 16 05:25:36 2019 (r352375) @@ -1311,19 +1311,23 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d int error; dsl_pool_t *dp = ds->ds_dir->dd_pool; - /* temporary clone name must not exist */ + /* Temporary clone name must not exist. */ error = zap_lookup(dp->dp_meta_objset, dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name, 8, 1, &val); if (error != ENOENT) - return (error == 0 ? EBUSY : error); + return (error == 0 ? SET_ERROR(EBUSY) : error); - /* new snapshot name must not exist */ + /* Resume state must not be set. */ + if (dsl_dataset_has_resume_receive_state(ds)) + return (SET_ERROR(EBUSY)); + + /* New snapshot name must not exist. */ error = zap_lookup(dp->dp_meta_objset, dsl_dataset_phys(ds)->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap, 8, 1, &val); if (error != ENOENT) - return (error == 0 ? EEXIST : error); + return (error == 0 ? SET_ERROR(EEXIST) : error); /* * Check snapshot limit before receiving. We'll recheck again at the From owner-svn-src-all@freebsd.org Mon Sep 16 05:28: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 8FD40F33E1; Mon, 16 Sep 2019 05:28:41 +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 46Wvt13Dbtz484V; Mon, 16 Sep 2019 05:28:41 +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 388FE1B8ED; Mon, 16 Sep 2019 05:28:41 +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 x8G5SfFn066964; Mon, 16 Sep 2019 05:28:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G5SeGB066962; Mon, 16 Sep 2019 05:28:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909160528.x8G5SeGB066962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 16 Sep 2019 05:28:40 +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: r352376 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352376 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 05:28:41 -0000 Author: avg Date: Mon Sep 16 05:28:40 2019 New Revision: 352376 URL: https://svnweb.freebsd.org/changeset/base/352376 Log: MFC r351803: ZFS: Always refuse receving non-resume stream when resume state exists Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Sep 16 05:25:36 2019 (r352375) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Sep 16 05:28:40 2019 (r352376) @@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const } } else { /* - * if the fs does not exist, look for it based on the - * fromsnap GUID + * If the fs does not exist, look for it based on the + * fromsnap GUID. */ - (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, - "cannot receive incremental stream")); + if (resuming) { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive resume stream")); + } else { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive incremental stream")); + } (void) strcpy(zc.zc_name, zc.zc_value); *strchr(zc.zc_name, '@') = '\0'; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 16 05:25:36 2019 (r352375) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Sep 16 05:28:40 2019 (r352376) @@ -1308,19 +1308,23 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d int error; dsl_pool_t *dp = ds->ds_dir->dd_pool; - /* temporary clone name must not exist */ + /* Temporary clone name must not exist. */ error = zap_lookup(dp->dp_meta_objset, dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name, 8, 1, &val); if (error != ENOENT) - return (error == 0 ? EBUSY : error); + return (error == 0 ? SET_ERROR(EBUSY) : error); - /* new snapshot name must not exist */ + /* Resume state must not be set. */ + if (dsl_dataset_has_resume_receive_state(ds)) + return (SET_ERROR(EBUSY)); + + /* New snapshot name must not exist. */ error = zap_lookup(dp->dp_meta_objset, dsl_dataset_phys(ds)->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap, 8, 1, &val); if (error != ENOENT) - return (error == 0 ? EEXIST : error); + return (error == 0 ? SET_ERROR(EEXIST) : error); /* * Check snapshot limit before receiving. We'll recheck again at the From owner-svn-src-all@freebsd.org Mon Sep 16 06:01: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 9C7C8F40B3; Mon, 16 Sep 2019 06:01:07 +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 46WwbR3gM3z49WV; Mon, 16 Sep 2019 06:01:07 +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 6166D1BE27; Mon, 16 Sep 2019 06:01:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G617ge088432; Mon, 16 Sep 2019 06:01:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G617fv088431; Mon, 16 Sep 2019 06:01:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909160601.x8G617fv088431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 16 Sep 2019 06:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352377 - in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt X-SVN-Commit-Revision: 352377 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:01:07 -0000 Author: dim Date: Mon Sep 16 06:01:06 2019 New Revision: 352377 URL: https://svnweb.freebsd.org/changeset/base/352377 Log: MFC r352306: Include in unwind-arm.h, since it uses uint32_t and uint64_t in various declarations. Otherwise, depending on how unwind-arm.h is included from other source files, the compiler may complain that uint32_t and uint64_t are unknown types. Modified: stable/12/contrib/libcxxrt/unwind-arm.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/libcxxrt/unwind-arm.h Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/libcxxrt/unwind-arm.h ============================================================================== --- stable/12/contrib/libcxxrt/unwind-arm.h Mon Sep 16 05:28:40 2019 (r352376) +++ stable/12/contrib/libcxxrt/unwind-arm.h Mon Sep 16 06:01:06 2019 (r352377) @@ -20,6 +20,9 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* For uint32_t and uint64_t */ +#include + /** * ARM-specific unwind definitions. These are taken from the ARM EHABI * specification. From owner-svn-src-all@freebsd.org Mon Sep 16 06:01: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 12E0AF40B9; Mon, 16 Sep 2019 06:01:08 +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 46WwbR6mZBz49WW; Mon, 16 Sep 2019 06:01:07 +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 CB8571BE28; Mon, 16 Sep 2019 06:01:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G61705088438; Mon, 16 Sep 2019 06:01:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G617kk088437; Mon, 16 Sep 2019 06:01:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909160601.x8G617kk088437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 16 Sep 2019 06:01:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352377 - in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libcxxrt 12/contrib/libcxxrt X-SVN-Commit-Revision: 352377 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:01:08 -0000 Author: dim Date: Mon Sep 16 06:01:06 2019 New Revision: 352377 URL: https://svnweb.freebsd.org/changeset/base/352377 Log: MFC r352306: Include in unwind-arm.h, since it uses uint32_t and uint64_t in various declarations. Otherwise, depending on how unwind-arm.h is included from other source files, the compiler may complain that uint32_t and uint64_t are unknown types. Modified: stable/11/contrib/libcxxrt/unwind-arm.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libcxxrt/unwind-arm.h Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/libcxxrt/unwind-arm.h ============================================================================== --- stable/11/contrib/libcxxrt/unwind-arm.h Mon Sep 16 05:28:40 2019 (r352376) +++ stable/11/contrib/libcxxrt/unwind-arm.h Mon Sep 16 06:01:06 2019 (r352377) @@ -20,6 +20,9 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* For uint32_t and uint64_t */ +#include + /** * ARM-specific unwind definitions. These are taken from the ARM EHABI * specification. From owner-svn-src-all@freebsd.org Mon Sep 16 06:12: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 69AE1F460D; Mon, 16 Sep 2019 06:12:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WwrF2CS1z4BJ5; Mon, 16 Sep 2019 06:12:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F6171C063; Mon, 16 Sep 2019 06:12:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G6CC4k095053; Mon, 16 Sep 2019 06:12:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6CC7m095052; Mon, 16 Sep 2019 06:12:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160612.x8G6CC7m095052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352378 - stable/12/sys/ufs/ffs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/ufs/ffs X-SVN-Commit-Revision: 352378 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:12:13 -0000 Author: kib Date: Mon Sep 16 06:12:12 2019 New Revision: 352378 URL: https://svnweb.freebsd.org/changeset/base/352378 Log: MFC r352058: Remove some unneeded vfs_busy() calls in SU code. Modified: stable/12/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:01:06 2019 (r352377) +++ stable/12/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:12:12 2019 (r352378) @@ -12478,24 +12478,13 @@ restart: FREE_LOCK(ump); if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp, FFSV_FORCEINSMQ)) { - error = vfs_busy(mp, MBF_NOWAIT); - if (error != 0) { - vfs_ref(mp); - VOP_UNLOCK(vp, 0); - error = vfs_busy(mp, 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - vfs_rel(mp); - if (error != 0) - return (ENOENT); - if (vp->v_iflag & VI_DOOMED) { - vfs_unbusy(mp); - return (ENOENT); - } - } + /* + * Unmount cannot proceed after unlock because + * caller must have called vn_start_write(). + */ VOP_UNLOCK(vp, 0); error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE, &pvp, FFSV_FORCEINSMQ); - vfs_unbusy(mp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { if (error == 0) From owner-svn-src-all@freebsd.org Mon Sep 16 06: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 D68A6F4825; Mon, 16 Sep 2019 06:13: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 46Wwsj56tyz4Bcc; Mon, 16 Sep 2019 06:13: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 931861C182; Mon, 16 Sep 2019 06:13: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 x8G6DTS4096097; Mon, 16 Sep 2019 06:13:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6DTp7096096; Mon, 16 Sep 2019 06:13:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160613.x8G6DTp7096096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:13: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: r352379 - stable/12/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/include X-SVN-Commit-Revision: 352379 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:13:29 -0000 Author: kib Date: Mon Sep 16 06:13:29 2019 New Revision: 352379 URL: https://svnweb.freebsd.org/changeset/base/352379 Log: MFC r352056: Make snprintf(3) and vscanf(3) definitions available under appropriate POSIX visibility. PR: 207287 Modified: stable/12/include/stdio.h Directory Properties: stable/12/ (props changed) Modified: stable/12/include/stdio.h ============================================================================== --- stable/12/include/stdio.h Mon Sep 16 06:12:12 2019 (r352378) +++ stable/12/include/stdio.h Mon Sep 16 06:13:29 2019 (r352379) @@ -295,14 +295,16 @@ int vprintf(const char * __restrict, __va_list); int vsprintf(char * __restrict, const char * __restrict, __va_list); -#if __ISO_C_VISIBLE >= 1999 +#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); +int vsnprintf(char * __restrict, size_t, const char * __restrict, + __va_list) __printflike(3, 0); +#endif +#if __ISO_C_VISIBLE >= 1999 int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); -int vsnprintf(char * __restrict, size_t, const char * __restrict, - __va_list) __printflike(3, 0); int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif From owner-svn-src-all@freebsd.org Mon Sep 16 06:15: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 A3567F49E1; Mon, 16 Sep 2019 06:15:23 +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 46Wwvv3rvmz4BqL; Mon, 16 Sep 2019 06:15:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E5921C18D; Mon, 16 Sep 2019 06:15:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G6FNSq096264; Mon, 16 Sep 2019 06:15:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6FN1U096263; Mon, 16 Sep 2019 06:15:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160615.x8G6FN1U096263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:15: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: r352380 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352380 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:15:23 -0000 Author: kib Date: Mon Sep 16 06:15:22 2019 New Revision: 352380 URL: https://svnweb.freebsd.org/changeset/base/352380 Log: MFC r352059, r352060: Make timehands count selectable at boottime. Modified: stable/12/sys/kern/kern_tc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_tc.c ============================================================================== --- stable/12/sys/kern/kern_tc.c Mon Sep 16 06:13:29 2019 (r352379) +++ stable/12/sys/kern/kern_tc.c Mon Sep 16 06:15:22 2019 (r352380) @@ -83,19 +83,16 @@ struct timehands { struct timehands *th_next; }; -static struct timehands th0; -static struct timehands th1 = { - .th_next = &th0 -}; -static struct timehands th0 = { +static struct timehands ths[16] = { + [0] = { .th_counter = &dummy_timecounter, .th_scale = (uint64_t)-1 / 1000000, .th_offset = { .sec = 1 }, .th_generation = 1, - .th_next = &th1 + }, }; -static struct timehands *volatile timehands = &th0; +static struct timehands *volatile timehands = &ths[0]; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; @@ -115,6 +112,11 @@ static int timestepwarnings; SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, ×tepwarnings, 0, "Log time steps"); +static int timehands_count = 2; +SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &timehands_count, 0, "Count of timehands in rotation"); + struct bintime bt_timethreshold; struct bintime bt_tickthreshold; sbintime_t sbt_timethreshold; @@ -1956,7 +1958,26 @@ done: return (0); } +/* Set up the requested number of timehands. */ static void +inittimehands(void *dummy) +{ + struct timehands *thp; + int i; + + TUNABLE_INT_FETCH("kern.timecounter.timehands_count", + &timehands_count); + if (timehands_count < 1) + timehands_count = 1; + if (timehands_count > nitems(ths)) + timehands_count = nitems(ths); + for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) + thp->th_next = &ths[i]; + thp->th_next = &ths[0]; +} +SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); + +static void inittimecounter(void *dummy) { u_int p; @@ -1986,6 +2007,7 @@ inittimecounter(void *dummy) #ifdef FFCLOCK ffclock_init(); #endif + /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); From owner-svn-src-all@freebsd.org Mon Sep 16 06:22: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 3D2DAF4CCE; Mon, 16 Sep 2019 06:22:09 +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 46Wx3j0wXNz4C59; Mon, 16 Sep 2019 06:22:09 +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 02F451C31A; Mon, 16 Sep 2019 06:22:09 +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 x8G6M8UJ001117; Mon, 16 Sep 2019 06:22:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6M8JG001116; Mon, 16 Sep 2019 06:22:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160622.x8G6M8JG001116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:22: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: r352381 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 352381 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:22:09 -0000 Author: kib Date: Mon Sep 16 06:22:08 2019 New Revision: 352381 URL: https://svnweb.freebsd.org/changeset/base/352381 Log: MFC r352058: Remove some unneeded vfs_busy() calls in SU code. Modified: stable/11/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:15:22 2019 (r352380) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 06:22:08 2019 (r352381) @@ -12429,24 +12429,13 @@ restart: FREE_LOCK(ump); if (ffs_vgetf(mp, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp, FFSV_FORCEINSMQ)) { - error = vfs_busy(mp, MBF_NOWAIT); - if (error != 0) { - vfs_ref(mp); - VOP_UNLOCK(vp, 0); - error = vfs_busy(mp, 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - vfs_rel(mp); - if (error != 0) - return (ENOENT); - if (vp->v_iflag & VI_DOOMED) { - vfs_unbusy(mp); - return (ENOENT); - } - } + /* + * Unmount cannot proceed after unlock because + * caller must have called vn_start_write(). + */ VOP_UNLOCK(vp, 0); error = ffs_vgetf(mp, parentino, LK_EXCLUSIVE, &pvp, FFSV_FORCEINSMQ); - vfs_unbusy(mp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { if (error == 0) From owner-svn-src-all@freebsd.org Mon Sep 16 06:22: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 AF28BF4D37; Mon, 16 Sep 2019 06:22:54 +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 46Wx4Z4FGFz4CLG; Mon, 16 Sep 2019 06:22:54 +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 74E641C33D; Mon, 16 Sep 2019 06:22:54 +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 x8G6MsUH002001; Mon, 16 Sep 2019 06:22:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6Msvg002000; Mon, 16 Sep 2019 06:22:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160622.x8G6Msvg002000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:22:54 +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: r352382 - stable/11/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/include X-SVN-Commit-Revision: 352382 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:22:54 -0000 Author: kib Date: Mon Sep 16 06:22:54 2019 New Revision: 352382 URL: https://svnweb.freebsd.org/changeset/base/352382 Log: MFC r352056: Make snprintf(3) and vscanf(3) definitions available under appropriate POSIX visibility. PR: 207287 Modified: stable/11/include/stdio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/include/stdio.h ============================================================================== --- stable/11/include/stdio.h Mon Sep 16 06:22:08 2019 (r352381) +++ stable/11/include/stdio.h Mon Sep 16 06:22:54 2019 (r352382) @@ -293,14 +293,16 @@ int vprintf(const char * __restrict, __va_list); int vsprintf(char * __restrict, const char * __restrict, __va_list); -#if __ISO_C_VISIBLE >= 1999 +#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); +int vsnprintf(char * __restrict, size_t, const char * __restrict, + __va_list) __printflike(3, 0); +#endif +#if __ISO_C_VISIBLE >= 1999 int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); -int vsnprintf(char * __restrict, size_t, const char * __restrict, - __va_list) __printflike(3, 0); int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif From owner-svn-src-all@freebsd.org Mon Sep 16 06:23: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 23424F4E1B; Mon, 16 Sep 2019 06:23: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 46Wx5j0796z4CVZ; Mon, 16 Sep 2019 06:23: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 DC98B1C343; Mon, 16 Sep 2019 06:23: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 x8G6Nqtj002124; Mon, 16 Sep 2019 06:23:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6Nqku002123; Mon, 16 Sep 2019 06:23:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160623.x8G6Nqku002123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352383 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 352383 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:23:53 -0000 Author: kib Date: Mon Sep 16 06:23:52 2019 New Revision: 352383 URL: https://svnweb.freebsd.org/changeset/base/352383 Log: MFC r352059, r352060: Make timehands count selectable at boottime. Modified: stable/11/sys/kern/kern_tc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Mon Sep 16 06:22:54 2019 (r352382) +++ stable/11/sys/kern/kern_tc.c Mon Sep 16 06:23:52 2019 (r352383) @@ -82,19 +82,16 @@ struct timehands { struct timehands *th_next; }; -static struct timehands th0; -static struct timehands th1 = { - .th_next = &th0 -}; -static struct timehands th0 = { +static struct timehands ths[16] = { + [0] = { .th_counter = &dummy_timecounter, .th_scale = (uint64_t)-1 / 1000000, .th_offset = { .sec = 1 }, .th_generation = 1, - .th_next = &th1 + }, }; -static struct timehands *volatile timehands = &th0; +static struct timehands *volatile timehands = &ths[0]; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; @@ -116,6 +113,11 @@ static int timestepwarnings; SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, ×tepwarnings, 0, "Log time steps"); +static int timehands_count = 2; +SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &timehands_count, 0, "Count of timehands in rotation"); + struct bintime bt_timethreshold; struct bintime bt_tickthreshold; sbintime_t sbt_timethreshold; @@ -1959,7 +1961,26 @@ done: return (0); } +/* Set up the requested number of timehands. */ static void +inittimehands(void *dummy) +{ + struct timehands *thp; + int i; + + TUNABLE_INT_FETCH("kern.timecounter.timehands_count", + &timehands_count); + if (timehands_count < 1) + timehands_count = 1; + if (timehands_count > nitems(ths)) + timehands_count = nitems(ths); + for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) + thp->th_next = &ths[i]; + thp->th_next = &ths[0]; +} +SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); + +static void inittimecounter(void *dummy) { u_int p; @@ -1989,6 +2010,7 @@ inittimecounter(void *dummy) #ifdef FFCLOCK ffclock_init(); #endif + /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); From owner-svn-src-all@freebsd.org Mon Sep 16 06:42: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 3F743F56AB; Mon, 16 Sep 2019 06:42:02 +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 46WxVf0z2Sz4DNp; Mon, 16 Sep 2019 06:42:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 049331C6A7; Mon, 16 Sep 2019 06:42:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G6g1vD013776; Mon, 16 Sep 2019 06:42:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G6g1oK013775; Mon, 16 Sep 2019 06:42:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909160642.x8G6g1oK013775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 06:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352384 - head/lib/libc/yp X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/yp X-SVN-Commit-Revision: 352384 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 06:42:02 -0000 Author: kib Date: Mon Sep 16 06:42:01 2019 New Revision: 352384 URL: https://svnweb.freebsd.org/changeset/base/352384 Log: Increase the size of the send and receive buffers for YP client rpc calls to max allowed UDP datagram size. Since max allowed size both for keys and values where increased, the old sizes of around 1K cause ypmatch(3) failures, while plain maps fetches work. The buffers were reduced in r34146 from default UDP rpcclient values to 1024/2304 due to the key and value size being 1K. Reviewed by: slavash Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21586 Modified: head/lib/libc/yp/yplib.c Modified: head/lib/libc/yp/yplib.c ============================================================================== --- head/lib/libc/yp/yplib.c Mon Sep 16 06:23:52 2019 (r352383) +++ head/lib/libc/yp/yplib.c Mon Sep 16 06:42:01 2019 (r352384) @@ -526,7 +526,7 @@ gotit: tv.tv_usec = 0; ysd->dom_socket = RPC_ANYSOCK; ysd->dom_client = clntudp_bufcreate(&ysd->dom_server_addr, - YPPROG, YPVERS, tv, &ysd->dom_socket, 1280, 2304); + YPPROG, YPVERS, tv, &ysd->dom_socket, 65507, 65507); if (ysd->dom_client == NULL) { clnt_pcreateerror("clntudp_create"); ysd->dom_vers = -1; From owner-svn-src-all@freebsd.org Mon Sep 16 07:08: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 2EDADF604B; Mon, 16 Sep 2019 07:08:08 +0000 (UTC) (envelope-from bapt@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 46Wy4m0QcSz4FSs; Mon, 16 Sep 2019 07:08:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id CDB6E973D; Mon, 16 Sep 2019 07:08:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 3EDB6B704C; Mon, 16 Sep 2019 09:08:06 +0200 (CEST) Date: Mon, 16 Sep 2019 09:08:06 +0200 From: Baptiste Daroussin To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r352341 - head/contrib/libedit Message-ID: <20190916070805.ykasrsmqdol3jwqt@ivaldir.net> References: <201909142149.x8ELnhqE035300@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zzllgpaayqdv4sjx" Content-Disposition: inline In-Reply-To: <201909142149.x8ELnhqE035300@repo.freebsd.org> User-Agent: NeoMutt/20180716 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 16 Sep 2019 07:08:08 -0000 --zzllgpaayqdv4sjx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 14, 2019 at 09:49:43PM +0000, Dimitry Andric wrote: > Author: dim > Date: Sat Sep 14 21:49:42 2019 > New Revision: 352341 > URL: https://svnweb.freebsd.org/changeset/base/352341 >=20 > Log: > Fix arm and aarch64 builds of libedit after r352275 > =20 > On arm and arm64, where chars are unsigned by default, buildworld dies > with: > =20 > --- terminal.o --- > /usr/src/contrib/libedit/terminal.c:569:41: error: comparison of > integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka > 'unsigned int') [-Werror,-Wsign-compare] > el->el_cursor.v][where & 0370] !=3D > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ > /usr/src/contrib/libedit/terminal.c:659:28: error: comparison of > integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka > 'unsigned int') [-Werror,-Wsign-compare] > [el->el_cursor.h] =3D=3D MB_FILL_C= HAR) > ~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ > =20 > Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed. > =20 > Note that in https://reviews.freebsd.org/D21584 this was also proposed > by Yuichiro Naito . > =20 > Reviewed by: bapt > Subscribers: naito.yuichiro_gmail.com, ml_vishwin.info > MFC after: 3 weeks > X-MFC-With: r352275 > Differential Revision: https://reviews.freebsd.org/D21657 >=20 Just for completeness it was also approved by christos@NetBSD (upstream) --zzllgpaayqdv4sjx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl1/NNMACgkQY4mL3PG3 PlrTaBAAtSpZxpx+klDe7Ic8UnmaYCPlu2pp4JVx55Zo5INSHmJBFnIKn38NZkjo KmnaQafSQVePFhyO93ZO6tLkb7rwsfvhwDVzkEHzvfLHlk5qeTDD57zH0nmhS/T2 MeXthJsKck3HP3BCA2v5LCEFXcjB1TiLRNG5v+/8897XbZPv7388xusHTMRjRKMW 111DVTfeiMFqFp2iFqXF+gcH0xEQy3dNv4cI+CBoHza2kD82r3jyt+K4KvhcdO79 VkWDX0yaQw0Hx99sZkP7DWywiAHHRS9tg7vDzPYZ5kYP1qqujkEqF0wAvc4mW8e3 sryAHrkX23PhBVqvhjIWHKxzbIVFzpTVxntbBIlPJo728e/7zOIVljqOH6V/PCRC w48un16RmsxfHzNTSuFa3NKkDTBDfxhDRMPzWOED00+X3dZvgUTJQbtyk9DyA8wd IDvsjcZ3bkZDtEZhJB7jwrMHd6QBeo3cvGXwQEjuJMAdDHXurrCpEaIDzLTHI71U Rrk0I0pd6r0f5zyE/dA9pMVLF5e5w8idMk4smPVzpBBgFRy6TtAq/i/60IqvTeAf cUs1bFimAJqc8Q+DQgLZvBEDO7R0JiD0v8I0EDtXaOJiwILQwWfqgNrpJCoRkRcp gEg0WiwsG3XOe9zkyuXBm9yCYb3VixVhZaCugc5j1P5i/0m+Xmk= =9ch+ -----END PGP SIGNATURE----- --zzllgpaayqdv4sjx-- From owner-svn-src-all@freebsd.org Mon Sep 16 07:32: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 50EBAF664E; Mon, 16 Sep 2019 07:32:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46WycJ1W30z4GPP; Mon, 16 Sep 2019 07:32:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17D5F1CE4D; Mon, 16 Sep 2019 07:32:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8G7Vxg0042222; Mon, 16 Sep 2019 07:31:59 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G7VxIe042221; Mon, 16 Sep 2019 07:31:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909160731.x8G7VxIe042221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 16 Sep 2019 07:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352385 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 352385 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 07:32:00 -0000 Author: bapt Date: Mon Sep 16 07:31:59 2019 New Revision: 352385 URL: https://svnweb.freebsd.org/changeset/base/352385 Log: Do not use our custom completion function, it is not needed anymore Modified: head/bin/sh/histedit.c Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Mon Sep 16 06:42:01 2019 (r352384) +++ head/bin/sh/histedit.c Mon Sep 16 07:31:59 2019 (r352385) @@ -122,7 +122,7 @@ histedit(void) el_set(el, EL_PROMPT, getprompt); el_set(el, EL_ADDFN, "sh-complete", "Filename completion", - _el_fn_sh_complete); + _el_fn_complete); } else { bad: out2fmt_flush("sh: can't initialize editing\n"); From owner-svn-src-all@freebsd.org Mon Sep 16 08:18: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 D1FDCF830A; Mon, 16 Sep 2019 08:18:05 +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 46WzdT57hqz4Jpj; Mon, 16 Sep 2019 08:18:05 +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 93AB01D73A; Mon, 16 Sep 2019 08:18:05 +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 x8G8I5pg067146; Mon, 16 Sep 2019 08:18:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8G8I5KO067145; Mon, 16 Sep 2019 08:18:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909160818.x8G8I5KO067145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 16 Sep 2019 08:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352386 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 352386 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 08:18:05 -0000 Author: tuexen Date: Mon Sep 16 08:18:05 2019 New Revision: 352386 URL: https://svnweb.freebsd.org/changeset/base/352386 Log: Don't write to memory outside of the allocated array for SACK blocks. Obtained from: rrs@ MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_sack.c Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Mon Sep 16 07:31:59 2019 (r352385) +++ head/sys/netinet/tcp_sack.c Mon Sep 16 08:18:05 2019 (r352386) @@ -235,7 +235,7 @@ tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_st saved_blks[n].start = mid_blk.start; saved_blks[n++].end = mid_blk.end; } - for (j = 0; (j < tp->rcv_numsacks) && (j < MAX_SACK_BLKS-1); j++) { + for (j = 0; (j < tp->rcv_numsacks) && (n < MAX_SACK_BLKS); j++) { if (((SEQ_LT(tp->sackblks[j].end, mid_blk.start) || SEQ_GT(tp->sackblks[j].start, mid_blk.end)) && (SEQ_GT(tp->sackblks[j].start, tp->rcv_nxt)))) From owner-svn-src-all@freebsd.org Mon Sep 16 12:44: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 0CD46FFC96; Mon, 16 Sep 2019 12:44:45 +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 46X5Y86cq3z4bvv; Mon, 16 Sep 2019 12:44:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C696C20735; Mon, 16 Sep 2019 12:44:44 +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 x8GCiicG056193; Mon, 16 Sep 2019 12:44:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GCiiEv056192; Mon, 16 Sep 2019 12:44:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909161244.x8GCiiEv056192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 16 Sep 2019 12:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352387 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 352387 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 12:44:45 -0000 Author: kevans Date: Mon Sep 16 12:44:44 2019 New Revision: 352387 URL: https://svnweb.freebsd.org/changeset/base/352387 Log: Fix 20190507 UPDATING entry The rc mechanism for loading kernel modules is actually called 'kld_list', not 'kld_load' Reported by: yuripv Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Sep 16 08:18:05 2019 (r352386) +++ head/UPDATING Mon Sep 16 12:44:44 2019 (r352387) @@ -89,8 +89,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: 20190507: The tap(4) driver has been folded into tun(4), and the module has been - renamed to tuntap. You should update any kld_load="if_tap" or - kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or + renamed to tuntap. You should update any kld_list="if_tap" or + kld_list="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap module instead, and "device tap" or "device tun" entries in kernel config files to select the tuntap device instead. From owner-svn-src-all@freebsd.org Mon Sep 16 12:51: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 74E0DFFF7E; Mon, 16 Sep 2019 12:51:29 +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 46X5hx29tDz4c9f; Mon, 16 Sep 2019 12:51:29 +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 2E23F20789; Mon, 16 Sep 2019 12:51:29 +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 x8GCpTkP058825; Mon, 16 Sep 2019 12:51:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GCpSWw058823; Mon, 16 Sep 2019 12:51:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909161251.x8GCpSWw058823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 16 Sep 2019 12:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352388 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 352388 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 12:51:29 -0000 Author: emaste Date: Mon Sep 16 12:51:28 2019 New Revision: 352388 URL: https://svnweb.freebsd.org/changeset/base/352388 Log: MFC r346445: Enable ioremap for aarch64 in the LinuxKPI Required for Mellanox drivers (e.g. on Ampere eMAG at Packet.com). PR: 237055 Submitted by: Greg V Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/io.h Mon Sep 16 12:44:44 2019 (r352387) +++ stable/12/sys/compat/linuxkpi/common/include/linux/io.h Mon Sep 16 12:51:28 2019 (r352388) @@ -350,7 +350,7 @@ _outb(u_char data, u_int port) } #endif -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #else #define _ioremap_attr(...) NULL Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Sep 16 12:44:44 2019 (r352387) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Sep 16 12:51:28 2019 (r352388) @@ -1777,7 +1777,7 @@ vmmap_remove(void *addr) return (vmmap); } -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) void * _ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr) { @@ -1800,7 +1800,7 @@ iounmap(void *addr) vmmap = vmmap_remove(addr); if (vmmap == NULL) return; -#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) pmap_unmapdev((vm_offset_t)addr, vmmap->vm_size); #endif kfree(vmmap); From owner-svn-src-all@freebsd.org Mon Sep 16 12:51: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 7E2DBFFFB3; Mon, 16 Sep 2019 12:51:31 +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 46X5hz2jC2z4cBC; Mon, 16 Sep 2019 12:51:31 +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 4079F2078D; Mon, 16 Sep 2019 12:51:31 +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 x8GCpVMJ058891; Mon, 16 Sep 2019 12:51:31 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GCpUKh058887; Mon, 16 Sep 2019 12:51:30 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201909161251.x8GCpUKh058887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 16 Sep 2019 12:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352389 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 352389 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 12:51:31 -0000 Author: manu Date: Mon Sep 16 12:51:30 2019 New Revision: 352389 URL: https://svnweb.freebsd.org/changeset/base/352389 Log: pkgbase: Move cap_mkdb from runtime to utilities POST-INSTALL Since login and login.conf moved to the utilities packages move also the post-install related commands. Reported by: mj-mailinglist@gmx.de Reviewed by: bapt Added: head/release/packages/utilities.ucl (contents, props changed) Modified: head/release/packages/runtime.ucl Modified: head/release/packages/runtime.ucl ============================================================================== --- head/release/packages/runtime.ucl Mon Sep 16 12:51:28 2019 (r352388) +++ head/release/packages/runtime.ucl Mon Sep 16 12:51:30 2019 (r352389) @@ -18,7 +18,6 @@ desc = < Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74CF81210E9; Mon, 16 Sep 2019 12:54:45 +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 46X5mj2YkWz4ccl; Mon, 16 Sep 2019 12:54:45 +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 3B9C8208F2; Mon, 16 Sep 2019 12:54:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GCsjbK063417; Mon, 16 Sep 2019 12:54:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GCsjC3063416; Mon, 16 Sep 2019 12:54:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909161254.x8GCsjC3063416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 16 Sep 2019 12:54: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: r352390 - stable/12/sys/modules/i2c/controllers/ichiic X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/modules/i2c/controllers/ichiic X-SVN-Commit-Revision: 352390 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 12:54:45 -0000 Author: emaste Date: Mon Sep 16 12:54:44 2019 New Revision: 352390 URL: https://svnweb.freebsd.org/changeset/base/352390 Log: MFC r350303: enable ig4_acpi on aarch64 The already-listed APMC0D0F ID belongs to the Ampere eMAG aarch64 platform, but ACPI support was not even built on aarch64. Submitted by: Greg V Modified: stable/12/sys/modules/i2c/controllers/ichiic/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/i2c/controllers/ichiic/Makefile ============================================================================== --- stable/12/sys/modules/i2c/controllers/ichiic/Makefile Mon Sep 16 12:51:30 2019 (r352389) +++ stable/12/sys/modules/i2c/controllers/ichiic/Makefile Mon Sep 16 12:54:44 2019 (r352390) @@ -6,7 +6,8 @@ SRCS = acpi_if.h device_if.h bus_if.h iicbus_if.h pci smbus_if.h ${ig4_acpi} ig4_iic.c ig4_pci.c ig4_reg.h \ ig4_var.h opt_acpi.h -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" ig4_acpi= ig4_acpi.c .endif From owner-svn-src-all@freebsd.org Mon Sep 16 13:10: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 BF5A4121656; Mon, 16 Sep 2019 13:10:03 +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 46X66M4gy5z4dHb; Mon, 16 Sep 2019 13:10:03 +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 83DAA20AC3; Mon, 16 Sep 2019 13:10:03 +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 x8GDA3NM071382; Mon, 16 Sep 2019 13:10:03 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GDA3PK071381; Mon, 16 Sep 2019 13:10:03 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201909161310.x8GDA3PK071381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 16 Sep 2019 13:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352391 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 352391 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 13:10:03 -0000 Author: yuripv Date: Mon Sep 16 13:10:03 2019 New Revision: 352391 URL: https://svnweb.freebsd.org/changeset/base/352391 Log: sbuf(9): fix sbuf_drain_func typedef markup Reviewed by: 0mp (previous version) Differential Revision: https://reviews.freebsd.org/D21569 Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Mon Sep 16 12:54:44 2019 (r352390) +++ head/share/man/man9/sbuf.9 Mon Sep 16 13:10:03 2019 (r352391) @@ -65,7 +65,12 @@ .Sh SYNOPSIS .In sys/types.h .In sys/sbuf.h -.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ len ) ; +.Ft typedef int +.Fo (sbuf_drain_func) +.Fa "void *arg" +.Fa "const char *data" +.Fa "int len" +.Fc .Pp .Ft struct sbuf * .Fo sbuf_new From owner-svn-src-all@freebsd.org Mon Sep 16 13:10: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 6C2DF1216BC; Mon, 16 Sep 2019 13:10:35 +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 46X66z2KpSz4dQm; Mon, 16 Sep 2019 13:10:35 +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 3330020AD7; Mon, 16 Sep 2019 13:10:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GDAYwo071512; Mon, 16 Sep 2019 13:10:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GDAYSJ071511; Mon, 16 Sep 2019 13:10:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909161310.x8GDAYSJ071511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 16 Sep 2019 13:10: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: r352392 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 352392 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 13:10:35 -0000 Author: emaste Date: Mon Sep 16 13:10:34 2019 New Revision: 352392 URL: https://svnweb.freebsd.org/changeset/base/352392 Log: MFC r350499: acpi_resource.c: mention ThunderX2 firmware revision with issue [This has been fixed in a later version] and the workaround can eventually be removed. See r330113 and r346066 details. Modified: stable/12/sys/dev/acpica/acpi_resource.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_resource.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_resource.c Mon Sep 16 13:10:03 2019 (r352391) +++ stable/12/sys/dev/acpica/acpi_resource.c Mon Sep 16 13:10:34 2019 (r352392) @@ -434,7 +434,10 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, arc.dev = dev; arc.ignore_producer_flag = false; - /* UARTs on ThunderX2 set ResourceProducer on memory resources. */ + /* + * UARTs on ThunderX2 set ResourceProducer on memory resources, with + * 7.2 firmware. + */ if (acpi_MatchHid(handle, "ARMH0011")) arc.ignore_producer_flag = true; From owner-svn-src-all@freebsd.org Mon Sep 16 13:26: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 E4624121C72; Mon, 16 Sep 2019 13:26:27 +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 46X6TH5hnjz4fJ3; Mon, 16 Sep 2019 13:26:27 +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 A237320E82; Mon, 16 Sep 2019 13:26:27 +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 x8GDQRdZ084855; Mon, 16 Sep 2019 13:26:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GDQRdl084854; Mon, 16 Sep 2019 13:26:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909161326.x8GDQRdl084854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 16 Sep 2019 13:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352393 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 352393 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 13:26:28 -0000 Author: kib Date: Mon Sep 16 13:26:27 2019 New Revision: 352393 URL: https://svnweb.freebsd.org/changeset/base/352393 Log: nfscl_loadattrcache: fix rest of the cases to not call vnode_pager_setsize() under the node mutex. r248567 moved some calls of vnode_pager_setsize() after the node lock is unlocked, do the rest now. Reported and tested by: peterj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Mon Sep 16 13:10:34 2019 (r352392) +++ head/sys/fs/nfsclient/nfs_clport.c Mon Sep 16 13:26:27 2019 (r352393) @@ -511,10 +511,10 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt * zero np->n_attrstamp to indicate that * the attributes are stale. */ - vap->va_size = np->n_size; + nsize = vap->va_size = np->n_size; + setnsize = 1; np->n_attrstamp = 0; KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); - vnode_pager_setsize(vp, np->n_size); } else if (np->n_flag & NMODIFIED) { /* * We've modified the file: Use the larger @@ -526,7 +526,8 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); + nsize = np->n_size; + setnsize = 1; } else if (vap->va_size < np->n_size) { /* * When shrinking the size, the call to @@ -538,9 +539,9 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt np->n_flag |= NSIZECHANGED; setnsize = 1; } else { - np->n_size = vap->va_size; + nsize = np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; - vnode_pager_setsize(vp, np->n_size); + setnsize = 1; } } else { np->n_size = vap->va_size; From owner-svn-src-all@freebsd.org Mon Sep 16 13:41: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 D8B8312201E; Mon, 16 Sep 2019 13:41:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X6pf6Bgtz4fsg; Mon, 16 Sep 2019 13:41:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B789021192; Mon, 16 Sep 2019 13:41:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GDfUgE094851; Mon, 16 Sep 2019 13:41:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GDfOxo094817; Mon, 16 Sep 2019 13:41:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161341.x8GDfOxo094817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 13:41:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352394 - in stable/12: etc/mtree gnu/lib gnu/lib/csu lib/csu lib/csu/aarch64 lib/csu/amd64 lib/csu/arm lib/csu/common lib/csu/i386 lib/csu/mips lib/csu/powerpc lib/csu/powerpc64 lib/cs... X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in stable/12: etc/mtree gnu/lib gnu/lib/csu lib/csu lib/csu/aarch64 lib/csu/amd64 lib/csu/arm lib/csu/common lib/csu/i386 lib/csu/mips lib/csu/powerpc lib/csu/powerpc64 lib/csu/riscv lib/csu/sparc64 l... X-SVN-Commit-Revision: 352394 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 13:41:30 -0000 Author: andrew Date: Mon Sep 16 13:41:24 2019 New Revision: 352394 URL: https://svnweb.freebsd.org/changeset/base/352394 Log: MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, r339912-r339913, r339916, r339954, r340213, r340395, r340840, r340910-r340911, r341424, r342773, r342974, r351027, r352073: MFC the BSD crtbegin to stable/12 but keep it disabled. r339738: Implement a BSD licensed crtbegin/crtend These are needed for .ctors/.dtors and .jcr handling. The former needs all the function pointers to be called in the correct order from the .init/.fini section. The latter just needs to call a gcj specific function if it exists with a pointer to the start of the .jcr section. This is currently disabled until __dso_handle support is added. Reviewed by: emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17587 r339744: Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined. MFC with: r339738 Sponsored by: DARPA, AFRL r339770: Drop the csu tests WARNS to 5 to fix the powerpc64 build. MFC with: r339738 Sponsored by: DARPA, AFRL r339773: Add __dso_handle to the BSD crtbegin. This is used to identify shared objects. MFC with: r339738 Sponsored by: DARPA, AFRL r339864: Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL when accessed from a shared object. MFC with: r339738 Sponsored by: DARPA, AFRL r339865: Include the csu test directories in BSD.tests.dist MFC with: r339738 Sponsored by: DARPA, AFRL r339866: Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be accessible from out of the files they are defined in. MFC with: r339738 Sponsored by: DARPA, AFRL r339907: The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise. MFC with: r339738 Sponsored by: DARPA, AFRL r339908: Run the csu tests on a DSO. This builds the tests into a shared library, then runs these from the base test programs. With this we can check crtbeginS.o and crtendS.o are working as expected. MFC with: r339738 Sponsored by: DARPA, AFRL r339912: Fix the location of the static keyword. MFC with: r339738 Sponsored by: DARPA, AFRL r339913: Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with the section. MFC with: r339738 Sponsored by: DARPA, AFRL r339916: Build the csu tests on all architectures. The tests haven't been run them, but this is enough to build them so I can get feedback on if the various crt.h headers are correct. MFC with: r339738 Sponsored by: DARPA, AFRL r339954: Add __used to __CTOR_LIST__ and __DTOR_LIST__ Enabling BSD_CRTBEGIN on amd64 resulted in error: unused variable '__CTOR_LIST__'. __CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of the .ctors array and is used in crtend.c. Annotate __DTOR_LIST__ as well for consistency. Discussed with: andrew MFC with: r339738 Sponsored by: The FreeBSD Foundation r340213: Add the (untested) mips and sparc64 .init call sequences. The BSD crtbegin/crtend code now builds on all architectures, however further work is needed to check if it works correctly. MFC with: r339738 Sponsored by: DARPA, AFRL r340395: Run __cxa_finalize in shared objects in the destructor path. When we have .dtors call them before .dtor handling, otherwise call from a destructor. PR: 233056 MFC with: r339738 Sponsored by: DARPA, AFRL r340840: Mark the function called by the MIPS .init/.fini sequence with .local. As with r328939 we need to mark local symbols as such. Without this the assembly parser treats the symbols as global and created relocations against these private symbols. MFC with: r339738 Sponsored by: DARPA, AFRL r340910: Add the missing 0 at the end of the .jcr section. Without this the dynamic library test was failing as it was calling _Jv_RegisterClasses multiple times. r340911: Re-enable the dynamiclib tests. These should be fixed by r340910. r341424: Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o files that haven't been implemented. Reported by: sbruno MFC with: r339738 Sponsored by: DARPA, AFRL r342773: Add explicit csu test dependency lib/csu/tests/dynamiclib requires libh_csu.so be built first. I'm not sure this is the most correct/best way to address this but it solves the issue in my testing. PR: 233734 Sponsored by: The FreeBSD Foundation r342974: Create crtsavres.o for powerpc builds Summary: GCC expects to link in a crtsavres.o on powerpc platforms. On powerpc64 this is an empty file, but on powerpc and powerpcspe this does contain some save/restore functions, which may not actually be necessary for newer modern GCC and clang. This appeases the in-tree gcc, though, and is needed in order to switch to the BSD CRTRBEGIN. PR: 233751 Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D18826 r351027: Enable BSD_CRTBEGIN on powerpc In r342974 jhibbits added support to build crtsavres.o. This was the blocker for BSD_CRTBEGIN to be enabled there. As such enable this option again. Reviewed by: jhibbits Sponsored by: DARPA, AFRL r352073: csu: Add the riscv .init call sequence Reviewed by: br Sponsored by: Axiado Differential Revision: https://reviews.freebsd.org/D21537 Added: stable/12/lib/csu/aarch64/crt.h - copied unchanged from r339738, head/lib/csu/aarch64/crt.h stable/12/lib/csu/amd64/crt.h - copied unchanged from r339738, head/lib/csu/amd64/crt.h stable/12/lib/csu/arm/crt.h - copied unchanged from r339916, head/lib/csu/arm/crt.h stable/12/lib/csu/common/crtbegin.c - copied, changed from r339738, head/lib/csu/common/crtbegin.c stable/12/lib/csu/common/crtend.c - copied, changed from r339738, head/lib/csu/common/crtend.c stable/12/lib/csu/i386/crt.h - copied unchanged from r339738, head/lib/csu/i386/crt.h stable/12/lib/csu/mips/crt.h - copied, changed from r339916, head/lib/csu/mips/crt.h stable/12/lib/csu/powerpc/crt.h - copied unchanged from r339916, head/lib/csu/powerpc/crt.h stable/12/lib/csu/powerpc/crtsavres.S - copied unchanged from r342974, head/lib/csu/powerpc/crtsavres.S stable/12/lib/csu/powerpc64/crt.h - copied unchanged from r339738, head/lib/csu/powerpc64/crt.h stable/12/lib/csu/riscv/crt.h - copied, changed from r339916, head/lib/csu/riscv/crt.h stable/12/lib/csu/sparc64/crt.h - copied, changed from r339916, head/lib/csu/sparc64/crt.h stable/12/lib/csu/tests/ - copied from r339738, head/lib/csu/tests/ stable/12/lib/csu/tests/dso/ - copied from r339908, head/lib/csu/tests/dso/ stable/12/lib/csu/tests/dynamiclib/ - copied from r339908, head/lib/csu/tests/dynamiclib/ stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN - copied unchanged from r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN stable/12/tools/build/options/WITH_BSD_CRTBEGIN - copied unchanged from r339738, head/tools/build/options/WITH_BSD_CRTBEGIN Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/gnu/lib/Makefile stable/12/gnu/lib/csu/Makefile stable/12/lib/csu/Makefile stable/12/lib/csu/Makefile.inc stable/12/lib/csu/powerpc/Makefile stable/12/lib/csu/powerpc64/Makefile stable/12/lib/csu/tests/Makefile stable/12/lib/csu/tests/Makefile.tests stable/12/lib/csu/tests/cxx_constructors.cc stable/12/lib/csu/tests/dynamic/Makefile stable/12/lib/csu/tests/fini_test.c stable/12/lib/csu/tests/init_test.c stable/12/lib/csu/tests/static/Makefile stable/12/share/mk/src.opts.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 13:41:24 2019 (r352394) @@ -280,6 +280,14 @@ test-programs .. .. + csu + dynamic + .. + dynamiclib + .. + static + .. + .. googletest gmock .. Modified: stable/12/gnu/lib/Makefile ============================================================================== --- stable/12/gnu/lib/Makefile Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/gnu/lib/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -2,7 +2,7 @@ .include -SUBDIR= csu +SUBDIR= SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_GCC}+= libgcov .if ${MK_GCC} != "no" && ${MK_OPENMP} == "no" @@ -10,6 +10,10 @@ SUBDIR+= libgomp .endif SUBDIR.${MK_SSP}+= libssp SUBDIR.${MK_TESTS}+= tests + +.if ${MK_BSD_CRTBEGIN} == "no" +SUBDIR+= csu +.endif .if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \ ${MK_GDB} != "no" Modified: stable/12/gnu/lib/csu/Makefile ============================================================================== --- stable/12/gnu/lib/csu/Makefile Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/gnu/lib/csu/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -28,10 +28,6 @@ CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG} CFLAGS+= -DTARGET_ARM_EABI .endif -.if ${MACHINE_CPUARCH} == "powerpc" -TGTOBJS= crtsavres.o -SRCS+= crtsavres.asm -.endif .if ${MACHINE_CPUARCH} == "sparc64" TGTOBJS= crtfastmath.o SRCS+= crtfastmath.c Modified: stable/12/lib/csu/Makefile ============================================================================== --- stable/12/lib/csu/Makefile Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/lib/csu/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -1,9 +1,14 @@ # $FreeBSD$ +.include + .if exists(${.CURDIR}/${MACHINE_ARCH}) SUBDIR+= ${MACHINE_ARCH} .else SUBDIR+= ${MACHINE_CPUARCH} .endif + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/12/lib/csu/Makefile.inc ============================================================================== --- stable/12/lib/csu/Makefile.inc Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/lib/csu/Makefile.inc Mon Sep 16 13:41:24 2019 (r352394) @@ -6,4 +6,27 @@ SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/ NO_WMISSING_VARIABLE_DECLARATIONS= +.include + +.if ${MK_BSD_CRTBEGIN} != "no" && !defined(BUILDING_TESTS) + +OBJS+= crtbegin.o crtbeginS.o crtbeginT.o +OBJS+= crtend.o crtendS.o + +CFLAGS_CRTS= -DSHARED ${PICFLAG} + +crtbegin.o: crtbegin.c +crtbeginS.o: crtbegin.c +crtbeginT.o: crtbegin.c +crtend.o: crtend.c +crtendS.o: crtend.c + +crtbegin.o crtend.o crtbeginT.o: + ${CC} ${CFLAGS} -I${.CURDIR} -c -o ${.TARGET} ${.ALLSRC} + +crtbeginS.o crtendS.o: + ${CC} ${CFLAGS} -I${.CURDIR} ${CFLAGS_CRTS} -c -o ${.TARGET} ${.ALLSRC} + +.endif + .include "../Makefile.inc" Copied: stable/12/lib/csu/aarch64/crt.h (from r339738, head/lib/csu/aarch64/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/aarch64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/aarch64/crt.h) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +/* Empty so we can include this unconditionally */ Copied: stable/12/lib/csu/amd64/crt.h (from r339738, head/lib/csu/amd64/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/amd64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/amd64/crt.h) @@ -0,0 +1,32 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2018 Andrew Turner + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) + +#endif Copied: stable/12/lib/csu/arm/crt.h (from r339916, head/lib/csu/arm/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/arm/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339916, head/lib/csu/arm/crt.h) @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +/* Empty so we can include this unconditionally */ Copied and modified: stable/12/lib/csu/common/crtbegin.c (from r339738, head/lib/csu/common/crtbegin.c) ============================================================================== --- head/lib/csu/common/crtbegin.c Thu Oct 25 17:39:41 2018 (r339738, copy source) +++ stable/12/lib/csu/common/crtbegin.c Mon Sep 16 13:41:24 2019 (r352394) @@ -30,17 +30,42 @@ __FBSDID("$FreeBSD$"); typedef void (*crt_func)(void); +extern void *__dso_handle __hidden; + +#ifndef SHARED +void *__dso_handle = 0; +#else +void *__dso_handle = &__dso_handle; +void __cxa_finalize(void *) __weak_symbol; + /* + * Call __cxa_finalize with the dso handle in shared objects. + * When we have ctors/dtors call from the dtor handler before calling + * any dtors, otherwise use a destructor. + */ +#ifndef HAVE_CTORS +__attribute__((destructor)) +#endif +static void +run_cxa_finalize(void) +{ + + if (__cxa_finalize != NULL) + __cxa_finalize(__dso_handle); +} +#endif + +/* * On some architectures and toolchains we may need to call the .dtors. * These are called in the order they are in the ELF file. */ #ifdef HAVE_CTORS static void __do_global_dtors_aux(void) __used; -crt_func __CTOR_LIST__[] __section(".ctors") __hidden = { +static crt_func __CTOR_LIST__[] __section(".ctors") __used = { (crt_func)-1 }; -crt_func __DTOR_LIST__[] __section(".dtors") __hidden = { +static crt_func __DTOR_LIST__[] __section(".dtors") __used = { (crt_func)-1 }; @@ -50,6 +75,10 @@ __do_global_dtors_aux(void) crt_func fn; int n; +#ifdef SHARED + run_cxa_finalize(); +#endif + for (n = 1;; n++) { fn = __DTOR_LIST__[n]; if (fn == (crt_func)0 || fn == (crt_func)-1) @@ -73,7 +102,7 @@ asm ( extern void _Jv_RegisterClasses(void *) __weak_symbol; static void register_classes(void) __used; -crt_func __JCR_LIST__[] __section(".jcr") __used __hidden = { }; +static crt_func __JCR_LIST__[] __section(".jcr") __used = { }; #ifndef CTORS_CONSTRUCTORS __attribute__((constructor)) Copied and modified: stable/12/lib/csu/common/crtend.c (from r339738, head/lib/csu/common/crtend.c) ============================================================================== --- head/lib/csu/common/crtend.c Thu Oct 25 17:39:41 2018 (r339738, copy source) +++ stable/12/lib/csu/common/crtend.c Mon Sep 16 13:41:24 2019 (r352394) @@ -35,10 +35,13 @@ typedef void (*crt_func)(void); */ static void __do_global_ctors_aux(void) __used; -crt_func __CTOR_END__[] __section(".ctors") __used __hidden = { +static crt_func __CTOR_END__[] __section(".ctors") __used = { (crt_func)0 }; -crt_func __DTOR_END__[] __section(".dtors") __used __hidden = { +static crt_func __DTOR_END__[] __section(".dtors") __used = { + (crt_func)0 +}; +static crt_func __JCR_LIST__[] __section(".jcr") __used = { (crt_func)0 }; Copied: stable/12/lib/csu/i386/crt.h (from r339738, head/lib/csu/i386/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/i386/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/i386/crt.h) @@ -0,0 +1,32 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2018 Andrew Turner + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) + +#endif Copied and modified: stable/12/lib/csu/mips/crt.h (from r339916, head/lib/csu/mips/crt.h) ============================================================================== --- head/lib/csu/mips/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source) +++ stable/12/lib/csu/mips/crt.h Mon Sep 16 13:41:24 2019 (r352394) @@ -27,5 +27,27 @@ #define _CRT_H_ #define HAVE_CTORS +#define CTORS_CONSTRUCTORS +#ifdef __mips_o32 +#define INIT_CALL_SEQ(func) \ + ".set noreorder \n" \ + "bal 1f \n" \ + "nop \n" \ + "1: \n" \ + ".cpload $ra \n" \ + ".set reorder \n" \ + ".local " __STRING(func) "\n" \ + "jal " __STRING(func) +#else +#define INIT_CALL_SEQ(func) \ + ".set noreorder \n" \ + "bal 1f \n" \ + "nop \n" \ + "1: \n" \ + ".set reorder \n" \ + ".cpsetup $ra, $v0, 1b \n" \ + ".local " __STRING(func) "\n" \ + "jal " __STRING(func) +#endif #endif Modified: stable/12/lib/csu/powerpc/Makefile ============================================================================== --- stable/12/lib/csu/powerpc/Makefile Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/lib/csu/powerpc/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -2,7 +2,7 @@ .PATH: ${.CURDIR:H}/common -SRCS= crt1.c crti.S crtn.S +SRCS= crt1.c crti.S crtn.S crtsavres.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR:H}/common \ Copied: stable/12/lib/csu/powerpc/crt.h (from r339916, head/lib/csu/powerpc/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/powerpc/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339916, head/lib/csu/powerpc/crt.h) @@ -0,0 +1,33 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2018 Andrew Turner + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define CTORS_CONSTRUCTORS +#define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop" + +#endif Copied: stable/12/lib/csu/powerpc/crtsavres.S (from r342974, head/lib/csu/powerpc/crtsavres.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/powerpc/crtsavres.S Mon Sep 16 13:41:24 2019 (r352394, copy of r342974, head/lib/csu/powerpc/crtsavres.S) @@ -0,0 +1,191 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2019 Justin Hibbits + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$"); + +.text + +/* + * The PowerPC ABI spec requires the following save/restore functions to be + * provided: + * + * _savefpr_N + * _restfpr_N + * _restfpr_N_x + * _savegpr_N + * _restgpr_N + * _restgpr_N_x + * + * With N ranging from 14 to 31, to save the nonvolatile registers. + */ + +#define _CRTENTRY(name) \ + .text; \ + .globl name; \ + .type name,@function; \ + name: + +#define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \ + stfd r,(-256 + r * 8)(11) + +SAVEFPR(14) +SAVEFPR(15) +SAVEFPR(16) +SAVEFPR(17) +SAVEFPR(18) +SAVEFPR(19) +SAVEFPR(20) +SAVEFPR(21) +SAVEFPR(22) +SAVEFPR(23) +SAVEFPR(24) +SAVEFPR(25) +SAVEFPR(26) +SAVEFPR(27) +SAVEFPR(28) +SAVEFPR(29) +SAVEFPR(30) +SAVEFPR(31) + blr + +#define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \ + lfd r,(-256 + r * 8)(11) + +RESTFPR(14) +RESTFPR(15) +RESTFPR(16) +RESTFPR(17) +RESTFPR(18) +RESTFPR(19) +RESTFPR(20) +RESTFPR(21) +RESTFPR(22) +RESTFPR(23) +RESTFPR(24) +RESTFPR(25) +RESTFPR(26) +RESTFPR(27) +RESTFPR(28) +RESTFPR(29) +RESTFPR(30) +RESTFPR(31) + blr + +#define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \ + stfd r,(-128 + r*4)(11) + +SAVEGPR(14) +SAVEGPR(15) +SAVEGPR(16) +SAVEGPR(17) +SAVEGPR(18) +SAVEGPR(19) +SAVEGPR(20) +SAVEGPR(21) +SAVEGPR(22) +SAVEGPR(23) +SAVEGPR(24) +SAVEGPR(25) +SAVEGPR(26) +SAVEGPR(27) +SAVEGPR(28) +SAVEGPR(29) +SAVEGPR(30) +SAVEGPR(31) + blr + +#define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \ + lwz r,(-128 + r*4)(11) + +RESTGPR(14) +RESTGPR(15) +RESTGPR(16) +RESTGPR(17) +RESTGPR(18) +RESTGPR(19) +RESTGPR(20) +RESTGPR(21) +RESTGPR(22) +RESTGPR(23) +RESTGPR(24) +RESTGPR(25) +RESTGPR(26) +RESTGPR(27) +RESTGPR(28) +RESTGPR(29) +RESTGPR(30) +RESTGPR(31) + blr + +#define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \ + lfd r,(-256 + r * 8)(11) + +RESTFPR_X(14) +RESTFPR_X(15) +RESTFPR_X(16) +RESTFPR_X(17) +RESTFPR_X(18) +RESTFPR_X(19) +RESTFPR_X(20) +RESTFPR_X(21) +RESTFPR_X(22) +RESTFPR_X(23) +RESTFPR_X(24) +RESTFPR_X(25) +RESTFPR_X(26) +RESTFPR_X(27) +RESTFPR_X(28) +RESTFPR_X(29) +RESTFPR_X(30) +RESTFPR_X(31) + lwz 0,4(11) + mtlr 0 + mr 1,11 + blr + +#define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \ + lwz r,(-128 + r*4)(11) + +RESTGPR_X(14) +RESTGPR_X(15) +RESTGPR_X(16) +RESTGPR_X(17) +RESTGPR_X(18) +RESTGPR_X(19) +RESTGPR_X(20) +RESTGPR_X(21) +RESTGPR_X(22) +RESTGPR_X(23) +RESTGPR_X(24) +RESTGPR_X(25) +RESTGPR_X(26) +RESTGPR_X(27) +RESTGPR_X(28) +RESTGPR_X(29) +RESTGPR_X(30) +RESTGPR_X(31) + lwz 0,4(11) + mtlr 0 + mr 1,11 + blr Modified: stable/12/lib/csu/powerpc64/Makefile ============================================================================== --- stable/12/lib/csu/powerpc64/Makefile Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/lib/csu/powerpc64/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -4,7 +4,7 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o gcrt1.o +OBJS+= crtsavres.o Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR:H}/common \ -I${SRCTOP}/lib/libc/include \ -mlongcall -DCRT_IRELOC_SUPPRESS @@ -18,7 +18,7 @@ FILESDIR= ${LIBDIR} .undef LIBRARIES_ONLY CLEANFILES= ${OBJS} -CLEANFILES+= crt1.s gcrt1.s Scrt1.s +CLEANFILES+= crt1.s crtsavres.s gcrt1.s Scrt1.s # See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not # directly compiled to .o files. @@ -26,6 +26,10 @@ CLEANFILES+= crt1.s gcrt1.s Scrt1.s crt1.s: crt1.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} + +# On powerpc64 crtsavres is an empty file +crtsavres.s: + touch ${.TARGET} crt1.o: crt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s Copied: stable/12/lib/csu/powerpc64/crt.h (from r339738, head/lib/csu/powerpc64/crt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/csu/powerpc64/crt.h Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/lib/csu/powerpc64/crt.h) @@ -0,0 +1,33 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2018 Andrew Turner + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define CTORS_CONSTRUCTORS +#define INIT_CALL_SEQ(func) "bl " __STRING(func) "; nop" + +#endif Copied and modified: stable/12/lib/csu/riscv/crt.h (from r339916, head/lib/csu/riscv/crt.h) ============================================================================== --- head/lib/csu/riscv/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source) +++ stable/12/lib/csu/riscv/crt.h Mon Sep 16 13:41:24 2019 (r352394) @@ -1,2 +1,9 @@ /* $FreeBSD$ */ -/* Empty so we can include this unconditionally */ + +#ifndef _CRT_H_ +#define _CRT_H_ + +#define HAVE_CTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) + +#endif Copied and modified: stable/12/lib/csu/sparc64/crt.h (from r339916, head/lib/csu/sparc64/crt.h) ============================================================================== --- head/lib/csu/sparc64/crt.h Tue Oct 30 14:44:12 2018 (r339916, copy source) +++ stable/12/lib/csu/sparc64/crt.h Mon Sep 16 13:41:24 2019 (r352394) @@ -27,5 +27,7 @@ #define _CRT_H_ #define HAVE_CTORS +#define CTORS_CONSTRUCTORS +#define INIT_CALL_SEQ(func) "call " __STRING(func) "; nop" #endif Modified: stable/12/lib/csu/tests/Makefile ============================================================================== --- head/lib/csu/tests/Makefile Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -1,6 +1,10 @@ # $FreeBSD$ +SUBDIR= dso TESTS_SUBDIRS= dynamic +TESTS_SUBDIRS+= dynamiclib TESTS_SUBDIRS+= static + +SUBDIR_DEPEND_dynamiclib=dso .include Modified: stable/12/lib/csu/tests/Makefile.tests ============================================================================== --- head/lib/csu/tests/Makefile.tests Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/Makefile.tests Mon Sep 16 13:41:24 2019 (r352394) @@ -4,6 +4,8 @@ ATF_TESTS_C+= init_test ATF_TESTS_C+= fini_test ATF_TESTS_CXX+= cxx_constructors +WARNS?= 3 + .if exists(${.CURDIR:H:H}/${MACHINE_ARCH}) CFLAGS+= -I${.CURDIR:H:H}/${MACHINE_ARCH} .else Modified: stable/12/lib/csu/tests/cxx_constructors.cc ============================================================================== --- head/lib/csu/tests/cxx_constructors.cc Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/cxx_constructors.cc Mon Sep 16 13:41:24 2019 (r352394) @@ -39,10 +39,18 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef DSO_LIB #include +#endif -static volatile int constructor_run; -static bool run_destructor_test = false; +extern volatile int constructor_run; +extern bool run_destructor_test; + +#ifndef DSO_BASE +volatile int constructor_run; +bool run_destructor_test = false; +#endif + struct Foo { Foo() { constructor_run = 1; @@ -53,8 +61,12 @@ struct Foo { } }; extern Foo foo; + +#ifndef DSO_BASE Foo foo; +#endif +#ifndef DSO_LIB ATF_TEST_CASE_WITHOUT_HEAD(cxx_constructor); ATF_TEST_CASE_BODY(cxx_constructor) { @@ -90,3 +102,4 @@ ATF_INIT_TEST_CASES(tcs) ATF_ADD_TEST_CASE(tcs, cxx_constructor); ATF_ADD_TEST_CASE(tcs, cxx_destructor); } +#endif Modified: stable/12/lib/csu/tests/dynamic/Makefile ============================================================================== --- head/lib/csu/tests/dynamic/Makefile Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/dynamic/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -1,7 +1,6 @@ # $FreeBSD$ .PATH: ${.CURDIR:H} -WARNS?= 6 .include "../Makefile.tests" .include Modified: stable/12/lib/csu/tests/fini_test.c ============================================================================== --- head/lib/csu/tests/fini_test.c Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/fini_test.c Mon Sep 16 13:41:24 2019 (r352394) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -43,10 +44,16 @@ __FBSDID("$FreeBSD$"); #include +extern bool run_dtors_test; +extern bool run_fini_array_test; +void dso_handle_check(void); + + +#ifndef DSO_BASE typedef void (*func_ptr)(void); -static bool run_dtors_test = false; -static bool run_fini_array_test = false; +bool run_dtors_test = false; +bool run_fini_array_test = false; static void dtors_handler(void) @@ -57,7 +64,9 @@ dtors_handler(void) } __section(".dtors") __used static func_ptr dtors_func = &dtors_handler; +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(dtors_test); ATF_TC_BODY(dtors_test, tc) { @@ -85,7 +94,9 @@ ATF_TC_BODY(dtors_test, tc) break; } } +#endif +#ifndef DSO_BASE static void fini_array_handler(void) { @@ -95,7 +106,9 @@ fini_array_handler(void) } __section(".fini_array") __used static func_ptr fini_array_func = &fini_array_handler; +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(fini_array_test); ATF_TC_BODY(fini_array_test, tc) { @@ -118,12 +131,41 @@ ATF_TC_BODY(fini_array_test, tc) break; } } +#endif +#ifndef DSO_BASE +extern void *__dso_handle; + +void +dso_handle_check(void) +{ + void *dso = __dso_handle; + +#ifdef DSO_LIB + ATF_REQUIRE_MSG(dso != NULL, + "Null __dso_handle in DSO"); +#else + ATF_REQUIRE_MSG(dso == NULL, + "Invalid __dso_handle in non-DSO"); +#endif +} +#endif + +#ifndef DSO_LIB +ATF_TC_WITHOUT_HEAD(dso_handle_test); +ATF_TC_BODY(dso_handle_test, tc) +{ + + dso_handle_check(); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, dtors_test); ATF_TP_ADD_TC(tp, fini_array_test); + ATF_TP_ADD_TC(tp, dso_handle_test); return (atf_no_error()); } +#endif Modified: stable/12/lib/csu/tests/init_test.c ============================================================================== --- head/lib/csu/tests/init_test.c Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/init_test.c Mon Sep 16 13:41:24 2019 (r352394) @@ -32,41 +32,58 @@ #include __FBSDID("$FreeBSD$"); +#ifndef DSO_LIB #include +#endif #include typedef void (*func_ptr)(void); -static volatile int jcr_run; -static const func_ptr *jcr_ptr; -static volatile int ctors_run; -static volatile int preinit_array_run; -static volatile int preinit_array_state = -1; -static volatile int init_array_run; -static volatile int init_array_state = -1; +extern volatile int jcr_run; +extern const func_ptr *jcr_ptr; +extern const void *jcr_func_ptr; +extern volatile int ctors_run; +extern volatile int preinit_array_run; +extern volatile int preinit_array_state; +extern volatile int init_array_run; +extern volatile int init_array_state; +#ifndef DSO_BASE +volatile int jcr_run; +const func_ptr *jcr_ptr; +volatile int ctors_run; +volatile int preinit_array_run; +volatile int preinit_array_state = -1; +volatile int init_array_run; +volatile int init_array_state = -1; + void _Jv_RegisterClasses(const func_ptr *); __section(".jcr") __used static func_ptr jcr_func = (func_ptr)1; +const void *jcr_func_ptr = &jcr_func; void -_Jv_RegisterClasses(const func_ptr *jcr __unused) +_Jv_RegisterClasses(const func_ptr *jcr) { jcr_run = 1; jcr_ptr = jcr; } +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(jcr_test); ATF_TC_BODY(jcr_test, tc) { ATF_REQUIRE_MSG(jcr_run == 1, ".jcr not run"); - ATF_REQUIRE_MSG(jcr_ptr == &jcr_func, + ATF_REQUIRE_MSG(jcr_ptr == jcr_func_ptr, "Incorrect pointer passed to _Jv_RegisterClasses"); } +#endif +#ifndef DSO_BASE static void ctors_handler(void) { @@ -75,7 +92,9 @@ ctors_handler(void) } __section(".ctors") __used static func_ptr ctors_func = &ctors_handler; +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(ctors_test); ATF_TC_BODY(ctors_test, tc) { @@ -86,7 +105,9 @@ ATF_TC_BODY(ctors_test, tc) ATF_REQUIRE_MSG(ctors_run == 0, ".ctors run"); #endif } +#endif +#if !defined(DSO_BASE) && !defined(DSO_LIB) static void preinit_array_handler(void) { @@ -96,16 +117,25 @@ preinit_array_handler(void) } __section(".preinit_array") __used static func_ptr preinit_array_func = &preinit_array_handler; +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(preinit_array_test); ATF_TC_BODY(preinit_array_test, tc) { +#ifdef DSO_BASE + /* Check .preinit_array wasn't run in a DSO */ + ATF_REQUIRE_MSG(preinit_array_run == 0, ".preinit_array run in DSO"); +#else ATF_REQUIRE_MSG(preinit_array_run == 1, ".preinit_array not run"); ATF_REQUIRE_MSG(preinit_array_state == 0, ".preinit_array was not run before .init_array"); +#endif } +#endif +#ifndef DSO_BASE static void init_array_handler(void) { @@ -115,14 +145,18 @@ init_array_handler(void) } __section(".init_array") __used static func_ptr init_array_func = &init_array_handler; +#endif +#ifndef DSO_LIB ATF_TC_WITHOUT_HEAD(init_array_test); ATF_TC_BODY(init_array_test, tc) { ATF_REQUIRE_MSG(init_array_run == 1, ".init_array not run"); +#ifndef DSO_BASE ATF_REQUIRE_MSG(init_array_state == 1, ".init_array was not run after .preinit_array"); +#endif } ATF_TP_ADD_TCS(tp) @@ -135,3 +169,4 @@ ATF_TP_ADD_TCS(tp) return (atf_no_error()); } +#endif Modified: stable/12/lib/csu/tests/static/Makefile ============================================================================== --- head/lib/csu/tests/static/Makefile Thu Oct 25 17:39:41 2018 (r339738) +++ stable/12/lib/csu/tests/static/Makefile Mon Sep 16 13:41:24 2019 (r352394) @@ -2,7 +2,6 @@ .PATH: ${.CURDIR:H} NO_SHARED= -WARNS?= 6 .include "../Makefile.tests" .include Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Mon Sep 16 13:26:27 2019 (r352393) +++ stable/12/share/mk/src.opts.mk Mon Sep 16 13:41:24 2019 (r352394) @@ -193,6 +193,7 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BEARSSL \ + BSD_CRTBEGIN \ BSD_GREP \ CLANG_EXTRAS \ DTRACE_TESTS \ @@ -396,6 +397,11 @@ __DEFAULT_NO_OPTIONS+=HYPERV __DEFAULT_YES_OPTIONS+=NVME .else __DEFAULT_NO_OPTIONS+=NVME +.endif + +# Sparc64 need extra crt*.o files +.if ${__T:Msparc64} +BROKEN_OPTIONS+=BSD_CRTBEGIN .endif .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "amd64" || ${__T} == "i386") Copied: stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN (from r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_BSD_CRTBEGIN Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/tools/build/options/WITHOUT_BSD_CRTBEGIN) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Disable the BSD licensed +.Pa crtbegin.o +and +.Pa crtend.o . Copied: stable/12/tools/build/options/WITH_BSD_CRTBEGIN (from r339738, head/tools/build/options/WITH_BSD_CRTBEGIN) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_BSD_CRTBEGIN Mon Sep 16 13:41:24 2019 (r352394, copy of r339738, head/tools/build/options/WITH_BSD_CRTBEGIN) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Enable the BSD licensed +.Pa crtbegin.o +and +.Pa crtend.o . From owner-svn-src-all@freebsd.org Mon Sep 16 13:45: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 66AFB122399; Mon, 16 Sep 2019 13:45:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X6vJ28Cjz4gHw; Mon, 16 Sep 2019 13:45:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E17F21203; Mon, 16 Sep 2019 13:45:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GDjWaJ096729; Mon, 16 Sep 2019 13:45:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GDjW4E096728; Mon, 16 Sep 2019 13:45:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161345.x8GDjW4E096728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 13:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352395 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352395 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 13:45:32 -0000 Author: andrew Date: Mon Sep 16 13:45:31 2019 New Revision: 352395 URL: https://svnweb.freebsd.org/changeset/base/352395 Log: MFC r346996: Restore x18 in efi_arch_leave. Some UEFI implementations trash this register and, as we use it as a platform register, the kernel doesn't save it before calling into the UEFI runtime services. As we have a copy in tpidr_el1 restore from there when exiting the EFI environment. PR: 237234, 237055 Reviewed by: manu Tested On: Ampere eMAG Sponsored by: DARPA, AFRL Sponsored by: Ampere Computing (hardware) Differential Revision: https://reviews.freebsd.org/D20127 Modified: stable/12/sys/arm64/arm64/efirt_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/efirt_machdep.c Mon Sep 16 13:41:24 2019 (r352394) +++ stable/12/sys/arm64/arm64/efirt_machdep.c Mon Sep 16 13:45:31 2019 (r352395) @@ -260,6 +260,16 @@ efi_arch_leave(void) { struct thread *td; + /* + * Restore the pcpu pointer. Some UEFI implementations trash it and + * we don't store it before calling into them. To fix this we need + * to restore it after returning to the kernel context. As reading + * curthread will access x18 we need to restore it before loading + * the thread pointer. + */ + __asm __volatile( + "mrs x18, tpidr_el1 \n" + ); td = curthread; __asm __volatile( "msr ttbr0_el1, %0 \n" From owner-svn-src-all@freebsd.org Mon Sep 16 14:07: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 281F312313D; Mon, 16 Sep 2019 14:07:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X7Ng0LZpz3DFx; Mon, 16 Sep 2019 14:07:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF8CE215A3; Mon, 16 Sep 2019 14:07:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GE7Uar010320; Mon, 16 Sep 2019 14:07:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GE7U4M010319; Mon, 16 Sep 2019 14:07:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161407.x8GE7U4M010319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:07: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: r352396 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352396 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:07:31 -0000 Author: andrew Date: Mon Sep 16 14:07:30 2019 New Revision: 352396 URL: https://svnweb.freebsd.org/changeset/base/352396 Log: MFC r343876: Add missing data barriers after storeing a new valid pagetable entry. When moving from an invalid to a valid entry we don't need to invalidate the tlb, however we do need to ensure the store is ordered before later memory accesses. This is because this later access may be to a virtual address within the newly mapped region. Add the needed barriers to places where we don't later invalidate the tlb. When we do invalidate the tlb there will be a barrier to correctly order this. This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off: panic: vm_fault_hold: fault on nofault entry, addr: 0xffff000040c11000 Reported by: jchandra Tested by: jchandra Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19097 Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 13:45:31 2019 (r352395) +++ stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 14:07:30 2019 (r352396) @@ -2935,6 +2935,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent /* Create the new mapping */ pmap_load_store(pte, newpte); + dsb(ishst); critical_exit(); intr_restore(intr); @@ -3309,6 +3310,7 @@ validate: } else { /* New mapping */ pmap_load_store(l3, new_l3); + dsb(ishst); } #if VM_NRESERVLEVEL > 0 @@ -3455,6 +3457,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t * Map the superpage. */ (void)pmap_load_store(l2, new_l2); + dsb(ishst); atomic_add_long(&pmap_l2_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_l2: success for va %#lx in pmap %p", From owner-svn-src-all@freebsd.org Mon Sep 16 14:25: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 882D31238F2; Mon, 16 Sep 2019 14:25:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X7nr31pPz3FK9; Mon, 16 Sep 2019 14:25:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 466C92190B; Mon, 16 Sep 2019 14:25:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEPqJ6023977; Mon, 16 Sep 2019 14:25:52 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEPqsa023976; Mon, 16 Sep 2019 14:25:52 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161425.x8GEPqsa023976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:25: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: r352397 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 352397 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:25:52 -0000 Author: andrew Date: Mon Sep 16 14:25:51 2019 New Revision: 352397 URL: https://svnweb.freebsd.org/changeset/base/352397 Log: MFC r348323: The alignment is passed into contigmalloc_domainset in the 7th argument. KUBSAN was complaining the pointer contigmalloc_domainset returned was misaligned. Fix this by using the correct argument to find the alignment in the function signature. Reported by: KUBSAN Sponsored by: DARPA, AFRL Modified: stable/12/sys/sys/malloc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/malloc.h ============================================================================== --- stable/12/sys/sys/malloc.h Mon Sep 16 14:07:30 2019 (r352396) +++ stable/12/sys/sys/malloc.h Mon Sep 16 14:25:51 2019 (r352397) @@ -177,7 +177,7 @@ void *contigmalloc(unsigned long size, struct malloc_t void *contigmalloc_domainset(unsigned long size, struct malloc_type *type, struct domainset *ds, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) - __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); + __malloc_like __result_use_check __alloc_size(1) __alloc_align(7); void free(void *addr, struct malloc_type *type); void free_domain(void *addr, struct malloc_type *type); void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like From owner-svn-src-all@freebsd.org Mon Sep 16 14:34: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 7407D123D42; Mon, 16 Sep 2019 14:34:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X7zR2Ggsz3FxM; Mon, 16 Sep 2019 14:34:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 328E221ADA; Mon, 16 Sep 2019 14:34:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEYBRx030907; Mon, 16 Sep 2019 14:34:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEYBiL030906; Mon, 16 Sep 2019 14:34:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161434.x8GEYBiL030906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:34: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: r352398 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352398 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:34:11 -0000 Author: andrew Date: Mon Sep 16 14:34:10 2019 New Revision: 352398 URL: https://svnweb.freebsd.org/changeset/base/352398 Log: MFC r339944: Fix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines when they are too long. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 14:25:51 2019 (r352397) +++ stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 14:34:10 2019 (r352398) @@ -4810,8 +4810,9 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size) if (size == 0) return (NULL); - /* Calculate how many full L2 blocks are needed for the mapping */ - l2_blocks = (roundup2(pa + size, L2_SIZE) - rounddown2(pa, L2_SIZE)) >> L2_SHIFT; + /* Calculate how many L2 blocks are needed for the mapping */ + l2_blocks = (roundup2(pa + size, L2_SIZE) - + rounddown2(pa, L2_SIZE)) >> L2_SHIFT; offset = pa & L2_OFFSET; @@ -4858,8 +4859,10 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size) for (i = 0; i < l2_blocks; i++) { pde = pmap_pde(kernel_pmap, va, &lvl); KASSERT(pde != NULL, - ("pmap_mapbios: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 1, ("pmap_mapbios: Invalid level %d", lvl)); + ("pmap_mapbios: Invalid page entry, va: 0x%lx", + va)); + KASSERT(lvl == 1, + ("pmap_mapbios: Invalid level %d", lvl)); /* Insert L2_BLOCK */ l2 = pmap_l1_to_l2(pde, va); @@ -4904,7 +4907,8 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) pt_entry_t *l2; int i, lvl, l2_blocks, block; - l2_blocks = (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT; + l2_blocks = + (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT; KASSERT(l2_blocks > 0, ("pmap_unmapbios: invalid size %lx", size)); /* Remove preinit mapping */ @@ -4912,7 +4916,8 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) { ppim = pmap_preinit_mapping + i; if (ppim->va == va) { - KASSERT(ppim->size == size, ("pmap_unmapbios: size mismatch")); + KASSERT(ppim->size == size, + ("pmap_unmapbios: size mismatch")); ppim->va = 0; ppim->pa = 0; ppim->size = 0; @@ -4922,10 +4927,12 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) /* Remove L2_BLOCK */ pde = pmap_pde(kernel_pmap, va_trunc, &lvl); KASSERT(pde != NULL, - ("pmap_unmapbios: Invalid page entry, va: 0x%lx", va_trunc)); + ("pmap_unmapbios: Invalid page entry, va: 0x%lx", + va_trunc)); l2 = pmap_l1_to_l2(pde, va_trunc); pmap_clear(l2); - pmap_invalidate_range(kernel_pmap, va_trunc, va_trunc + L2_SIZE); + pmap_invalidate_range(kernel_pmap, va_trunc, + va_trunc + L2_SIZE); if (block == (l2_blocks - 1)) return; From owner-svn-src-all@freebsd.org Mon Sep 16 14:35: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 C15C8123E2F; Mon, 16 Sep 2019 14:35:03 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X80R4hv0z3G8f; Mon, 16 Sep 2019 14:35:03 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C76221ADB; Mon, 16 Sep 2019 14:35:03 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEZ3vM031118; Mon, 16 Sep 2019 14:35:03 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEZ3dj031117; Mon, 16 Sep 2019 14:35:03 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161435.x8GEZ3dj031117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352399 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352399 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:35:03 -0000 Author: andrew Date: Mon Sep 16 14:35:02 2019 New Revision: 352399 URL: https://svnweb.freebsd.org/changeset/base/352399 Log: MFC r339948: Use pmap_invalidate_all rather than invalidating 512 level 2 entries in the early pmap_mapbios/unmapbios code. It is even worse when there are multiple L2 entries to handle as we would need to iterate over all pages. Sponsored by: DARPA, AFRL Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 14:34:10 2019 (r352398) +++ stable/12/sys/arm64/arm64/pmap.c Mon Sep 16 14:35:02 2019 (r352399) @@ -4869,11 +4869,11 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size) pmap_load_store(l2, pa | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); - pmap_invalidate_range(kernel_pmap, va, va + L2_SIZE); va += L2_SIZE; pa += L2_SIZE; } + pmap_invalidate_all(kernel_pmap); va = preinit_map_va + (start_idx * L2_SIZE); @@ -4906,12 +4906,14 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) pd_entry_t *pde; pt_entry_t *l2; int i, lvl, l2_blocks, block; + bool preinit_map; l2_blocks = (roundup2(va + size, L2_SIZE) - rounddown2(va, L2_SIZE)) >> L2_SHIFT; KASSERT(l2_blocks > 0, ("pmap_unmapbios: invalid size %lx", size)); /* Remove preinit mapping */ + preinit_map = false; block = 0; for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) { ppim = pmap_preinit_mapping + i; @@ -4921,6 +4923,7 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) ppim->va = 0; ppim->pa = 0; ppim->size = 0; + preinit_map = true; offset = block * L2_SIZE; va_trunc = rounddown2(va, L2_SIZE) + offset; @@ -4931,13 +4934,15 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) va_trunc)); l2 = pmap_l1_to_l2(pde, va_trunc); pmap_clear(l2); - pmap_invalidate_range(kernel_pmap, va_trunc, - va_trunc + L2_SIZE); if (block == (l2_blocks - 1)) - return; + break; block++; } + } + if (preinit_map) { + pmap_invalidate_all(kernel_pmap); + return; } /* Unmap the pages reserved with kva_alloc. */ From owner-svn-src-all@freebsd.org Mon Sep 16 14:42: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 21593124275; Mon, 16 Sep 2019 14:42:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X88l05fYz3GqC; Mon, 16 Sep 2019 14:42:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC12A21C77; Mon, 16 Sep 2019 14:42:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEgEEo036615; Mon, 16 Sep 2019 14:42:14 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEgEAx036614; Mon, 16 Sep 2019 14:42:14 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161442.x8GEgEAx036614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:42: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: r352400 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 352400 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:42:15 -0000 Author: andrew Date: Mon Sep 16 14:42:14 2019 New Revision: 352400 URL: https://svnweb.freebsd.org/changeset/base/352400 Log: MFC r341489: Only gnu/lib/csu when MK_BSD_CRTBEGIN is off. We were still building it from Makefile.inc1. Disable it there so we don't try to build the GNU crtbegin/crtend when the BSD version was asked for. PR: 233733 Reported by: lwhsu Reviewed by: emaste MFC with: r339738 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18428 Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Mon Sep 16 14:35:02 2019 (r352399) +++ stable/12/Makefile.inc1 Mon Sep 16 14:42:14 2019 (r352400) @@ -2514,8 +2514,10 @@ _prereq_libs+= gnu/lib/libssp/libssp_nonshared # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before # all shared libraries for ELF. # -_startup_libs= gnu/lib/csu -_startup_libs+= lib/csu +_startup_libs= lib/csu +.if ${MK_BSD_CRTBEGIN} == "no" +_startup_libs+= gnu/lib/csu +.endif _startup_libs+= lib/libcompiler_rt _startup_libs+= lib/libc _startup_libs+= lib/libc_nonshared From owner-svn-src-all@freebsd.org Mon Sep 16 14:43: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 24A4112435F; Mon, 16 Sep 2019 14:43:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X8BS08Nbz3H1M; Mon, 16 Sep 2019 14:43:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCD6121C9E; Mon, 16 Sep 2019 14:43:43 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEhhG2037729; Mon, 16 Sep 2019 14:43:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEhh1Q037728; Mon, 16 Sep 2019 14:43:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161443.x8GEhh1Q037728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352401 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352401 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:43:44 -0000 Author: andrew Date: Mon Sep 16 14:43:43 2019 New Revision: 352401 URL: https://svnweb.freebsd.org/changeset/base/352401 Log: MFC r339594: Stop advertising ARMv8.3 Pointer Authentication This needs firmware and kernel support before userspace can use it. Until then don't advertise it's available. Modified: stable/12/sys/arm64/arm64/identcpu.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/identcpu.c ============================================================================== --- stable/12/sys/arm64/arm64/identcpu.c Mon Sep 16 14:42:14 2019 (r352400) +++ stable/12/sys/arm64/arm64/identcpu.c Mon Sep 16 14:43:43 2019 (r352401) @@ -211,13 +211,13 @@ static struct mrs_field id_aa64isar0_fields[] = { }; static struct mrs_field id_aa64isar1_fields[] = { - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_GPI_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_GPA_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPI_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_GPA_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_LRCPC_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_FCMA_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_JSCVT_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_API_SHIFT), - MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_APA_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_API_SHIFT), + MRS_FIELD(false, MRS_EXACT, ID_AA64ISAR1_APA_SHIFT), MRS_FIELD(false, MRS_LOWER, ID_AA64ISAR1_DPB_SHIFT), MRS_FIELD_END, }; From owner-svn-src-all@freebsd.org Mon Sep 16 14:45: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 7AB3C124405; Mon, 16 Sep 2019 14:45:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X8DK2gppz3H84; Mon, 16 Sep 2019 14:45:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F56021C9F; Mon, 16 Sep 2019 14:45:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEjLqA038078; Mon, 16 Sep 2019 14:45:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEjLY8038077; Mon, 16 Sep 2019 14:45:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161445.x8GEjLY8038077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:45: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: r352402 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352402 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:45:21 -0000 Author: andrew Date: Mon Sep 16 14:45:20 2019 New Revision: 352402 URL: https://svnweb.freebsd.org/changeset/base/352402 Log: MFC r339988: Use the correct offsets for the trap frame in fork_trampoline. Sponsored by: DARPA, AFRL Modified: stable/12/sys/arm64/arm64/swtch.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/swtch.S ============================================================================== --- stable/12/sys/arm64/arm64/swtch.S Mon Sep 16 14:43:43 2019 (r352401) +++ stable/12/sys/arm64/arm64/swtch.S Mon Sep 16 14:45:20 2019 (r352402) @@ -236,12 +236,12 @@ ENTRY(fork_trampoline) msr daifset, #2 /* Restore sp and lr */ - ldp x0, x1, [sp] + ldp x0, x1, [sp, #TF_SP] msr sp_el0, x0 mov lr, x1 /* Restore elr and spsr */ - ldp x0, x1, [sp, #16] + ldp x0, x1, [sp, #TF_ELR] msr elr_el1, x0 msr spsr_el1, x1 From owner-svn-src-all@freebsd.org Mon Sep 16 14:51: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 4C682124596; Mon, 16 Sep 2019 14:51:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X8MK1GjTz3HPS; Mon, 16 Sep 2019 14:51:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0ED8C21CFB; Mon, 16 Sep 2019 14:51:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GEpORh040737; Mon, 16 Sep 2019 14:51:24 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEpOSZ040444; Mon, 16 Sep 2019 14:51:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161451.x8GEpOSZ040444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 14:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352403 - in stable/12/sys/arm64: arm64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in stable/12/sys/arm64: arm64 include X-SVN-Commit-Revision: 352403 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:51:25 -0000 Author: andrew Date: Mon Sep 16 14:51:24 2019 New Revision: 352403 URL: https://svnweb.freebsd.org/changeset/base/352403 Log: MFC r340008, r340013 r340008: Add the ARMv8.3 HCR_EL2 register fields. Sponsored by: DARPA, AFRL r340013: Add the ARMv8.3 SCTLR_EL1 fields. While here tag which architecture release fields were added and remove a field that only existed in very early releases of the ARMv8 spec. Sponsored by: DARPA, AFRL Modified: stable/12/sys/arm64/arm64/locore.S stable/12/sys/arm64/include/armreg.h stable/12/sys/arm64/include/hypervisor.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/locore.S ============================================================================== --- stable/12/sys/arm64/arm64/locore.S Mon Sep 16 14:45:20 2019 (r352402) +++ stable/12/sys/arm64/arm64/locore.S Mon Sep 16 14:51:24 2019 (r352403) @@ -633,7 +633,7 @@ sctlr_set: sctlr_clear: /* Bits to clear */ .quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ - SCTLR_ITD | SCTLR_THEE | SCTLR_A) + SCTLR_ITD | SCTLR_A) .globl abort abort: Modified: stable/12/sys/arm64/include/armreg.h ============================================================================== --- stable/12/sys/arm64/include/armreg.h Mon Sep 16 14:45:20 2019 (r352402) +++ stable/12/sys/arm64/include/armreg.h Mon Sep 16 14:51:24 2019 (r352403) @@ -527,7 +527,7 @@ #define PAR_S_MASK (0x1 << PAR_S_SHIFT) /* SCTLR_EL1 - System Control Register */ -#define SCTLR_RES0 0xc8222400 /* Reserved ARMv8.0, write 0 */ +#define SCTLR_RES0 0xc8222440 /* Reserved ARMv8.0, write 0 */ #define SCTLR_RES1 0x30d00800 /* Reserved ARMv8.0, write 1 */ #define SCTLR_M 0x00000001 @@ -536,23 +536,32 @@ #define SCTLR_SA 0x00000008 #define SCTLR_SA0 0x00000010 #define SCTLR_CP15BEN 0x00000020 -#define SCTLR_THEE 0x00000040 +/* Bit 6 is reserved */ #define SCTLR_ITD 0x00000080 #define SCTLR_SED 0x00000100 #define SCTLR_UMA 0x00000200 +/* Bit 10 is reserved */ +/* Bit 11 is reserved */ #define SCTLR_I 0x00001000 +#define SCTLR_EnDB 0x00002000 /* ARMv8.3 */ #define SCTLR_DZE 0x00004000 #define SCTLR_UCT 0x00008000 #define SCTLR_nTWI 0x00010000 +/* Bit 17 is reserved */ #define SCTLR_nTWE 0x00040000 #define SCTLR_WXN 0x00080000 -#define SCTLR_IESB 0x00200000 -#define SCTLR_SPAN 0x00800000 +/* Bit 20 is reserved */ +#define SCTLR_IESB 0x00200000 /* ARMv8.2 */ +/* Bit 22 is reserved */ +#define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ #define SCTLR_EOE 0x01000000 #define SCTLR_EE 0x02000000 #define SCTLR_UCI 0x04000000 -#define SCTLR_nTLSMD 0x10000000 -#define SCTLR_LSMAOE 0x20000000 +#define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ +#define SCTLR_nTLSMD 0x10000000 /* ARMv8.2 */ +#define SCTLR_LSMAOE 0x20000000 /* ARMv8.2 */ +#define SCTLR_EnIB 0x40000000 /* ARMv8.3 */ +#define SCTLR_EnIA 0x80000000 /* ARMv8.3 */ /* SPSR_EL1 */ /* Modified: stable/12/sys/arm64/include/hypervisor.h ============================================================================== --- stable/12/sys/arm64/include/hypervisor.h Mon Sep 16 14:45:20 2019 (r352402) +++ stable/12/sys/arm64/include/hypervisor.h Mon Sep 16 14:51:24 2019 (r352403) @@ -80,6 +80,17 @@ #define HCR_RW 0x0000000080000000 #define HCR_CD 0x0000000100000000 #define HCR_ID 0x0000000200000000 +#define HCR_E2H 0x0000000400000000 +#define HCR_TLOR 0x0000000800000000 +#define HCR_TERR 0x0000001000000000 +#define HCR_TEA 0x0000002000000000 +#define HCR_MIOCNCE 0x0000004000000000 +/* Bit 39 is reserved */ +#define HCR_APK 0x0000010000000000 +#define HCR_API 0x0000020000000000 +#define HCR_NV 0x0000040000000000 +#define HCR_NV1 0x0000080000000000 +#define HCR_AT 0x0000100000000000 #endif From owner-svn-src-all@freebsd.org Mon Sep 16 14:51: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 3B62A1245FB; Mon, 16 Sep 2019 14:51:50 +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 46X8Mp0tvXz3HXV; Mon, 16 Sep 2019 14:51:50 +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 02BA821E18; Mon, 16 Sep 2019 14:51:50 +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 x8GEpnp0043083; Mon, 16 Sep 2019 14:51:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GEpn6O043081; Mon, 16 Sep 2019 14:51:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909161451.x8GEpn6O043081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 14:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352404 - head/sys/fs/fuse X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/fs/fuse X-SVN-Commit-Revision: 352404 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 14:51:50 -0000 Author: asomers Date: Mon Sep 16 14:51:49 2019 New Revision: 352404 URL: https://svnweb.freebsd.org/changeset/base/352404 Log: fusefs: fix some minor issues with fuse_vnode_setparent * When unparenting a vnode, actually clear the flag. AFAIK this is basically a no-op because we only unparent a vnode when reclaiming it or when unlinking. * There's no need to call fuse_vnode_setparent during reclaim, because we're about to free the vnode data anyway. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21630 Modified: head/sys/fs/fuse/fuse_node.h head/sys/fs/fuse/fuse_vnops.c Modified: head/sys/fs/fuse/fuse_node.h ============================================================================== --- head/sys/fs/fuse/fuse_node.h Mon Sep 16 14:51:24 2019 (r352403) +++ head/sys/fs/fuse/fuse_node.h Mon Sep 16 14:51:49 2019 (r352404) @@ -174,6 +174,8 @@ fuse_vnode_setparent(struct vnode *vp, struct vnode *d MPASS(dvp->v_type == VDIR); VTOFUD(vp)->parent_nid = VTOI(dvp); VTOFUD(vp)->flag |= FN_PARENT_NID; + } else { + VTOFUD(vp)->flag &= ~FN_PARENT_NID; } } Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Mon Sep 16 14:51:24 2019 (r352403) +++ head/sys/fs/fuse/fuse_vnops.c Mon Sep 16 14:51:49 2019 (r352404) @@ -1525,11 +1525,10 @@ fuse_vnop_reclaim(struct vop_reclaim_args *ap) fuse_filehandle_close(vp, fufh, td, NULL); } - if ((!fuse_isdeadfs(vp)) && (fvdat->nlookup)) { + if (!fuse_isdeadfs(vp) && fvdat->nlookup > 0) { fuse_internal_forget_send(vnode_mount(vp), td, NULL, VTOI(vp), fvdat->nlookup); } - fuse_vnode_setparent(vp, NULL); cache_purge(vp); vfs_hash_remove(vp); fuse_vnode_destroy(vp); From owner-svn-src-all@freebsd.org Mon Sep 16 15:00: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 3BD4E124B1E; Mon, 16 Sep 2019 15:00:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X8YS0tKBz3J5R; Mon, 16 Sep 2019 15:00:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02C8A21E64; Mon, 16 Sep 2019 15:00:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GF0Bxl045951; Mon, 16 Sep 2019 15:00:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GF0B3o045949; Mon, 16 Sep 2019 15:00:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909161500.x8GF0B3o045949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 16 Sep 2019 15:00: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: r352405 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352405 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:00:12 -0000 Author: andrew Date: Mon Sep 16 15:00:11 2019 New Revision: 352405 URL: https://svnweb.freebsd.org/changeset/base/352405 Log: MFC r342937: Fix the location of td->td_frame at the top of the kernel stack. In cpu_thread_alloc we would allocate space for the trap frame at the top of the kernel stack. This is just below the pcb, however due to a missing cast the pointer arithmetic would use the pcb size, not the trapframe size. As the pcb is larger than the trapframe this is safe, however later in cpu_fork we include the case leading to the two disagreeing on the location. Fix by using the same arithmetic in both locations. Found by: An early KASAN patch Sponsored by: DARPA, AFRL Modified: stable/12/sys/arm64/arm64/vm_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/vm_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/vm_machdep.c Mon Sep 16 14:51:49 2019 (r352404) +++ stable/12/sys/arm64/arm64/vm_machdep.c Mon Sep 16 15:00:11 2019 (r352405) @@ -228,7 +228,7 @@ cpu_thread_alloc(struct thread *td) td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *)STACKALIGN( - td->td_pcb - 1); + (struct trapframe *)td->td_pcb - 1); } void From owner-svn-src-all@freebsd.org Mon Sep 16 15:03: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 882AE124E96; Mon, 16 Sep 2019 15:03: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 46X8d03VqHz3JYf; Mon, 16 Sep 2019 15:03:16 +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 5BF4322026; Mon, 16 Sep 2019 15:03:16 +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 x8GF3GGS052035; Mon, 16 Sep 2019 15:03:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GF3C9J052007; Mon, 16 Sep 2019 15:03:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161503.x8GF3C9J052007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352406 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/m... X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/mips/mips sys/powerpc/aim ... X-SVN-Commit-Revision: 352406 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:03:16 -0000 Author: markj Date: Mon Sep 16 15:03:12 2019 New Revision: 352406 URL: https://svnweb.freebsd.org/changeset/base/352406 Log: Fix a couple of nits in r352110. - Remove a dead variable from the amd64 pmap_extract_and_hold(). - Fix grammar in the vm_page_wire man page. Reported by: alc Reviewed by: alc, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21639 Modified: head/share/man/man9/vm_page_wire.9 head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/dev/virtio/balloon/virtio_balloon.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h head/sys/vm/vm_swapout.c Modified: head/share/man/man9/vm_page_wire.9 ============================================================================== --- head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:00:11 2019 (r352405) +++ head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:03:12 2019 (r352406) @@ -51,7 +51,7 @@ The .Fn vm_page_wire and .Fn vm_page_wire_mapped -function wire the page, prevent it from being reclaimed by the page +functions wire the page, which prevents it from being reclaimed by the page daemon or when its containing object is destroyed. Both functions require that the page belong to an object. The Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -3064,10 +3064,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_ { pd_entry_t pde, *pdep; pt_entry_t pte, PG_RW, PG_V; - vm_paddr_t pa; vm_page_t m; - pa = 0; m = NULL; PG_RW = pmap_rw_bit(pmap); PG_V = pmap_valid_bit(pmap); @@ -5806,7 +5804,7 @@ retry: ("pmap_enter: no PV entry for %#lx", va)); if ((newpte & PG_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((om->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -6989,7 +6987,7 @@ pmap_remove_pages(pmap_t pmap) pvh->pv_gen++; if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) - if ((mt->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(mt) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&mt->md.pv_list)) vm_page_aflag_clear(mt, PGA_WRITEABLE); } @@ -7007,7 +7005,7 @@ pmap_remove_pages(pmap_t pmap) pmap_resident_count_dec(pmap, 1); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; - if ((m->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(m) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); @@ -7138,7 +7136,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -7207,7 +7205,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -7690,7 +7688,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/amd64/include/pmap.h Mon Sep 16 15:03:12 2019 (r352406) @@ -423,7 +423,8 @@ extern int pmap_pcid_enabled; extern int invpcid_works; #define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) -#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) +#define pmap_page_is_write_mapped(m) \ + (((m)->astate.flags & PGA_WRITEABLE) != 0) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) struct thread; Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/arm/arm/pmap-v4.c Mon Sep 16 15:03:12 2019 (r352406) @@ -4104,7 +4104,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; if (m->md.pvh_attrs & PVF_MOD) pmap_clearbit(m, PVF_MOD); @@ -4143,7 +4143,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (vm_page_xbusied(m) || (m->aflags & PGA_WRITEABLE) != 0) + if (vm_page_xbusied(m) || (vm_page_aflags(m) & PGA_WRITEABLE) != 0) pmap_clearbit(m, PVF_WRITE); } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/arm/arm/pmap-v6.c Mon Sep 16 15:03:12 2019 (r352406) @@ -5197,7 +5197,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTE2s can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -5540,7 +5540,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && !pmap_page_is_write_mapped(m)) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/arm64/arm64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -3333,7 +3333,7 @@ havel3: pv = pmap_pvh_remove(&om->md, pmap, va); if ((m->oflags & VPO_UNMANAGED) != 0) free_pv_entry(pmap, pv); - if ((om->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -4372,7 +4372,7 @@ pmap_remove_pages(pmap_t pmap) pvh->pv_gen++; if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) - if ((mt->aflags & PGA_WRITEABLE) != 0 && + if (vm_page_aflags(mt) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&mt->md.pv_list)) vm_page_aflag_clear(mt, PGA_WRITEABLE); } @@ -4394,7 +4394,7 @@ pmap_remove_pages(pmap_t pmap) TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; - if ((m->aflags & PGA_WRITEABLE) != 0 && + if (vm_page_aflags(m) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { pvh = pa_to_pvh( @@ -4534,7 +4534,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -4600,7 +4600,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4977,7 +4977,7 @@ pmap_clear_modify(vm_page_t m) * set. If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Sep 16 15:03:12 2019 (r352406) @@ -1718,12 +1718,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ bcopy((char *)db->db_data + bufoff, va, PAGESIZE); zfs_unmap_page(sf); m->valid = VM_PAGE_BITS_ALL; - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); } *rbehind = i; @@ -1838,12 +1836,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ } zfs_unmap_page(sf); m->valid = VM_PAGE_BITS_ALL; - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); } *rahead = i; zfs_vmobject_wunlock(vmobj); Modified: head/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/dev/virtio/balloon/virtio_balloon.c Mon Sep 16 15:03:12 2019 (r352406) @@ -332,8 +332,6 @@ vtballoon_inflate(struct vtballoon_softc *sc, int npag sc->vtballoon_page_frames[i] = VM_PAGE_TO_PHYS(m) >> VIRTIO_BALLOON_PFN_SHIFT; - KASSERT(m->queue == PQ_NONE, - ("%s: allocated page %p on queue", __func__, m)); TAILQ_INSERT_TAIL(&sc->vtballoon_pages, m, plinks.q); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/i386/i386/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -3752,7 +3752,7 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, v ("pmap_enter: no PV entry for %#x", va)); if ((newpte & PG_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((om->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -4848,7 +4848,7 @@ __CONCAT(PMTYPE, is_modified)(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -4979,7 +4979,7 @@ __CONCAT(PMTYPE, remove_write)(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); sched_pin(); @@ -5291,7 +5291,7 @@ __CONCAT(PMTYPE, clear_modify)(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/mips/mips/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -2164,7 +2164,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pv = pmap_pvh_remove(&om->md, pmap, va); if (!pte_test(&newpte, PTE_MANAGED)) free_pv_entry(pmap, pv); - if ((om->aflags & PGA_WRITEABLE) != 0 && + if (vm_page_aflags(m) & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list)) vm_page_aflag_clear(om, PGA_WRITEABLE); } @@ -2934,7 +2934,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2999,7 +2999,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PTE_D set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_testbit(m, PTE_D); @@ -3143,7 +3143,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * write busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -3270,7 +3270,7 @@ retry: * determine if the address is MINCORE_REFERENCED. */ m = PHYS_TO_VM_PAGE(pa); - if ((m->aflags & PGA_REFERENCED) != 0) + if ((vm_page_aflags(m) & PGA_REFERENCED) != 0) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/powerpc/aim/mmu_oea.c Mon Sep 16 15:03:12 2019 (r352406) @@ -1319,7 +1319,7 @@ moea_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can have PTE_CHG set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = moea_query_bit(m, PTE_CHG); @@ -1355,7 +1355,7 @@ moea_clear_modify(mmu_t mmu, vm_page_t m) * set. If the object containing the page is locked and the page is * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); moea_clear_bit(m, PTE_CHG); @@ -1382,7 +1382,7 @@ moea_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); lo = moea_attr_fetch(m); @@ -1915,7 +1915,8 @@ moea_remove_all(mmu_t mmu, vm_page_t m) moea_pvo_remove(pvo, -1); PMAP_UNLOCK(pmap); } - if ((m->aflags & PGA_WRITEABLE) && moea_query_bit(m, PTE_CHG)) { + if ((vm_page_aflags(m) & PGA_WRITEABLE) != 0 && + moea_query_bit(m, PTE_CHG)) { moea_attr_clear(m, PTE_CHG); vm_page_dirty(m); } Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Sep 16 15:03:12 2019 (r352406) @@ -1467,7 +1467,7 @@ out: * Flush the page from the instruction cache if this page is * mapped executable and cacheable. */ - if (pmap != kernel_pmap && !(m->aflags & PGA_EXECUTABLE) && + if (pmap != kernel_pmap && (vm_page_aflags(m) & PGA_EXECUTABLE) != 0 && (pte_lo & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { vm_page_aflag_set(m, PGA_EXECUTABLE); moea64_syncicache(mmu, pmap, va, VM_PAGE_TO_PHYS(m), PAGE_SIZE); @@ -1688,7 +1688,7 @@ moea64_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can have LPTE_CHG set. */ VM_OBJECT_ASSERT_LOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); return (moea64_query_bit(mmu, m, LPTE_CHG)); } @@ -1722,7 +1722,7 @@ moea64_clear_modify(mmu_t mmu, vm_page_t m) * set. If the object containing the page is locked and the page is * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; moea64_clear_bit(mmu, m, LPTE_CHG); } @@ -1746,7 +1746,7 @@ moea64_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; powerpc_sync(); PV_PAGE_LOCK(m); @@ -2240,7 +2240,8 @@ moea64_pvo_protect(mmu_t mmu, pmap_t pm, struct pvo_e if (refchg < 0) refchg = (oldprot & VM_PROT_WRITE) ? LPTE_CHG : 0; - if (pm != kernel_pmap && pg != NULL && !(pg->aflags & PGA_EXECUTABLE) && + if (pm != kernel_pmap && pg != NULL && + (vm_page_aflags(pg) & PGA_EXECUTABLE) == 0 && (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { if ((pg->oflags & VPO_UNMANAGED) == 0) vm_page_aflag_set(pg, PGA_EXECUTABLE); @@ -2454,7 +2455,8 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) } KASSERT(!pmap_page_is_mapped(m), ("Page still has mappings")); - KASSERT(!(m->aflags & PGA_WRITEABLE), ("Page still writable")); + KASSERT((vm_page_aflags(m) & PGA_WRITEABLE) == 0, + ("Page still writable")); PV_PAGE_UNLOCK(m); /* Clean up UMA allocations */ Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/powerpc/booke/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -2694,7 +2694,7 @@ mmu_booke_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { @@ -3040,7 +3040,7 @@ mmu_booke_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can be modified. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (rv); rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { @@ -3119,7 +3119,7 @@ mmu_booke_clear_modify(mmu_t mmu, vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PG_AWRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/riscv/riscv/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -2825,7 +2825,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v ("pmap_enter: no PV entry for %#lx", va)); if ((new_l3 & PTE_SW_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((om->aflags & PGA_WRITEABLE) != 0 && + if ((vm_page_aflags(om) & PGA_WRITEABLE) == 0 && TAILQ_EMPTY(&om->md.pv_list)) vm_page_aflag_clear(om, PGA_WRITEABLE); } @@ -3556,7 +3556,7 @@ pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entr if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[Ln_ENTRIES]; mt++) if (TAILQ_EMPTY(&mt->md.pv_list) && - (mt->aflags & PGA_WRITEABLE) != 0) + (vm_page_aflags(mt) & PGA_WRITEABLE) != 0) vm_page_aflag_clear(mt, PGA_WRITEABLE); } mpte = pmap_remove_pt_page(pmap, pv->pv_va); @@ -3574,7 +3574,7 @@ pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entr TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; if (TAILQ_EMPTY(&m->md.pv_list) && - (m->aflags & PGA_WRITEABLE) != 0) { + (vm_page_aflags(m) & PGA_WRITEABLE) != 0) { pvh = pa_to_pvh(m->phys_addr); if (TAILQ_EMPTY(&pvh->pv_list)) vm_page_aflag_clear(m, PGA_WRITEABLE); @@ -3789,7 +3789,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -3855,7 +3855,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4115,7 +4115,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/sparc64/sparc64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -2121,7 +2121,7 @@ pmap_is_modified(vm_page_t m) * is clear, no TTEs can have TD_W set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return (rv); rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { @@ -2204,7 +2204,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->aflags & PGA_WRITEABLE) == 0) + if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { @@ -2232,7 +2232,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) return; rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/vm/swap_pager.c Mon Sep 16 15:03:12 2019 (r352406) @@ -1648,12 +1648,6 @@ swp_pager_force_dirty(vm_page_t m) { vm_page_dirty(m); -#ifdef INVARIANTS - vm_page_lock(m); - if (!vm_page_wired(m) && m->queue == PQ_NONE) - panic("page %p is neither wired nor queued", m); - vm_page_unlock(m); -#endif vm_page_xunbusy(m); swap_pager_unswapped(m); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/vm/vm_fault.c Mon Sep 16 15:03:12 2019 (r352406) @@ -153,9 +153,7 @@ release_page(struct faultstate *fs) { vm_page_xunbusy(fs->m); - vm_page_lock(fs->m); vm_page_deactivate(fs->m); - vm_page_unlock(fs->m); fs->m = NULL; } @@ -376,9 +374,7 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pinde for (pidx = first, m = vm_page_lookup(object, pidx); pidx <= last; pidx++, m = vm_page_next(m)) { vm_fault_populate_check_page(m); - vm_page_lock(m); vm_page_deactivate(m); - vm_page_unlock(m); vm_page_xunbusy(m); } } @@ -1325,9 +1321,7 @@ readrest: if ((fault_flags & VM_FAULT_WIRE) != 0) { vm_page_wire(fs.m); } else { - vm_page_lock(fs.m); vm_page_activate(fs.m); - vm_page_unlock(fs.m); } if (m_hold != NULL) { *m_hold = fs.m; Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/vm/vm_mmap.c Mon Sep 16 15:03:12 2019 (r352406) @@ -935,9 +935,9 @@ RestartScan: * and set PGA_REFERENCED before the call to * pmap_is_referenced(). */ - if ((m->aflags & PGA_REFERENCED) != 0 || + if ((vm_page_aflags(m) & PGA_REFERENCED) != 0 || pmap_is_referenced(m) || - (m->aflags & PGA_REFERENCED) != 0) + (vm_page_aflags(m) & PGA_REFERENCED) != 0) mincoreinfo |= MINCORE_REFERENCED_OTHER; } if (object != NULL) Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/vm/vm_object.c Mon Sep 16 15:03:12 2019 (r352406) @@ -2312,9 +2312,9 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) * sysctl is only meant to give an * approximation of the system anyway. */ - if (m->queue == PQ_ACTIVE) + if (m->astate.queue == PQ_ACTIVE) kvo->kvo_active++; - else if (m->queue == PQ_INACTIVE) + else if (m->astate.queue == PQ_INACTIVE) kvo->kvo_inactive++; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Sep 16 15:00:11 2019 (r352405) +++ head/sys/vm/vm_page.c Mon Sep 16 15:03:12 2019 (r352406) @@ -73,11 +73,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include #include +#include #include #include #include @@ -130,6 +131,34 @@ static int vm_min_waiters; static int vm_severe_waiters; static int vm_pageproc_waiters; +static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0, + "VM page stats"); + +static counter_u64_t pqstate_commit_aborts = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, commit_aborts, CTLFLAG_RD, + &pqstate_commit_aborts, + "Failed page queue state updates"); + +static counter_u64_t queue_ops = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops, CTLFLAG_RD, + &queue_ops, + "Batched queue operations"); + +static counter_u64_t null_queue_ops = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, null_queue_ops, CTLFLAG_RD, + &null_queue_ops, + "Batched queue operations with no effect"); + +static void +counter_startup(void) +{ + + pqstate_commit_aborts = counter_u64_alloc(M_WAITOK); + queue_ops = counter_u64_alloc(M_WAITOK); + null_queue_ops = counter_u64_alloc(M_WAITOK); +} +SYSINIT(page_counters, SI_SUB_CPU, SI_ORDER_ANY, counter_startup, NULL); + /* * bogus page -- for I/O to/from partially complete buffers, * or for paging into sparsely invalid regions. @@ -158,16 +187,17 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); -static void vm_page_dequeue_complete(vm_page_t m); static void vm_page_enqueue(vm_page_t m, uint8_t queue); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); static void vm_page_insert_radixdone(vm_page_t m, vm_object_t object, vm_page_t mpred); -static void vm_page_mvqueue(vm_page_t m, uint8_t queue); +static void vm_page_mvqueue(vm_page_t m, const uint8_t queue, + const uint16_t nflag); static int vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, vm_paddr_t high); +static bool vm_page_release_toq(vm_page_t m, uint8_t queue, bool noreuse); static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object, int req); static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, @@ -440,10 +470,10 @@ vm_page_init_marker(vm_page_t marker, int queue, uint8 { bzero(marker, sizeof(*marker)); - marker->flags = PG_MARKER; - marker->aflags = aflags; marker->busy_lock = VPB_SINGLE_EXCLUSIVER; - marker->queue = queue; + marker->astate.flags = aflags; + marker->astate.queue = queue; + marker->flags = PG_MARKER; } static void @@ -513,9 +543,10 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segi m->object = NULL; m->ref_count = 0; m->busy_lock = VPB_UNBUSIED; - m->flags = m->aflags = 0; + m->flags = 0; m->phys_addr = pa; - m->queue = PQ_NONE; + m->astate.flags = 0; + m->astate.queue = PQ_NONE; m->psind = 0; m->segind = segind; m->order = VM_NFREEORDER; @@ -1152,7 +1183,7 @@ vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_mem goto memattr; } m->phys_addr = paddr; - m->queue = PQ_NONE; + m->astate.queue = PQ_NONE; /* Fictitious pages don't use "segind". */ m->flags = PG_FICTITIOUS; /* Fictitious pages don't use "order" or "pool". */ @@ -1239,12 +1270,10 @@ vm_page_readahead_finish(vm_page_t m) * have shown that deactivating the page is usually the best choice, * unless the page is wanted by another thread. */ - vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); - vm_page_unlock(m); vm_page_xunbusy(m); } @@ -1607,7 +1636,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm mnew->pindex = pindex; atomic_set_int(&mnew->ref_count, VPRC_OBJREF); mold = vm_radix_replace(&object->rtree, mnew); - KASSERT(mold->queue == PQ_NONE, + KASSERT(mold->astate.queue == PQ_NONE, ("vm_page_replace: old page %p is on a paging queue", mold)); /* Keep the resident page list in sorted order. */ @@ -1883,7 +1912,7 @@ found: if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; - m->aflags = 0; + m->astate.flags = 0; m->oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; m->busy_lock = VPB_UNBUSIED; @@ -1899,7 +1928,7 @@ found: vm_wire_add(1); m->ref_count = 1; } - m->act_count = 0; + m->astate.act_count = 0; if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { @@ -2093,12 +2122,12 @@ found: memattr = object->memattr; } for (m = m_ret; m < &m_ret[npages]; m++) { - m->aflags = 0; + m->astate.flags = 0; m->flags = (m->flags | PG_NODUMP) & flags; m->busy_lock = busy_lock; if ((req & VM_ALLOC_WIRED) != 0) m->ref_count = 1; - m->act_count = 0; + m->astate.act_count = 0; m->oflags = oflags; if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { @@ -2141,9 +2170,10 @@ vm_page_alloc_check(vm_page_t m) { KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->queue == PQ_NONE && (m->aflags & PGA_QUEUE_STATE_MASK) == 0, + KASSERT(m->astate.queue == PQ_NONE && + (m->astate.flags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", - m, m->queue, (m->aflags & PGA_QUEUE_STATE_MASK))); + m, m->astate.queue, (m->astate.flags & PGA_QUEUE_STATE_MASK))); KASSERT(m->ref_count == 0, ("page %p has references", m)); KASSERT(!vm_page_busied(m), ("page %p is busy", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); @@ -2217,7 +2247,7 @@ again: /* * Initialize the page. Only the PG_ZERO flag is inherited. */ - m->aflags = 0; + m->astate.flags = 0; flags = 0; if ((req & VM_ALLOC_ZERO) != 0) flags = PG_ZERO; @@ -2396,8 +2426,7 @@ retry: vm_reserv_size(level)) - pa); #endif } else if (object->memattr == VM_MEMATTR_DEFAULT && - vm_page_queue(m) != PQ_NONE && !vm_page_busied(m) && - !vm_page_wired(m)) { + !vm_page_busied(m) && !vm_page_wired(m)) { /* * The page is allocated but eligible for * relocation. Extend the current run by one @@ -2545,8 +2574,7 @@ retry: error = EINVAL; else if (object->memattr != VM_MEMATTR_DEFAULT) error = EINVAL; - else if (vm_page_queue(m) != PQ_NONE && - !vm_page_busied(m) && !vm_page_wired(m)) { + else if (!vm_page_busied(m) && !vm_page_wired(m)) { KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("page %p has an unexpected memattr", m)); @@ -2607,7 +2635,7 @@ retry: error = EBUSY; goto unlock; } - m_new->aflags = m->aflags & + m_new->astate.flags = m->astate.flags & ~PGA_QUEUE_STATE_MASK; KASSERT(m_new->oflags == VPO_UNMANAGED, ("page %p is managed", m_new)); @@ -3075,65 +3103,141 @@ vm_waitpfault(struct domainset *dset, int timo) mtx_unlock(&vm_domainset_lock); } -static struct vm_pagequeue * -vm_page_pagequeue(vm_page_t m) +bool +vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new) { + vm_page_t next; + struct vm_pagequeue *pq; + int mask; - uint8_t queue; + if (old->queue != PQ_NONE && old->queue != new.queue) { + new.flags &= ~PGA_ENQUEUED; - if ((queue = atomic_load_8(&m->queue)) == PQ_NONE) - return (NULL); - return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); + pq = _vm_page_pagequeue(m, old->queue); + + /* + * The physical queue state might change at any point before the + * page queue lock is acquired, so we must verify that the lock + * is correct before proceeding. Once the page's queue index is + * changed, the page queue lock we hold will no longer + * synchronize the physical queue state of the page, so we must + * awkwardly remove the page from the queue and put it back if + * the commit fails. + */ + vm_pagequeue_lock(pq); + if (__predict_false(m->astate.queue != old->queue)) { + vm_pagequeue_unlock(pq); + *old = vm_page_astate_load(m); + return (false); + } + if (__predict_true((m->astate.flags & PGA_ENQUEUED) != 0)) { + next = TAILQ_NEXT(m, plinks.q); + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + } + if (__predict_false(!vm_page_astate_fcmpset(m, old, new))) { + if ((old->flags & PGA_ENQUEUED) != 0) { + if (next == NULL) + TAILQ_INSERT_TAIL(&pq->pq_pl, m, + plinks.q); + else + TAILQ_INSERT_BEFORE(next, m, plinks.q); + } + vm_pagequeue_unlock(pq); + counter_u64_add(pqstate_commit_aborts, 1); + return (false); + } + if ((old->flags & PGA_ENQUEUED) != 0) + vm_pagequeue_cnt_dec(pq); + vm_pagequeue_unlock(pq); + } else if (__predict_false(!vm_page_astate_fcmpset(m, old, new))) { + counter_u64_add(pqstate_commit_aborts, 1); + return (false); + } + + if (new.queue != PQ_NONE) { + mask = new.flags & PGA_QUEUE_OP_MASK; + if (mask != 0 && (old->flags & mask) != mask) + vm_page_pqbatch_submit(m, new.queue); + } + + return (true); } static inline void -vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m) +vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m, uint8_t queue) { + vm_page_t next; struct vm_domain *vmd; - uint8_t qflags; + vm_page_astate_t old, new; CRITICAL_ASSERT(curthread); vm_pagequeue_assert_locked(pq); + old = vm_page_astate_load(m); +retry: + if (__predict_false(old.queue != queue)) + return; + KASSERT(pq == _vm_page_pagequeue(m, queue), + ("page %p does not belong to queue %p", m, pq)); + KASSERT(old.queue != PQ_NONE || (old.flags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p has unexpected queue state", m)); + /* - * The page daemon is allowed to set m->queue = PQ_NONE without - * the page queue lock held. In this case it is about to free the page, - * which must not have any queue state. + * Update the page's queue state before modifying the page queues + * themselves, to avoid having to roll back updates when a queue state + * update fails and requires a retry. */ - 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)); + new = old; + if ((old.flags & PGA_DEQUEUE) != 0) { + new.queue = PQ_NONE; + new.flags &= ~PGA_QUEUE_STATE_MASK; + if (__predict_true((old.flags & PGA_ENQUEUED) != 0)) { + next = TAILQ_NEXT(m, plinks.q); + TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); + } + if (__predict_false(!vm_page_astate_fcmpset(m, &old, new))) { + if ((old.flags & PGA_ENQUEUED) != 0) { + if (next == NULL) + TAILQ_INSERT_TAIL(&pq->pq_pl, m, + plinks.q); + else + TAILQ_INSERT_BEFORE(next, m, plinks.q); + } + counter_u64_add(pqstate_commit_aborts, 1); + goto retry; + } + if ((old.flags & PGA_ENQUEUED) != 0) + vm_pagequeue_cnt_dec(pq); + counter_u64_add(queue_ops, 1); + } else if ((old.flags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { + new.flags |= PGA_ENQUEUED; + new.flags &= ~(PGA_REQUEUE | PGA_REQUEUE_HEAD); + if (__predict_false(!vm_page_astate_fcmpset(m, &old, new))) { + counter_u64_add(pqstate_commit_aborts, 1); + goto retry; + } - if ((qflags & PGA_DEQUEUE) != 0) { - 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) + if ((old.flags & PGA_ENQUEUED) != 0) TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - else { + else 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. + * 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, + if ((old.flags & PGA_REQUEUE_HEAD) != 0) { + KASSERT(old.queue == PQ_INACTIVE, ("head enqueue not supported for page %p", m)); vmd = vm_pagequeue_domain(m); TAILQ_INSERT_BEFORE(&vmd->vmd_inacthead, m, plinks.q); - } else + } else { TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); - - vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | - PGA_REQUEUE_HEAD)); + } + counter_u64_add(queue_ops, 1); + } else { + counter_u64_add(null_queue_ops, 1); } } @@ -3141,15 +3245,10 @@ static void vm_pqbatch_process(struct vm_pagequeue *pq, struct vm_batchqueue *bq, uint8_t queue) { - vm_page_t m; int i; - for (i = 0; i < bq->bq_cnt; i++) { - m = bq->bq_pa[i]; - if (__predict_false(m->queue != queue)) - continue; - vm_pqbatch_process_page(pq, m); - } + for (i = 0; i < bq->bq_cnt; i++) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Sep 16 15:04: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 B003A124F32; Mon, 16 Sep 2019 15:04:50 +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 46X8fp4w6Fz3Jhl; Mon, 16 Sep 2019 15:04:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C07422027; Mon, 16 Sep 2019 15:04:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GF4o12052353; Mon, 16 Sep 2019 15:04:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GF4kZk052320; Mon, 16 Sep 2019 15:04:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161504.x8GF4kZk052320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352407 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/m... X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/virtio/balloon sys/i386/i386 sys/mips/mips sys/powerpc/aim ... X-SVN-Commit-Revision: 352407 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:04:50 -0000 Author: markj Date: Mon Sep 16 15:04:45 2019 New Revision: 352407 URL: https://svnweb.freebsd.org/changeset/base/352407 Log: Revert r352406, which contained changes I didn't intend to commit. Modified: head/share/man/man9/vm_page_wire.9 head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/dev/virtio/balloon/virtio_balloon.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h head/sys/vm/vm_swapout.c Modified: head/share/man/man9/vm_page_wire.9 ============================================================================== --- head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:03:12 2019 (r352406) +++ head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:04:45 2019 (r352407) @@ -51,7 +51,7 @@ The .Fn vm_page_wire and .Fn vm_page_wire_mapped -functions wire the page, which prevents it from being reclaimed by the page +function wire the page, prevent it from being reclaimed by the page daemon or when its containing object is destroyed. Both functions require that the page belong to an object. The Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -3064,8 +3064,10 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_ { pd_entry_t pde, *pdep; pt_entry_t pte, PG_RW, PG_V; + vm_paddr_t pa; vm_page_t m; + pa = 0; m = NULL; PG_RW = pmap_rw_bit(pmap); PG_V = pmap_valid_bit(pmap); @@ -5804,7 +5806,7 @@ retry: ("pmap_enter: no PV entry for %#lx", va)); if ((newpte & PG_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && + if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -6987,7 +6989,7 @@ pmap_remove_pages(pmap_t pmap) pvh->pv_gen++; if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) - if ((vm_page_aflags(mt) & PGA_WRITEABLE) != 0 && + if ((mt->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&mt->md.pv_list)) vm_page_aflag_clear(mt, PGA_WRITEABLE); } @@ -7005,7 +7007,7 @@ pmap_remove_pages(pmap_t pmap) pmap_resident_count_dec(pmap, 1); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; - if ((vm_page_aflags(m) & PGA_WRITEABLE) != 0 && + if ((m->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); @@ -7136,7 +7138,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -7205,7 +7207,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -7688,7 +7690,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/amd64/include/pmap.h Mon Sep 16 15:04:45 2019 (r352407) @@ -423,8 +423,7 @@ extern int pmap_pcid_enabled; extern int invpcid_works; #define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) -#define pmap_page_is_write_mapped(m) \ - (((m)->astate.flags & PGA_WRITEABLE) != 0) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) struct thread; Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/arm/arm/pmap-v4.c Mon Sep 16 15:04:45 2019 (r352407) @@ -4104,7 +4104,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; if (m->md.pvh_attrs & PVF_MOD) pmap_clearbit(m, PVF_MOD); @@ -4143,7 +4143,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (vm_page_xbusied(m) || (vm_page_aflags(m) & PGA_WRITEABLE) != 0) + if (vm_page_xbusied(m) || (m->aflags & PGA_WRITEABLE) != 0) pmap_clearbit(m, PVF_WRITE); } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/arm/arm/pmap-v6.c Mon Sep 16 15:04:45 2019 (r352407) @@ -5197,7 +5197,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTE2s can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -5540,7 +5540,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && !pmap_page_is_write_mapped(m)) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/arm64/arm64/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -3333,7 +3333,7 @@ havel3: pv = pmap_pvh_remove(&om->md, pmap, va); if ((m->oflags & VPO_UNMANAGED) != 0) free_pv_entry(pmap, pv); - if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && + if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -4372,7 +4372,7 @@ pmap_remove_pages(pmap_t pmap) pvh->pv_gen++; if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) - if (vm_page_aflags(mt) & PGA_WRITEABLE) != 0 && + if ((mt->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&mt->md.pv_list)) vm_page_aflag_clear(mt, PGA_WRITEABLE); } @@ -4394,7 +4394,7 @@ pmap_remove_pages(pmap_t pmap) TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; - if (vm_page_aflags(m) & PGA_WRITEABLE) != 0 && + if ((m->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { pvh = pa_to_pvh( @@ -4534,7 +4534,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -4600,7 +4600,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4977,7 +4977,7 @@ pmap_clear_modify(vm_page_t m) * set. If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Sep 16 15:04:45 2019 (r352407) @@ -1718,10 +1718,12 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ bcopy((char *)db->db_data + bufoff, va, PAGESIZE); zfs_unmap_page(sf); m->valid = VM_PAGE_BITS_ALL; + vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); + vm_page_unlock(m); } *rbehind = i; @@ -1836,10 +1838,12 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ } zfs_unmap_page(sf); m->valid = VM_PAGE_BITS_ALL; + vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); + vm_page_unlock(m); } *rahead = i; zfs_vmobject_wunlock(vmobj); Modified: head/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/dev/virtio/balloon/virtio_balloon.c Mon Sep 16 15:04:45 2019 (r352407) @@ -332,6 +332,8 @@ vtballoon_inflate(struct vtballoon_softc *sc, int npag sc->vtballoon_page_frames[i] = VM_PAGE_TO_PHYS(m) >> VIRTIO_BALLOON_PFN_SHIFT; + KASSERT(m->queue == PQ_NONE, + ("%s: allocated page %p on queue", __func__, m)); TAILQ_INSERT_TAIL(&sc->vtballoon_pages, m, plinks.q); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/i386/i386/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -3752,7 +3752,7 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, v ("pmap_enter: no PV entry for %#x", va)); if ((newpte & PG_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((vm_page_aflags(om) & PGA_WRITEABLE) != 0 && + if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) @@ -4848,7 +4848,7 @@ __CONCAT(PMTYPE, is_modified)(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_is_modified_pvh(&m->md) || @@ -4979,7 +4979,7 @@ __CONCAT(PMTYPE, remove_write)(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); sched_pin(); @@ -5291,7 +5291,7 @@ __CONCAT(PMTYPE, clear_modify)(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); sched_pin(); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/mips/mips/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -2164,7 +2164,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pv = pmap_pvh_remove(&om->md, pmap, va); if (!pte_test(&newpte, PTE_MANAGED)) free_pv_entry(pmap, pv); - if (vm_page_aflags(m) & PGA_WRITEABLE) != 0 && + if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list)) vm_page_aflag_clear(om, PGA_WRITEABLE); } @@ -2934,7 +2934,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2999,7 +2999,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PTE_D set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = pmap_testbit(m, PTE_D); @@ -3143,7 +3143,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * write busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -3270,7 +3270,7 @@ retry: * determine if the address is MINCORE_REFERENCED. */ m = PHYS_TO_VM_PAGE(pa); - if ((vm_page_aflags(m) & PGA_REFERENCED) != 0) + if ((m->aflags & PGA_REFERENCED) != 0) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/powerpc/aim/mmu_oea.c Mon Sep 16 15:04:45 2019 (r352407) @@ -1319,7 +1319,7 @@ moea_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can have PTE_CHG set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); rw_wlock(&pvh_global_lock); rv = moea_query_bit(m, PTE_CHG); @@ -1355,7 +1355,7 @@ moea_clear_modify(mmu_t mmu, vm_page_t m) * set. If the object containing the page is locked and the page is * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); moea_clear_bit(m, PTE_CHG); @@ -1382,7 +1382,7 @@ moea_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); lo = moea_attr_fetch(m); @@ -1915,8 +1915,7 @@ moea_remove_all(mmu_t mmu, vm_page_t m) moea_pvo_remove(pvo, -1); PMAP_UNLOCK(pmap); } - if ((vm_page_aflags(m) & PGA_WRITEABLE) != 0 && - moea_query_bit(m, PTE_CHG)) { + if ((m->aflags & PGA_WRITEABLE) && moea_query_bit(m, PTE_CHG)) { moea_attr_clear(m, PTE_CHG); vm_page_dirty(m); } Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Sep 16 15:04:45 2019 (r352407) @@ -1467,7 +1467,7 @@ out: * Flush the page from the instruction cache if this page is * mapped executable and cacheable. */ - if (pmap != kernel_pmap && (vm_page_aflags(m) & PGA_EXECUTABLE) != 0 && + if (pmap != kernel_pmap && !(m->aflags & PGA_EXECUTABLE) && (pte_lo & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { vm_page_aflag_set(m, PGA_EXECUTABLE); moea64_syncicache(mmu, pmap, va, VM_PAGE_TO_PHYS(m), PAGE_SIZE); @@ -1688,7 +1688,7 @@ moea64_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can have LPTE_CHG set. */ VM_OBJECT_ASSERT_LOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); return (moea64_query_bit(mmu, m, LPTE_CHG)); } @@ -1722,7 +1722,7 @@ moea64_clear_modify(mmu_t mmu, vm_page_t m) * set. If the object containing the page is locked and the page is * not exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; moea64_clear_bit(mmu, m, LPTE_CHG); } @@ -1746,7 +1746,7 @@ moea64_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; powerpc_sync(); PV_PAGE_LOCK(m); @@ -2240,8 +2240,7 @@ moea64_pvo_protect(mmu_t mmu, pmap_t pm, struct pvo_e if (refchg < 0) refchg = (oldprot & VM_PROT_WRITE) ? LPTE_CHG : 0; - if (pm != kernel_pmap && pg != NULL && - (vm_page_aflags(pg) & PGA_EXECUTABLE) == 0 && + if (pm != kernel_pmap && pg != NULL && !(pg->aflags & PGA_EXECUTABLE) && (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { if ((pg->oflags & VPO_UNMANAGED) == 0) vm_page_aflag_set(pg, PGA_EXECUTABLE); @@ -2455,8 +2454,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) } KASSERT(!pmap_page_is_mapped(m), ("Page still has mappings")); - KASSERT((vm_page_aflags(m) & PGA_WRITEABLE) == 0, - ("Page still writable")); + KASSERT(!(m->aflags & PGA_WRITEABLE), ("Page still writable")); PV_PAGE_UNLOCK(m); /* Clean up UMA allocations */ Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/powerpc/booke/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -2694,7 +2694,7 @@ mmu_booke_remove_write(mmu_t mmu, vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { @@ -3040,7 +3040,7 @@ mmu_booke_is_modified(mmu_t mmu, vm_page_t m) * is clear, no PTEs can be modified. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (rv); rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { @@ -3119,7 +3119,7 @@ mmu_booke_clear_modify(mmu_t mmu, vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PG_AWRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&pvh_global_lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) { Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/riscv/riscv/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -2825,7 +2825,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v ("pmap_enter: no PV entry for %#lx", va)); if ((new_l3 & PTE_SW_MANAGED) == 0) free_pv_entry(pmap, pv); - if ((vm_page_aflags(om) & PGA_WRITEABLE) == 0 && + if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list)) vm_page_aflag_clear(om, PGA_WRITEABLE); } @@ -3556,7 +3556,7 @@ pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entr if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[Ln_ENTRIES]; mt++) if (TAILQ_EMPTY(&mt->md.pv_list) && - (vm_page_aflags(mt) & PGA_WRITEABLE) != 0) + (mt->aflags & PGA_WRITEABLE) != 0) vm_page_aflag_clear(mt, PGA_WRITEABLE); } mpte = pmap_remove_pt_page(pmap, pv->pv_va); @@ -3574,7 +3574,7 @@ pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entr TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; if (TAILQ_EMPTY(&m->md.pv_list) && - (vm_page_aflags(m) & PGA_WRITEABLE) != 0) { + (m->aflags & PGA_WRITEABLE) != 0) { pvh = pa_to_pvh(m->phys_addr); if (TAILQ_EMPTY(&pvh->pv_list)) vm_page_aflag_clear(m, PGA_WRITEABLE); @@ -3789,7 +3789,7 @@ pmap_is_modified(vm_page_t m) * is clear, no PTEs can have PG_M set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); return (pmap_page_test_mappings(m, FALSE, TRUE)); } @@ -3855,7 +3855,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : @@ -4115,7 +4115,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/sparc64/sparc64/pmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -2121,7 +2121,7 @@ pmap_is_modified(vm_page_t m) * is clear, no TTEs can have TD_W set. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return (rv); rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { @@ -2204,7 +2204,7 @@ pmap_clear_modify(vm_page_t m) * If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ - if ((vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { @@ -2232,7 +2232,7 @@ pmap_remove_write(vm_page_t m) * if PGA_WRITEABLE is clear, no page table entries need updating. */ VM_OBJECT_ASSERT_WLOCKED(m->object); - if (!vm_page_xbusied(m) && (vm_page_aflags(m) & PGA_WRITEABLE) == 0) + if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; rw_wlock(&tte_list_global_lock); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/vm/swap_pager.c Mon Sep 16 15:04:45 2019 (r352407) @@ -1648,6 +1648,12 @@ swp_pager_force_dirty(vm_page_t m) { vm_page_dirty(m); +#ifdef INVARIANTS + vm_page_lock(m); + if (!vm_page_wired(m) && m->queue == PQ_NONE) + panic("page %p is neither wired nor queued", m); + vm_page_unlock(m); +#endif vm_page_xunbusy(m); swap_pager_unswapped(m); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/vm/vm_fault.c Mon Sep 16 15:04:45 2019 (r352407) @@ -153,7 +153,9 @@ release_page(struct faultstate *fs) { vm_page_xunbusy(fs->m); + vm_page_lock(fs->m); vm_page_deactivate(fs->m); + vm_page_unlock(fs->m); fs->m = NULL; } @@ -374,7 +376,9 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pinde for (pidx = first, m = vm_page_lookup(object, pidx); pidx <= last; pidx++, m = vm_page_next(m)) { vm_fault_populate_check_page(m); + vm_page_lock(m); vm_page_deactivate(m); + vm_page_unlock(m); vm_page_xunbusy(m); } } @@ -1321,7 +1325,9 @@ readrest: if ((fault_flags & VM_FAULT_WIRE) != 0) { vm_page_wire(fs.m); } else { + vm_page_lock(fs.m); vm_page_activate(fs.m); + vm_page_unlock(fs.m); } if (m_hold != NULL) { *m_hold = fs.m; Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/vm/vm_mmap.c Mon Sep 16 15:04:45 2019 (r352407) @@ -935,9 +935,9 @@ RestartScan: * and set PGA_REFERENCED before the call to * pmap_is_referenced(). */ - if ((vm_page_aflags(m) & PGA_REFERENCED) != 0 || + if ((m->aflags & PGA_REFERENCED) != 0 || pmap_is_referenced(m) || - (vm_page_aflags(m) & PGA_REFERENCED) != 0) + (m->aflags & PGA_REFERENCED) != 0) mincoreinfo |= MINCORE_REFERENCED_OTHER; } if (object != NULL) Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/vm/vm_object.c Mon Sep 16 15:04:45 2019 (r352407) @@ -2312,9 +2312,9 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) * sysctl is only meant to give an * approximation of the system anyway. */ - if (m->astate.queue == PQ_ACTIVE) + if (m->queue == PQ_ACTIVE) kvo->kvo_active++; - else if (m->astate.queue == PQ_INACTIVE) + else if (m->queue == PQ_INACTIVE) kvo->kvo_inactive++; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Sep 16 15:03:12 2019 (r352406) +++ head/sys/vm/vm_page.c Mon Sep 16 15:04:45 2019 (r352407) @@ -73,12 +73,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include #include -#include #include #include #include @@ -131,34 +130,6 @@ static int vm_min_waiters; static int vm_severe_waiters; static int vm_pageproc_waiters; -static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0, - "VM page stats"); - -static counter_u64_t pqstate_commit_aborts = EARLY_COUNTER; -SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, commit_aborts, CTLFLAG_RD, - &pqstate_commit_aborts, - "Failed page queue state updates"); - -static counter_u64_t queue_ops = EARLY_COUNTER; -SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops, CTLFLAG_RD, - &queue_ops, - "Batched queue operations"); - -static counter_u64_t null_queue_ops = EARLY_COUNTER; -SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, null_queue_ops, CTLFLAG_RD, - &null_queue_ops, - "Batched queue operations with no effect"); - -static void -counter_startup(void) -{ - - pqstate_commit_aborts = counter_u64_alloc(M_WAITOK); - queue_ops = counter_u64_alloc(M_WAITOK); - null_queue_ops = counter_u64_alloc(M_WAITOK); -} -SYSINIT(page_counters, SI_SUB_CPU, SI_ORDER_ANY, counter_startup, NULL); - /* * bogus page -- for I/O to/from partially complete buffers, * or for paging into sparsely invalid regions. @@ -187,17 +158,16 @@ static uma_zone_t fakepg_zone; static void vm_page_alloc_check(vm_page_t m); static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); +static void vm_page_dequeue_complete(vm_page_t m); static void vm_page_enqueue(vm_page_t m, uint8_t queue); static void vm_page_init(void *dummy); static int vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex, vm_page_t mpred); static void vm_page_insert_radixdone(vm_page_t m, vm_object_t object, vm_page_t mpred); -static void vm_page_mvqueue(vm_page_t m, const uint8_t queue, - const uint16_t nflag); +static void vm_page_mvqueue(vm_page_t m, uint8_t queue); static int vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, vm_paddr_t high); -static bool vm_page_release_toq(vm_page_t m, uint8_t queue, bool noreuse); static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object, int req); static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, @@ -470,10 +440,10 @@ vm_page_init_marker(vm_page_t marker, int queue, uint8 { bzero(marker, sizeof(*marker)); - marker->busy_lock = VPB_SINGLE_EXCLUSIVER; - marker->astate.flags = aflags; - marker->astate.queue = queue; marker->flags = PG_MARKER; + marker->aflags = aflags; + marker->busy_lock = VPB_SINGLE_EXCLUSIVER; + marker->queue = queue; } static void @@ -543,10 +513,9 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segi m->object = NULL; m->ref_count = 0; m->busy_lock = VPB_UNBUSIED; - m->flags = 0; + m->flags = m->aflags = 0; m->phys_addr = pa; - m->astate.flags = 0; - m->astate.queue = PQ_NONE; + m->queue = PQ_NONE; m->psind = 0; m->segind = segind; m->order = VM_NFREEORDER; @@ -1183,7 +1152,7 @@ vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_mem goto memattr; } m->phys_addr = paddr; - m->astate.queue = PQ_NONE; + m->queue = PQ_NONE; /* Fictitious pages don't use "segind". */ m->flags = PG_FICTITIOUS; /* Fictitious pages don't use "order" or "pool". */ @@ -1270,10 +1239,12 @@ vm_page_readahead_finish(vm_page_t m) * have shown that deactivating the page is usually the best choice, * unless the page is wanted by another thread. */ + vm_page_lock(m); if ((m->busy_lock & VPB_BIT_WAITERS) != 0) vm_page_activate(m); else vm_page_deactivate(m); + vm_page_unlock(m); vm_page_xunbusy(m); } @@ -1636,7 +1607,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm mnew->pindex = pindex; atomic_set_int(&mnew->ref_count, VPRC_OBJREF); mold = vm_radix_replace(&object->rtree, mnew); - KASSERT(mold->astate.queue == PQ_NONE, + KASSERT(mold->queue == PQ_NONE, ("vm_page_replace: old page %p is on a paging queue", mold)); /* Keep the resident page list in sorted order. */ @@ -1912,7 +1883,7 @@ found: if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; - m->astate.flags = 0; + m->aflags = 0; m->oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; m->busy_lock = VPB_UNBUSIED; @@ -1928,7 +1899,7 @@ found: vm_wire_add(1); m->ref_count = 1; } - m->astate.act_count = 0; + m->act_count = 0; if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { @@ -2122,12 +2093,12 @@ found: memattr = object->memattr; } for (m = m_ret; m < &m_ret[npages]; m++) { - m->astate.flags = 0; + m->aflags = 0; m->flags = (m->flags | PG_NODUMP) & flags; m->busy_lock = busy_lock; if ((req & VM_ALLOC_WIRED) != 0) m->ref_count = 1; - m->astate.act_count = 0; + m->act_count = 0; m->oflags = oflags; if (object != NULL) { if (vm_page_insert_after(m, object, pindex, mpred)) { @@ -2170,10 +2141,9 @@ vm_page_alloc_check(vm_page_t m) { KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->astate.queue == PQ_NONE && - (m->astate.flags & PGA_QUEUE_STATE_MASK) == 0, + KASSERT(m->queue == PQ_NONE && (m->aflags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", - m, m->astate.queue, (m->astate.flags & PGA_QUEUE_STATE_MASK))); + m, m->queue, (m->aflags & PGA_QUEUE_STATE_MASK))); KASSERT(m->ref_count == 0, ("page %p has references", m)); KASSERT(!vm_page_busied(m), ("page %p is busy", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); @@ -2247,7 +2217,7 @@ again: /* * Initialize the page. Only the PG_ZERO flag is inherited. */ - m->astate.flags = 0; + m->aflags = 0; flags = 0; if ((req & VM_ALLOC_ZERO) != 0) flags = PG_ZERO; @@ -2426,7 +2396,8 @@ retry: vm_reserv_size(level)) - pa); #endif } else if (object->memattr == VM_MEMATTR_DEFAULT && - !vm_page_busied(m) && !vm_page_wired(m)) { + vm_page_queue(m) != PQ_NONE && !vm_page_busied(m) && + !vm_page_wired(m)) { /* * The page is allocated but eligible for * relocation. Extend the current run by one @@ -2574,7 +2545,8 @@ retry: error = EINVAL; else if (object->memattr != VM_MEMATTR_DEFAULT) error = EINVAL; - else if (!vm_page_busied(m) && !vm_page_wired(m)) { + else if (vm_page_queue(m) != PQ_NONE && + !vm_page_busied(m) && !vm_page_wired(m)) { KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("page %p has an unexpected memattr", m)); @@ -2635,7 +2607,7 @@ retry: error = EBUSY; goto unlock; } - m_new->astate.flags = m->astate.flags & + m_new->aflags = m->aflags & ~PGA_QUEUE_STATE_MASK; KASSERT(m_new->oflags == VPO_UNMANAGED, ("page %p is managed", m_new)); @@ -3103,141 +3075,65 @@ vm_waitpfault(struct domainset *dset, int timo) mtx_unlock(&vm_domainset_lock); } -bool -vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new) +static struct vm_pagequeue * +vm_page_pagequeue(vm_page_t m) { - vm_page_t next; - struct vm_pagequeue *pq; - int mask; - if (old->queue != PQ_NONE && old->queue != new.queue) { - new.flags &= ~PGA_ENQUEUED; + uint8_t queue; - pq = _vm_page_pagequeue(m, old->queue); - - /* - * The physical queue state might change at any point before the - * page queue lock is acquired, so we must verify that the lock - * is correct before proceeding. Once the page's queue index is - * changed, the page queue lock we hold will no longer - * synchronize the physical queue state of the page, so we must - * awkwardly remove the page from the queue and put it back if - * the commit fails. - */ - vm_pagequeue_lock(pq); - if (__predict_false(m->astate.queue != old->queue)) { - vm_pagequeue_unlock(pq); - *old = vm_page_astate_load(m); - return (false); - } - if (__predict_true((m->astate.flags & PGA_ENQUEUED) != 0)) { - next = TAILQ_NEXT(m, plinks.q); - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - } - if (__predict_false(!vm_page_astate_fcmpset(m, old, new))) { - if ((old->flags & PGA_ENQUEUED) != 0) { - if (next == NULL) - TAILQ_INSERT_TAIL(&pq->pq_pl, m, - plinks.q); - else - TAILQ_INSERT_BEFORE(next, m, plinks.q); - } - vm_pagequeue_unlock(pq); - counter_u64_add(pqstate_commit_aborts, 1); - return (false); - } - if ((old->flags & PGA_ENQUEUED) != 0) - vm_pagequeue_cnt_dec(pq); - vm_pagequeue_unlock(pq); - } else if (__predict_false(!vm_page_astate_fcmpset(m, old, new))) { - counter_u64_add(pqstate_commit_aborts, 1); - return (false); - } - - if (new.queue != PQ_NONE) { - mask = new.flags & PGA_QUEUE_OP_MASK; - if (mask != 0 && (old->flags & mask) != mask) - vm_page_pqbatch_submit(m, new.queue); - } - - return (true); + if ((queue = atomic_load_8(&m->queue)) == PQ_NONE) + return (NULL); + return (&vm_pagequeue_domain(m)->vmd_pagequeues[queue]); } static inline void -vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m, uint8_t queue) +vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m) { - vm_page_t next; struct vm_domain *vmd; - vm_page_astate_t old, new; + uint8_t qflags; CRITICAL_ASSERT(curthread); vm_pagequeue_assert_locked(pq); - old = vm_page_astate_load(m); -retry: - if (__predict_false(old.queue != queue)) - return; - KASSERT(pq == _vm_page_pagequeue(m, queue), - ("page %p does not belong to queue %p", m, pq)); - KASSERT(old.queue != PQ_NONE || (old.flags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p has unexpected queue state", m)); - /* - * Update the page's queue state before modifying the page queues - * themselves, to avoid having to roll back updates when a queue state - * update fails and requires a retry. + * The page daemon is allowed to set m->queue = PQ_NONE without + * the page queue lock held. In this case it is about to free the page, + * which must not have any queue state. */ - new = old; - if ((old.flags & PGA_DEQUEUE) != 0) { - new.queue = PQ_NONE; - new.flags &= ~PGA_QUEUE_STATE_MASK; - if (__predict_true((old.flags & PGA_ENQUEUED) != 0)) { - next = TAILQ_NEXT(m, plinks.q); - TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - } - if (__predict_false(!vm_page_astate_fcmpset(m, &old, new))) { - if ((old.flags & PGA_ENQUEUED) != 0) { - if (next == NULL) - TAILQ_INSERT_TAIL(&pq->pq_pl, m, - plinks.q); - else - TAILQ_INSERT_BEFORE(next, m, plinks.q); - } - counter_u64_add(pqstate_commit_aborts, 1); - goto retry; - } - if ((old.flags & PGA_ENQUEUED) != 0) - vm_pagequeue_cnt_dec(pq); - counter_u64_add(queue_ops, 1); - } else if ((old.flags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { - new.flags |= PGA_ENQUEUED; - new.flags &= ~(PGA_REQUEUE | PGA_REQUEUE_HEAD); - if (__predict_false(!vm_page_astate_fcmpset(m, &old, new))) { - counter_u64_add(pqstate_commit_aborts, 1); - goto retry; - } + 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 ((old.flags & PGA_ENQUEUED) != 0) + if ((qflags & PGA_DEQUEUE) != 0) { + 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) TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); - else + else { 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. + * 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 ((old.flags & PGA_REQUEUE_HEAD) != 0) { - KASSERT(old.queue == PQ_INACTIVE, + if ((qflags & PGA_REQUEUE_HEAD) != 0) { + KASSERT(m->queue == PQ_INACTIVE, ("head enqueue not supported for page %p", m)); vmd = vm_pagequeue_domain(m); TAILQ_INSERT_BEFORE(&vmd->vmd_inacthead, m, plinks.q); - } else { + } else TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); - } - counter_u64_add(queue_ops, 1); - } else { - counter_u64_add(null_queue_ops, 1); + + vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | + PGA_REQUEUE_HEAD)); } } @@ -3245,10 +3141,15 @@ static void vm_pqbatch_process(struct vm_pagequeue *pq, struct vm_batchqueue *bq, uint8_t queue) { + vm_page_t m; int i; - for (i = 0; i < bq->bq_cnt; i++) - vm_pqbatch_process_page(pq, bq->bq_pa[i], queue); + for (i = 0; i < bq->bq_cnt; i++) { + m = bq->bq_pa[i]; + if (__predict_false(m->queue != queue)) + continue; + vm_pqbatch_process_page(pq, m); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Sep 16 15:06: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 28D7E124FD6; Mon, 16 Sep 2019 15:06:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46X8hX0JN6z3JrJ; Mon, 16 Sep 2019 15:06:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E28D82202D; Mon, 16 Sep 2019 15:06:19 +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 x8GF6JYv052659; Mon, 16 Sep 2019 15:06:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GF6Jpa052657; Mon, 16 Sep 2019 15:06:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161506.x8GF6Jpa052657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352408 - in head: share/man/man9 sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 X-SVN-Commit-Revision: 352408 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:06:20 -0000 Author: markj Date: Mon Sep 16 15:06:19 2019 New Revision: 352408 URL: https://svnweb.freebsd.org/changeset/base/352408 Log: Fix a couple of nits in r352110. - Remove a dead variable from the amd64 pmap_extract_and_hold(). - Fix grammar in the vm_page_wire man page. Reported by: alc Reviewed by: alc, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21639 Modified: head/share/man/man9/vm_page_wire.9 head/sys/amd64/amd64/pmap.c Modified: head/share/man/man9/vm_page_wire.9 ============================================================================== --- head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:04:45 2019 (r352407) +++ head/share/man/man9/vm_page_wire.9 Mon Sep 16 15:06:19 2019 (r352408) @@ -51,7 +51,7 @@ The .Fn vm_page_wire and .Fn vm_page_wire_mapped -function wire the page, prevent it from being reclaimed by the page +functions wire the page, which prevents it from being reclaimed by the page daemon or when its containing object is destroyed. Both functions require that the page belong to an object. The Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Sep 16 15:04:45 2019 (r352407) +++ head/sys/amd64/amd64/pmap.c Mon Sep 16 15:06:19 2019 (r352408) @@ -3064,10 +3064,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_ { pd_entry_t pde, *pdep; pt_entry_t pte, PG_RW, PG_V; - vm_paddr_t pa; vm_page_t m; - pa = 0; m = NULL; PG_RW = pmap_rw_bit(pmap); PG_V = pmap_valid_bit(pmap); From owner-svn-src-all@freebsd.org Mon Sep 16 15: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 6290612512B; Mon, 16 Sep 2019 15:09:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46X8mD1SPYz3K6P; Mon, 16 Sep 2019 15:09:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 114FC22042; Mon, 16 Sep 2019 15:09:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GF9Vd0053329; Mon, 16 Sep 2019 15:09:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GF9VHl053328; Mon, 16 Sep 2019 15:09:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161509.x8GF9VHl053328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352409 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352409 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:09:32 -0000 Author: markj Date: Mon Sep 16 15:09:31 2019 New Revision: 352409 URL: https://svnweb.freebsd.org/changeset/base/352409 Log: Fix a page leak in vm_page_reclaim_run(). After r352110 the attempt to remove mappings of the page being replaced may fail if the page is wired. In this case we must free the replacement page. Reviewed by: alc, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21639 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Sep 16 15:06:19 2019 (r352408) +++ head/sys/vm/vm_page.c Mon Sep 16 15:09:31 2019 (r352409) @@ -2597,16 +2597,23 @@ retry: } /* - * Replace "m" with the new page. For - * vm_page_replace(), "m" must be busy - * and dequeued. Finally, change "m" - * as if vm_page_free() was called. + * Unmap the page and check for new + * wirings that may have been acquired + * through a pmap lookup. */ if (object->ref_count != 0 && !vm_page_try_remove_all(m)) { + vm_page_free(m_new); error = EBUSY; goto unlock; } + + /* + * Replace "m" with the new page. For + * vm_page_replace(), "m" must be busy + * and dequeued. Finally, change "m" + * as if vm_page_free() was called. + */ m_new->aflags = m->aflags & ~PGA_QUEUE_STATE_MASK; KASSERT(m_new->oflags == VPO_UNMANAGED, From owner-svn-src-all@freebsd.org Mon Sep 16 15:12: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 1932D125388; Mon, 16 Sep 2019 15:12:50 +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 46X8r16tQyz3KVb; Mon, 16 Sep 2019 15:12:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCD26221F0; Mon, 16 Sep 2019 15:12:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GFCnDm059215; Mon, 16 Sep 2019 15:12:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GFCn07059211; Mon, 16 Sep 2019 15:12:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161512.x8GFCn07059211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352410 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352410 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:12:50 -0000 Author: markj Date: Mon Sep 16 15:12:49 2019 New Revision: 352410 URL: https://svnweb.freebsd.org/changeset/base/352410 Log: Fix a race in vm_page_dequeue_deferred_free() after r352110. This function loaded the page's queue index before setting PGA_DEQUEUE. In this window the page daemon may have deactivated the page, updating its queue index. Make the operation atomic using vm_page_pqstate_cmpset(); the page daemon will not modify the page once it observes that PGA_DEQUEUE is set. Reported and tested by: pho Reviewed by: alc, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21639 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Sep 16 15:09:31 2019 (r352409) +++ head/sys/vm/vm_page.c Mon Sep 16 15:12:49 2019 (r352410) @@ -3315,13 +3315,18 @@ vm_page_dequeue_deferred_free(vm_page_t m) KASSERT(m->ref_count == 0, ("page %p has references", m)); - if ((m->aflags & PGA_DEQUEUE) != 0) - return; - atomic_thread_fence_acq(); - if ((queue = m->queue) == PQ_NONE) - return; - vm_page_aflag_set(m, PGA_DEQUEUE); - vm_page_pqbatch_submit(m, queue); + for (;;) { + if ((m->aflags & PGA_DEQUEUE) != 0) + return; + atomic_thread_fence_acq(); + if ((queue = atomic_load_8(&m->queue)) == PQ_NONE) + return; + if (vm_page_pqstate_cmpset(m, queue, queue, PGA_DEQUEUE, + PGA_DEQUEUE)) { + vm_page_pqbatch_submit(m, queue); + break; + } + } } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Sep 16 15:09:31 2019 (r352409) +++ head/sys/vm/vm_page.h Mon Sep 16 15:12:49 2019 (r352410) @@ -783,8 +783,6 @@ vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uin { uint32_t *addr, nval, oval, qsmask; - vm_page_assert_locked(m); - fflags <<= VM_PAGE_AFLAG_SHIFT; nflags <<= VM_PAGE_AFLAG_SHIFT; newq <<= VM_PAGE_QUEUE_SHIFT; From owner-svn-src-all@freebsd.org Mon Sep 16 15:16: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 E816C12548D; Mon, 16 Sep 2019 15:16:48 +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 46X8wc5s8Cz3Kfk; Mon, 16 Sep 2019 15:16:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8204221F1; Mon, 16 Sep 2019 15:16:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GFGmFJ059901; Mon, 16 Sep 2019 15:16:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GFGm40059900; Mon, 16 Sep 2019 15:16:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161516.x8GFGm40059900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352411 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352411 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:16:49 -0000 Author: markj Date: Mon Sep 16 15:16:48 2019 New Revision: 352411 URL: https://svnweb.freebsd.org/changeset/base/352411 Log: Assert that the refcount value is not VPRC_BLOCKED in vm_page_drop(). VPRC_BLOCKED is a refcount flag used to indicate that a thread is tearing down mappings of a page. When set, it causes attempts to wire a page via a pmap lookup to fail. It should never represent the last reference to a page, so assert this. Suggested by: kib Reviewed by: alc, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21639 Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Sep 16 15:12:49 2019 (r352410) +++ head/sys/vm/vm_page.h Mon Sep 16 15:16:48 2019 (r352411) @@ -902,13 +902,17 @@ vm_page_in_laundry(vm_page_t m) static inline u_int vm_page_drop(vm_page_t m, u_int val) { + u_int old; /* * Synchronize with vm_page_free_prep(): ensure that all updates to the * page structure are visible before it is freed. */ atomic_thread_fence_rel(); - return (atomic_fetchadd_int(&m->ref_count, -val)); + old = atomic_fetchadd_int(&m->ref_count, -val); + KASSERT(old != VPRC_BLOCKED, + ("vm_page_drop: page %p has an invalid refcount value", m)); + return (old); } /* From owner-svn-src-all@freebsd.org Mon Sep 16 15:21: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 ED89E125550; Mon, 16 Sep 2019 15:21:37 +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 46X929620Lz3L1D; Mon, 16 Sep 2019 15:21:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B27972225D; Mon, 16 Sep 2019 15:21:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GFLbIU062866; Mon, 16 Sep 2019 15:21:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GFLbxI062865; Mon, 16 Sep 2019 15:21:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161521.x8GFLbxI062865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 15:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352412 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 352412 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:21:38 -0000 Author: markj Date: Mon Sep 16 15:21:37 2019 New Revision: 352412 URL: https://svnweb.freebsd.org/changeset/base/352412 Log: MFC r351727: Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Sep 16 15:16:48 2019 (r352411) +++ stable/12/sys/amd64/amd64/pmap.c Mon Sep 16 15:21:37 2019 (r352412) @@ -426,8 +426,8 @@ static int pmap_flags = PMAP_PDE_SUPERPAGE; /* flags f static vmem_t *large_vmem; static u_int lm_ents; -#define PMAP_LARGEMAP_MAX_ADDRESS() \ - (LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents) +#define PMAP_ADDRESS_IN_LARGEMAP(va) ((va) >= LARGEMAP_MIN_ADDRESS && \ + (va) < LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents) int pmap_pcid_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, @@ -3063,8 +3063,7 @@ pmap_kextract(vm_offset_t va) if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) { pa = DMAP_TO_PHYS(va); - } else if (LARGEMAP_MIN_ADDRESS <= va && - va < PMAP_LARGEMAP_MAX_ADDRESS()) { + } else if (PMAP_ADDRESS_IN_LARGEMAP(va)) { pa = pmap_large_map_kextract(va); } else { pde = *vtopde(va); @@ -8957,7 +8956,7 @@ pmap_large_map_kextract(vm_offset_t va) pd_entry_t *pde, pd; pt_entry_t *pte, pt; - KASSERT(LARGEMAP_MIN_ADDRESS <= va && va < PMAP_LARGEMAP_MAX_ADDRESS(), + KASSERT(PMAP_ADDRESS_IN_LARGEMAP(va), ("not largemap range %#lx", (u_long)va)); pdpe = pmap_large_map_pdpe(va); pdp = *pdpe; @@ -9099,8 +9098,8 @@ pmap_large_unmap(void *svaa, vm_size_t len) return; SLIST_INIT(&spgf); - KASSERT(LARGEMAP_MIN_ADDRESS <= sva && - sva + len <= PMAP_LARGEMAP_MAX_ADDRESS(), + KASSERT(PMAP_ADDRESS_IN_LARGEMAP(sva) && + PMAP_ADDRESS_IN_LARGEMAP(sva + len - 1), ("not largemap range %#lx %#lx", (u_long)svaa, (u_long)svaa + len)); PMAP_LOCK(kernel_pmap); for (va = sva; va < sva + len; va += inc) { From owner-svn-src-all@freebsd.org Mon Sep 16 15:28: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 3558A12587B for ; Mon, 16 Sep 2019 15:28:55 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670052.outbound.protection.outlook.com [40.107.67.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46X9BZ1jtNz3LLk for ; Mon, 16 Sep 2019 15:28:53 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LyF+HUn1Oy6nu3uT7HLMEVRTo6lVSFAHY5wdD7njIt0ItEhf8ci5thqmydwen5FQlfrTGKQqIYLbE+93VKyGjyV5ZxNjJ/tOfZkQzNNL2/iFhB3Wtp5R+81Z55Xt0GEnCQHCRFREEcynGQypONSvZmMz1HwcYkVgNtE/KCxU6SamBnhE3bAK//8+9+Cb5ISJYJkAspkT/1A5+ouKRx+W3yodgM5ozrFgK8N8SuxxPQNAXYk2vVZfi6X9nL5eAqYUjFfRKZF21asR7+poeTfsT+Zx+i6Usc8x+sxpLm9GyXAc0BThADeISBg7JgCUflHpEQB3aXDSOAylJ71QAIYHpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9cAdxeDqNnxZfwwu6YLGWYxtyVOdbIMjF6y9qSH3RiM=; b=KPmVPKakt21PzkitHzp4Y0RpciVtpuDjPs4t4k51rgWIQFZWEkSoqkwKv+n9bd2zX8GlBC4kE44rvCumd70Ny6h+dn/Vrc4WyJRSgZRRcGmrIfW//D1aXwsMnOeAzq/wMmru8WpBsUd33YGJVjCx0HXN2Q8m58r0omNiAU1NJgXZFQq6CXXFbO3HVxzjktOKbqBZVzY7ChUUsbg9X+HOqekJoiywknv4ddCJh1LtFqe8k+5gyuy1OKdTaFXEAhoRHmNA/LeIS5LXmpfYdJ56pyRwtc6+/+J+AfRw4NaR9tqO9ms0B/kjT682BTpmb2zvsrLuDZPQkmvnF+BZfYUhsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none Received: from YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM (52.132.39.22) by YTXPR0101MB2077.CANPRD01.PROD.OUTLOOK.COM (52.132.37.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.23; Mon, 16 Sep 2019 15:28:52 +0000 Received: from YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM ([fe80::5413:22e8:7013:d8b9]) by YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM ([fe80::5413:22e8:7013:d8b9%5]) with mapi id 15.20.2263.023; Mon, 16 Sep 2019 15:28:52 +0000 From: Rick Macklem To: "svn-src-all@freebsd.org" Subject: Re: Re; svn commit: r352393 - head/sys/fs/nfsclient Thread-Topic: Re; svn commit: r352393 - head/sys/fs/nfsclient Thread-Index: AQHVbKIrGKQ8rOwi4UavHi4KjNkUJKcubWwC Date: Mon, 16 Sep 2019 15:28:52 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4f81cc5d-fdaa-475b-92ca-08d73aba9490 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:YTXPR0101MB2077; x-ms-traffictypediagnostic: YTXPR0101MB2077: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:350; x-forefront-prvs: 0162ACCC24 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(11346002)(46003)(6916009)(446003)(229853002)(6436002)(2351001)(256004)(476003)(5640700003)(9686003)(14444005)(486006)(786003)(316002)(2501003)(2940100002)(33656002)(55016002)(71200400001)(71190400001)(4744005)(2906002)(478600001)(81166006)(52536014)(86362001)(8676002)(25786009)(81156014)(66946007)(64756008)(8936002)(66556008)(76116006)(66476007)(74316002)(305945005)(66446008)(53936002)(99286004)(14454004)(76176011)(102836004)(186003)(53546011)(6246003)(6506007)(5660300002)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR0101MB2077; H:YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: lZZTNLK4bQg0a0TgQauSMU0hsSoq6VmA/LH3o3qmE6xc900ZeT//9JYy3Tl3oBA2BPC5Cz2s+8wdsaBfD+fMsVnc5sGW+n4UF5ni7X7FrtRcvtT7Jb6wBLwcpYb6ynlekthqRCxeJKkDLs5mFHZYbBzZK2Q1S1GMzVliuUb/6ef6ExOfExQexjKyOgZ7uy/ZurbiRA9FY2rfA1cveJ5fkzDxOKTqqfZxHpEk40knsxRhWa8aRZ+i+IDP06RgRAci02iMCj1rVtOYab3VyVlPyoeQyuKJuNYfputQXcVyhA12ml848Hvrv9hQY5OjByNQ/w1ziKCUzHwW92bO/CQs/8EVZXcvyMxjm1c8T4qyeUNiXUNTwL9tUcNlnF7rIVx6Ynh3kvL22/NIAgFBnsMkyd6no0LPfy2rSfgxqcFBt5w= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 4f81cc5d-fdaa-475b-92ca-08d73aba9490 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2019 15:28:52.5856 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CMXkw9cq9ad9yenefRxBsEEeyI3aAjkLAsEkpAhCvvCDAn3RUDYZRbnyB2sw2aJKjXfzMfig5d418SEdnFhEVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR0101MB2077 X-Rspamd-Queue-Id: 46X9BZ1jtNz3LLk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.52 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-4.54 / 15.00]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.24)[ipnet: 40.64.0.0/10(-3.65), asn: 8075(-2.51), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[52.67.107.40.list.dnswl.org : 127.0.3.0]; TO_DN_EQ_ADDR_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[i=1] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 16 Sep 2019 15:28:55 -0000 Resent to correct address...=0A= =0A= ________________________________________=0A= From: Rick Macklem=0A= Sent: Monday, September 16, 2019 11:27 AM=0A= To: kib@freebsd.org; peterj@freebsd.org=0A= Cc: src-svn-all@freebsd.org=0A= Subject: Re; svn commit: r352393 - head/sys/fs/nfsclient=0A= =0A= Hi Kostik,=0A= =0A= I'm afraid there was a reason that only certain cases (where the file was= =0A= being shrunk) did the vnode_pager_setsize() call after the NFS node=0A= lock is released.=0A= =0A= See the commit log message for r252528.=0A= =0A= If vnode_pager_setsize() now acquires a sleep lock for the case where the= =0A= size is increasing, it sounds like the NFS node lock will have to become a= =0A= sleep lock instead of a mutex.=0A= (If needed, I can get working on this in a day or two.)=0A= =0A= rick=0A= From owner-svn-src-all@freebsd.org Mon Sep 16 15:45: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 01A66125E72; Mon, 16 Sep 2019 15:45:01 +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 46X9Y868JTz3M5v; Mon, 16 Sep 2019 15:45:00 +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 B5AC82271C; Mon, 16 Sep 2019 15:45:00 +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 x8GFj03i080388; Mon, 16 Sep 2019 15:45:00 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GFj09T080385; Mon, 16 Sep 2019 15:45:00 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909161545.x8GFj09T080385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 15:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352413 - head/tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/fs/fusefs X-SVN-Commit-Revision: 352413 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:45:01 -0000 Author: asomers Date: Mon Sep 16 15:44:59 2019 New Revision: 352413 URL: https://svnweb.freebsd.org/changeset/base/352413 Log: fusefs: fix some minor Coverity CIDs in the tests Where open(2) is expected to fail, the tests should assert or expect that its return value is -1. These tests all accepted too much but happened to pass anyway. Reported by: Coverity Coverity CID: 1404512, 1404378, 1404504, 1404483 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/fs/fusefs/create.cc head/tests/sys/fs/fusefs/default_permissions.cc head/tests/sys/fs/fusefs/opendir.cc Modified: head/tests/sys/fs/fusefs/create.cc ============================================================================== --- head/tests/sys/fs/fusefs/create.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/create.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -204,7 +204,7 @@ TEST_F(Create, eexist) EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_create(RELPATH, mode, ReturnErrno(EEXIST)); - EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode)); + EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode)); EXPECT_EQ(EEXIST, errno); } @@ -342,7 +342,7 @@ TEST_F(Create, eperm) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_create(RELPATH, mode, ReturnErrno(EPERM)); - EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode)); + EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode)); EXPECT_EQ(EPERM, errno); } Modified: head/tests/sys/fs/fusefs/default_permissions.cc ============================================================================== --- head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -749,7 +749,7 @@ TEST_F(Open, eacces) expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1); expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX); - EXPECT_NE(0, open(FULLPATH, O_RDWR)); + EXPECT_EQ(-1, open(FULLPATH, O_RDWR)); EXPECT_EQ(EACCES, errno); } Modified: head/tests/sys/fs/fusefs/opendir.cc ============================================================================== --- head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -103,7 +103,7 @@ TEST_F(Opendir, eperm) expect_lookup(RELPATH, ino); expect_opendir(ino, O_RDONLY, ReturnErrno(EPERM)); - EXPECT_NE(0, open(FULLPATH, O_DIRECTORY)); + EXPECT_EQ(-1, open(FULLPATH, O_DIRECTORY)); EXPECT_EQ(EPERM, errno); } From owner-svn-src-all@freebsd.org Mon Sep 16 15:56: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 414D712614A; Mon, 16 Sep 2019 15:56:22 +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 46X9pG0zjgz3MZ0; Mon, 16 Sep 2019 15:56:22 +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 006EB228D6; Mon, 16 Sep 2019 15:56:21 +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 x8GFuLQh087539; Mon, 16 Sep 2019 15:56:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GFuL3u087536; Mon, 16 Sep 2019 15:56:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909161556.x8GFuL3u087536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 15:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352414 - head/tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/fs/fusefs X-SVN-Commit-Revision: 352414 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 15:56:22 -0000 Author: asomers Date: Mon Sep 16 15:56:21 2019 New Revision: 352414 URL: https://svnweb.freebsd.org/changeset/base/352414 Log: fusefs: initialize C++ classes the Coverity way Coverity complained that I wasn't initializing some class members until the SetUp method. Do it in the constructor instead. Reported by: Coverity Coverity CIDs: 1404352, 1404378 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/fs/fusefs/io.cc head/tests/sys/fs/fusefs/mknod.cc Modified: head/tests/sys/fs/fusefs/io.cc ============================================================================== --- head/tests/sys/fs/fusefs/io.cc Mon Sep 16 15:44:59 2019 (r352413) +++ head/tests/sys/fs/fusefs/io.cc Mon Sep 16 15:56:21 2019 (r352414) @@ -108,11 +108,11 @@ int m_backing_fd, m_control_fd, m_test_fd; off_t m_filesize; bool m_direct_io; -Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_direct_io(false) {}; +Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_filesize(0), + m_direct_io(false) {}; void SetUp() { - m_filesize = 0; m_backing_fd = open("backing_file", O_RDWR | O_CREAT | O_TRUNC, 0644); if (m_backing_fd < 0) FAIL() << strerror(errno); Modified: head/tests/sys/fs/fusefs/mknod.cc ============================================================================== --- head/tests/sys/fs/fusefs/mknod.cc Mon Sep 16 15:44:59 2019 (r352413) +++ head/tests/sys/fs/fusefs/mknod.cc Mon Sep 16 15:56:21 2019 (r352414) @@ -55,8 +55,11 @@ const static mode_t c_umask = 022; public: -virtual void SetUp() { +Mknod() { m_oldmask = umask(c_umask); +} + +virtual void SetUp() { if (geteuid() != 0) { GTEST_SKIP() << "Only root may use most mknod(2) variations"; } From owner-svn-src-all@freebsd.org Mon Sep 16 16:10: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 4FBAE12677A; Mon, 16 Sep 2019 16:10:45 +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 46XB6s1NXLz3N9v; Mon, 16 Sep 2019 16:10:45 +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 141D922ACC; Mon, 16 Sep 2019 16:10:45 +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 x8GGAiiN095903; Mon, 16 Sep 2019 16:10:44 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GGAihM095902; Mon, 16 Sep 2019 16:10:44 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201909161610.x8GGAihM095902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 16 Sep 2019 16:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352415 - stable/12/sys/dev/ichsmb X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: stable/12/sys/dev/ichsmb X-SVN-Commit-Revision: 352415 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 16:10:45 -0000 Author: yuripv Date: Mon Sep 16 16:10:44 2019 New Revision: 352415 URL: https://svnweb.freebsd.org/changeset/base/352415 Log: MFC r351604: 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: stable/12/sys/dev/ichsmb/ichsmb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ichsmb/ichsmb.c ============================================================================== --- stable/12/sys/dev/ichsmb/ichsmb.c Mon Sep 16 15:56:21 2019 (r352414) +++ stable/12/sys/dev/ichsmb/ichsmb.c Mon Sep 16 16:10:44 2019 (r352415) @@ -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 Mon Sep 16 16: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 39C78126A8F; Mon, 16 Sep 2019 16:17:32 +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 46XBGh1TpSz3Ng9; Mon, 16 Sep 2019 16:17:32 +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 12BD722C65; Mon, 16 Sep 2019 16:17:32 +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 x8GGHWPO001739; Mon, 16 Sep 2019 16:17:32 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GGHTQk001721; Mon, 16 Sep 2019 16:17:29 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201909161617.x8GGHTQk001721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 16 Sep 2019 16:17: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: r352416 - in stable/12: etc/mtree usr.bin/locale usr.bin/locale/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12: etc/mtree usr.bin/locale usr.bin/locale/tests X-SVN-Commit-Revision: 352416 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 16:17:32 -0000 Author: yuripv Date: Mon Sep 16 16:17:29 2019 New Revision: 352416 URL: https://svnweb.freebsd.org/changeset/base/352416 Log: MFC r352138, r352214, r352216: locale: handle day, abday, mon, abmon, am_pm keywords All of these are defined as mandatory by POSIX. While here, mark all non-standard ones as FreeBSD-only as other systems (at least, GNU/Linux and illumos) do not handle them, so we should not encourage their use. - make abday, day, abmon, mon, am_pm output quoting match linux - workaround localeconv() issue for mon_grouping and grouping (PR172215) - for other values not available in default locale, output -1 instead of 127 (CHAR_MAX) as returned by localeconv() PR: 237752 Added: stable/12/usr.bin/locale/tests/ - copied from r352138, head/usr.bin/locale/tests/ stable/12/usr.bin/locale/tests/no_flags_posix_messages.out - copied unchanged from r352214, head/usr.bin/locale/tests/no_flags_posix_messages.out stable/12/usr.bin/locale/tests/no_flags_posix_monetary.out - copied unchanged from r352214, head/usr.bin/locale/tests/no_flags_posix_monetary.out stable/12/usr.bin/locale/tests/no_flags_posix_numeric.out - copied unchanged from r352214, head/usr.bin/locale/tests/no_flags_posix_numeric.out stable/12/usr.bin/locale/tests/no_flags_posix_time.out - copied unchanged from r352214, head/usr.bin/locale/tests/no_flags_posix_time.out Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.bin/locale/Makefile stable/12/usr.bin/locale/locale.c stable/12/usr.bin/locale/tests/Makefile stable/12/usr.bin/locale/tests/k_flag_posix_monetary.out stable/12/usr.bin/locale/tests/k_flag_posix_numeric.out stable/12/usr.bin/locale/tests/k_flag_posix_time.out stable/12/usr.bin/locale/tests/locale_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 16:10:44 2019 (r352415) +++ stable/12/etc/mtree/BSD.tests.dist Mon Sep 16 16:17:29 2019 (r352416) @@ -1000,6 +1000,8 @@ .. limits .. + locale + .. m4 .. mkimg Modified: stable/12/usr.bin/locale/Makefile ============================================================================== --- stable/12/usr.bin/locale/Makefile Mon Sep 16 16:10:44 2019 (r352415) +++ stable/12/usr.bin/locale/Makefile Mon Sep 16 16:17:29 2019 (r352416) @@ -1,6 +1,12 @@ # $FreeBSD$ +.include + PROG= locale CFLAGS+= -I${SRCTOP}/lib/libc/locale +LIBADD+= sbuf + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/12/usr.bin/locale/locale.c ============================================================================== --- stable/12/usr.bin/locale/locale.c Mon Sep 16 16:10:44 2019 (r352415) +++ stable/12/usr.bin/locale/locale.c Mon Sep 16 16:17:29 2019 (r352416) @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -53,13 +54,13 @@ #include "setlocale.h" /* Local prototypes */ -char *format_grouping(const char *); +char *format_grouping(char *); void init_locales_list(void); void list_charmaps(void); void list_locales(void); const char *lookup_localecat(int); char *kwval_lconv(int); -int kwval_lookup(const char *, char **, int *, int *); +int kwval_lookup(const char *, char **, int *, int *, int *); void showdetails(const char *); void showkeywordslist(char *substring); void showlocale(void); @@ -87,141 +88,264 @@ static const struct _lcinfo { #define NLCINFO nitems(lcinfo) /* ids for values not referenced by nl_langinfo() */ -#define KW_ZERO 10000 -#define KW_GROUPING (KW_ZERO+1) -#define KW_INT_CURR_SYMBOL (KW_ZERO+2) -#define KW_CURRENCY_SYMBOL (KW_ZERO+3) -#define KW_MON_DECIMAL_POINT (KW_ZERO+4) -#define KW_MON_THOUSANDS_SEP (KW_ZERO+5) -#define KW_MON_GROUPING (KW_ZERO+6) -#define KW_POSITIVE_SIGN (KW_ZERO+7) -#define KW_NEGATIVE_SIGN (KW_ZERO+8) -#define KW_INT_FRAC_DIGITS (KW_ZERO+9) -#define KW_FRAC_DIGITS (KW_ZERO+10) -#define KW_P_CS_PRECEDES (KW_ZERO+11) -#define KW_P_SEP_BY_SPACE (KW_ZERO+12) -#define KW_N_CS_PRECEDES (KW_ZERO+13) -#define KW_N_SEP_BY_SPACE (KW_ZERO+14) -#define KW_P_SIGN_POSN (KW_ZERO+15) -#define KW_N_SIGN_POSN (KW_ZERO+16) -#define KW_INT_P_CS_PRECEDES (KW_ZERO+17) -#define KW_INT_P_SEP_BY_SPACE (KW_ZERO+18) -#define KW_INT_N_CS_PRECEDES (KW_ZERO+19) -#define KW_INT_N_SEP_BY_SPACE (KW_ZERO+20) -#define KW_INT_P_SIGN_POSN (KW_ZERO+21) -#define KW_INT_N_SIGN_POSN (KW_ZERO+22) +enum { + KW_GROUPING, + KW_INT_CURR_SYMBOL, + KW_CURRENCY_SYMBOL, + KW_MON_DECIMAL_POINT, + KW_MON_THOUSANDS_SEP, + KW_MON_GROUPING, + KW_POSITIVE_SIGN, + KW_NEGATIVE_SIGN, + KW_INT_FRAC_DIGITS, + KW_FRAC_DIGITS, + KW_P_CS_PRECEDES, + KW_P_SEP_BY_SPACE, + KW_N_CS_PRECEDES, + KW_N_SEP_BY_SPACE, + KW_P_SIGN_POSN, + KW_N_SIGN_POSN, + KW_INT_P_CS_PRECEDES, + KW_INT_P_SEP_BY_SPACE, + KW_INT_N_CS_PRECEDES, + KW_INT_N_SEP_BY_SPACE, + KW_INT_P_SIGN_POSN, + KW_INT_N_SIGN_POSN, + KW_TIME_DAY, + KW_TIME_ABDAY, + KW_TIME_MON, + KW_TIME_ABMON, + KW_TIME_AM_PM +}; +enum { + TYPE_NUM, + TYPE_STR, + TYPE_UNQ +}; + +enum { + SRC_LINFO, + SRC_LCONV, + SRC_LTIME +}; + static const struct _kwinfo { const char *name; - int isstr; /* true - string, false - number */ + int type; int catid; /* LC_* */ + int source; int value_ref; const char *comment; } kwinfo [] = { - { "charmap", 1, LC_CTYPE, CODESET, "" }, /* hack */ + { "charmap", TYPE_STR, LC_CTYPE, SRC_LINFO, + CODESET, "" }, /* hack */ - { "decimal_point", 1, LC_NUMERIC, RADIXCHAR, "" }, - { "thousands_sep", 1, LC_NUMERIC, THOUSEP, "" }, - { "grouping", 1, LC_NUMERIC, KW_GROUPING, "" }, - { "radixchar", 1, LC_NUMERIC, RADIXCHAR, - "Same as decimal_point (FreeBSD only)" }, /* compat */ - { "thousep", 1, LC_NUMERIC, THOUSEP, - "Same as thousands_sep (FreeBSD only)" }, /* compat */ + /* LC_MONETARY - POSIX */ + { "int_curr_symbol", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_INT_CURR_SYMBOL, "" }, + { "currency_symbol", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_CURRENCY_SYMBOL, "" }, + { "mon_decimal_point", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_MON_DECIMAL_POINT, "" }, + { "mon_thousands_sep", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_MON_THOUSANDS_SEP, "" }, + { "mon_grouping", TYPE_UNQ, LC_MONETARY, SRC_LCONV, + KW_MON_GROUPING, "" }, + { "positive_sign", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_POSITIVE_SIGN, "" }, + { "negative_sign", TYPE_STR, LC_MONETARY, SRC_LCONV, + KW_NEGATIVE_SIGN, "" }, + { "int_frac_digits", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_FRAC_DIGITS, "" }, + { "frac_digits", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_FRAC_DIGITS, "" }, + { "p_cs_precedes", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_P_CS_PRECEDES, "" }, + { "p_sep_by_space", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_P_SEP_BY_SPACE, "" }, + { "n_cs_precedes", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_N_CS_PRECEDES, "" }, + { "n_sep_by_space", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_N_SEP_BY_SPACE, "" }, + { "p_sign_posn", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_P_SIGN_POSN, "" }, + { "n_sign_posn", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_N_SIGN_POSN, "" }, + { "int_p_cs_precedes", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_P_CS_PRECEDES, "" }, + { "int_p_sep_by_space", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_P_SEP_BY_SPACE, "" }, + { "int_n_cs_precedes", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_N_CS_PRECEDES, "" }, + { "int_n_sep_by_space", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_N_SEP_BY_SPACE, "" }, + { "int_p_sign_posn", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_P_SIGN_POSN, "" }, + { "int_n_sign_posn", TYPE_NUM, LC_MONETARY, SRC_LCONV, + KW_INT_N_SIGN_POSN, "" }, - { "int_curr_symbol", 1, LC_MONETARY, KW_INT_CURR_SYMBOL, "" }, - { "currency_symbol", 1, LC_MONETARY, KW_CURRENCY_SYMBOL, "" }, - { "mon_decimal_point", 1, LC_MONETARY, KW_MON_DECIMAL_POINT, "" }, - { "mon_thousands_sep", 1, LC_MONETARY, KW_MON_THOUSANDS_SEP, "" }, - { "mon_grouping", 1, LC_MONETARY, KW_MON_GROUPING, "" }, - { "positive_sign", 1, LC_MONETARY, KW_POSITIVE_SIGN, "" }, - { "negative_sign", 1, LC_MONETARY, KW_NEGATIVE_SIGN, "" }, + /* LC_NUMERIC - POSIX */ + { "decimal_point", TYPE_STR, LC_NUMERIC, SRC_LINFO, + RADIXCHAR, "" }, + { "thousands_sep", TYPE_STR, LC_NUMERIC, SRC_LINFO, + THOUSEP, "" }, + { "grouping", TYPE_UNQ, LC_NUMERIC, SRC_LCONV, + KW_GROUPING, "" }, + /* LC_NUMERIC - local additions */ + { "radixchar", TYPE_STR, LC_NUMERIC, SRC_LINFO, + RADIXCHAR, "Same as decimal_point (FreeBSD only)" }, /* compat */ + { "thousep", TYPE_STR, LC_NUMERIC, SRC_LINFO, + THOUSEP, "Same as thousands_sep (FreeBSD only)" }, /* compat */ - { "int_frac_digits", 0, LC_MONETARY, KW_INT_FRAC_DIGITS, "" }, - { "frac_digits", 0, LC_MONETARY, KW_FRAC_DIGITS, "" }, - { "p_cs_precedes", 0, LC_MONETARY, KW_P_CS_PRECEDES, "" }, - { "p_sep_by_space", 0, LC_MONETARY, KW_P_SEP_BY_SPACE, "" }, - { "n_cs_precedes", 0, LC_MONETARY, KW_N_CS_PRECEDES, "" }, - { "n_sep_by_space", 0, LC_MONETARY, KW_N_SEP_BY_SPACE, "" }, - { "p_sign_posn", 0, LC_MONETARY, KW_P_SIGN_POSN, "" }, - { "n_sign_posn", 0, LC_MONETARY, KW_N_SIGN_POSN, "" }, - { "int_p_cs_precedes", 0, LC_MONETARY, KW_INT_P_CS_PRECEDES, "" }, - { "int_p_sep_by_space", 0, LC_MONETARY, KW_INT_P_SEP_BY_SPACE, "" }, - { "int_n_cs_precedes", 0, LC_MONETARY, KW_INT_N_CS_PRECEDES, "" }, - { "int_n_sep_by_space", 0, LC_MONETARY, KW_INT_N_SEP_BY_SPACE, "" }, - { "int_p_sign_posn", 0, LC_MONETARY, KW_INT_P_SIGN_POSN, "" }, - { "int_n_sign_posn", 0, LC_MONETARY, KW_INT_N_SIGN_POSN, "" }, + /* LC_TIME - POSIX */ + { "abday", TYPE_STR, LC_TIME, SRC_LTIME, + KW_TIME_ABDAY, "" }, + { "day", TYPE_STR, LC_TIME, SRC_LTIME, + KW_TIME_DAY, "" }, + { "abmon", TYPE_STR, LC_TIME, SRC_LTIME, + KW_TIME_ABMON, "" }, + { "mon", TYPE_STR, LC_TIME, SRC_LTIME, + KW_TIME_MON, "" }, + { "d_t_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + D_T_FMT, "" }, + { "d_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + D_FMT, "" }, + { "t_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + T_FMT, "" }, + { "am_pm", TYPE_STR, LC_TIME, SRC_LTIME, + KW_TIME_AM_PM, "" }, + { "t_fmt_ampm", TYPE_STR, LC_TIME, SRC_LINFO, + T_FMT_AMPM, "" }, + { "era", TYPE_UNQ, LC_TIME, SRC_LINFO, + ERA, "(unavailable)" }, + { "era_d_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + ERA_D_FMT, "(unavailable)" }, + { "era_d_t_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + ERA_D_T_FMT, "(unavailable)" }, + { "era_t_fmt", TYPE_STR, LC_TIME, SRC_LINFO, + ERA_T_FMT, "(unavailable)" }, + { "alt_digits", TYPE_UNQ, LC_TIME, SRC_LINFO, + ALT_DIGITS, "" }, + /* LC_TIME - local additions */ + { "abday_1", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_1, "(FreeBSD only)" }, + { "abday_2", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_2, "(FreeBSD only)" }, + { "abday_3", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_3, "(FreeBSD only)" }, + { "abday_4", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_4, "(FreeBSD only)" }, + { "abday_5", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_5, "(FreeBSD only)" }, + { "abday_6", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_6, "(FreeBSD only)" }, + { "abday_7", TYPE_STR, LC_TIME, SRC_LINFO, + ABDAY_7, "(FreeBSD only)" }, + { "day_1", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_1, "(FreeBSD only)" }, + { "day_2", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_2, "(FreeBSD only)" }, + { "day_3", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_3, "(FreeBSD only)" }, + { "day_4", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_4, "(FreeBSD only)" }, + { "day_5", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_5, "(FreeBSD only)" }, + { "day_6", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_6, "(FreeBSD only)" }, + { "day_7", TYPE_STR, LC_TIME, SRC_LINFO, + DAY_7, "(FreeBSD only)" }, + { "abmon_1", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_1, "(FreeBSD only)" }, + { "abmon_2", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_2, "(FreeBSD only)" }, + { "abmon_3", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_3, "(FreeBSD only)" }, + { "abmon_4", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_4, "(FreeBSD only)" }, + { "abmon_5", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_5, "(FreeBSD only)" }, + { "abmon_6", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_6, "(FreeBSD only)" }, + { "abmon_7", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_7, "(FreeBSD only)" }, + { "abmon_8", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_8, "(FreeBSD only)" }, + { "abmon_9", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_9, "(FreeBSD only)" }, + { "abmon_10", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_10, "(FreeBSD only)" }, + { "abmon_11", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_11, "(FreeBSD only)" }, + { "abmon_12", TYPE_STR, LC_TIME, SRC_LINFO, + ABMON_12, "(FreeBSD only)" }, + { "mon_1", TYPE_STR, LC_TIME, SRC_LINFO, + MON_1, "(FreeBSD only)" }, + { "mon_2", TYPE_STR, LC_TIME, SRC_LINFO, + MON_2, "(FreeBSD only)" }, + { "mon_3", TYPE_STR, LC_TIME, SRC_LINFO, + MON_3, "(FreeBSD only)" }, + { "mon_4", TYPE_STR, LC_TIME, SRC_LINFO, + MON_4, "(FreeBSD only)" }, + { "mon_5", TYPE_STR, LC_TIME, SRC_LINFO, + MON_5, "(FreeBSD only)" }, + { "mon_6", TYPE_STR, LC_TIME, SRC_LINFO, + MON_6, "(FreeBSD only)" }, + { "mon_7", TYPE_STR, LC_TIME, SRC_LINFO, + MON_7, "(FreeBSD only)" }, + { "mon_8", TYPE_STR, LC_TIME, SRC_LINFO, + MON_8, "(FreeBSD only)" }, + { "mon_9", TYPE_STR, LC_TIME, SRC_LINFO, + MON_9, "(FreeBSD only)" }, + { "mon_10", TYPE_STR, LC_TIME, SRC_LINFO, + MON_10, "(FreeBSD only)" }, + { "mon_11", TYPE_STR, LC_TIME, SRC_LINFO, + MON_11, "(FreeBSD only)" }, + { "mon_12", TYPE_STR, LC_TIME, SRC_LINFO, + MON_12, "(FreeBSD only)" }, + { "altmon_1", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_1, "(FreeBSD only)" }, + { "altmon_2", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_2, "(FreeBSD only)" }, + { "altmon_3", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_3, "(FreeBSD only)" }, + { "altmon_4", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_4, "(FreeBSD only)" }, + { "altmon_5", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_5, "(FreeBSD only)" }, + { "altmon_6", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_6, "(FreeBSD only)" }, + { "altmon_7", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_7, "(FreeBSD only)" }, + { "altmon_8", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_8, "(FreeBSD only)" }, + { "altmon_9", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_9, "(FreeBSD only)" }, + { "altmon_10", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_10, "(FreeBSD only)" }, + { "altmon_11", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_11, "(FreeBSD only)" }, + { "altmon_12", TYPE_STR, LC_TIME, SRC_LINFO, + ALTMON_12, "(FreeBSD only)" }, + { "am_str", TYPE_STR, LC_TIME, SRC_LINFO, + AM_STR, "(FreeBSD only)" }, + { "pm_str", TYPE_STR, LC_TIME, SRC_LINFO, + PM_STR, "(FreeBSD only)" }, + { "d_md_order", TYPE_STR, LC_TIME, SRC_LINFO, + D_MD_ORDER, "(FreeBSD only)" }, /* local */ - { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" }, - { "d_fmt", 1, LC_TIME, D_FMT, "" }, - { "t_fmt", 1, LC_TIME, T_FMT, "" }, - { "am_str", 1, LC_TIME, AM_STR, "" }, - { "pm_str", 1, LC_TIME, PM_STR, "" }, - { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" }, - { "day_1", 1, LC_TIME, DAY_1, "" }, - { "day_2", 1, LC_TIME, DAY_2, "" }, - { "day_3", 1, LC_TIME, DAY_3, "" }, - { "day_4", 1, LC_TIME, DAY_4, "" }, - { "day_5", 1, LC_TIME, DAY_5, "" }, - { "day_6", 1, LC_TIME, DAY_6, "" }, - { "day_7", 1, LC_TIME, DAY_7, "" }, - { "abday_1", 1, LC_TIME, ABDAY_1, "" }, - { "abday_2", 1, LC_TIME, ABDAY_2, "" }, - { "abday_3", 1, LC_TIME, ABDAY_3, "" }, - { "abday_4", 1, LC_TIME, ABDAY_4, "" }, - { "abday_5", 1, LC_TIME, ABDAY_5, "" }, - { "abday_6", 1, LC_TIME, ABDAY_6, "" }, - { "abday_7", 1, LC_TIME, ABDAY_7, "" }, - { "mon_1", 1, LC_TIME, MON_1, "" }, - { "mon_2", 1, LC_TIME, MON_2, "" }, - { "mon_3", 1, LC_TIME, MON_3, "" }, - { "mon_4", 1, LC_TIME, MON_4, "" }, - { "mon_5", 1, LC_TIME, MON_5, "" }, - { "mon_6", 1, LC_TIME, MON_6, "" }, - { "mon_7", 1, LC_TIME, MON_7, "" }, - { "mon_8", 1, LC_TIME, MON_8, "" }, - { "mon_9", 1, LC_TIME, MON_9, "" }, - { "mon_10", 1, LC_TIME, MON_10, "" }, - { "mon_11", 1, LC_TIME, MON_11, "" }, - { "mon_12", 1, LC_TIME, MON_12, "" }, - { "abmon_1", 1, LC_TIME, ABMON_1, "" }, - { "abmon_2", 1, LC_TIME, ABMON_2, "" }, - { "abmon_3", 1, LC_TIME, ABMON_3, "" }, - { "abmon_4", 1, LC_TIME, ABMON_4, "" }, - { "abmon_5", 1, LC_TIME, ABMON_5, "" }, - { "abmon_6", 1, LC_TIME, ABMON_6, "" }, - { "abmon_7", 1, LC_TIME, ABMON_7, "" }, - { "abmon_8", 1, LC_TIME, ABMON_8, "" }, - { "abmon_9", 1, LC_TIME, ABMON_9, "" }, - { "abmon_10", 1, LC_TIME, ABMON_10, "" }, - { "abmon_11", 1, LC_TIME, ABMON_11, "" }, - { "abmon_12", 1, LC_TIME, ABMON_12, "" }, - { "altmon_1", 1, LC_TIME, ALTMON_1, "(FreeBSD only)" }, - { "altmon_2", 1, LC_TIME, ALTMON_2, "(FreeBSD only)" }, - { "altmon_3", 1, LC_TIME, ALTMON_3, "(FreeBSD only)" }, - { "altmon_4", 1, LC_TIME, ALTMON_4, "(FreeBSD only)" }, - { "altmon_5", 1, LC_TIME, ALTMON_5, "(FreeBSD only)" }, - { "altmon_6", 1, LC_TIME, ALTMON_6, "(FreeBSD only)" }, - { "altmon_7", 1, LC_TIME, ALTMON_7, "(FreeBSD only)" }, - { "altmon_8", 1, LC_TIME, ALTMON_8, "(FreeBSD only)" }, - { "altmon_9", 1, LC_TIME, ALTMON_9, "(FreeBSD only)" }, - { "altmon_10", 1, LC_TIME, ALTMON_10, "(FreeBSD only)" }, - { "altmon_11", 1, LC_TIME, ALTMON_11, "(FreeBSD only)" }, - { "altmon_12", 1, LC_TIME, ALTMON_12, "(FreeBSD only)" }, - { "era", 1, LC_TIME, ERA, "(unavailable)" }, - { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" }, - { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" }, - { "era_t_fmt", 1, LC_TIME, ERA_T_FMT, "(unavailable)" }, - { "alt_digits", 1, LC_TIME, ALT_DIGITS, "" }, - { "d_md_order", 1, LC_TIME, D_MD_ORDER, - "(FreeBSD only)" }, /* local */ + /* LC_MESSAGES - POSIX */ + { "yesexpr", TYPE_STR, LC_MESSAGES, SRC_LINFO, + YESEXPR, "" }, + { "noexpr", TYPE_STR, LC_MESSAGES, SRC_LINFO, + NOEXPR, "" }, + /* LC_MESSAGES - local additions */ + { "yesstr", TYPE_STR, LC_MESSAGES, SRC_LINFO, + YESSTR, "(POSIX legacy)" }, /* compat */ + { "nostr", TYPE_STR, LC_MESSAGES, SRC_LINFO, + NOSTR, "(POSIX legacy)" } /* compat */ - { "yesexpr", 1, LC_MESSAGES, YESEXPR, "" }, - { "noexpr", 1, LC_MESSAGES, NOEXPR, "" }, - { "yesstr", 1, LC_MESSAGES, YESSTR, - "(POSIX legacy)" }, /* compat */ - { "nostr", 1, LC_MESSAGES, NOSTR, - "(POSIX legacy)" } /* compat */ - }; #define NKWINFO (nitems(kwinfo)) @@ -492,13 +616,20 @@ showlocale(void) } char * -format_grouping(const char *binary) +format_grouping(char *binary) { static char rval[64]; const char *cp; size_t roff; int len; + /* + * XXX This check will need to be modified if/when localeconv() is + * fixed (PR172215). + */ + if (*binary == CHAR_MAX) + return (binary); + rval[0] = '\0'; roff = 0; for (cp = binary; *cp != '\0'; ++cp) { @@ -522,7 +653,7 @@ format_grouping(const char *binary) } /* - * keyword value lookup helper (via localeconv()) + * keyword value lookup helper for values accessible via localeconv() */ char * kwval_lconv(int id) @@ -606,24 +737,94 @@ kwval_lconv(int id) } /* + * keyword value lookup helper for LC_TIME keywords not accessible + * via nl_langinfo() or localeconv() + */ +static char * +kwval_ltime(int id) +{ + char *rval; + struct sbuf *kwsbuf; + nl_item i, s_item = 0, e_item = 0; + + switch (id) { + case KW_TIME_DAY: + s_item = DAY_1; + e_item = DAY_7; + break; + case KW_TIME_ABDAY: + s_item = ABDAY_1; + e_item = ABDAY_7; + break; + case KW_TIME_MON: + s_item = MON_1; + e_item = MON_12; + break; + case KW_TIME_ABMON: + s_item = ABMON_1; + e_item = ABMON_12; + break; + case KW_TIME_AM_PM: + if (asprintf(&rval, "%s;%s", + nl_langinfo(AM_STR), + nl_langinfo(PM_STR)) == -1) + err(1, "asprintf"); + return (rval); + } + + kwsbuf = sbuf_new_auto(); + if (kwsbuf == NULL) + err(1, "sbuf"); + for (i = s_item; i <= e_item; i++) { + (void) sbuf_cat(kwsbuf, nl_langinfo(i)); + if (i != e_item) + (void) sbuf_cat(kwsbuf, ";"); + } + (void) sbuf_finish(kwsbuf); + rval = strdup(sbuf_data(kwsbuf)); + if (rval == NULL) + err(1, "strdup"); + sbuf_delete(kwsbuf); + return (rval); +} + +/* * keyword value and properties lookup */ int -kwval_lookup(const char *kwname, char **kwval, int *cat, int *isstr) +kwval_lookup(const char *kwname, char **kwval, int *cat, int *type, int *alloc) { int rval; size_t i; + static char nastr[3] = "-1"; rval = 0; + *alloc = 0; for (i = 0; i < NKWINFO; i++) { if (strcasecmp(kwname, kwinfo[i].name) == 0) { rval = 1; *cat = kwinfo[i].catid; - *isstr = kwinfo[i].isstr; - if (kwinfo[i].value_ref < KW_ZERO) { + *type = kwinfo[i].type; + switch (kwinfo[i].source) { + case SRC_LINFO: *kwval = nl_langinfo(kwinfo[i].value_ref); - } else { + break; + case SRC_LCONV: *kwval = kwval_lconv(kwinfo[i].value_ref); + /* + * XXX This check will need to be modified + * if/when localeconv() is fixed (PR172215). + */ + if (**kwval == CHAR_MAX) { + if (*type == TYPE_NUM) + *type = TYPE_UNQ; + *kwval = nastr; + } + break; + case SRC_LTIME: + *kwval = kwval_ltime(kwinfo[i].value_ref); + *alloc = 1; + break; } break; } @@ -639,10 +840,10 @@ kwval_lookup(const char *kwname, char **kwval, int *ca void showdetails(const char *kw) { - int isstr, cat, tmpval; + int type, cat, tmpval, alloc; char *kwval; - if (kwval_lookup(kw, &kwval, &cat, &isstr) == 0) { + if (kwval_lookup(kw, &kwval, &cat, &type, &alloc) == 0) { /* * invalid keyword specified. * XXX: any actions? @@ -659,22 +860,35 @@ showdetails(const char *kw) } if (prt_keywords) { - if (isstr) { - printf("%s=\"%s\"\n", kw, kwval); - } else { - tmpval = (char) *kwval; + switch (type) { + case TYPE_NUM: + tmpval = (char)*kwval; printf("%s=%d\n", kw, tmpval); + break; + case TYPE_STR: + printf("%s=\"%s\"\n", kw, kwval); + break; + case TYPE_UNQ: + printf("%s=%s\n", kw, kwval); + break; } } if (!prt_categories && !prt_keywords) { - if (isstr) { - printf("%s\n", kwval); - } else { - tmpval = (char) *kwval; + switch (type) { + case TYPE_NUM: + tmpval = (char)*kwval; printf("%d\n", tmpval); + break; + case TYPE_STR: + case TYPE_UNQ: + printf("%s\n", kwval); + break; } } + + if (alloc) + free(kwval); } /* @@ -718,7 +932,7 @@ showkeywordslist(char *substring) printf(FMT, kwinfo[i].name, lookup_localecat(kwinfo[i].catid), - (kwinfo[i].isstr == 0) ? "number" : "string", + (kwinfo[i].type == TYPE_NUM) ? "number" : "string", kwinfo[i].comment); } } Modified: stable/12/usr.bin/locale/tests/Makefile ============================================================================== --- head/usr.bin/locale/tests/Makefile Tue Sep 10 15:09:46 2019 (r352138) +++ stable/12/usr.bin/locale/tests/Makefile Mon Sep 16 16:17:29 2019 (r352416) @@ -8,5 +8,9 @@ ${PACKAGE}FILES+= k_flag_posix_monetary.out ${PACKAGE}FILES+= k_flag_posix_numeric.out ${PACKAGE}FILES+= k_flag_posix_time.out ${PACKAGE}FILES+= k_flag_posix_messages.out +${PACKAGE}FILES+= no_flags_posix_monetary.out +${PACKAGE}FILES+= no_flags_posix_numeric.out +${PACKAGE}FILES+= no_flags_posix_time.out +${PACKAGE}FILES+= no_flags_posix_messages.out .include Modified: stable/12/usr.bin/locale/tests/k_flag_posix_monetary.out ============================================================================== --- head/usr.bin/locale/tests/k_flag_posix_monetary.out Tue Sep 10 15:09:46 2019 (r352138) +++ stable/12/usr.bin/locale/tests/k_flag_posix_monetary.out Mon Sep 16 16:17:29 2019 (r352416) @@ -2,20 +2,20 @@ int_curr_symbol="" currency_symbol="" mon_decimal_point="" mon_thousands_sep="" -mon_grouping="127" +mon_grouping=-1 positive_sign="" negative_sign="" -int_frac_digits=127 -frac_digits=127 -p_cs_precedes=127 -p_sep_by_space=127 -n_cs_precedes=127 -n_sep_by_space=127 -p_sign_posn=127 -n_sign_posn=127 -int_p_cs_precedes=127 -int_n_cs_precedes=127 -int_p_sep_by_space=127 -int_n_sep_by_space=127 -int_p_sign_posn=127 -int_n_sign_posn=127 +int_frac_digits=-1 +frac_digits=-1 +p_cs_precedes=-1 +p_sep_by_space=-1 +n_cs_precedes=-1 +n_sep_by_space=-1 +p_sign_posn=-1 +n_sign_posn=-1 +int_p_cs_precedes=-1 +int_n_cs_precedes=-1 +int_p_sep_by_space=-1 +int_n_sep_by_space=-1 +int_p_sign_posn=-1 +int_n_sign_posn=-1 Modified: stable/12/usr.bin/locale/tests/k_flag_posix_numeric.out ============================================================================== --- head/usr.bin/locale/tests/k_flag_posix_numeric.out Tue Sep 10 15:09:46 2019 (r352138) +++ stable/12/usr.bin/locale/tests/k_flag_posix_numeric.out Mon Sep 16 16:17:29 2019 (r352416) @@ -1,3 +1,3 @@ decimal_point="." thousands_sep="" -grouping="127" +grouping=-1 Modified: stable/12/usr.bin/locale/tests/k_flag_posix_time.out ============================================================================== --- head/usr.bin/locale/tests/k_flag_posix_time.out Tue Sep 10 15:09:46 2019 (r352138) +++ stable/12/usr.bin/locale/tests/k_flag_posix_time.out Mon Sep 16 16:17:29 2019 (r352416) @@ -1,14 +1,14 @@ -abday="Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat" -day="Sunday";"Monday";"Tuesday";"Wednesday";"Thursday";"Friday";"Saturday" -abmon="Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec" -mon="January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December" +abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat" +day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday" +abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec" +mon="January;February;March;April;May;June;July;August;September;October;November;December" d_t_fmt="%a %b %e %H:%M:%S %Y" d_fmt="%m/%d/%y" t_fmt="%H:%M:%S" -am_pm="AM";"PM" +am_pm="AM;PM" t_fmt_ampm="%I:%M:%S %p" -era="" +era= era_d_fmt="" era_t_fmt="" era_d_t_fmt="" -alt_digits="" +alt_digits= Modified: stable/12/usr.bin/locale/tests/locale_test.sh ============================================================================== --- head/usr.bin/locale/tests/locale_test.sh Tue Sep 10 15:09:46 2019 (r352138) +++ stable/12/usr.bin/locale/tests/locale_test.sh Mon Sep 16 16:17:29 2019 (r352416) @@ -29,7 +29,8 @@ atf_test_case k_flag_posix k_flag_posix_head() { - atf_set "descr" "Verify -k handles all POSIX specified keywords" + atf_set "descr" \ + "Verify output of 'locale -k' for all POSIX specified keywords" } k_flag_posix_body() { @@ -92,7 +93,75 @@ k_flag_posix_body() noexpr } +atf_test_case no_flags_posix +no_flags_posix_head() +{ + atf_set "descr" \ + "Verify output of 'locale' for all POSIX specified keywords" +} +no_flags_posix_body() +{ + export LC_ALL="C" + + # LC_MONETARY + atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_monetary.out" \ + locale \ + int_curr_symbol \ + currency_symbol \ + mon_decimal_point \ + mon_thousands_sep \ + mon_grouping \ + positive_sign \ + negative_sign \ + int_frac_digits \ + frac_digits \ + p_cs_precedes \ + p_sep_by_space \ + n_cs_precedes \ + n_sep_by_space \ + p_sign_posn \ + n_sign_posn \ + int_p_cs_precedes \ + int_n_cs_precedes \ + int_p_sep_by_space \ + int_n_sep_by_space \ + int_p_sign_posn \ + int_n_sign_posn + + # LC_NUMERIC + atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_numeric.out" \ + locale \ + decimal_point \ + thousands_sep \ + grouping + + # LC_TIME + atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_time.out" \ + locale \ + abday \ + day \ + abmon \ + mon \ + d_t_fmt \ + d_fmt \ + t_fmt \ + am_pm \ + t_fmt_ampm \ + era \ + era_d_fmt \ + era_t_fmt \ + era_d_t_fmt \ + alt_digits + + # LC_MESSAGES + atf_check -o file:"$(atf_get_srcdir)/no_flags_posix_messages.out" \ + locale \ + yesexpr \ + noexpr +} + atf_init_test_cases() { atf_add_test_case k_flag_posix + atf_add_test_case no_flags_posix } Copied: stable/12/usr.bin/locale/tests/no_flags_posix_messages.out (from r352214, head/usr.bin/locale/tests/no_flags_posix_messages.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.bin/locale/tests/no_flags_posix_messages.out Mon Sep 16 16:17:29 2019 (r352416, copy of r352214, head/usr.bin/locale/tests/no_flags_posix_messages.out) @@ -0,0 +1,2 @@ +^[yY] +^[nN] Copied: stable/12/usr.bin/locale/tests/no_flags_posix_monetary.out (from r352214, head/usr.bin/locale/tests/no_flags_posix_monetary.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.bin/locale/tests/no_flags_posix_monetary.out Mon Sep 16 16:17:29 2019 (r352416, copy of r352214, head/usr.bin/locale/tests/no_flags_posix_monetary.out) @@ -0,0 +1,21 @@ + + + + +-1 + + +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 Copied: stable/12/usr.bin/locale/tests/no_flags_posix_numeric.out (from r352214, head/usr.bin/locale/tests/no_flags_posix_numeric.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.bin/locale/tests/no_flags_posix_numeric.out Mon Sep 16 16:17:29 2019 (r352416, copy of r352214, head/usr.bin/locale/tests/no_flags_posix_numeric.out) @@ -0,0 +1,3 @@ +. + +-1 Copied: stable/12/usr.bin/locale/tests/no_flags_posix_time.out (from r352214, head/usr.bin/locale/tests/no_flags_posix_time.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.bin/locale/tests/no_flags_posix_time.out Mon Sep 16 16:17:29 2019 (r352416, copy of r352214, head/usr.bin/locale/tests/no_flags_posix_time.out) @@ -0,0 +1,14 @@ +Sun;Mon;Tue;Wed;Thu;Fri;Sat +Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday +Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec +January;February;March;April;May;June;July;August;September;October;November;December +%a %b %e %H:%M:%S %Y +%m/%d/%y +%H:%M:%S +AM;PM +%I:%M:%S %p + + + + + From owner-svn-src-all@freebsd.org Mon Sep 16 16:41: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 C8AB212705A; Mon, 16 Sep 2019 16:41:01 +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 46XBnn4hN4z3PTb; Mon, 16 Sep 2019 16:41:01 +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 856862302C; Mon, 16 Sep 2019 16:41:01 +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 x8GGf1D4017638; Mon, 16 Sep 2019 16:41:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GGf1p8017637; Mon, 16 Sep 2019 16:41:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909161641.x8GGf1p8017637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 16 Sep 2019 16:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352417 - head/sys/fs/fuse X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/fs/fuse X-SVN-Commit-Revision: 352417 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 16:41:01 -0000 Author: asomers Date: Mon Sep 16 16:41:01 2019 New Revision: 352417 URL: https://svnweb.freebsd.org/changeset/base/352417 Log: Fix an off-by-one error from r351961 That revision addressed a Coverity CID that could lead to a buffer overflow, but it had an off-by-one error in the buffer size check. Reported by: Coverity Coverity CID: 1405530 MFC after: 3 days MFC-With: 351961 Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/fuse/fuse_internal.c Modified: head/sys/fs/fuse/fuse_internal.c ============================================================================== --- head/sys/fs/fuse/fuse_internal.c Mon Sep 16 16:17:29 2019 (r352416) +++ head/sys/fs/fuse/fuse_internal.c Mon Sep 16 16:41:01 2019 (r352417) @@ -390,7 +390,7 @@ fuse_internal_invalidate_entry(struct mount *mp, struc if ((err = uiomove(&fnieo, sizeof(fnieo), uio)) != 0) return (err); - if (fnieo.namelen > sizeof(name)) + if (fnieo.namelen >= sizeof(name)) return (EINVAL); if ((err = uiomove(name, fnieo.namelen, uio)) != 0) From owner-svn-src-all@freebsd.org Mon Sep 16 18:23: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 DB6E6E8B67; Mon, 16 Sep 2019 18:23:01 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XF3T5VFsz3ySn; Mon, 16 Sep 2019 18:23:01 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A15C324309; Mon, 16 Sep 2019 18:23:01 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GIN1T2089685; Mon, 16 Sep 2019 18:23:01 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GIN15Q089684; Mon, 16 Sep 2019 18:23:01 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909161823.x8GIN15Q089684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Mon, 16 Sep 2019 18:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352418 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352418 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 18:23:01 -0000 Author: johalun Date: Mon Sep 16 18:23:01 2019 New Revision: 352418 URL: https://svnweb.freebsd.org/changeset/base/352418 Log: LinuxKPI: Limit exposure of new field in dev_pm_ops to LinuxKPI >= 50000. This will fix a suspend/resume issue that occurs on drm-kmod packages build on 12.0 and run on 12.1. Approved by: imp (mentor) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/device.h Mon Sep 16 16:41:01 2019 (r352417) +++ stable/12/sys/compat/linuxkpi/common/include/linux/device.h Mon Sep 16 18:23:01 2019 (r352418) @@ -60,7 +60,9 @@ struct class { }; struct dev_pm_ops { +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 int (*prepare)(struct device *dev); +#endif int (*suspend)(struct device *dev); int (*suspend_late)(struct device *dev); int (*resume)(struct device *dev); From owner-svn-src-all@freebsd.org Mon Sep 16 18:40: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 0D5FCE926C; Mon, 16 Sep 2019 18:40:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46XFRb6cf8z405l; Mon, 16 Sep 2019 18:40:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7A04244F5; Mon, 16 Sep 2019 18:40:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GIeREP097442; Mon, 16 Sep 2019 18:40:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GIeR5s097441; Mon, 16 Sep 2019 18:40:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909161840.x8GIeR5s097441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Sep 2019 18:40:27 +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: r352419 - stable/12/sys/fs/fuse X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/fs/fuse X-SVN-Commit-Revision: 352419 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 18:40:28 -0000 Author: markj Date: Mon Sep 16 18:40:27 2019 New Revision: 352419 URL: https://svnweb.freebsd.org/changeset/base/352419 Log: MFC r351613: Remove unused VM page locking macros. This completes the merge of the revision. r352043 updated only the merge info for some reason. Reported by: alc Modified: stable/12/sys/fs/fuse/fuse_vnops.c Modified: stable/12/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/12/sys/fs/fuse/fuse_vnops.c Mon Sep 16 18:23:01 2019 (r352418) +++ stable/12/sys/fs/fuse/fuse_vnops.c Mon Sep 16 18:40:27 2019 (r352419) @@ -226,11 +226,6 @@ struct vop_vector fuse_vnops = { int fuse_pbuf_freecnt = -1; -#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 Mon Sep 16 20:26: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 ECD73EB906; Mon, 16 Sep 2019 20:26:53 +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 46XHpP5zGhz45s6; Mon, 16 Sep 2019 20:26:53 +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 AC16C258E1; Mon, 16 Sep 2019 20:26:53 +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 x8GKQrqk063975; Mon, 16 Sep 2019 20:26:53 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GKQreB063974; Mon, 16 Sep 2019 20:26:53 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909162026.x8GKQreB063974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 16 Sep 2019 20:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352420 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 352420 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 20:26:54 -0000 Author: tsoome Date: Mon Sep 16 20:26:53 2019 New Revision: 352420 URL: https://svnweb.freebsd.org/changeset/base/352420 Log: loader_4th: scan_buffer can leave empty string on stack When the file processing is done, we will have string with lenght 0 in stack and we will attempt to allocate 0 bytes. Modified: head/stand/forth/support.4th Modified: head/stand/forth/support.4th ============================================================================== --- head/stand/forth/support.4th Mon Sep 16 18:40:27 2019 (r352419) +++ head/stand/forth/support.4th Mon Sep 16 20:26:53 2019 (r352420) @@ -363,6 +363,7 @@ variable fd ; : line_buffer_resize ( len -- len ) + dup 0= if exit then >r line_buffer .len @ if line_buffer .addr @ @@ -376,6 +377,7 @@ variable fd ; : append_to_line_buffer ( addr len -- ) + dup 0= if 2drop exit then line_buffer strget 2swap strcat line_buffer .len ! From owner-svn-src-all@freebsd.org Mon Sep 16 20:28: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 CA728EB99C; Mon, 16 Sep 2019 20:28: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 46XHqs3LwCz461P; Mon, 16 Sep 2019 20:28: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 56203258E2; Mon, 16 Sep 2019 20:28: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 x8GKS9LC064080; Mon, 16 Sep 2019 20:28:09 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GKS9jK064079; Mon, 16 Sep 2019 20:28:09 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909162028.x8GKS9jK064079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 16 Sep 2019 20:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352421 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352421 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 20:28:09 -0000 Author: tsoome Date: Mon Sep 16 20:28:08 2019 New Revision: 352421 URL: https://svnweb.freebsd.org/changeset/base/352421 Log: loader: Malloc(0) should return NULL. We really should not allocate anything with size 0. Modified: head/stand/libsa/zalloc_malloc.c Modified: head/stand/libsa/zalloc_malloc.c ============================================================================== --- head/stand/libsa/zalloc_malloc.c Mon Sep 16 20:26:53 2019 (r352420) +++ head/stand/libsa/zalloc_malloc.c Mon Sep 16 20:28:08 2019 (r352421) @@ -55,6 +55,9 @@ Malloc(size_t bytes, const char *file, int line) { Guard *res; + if (bytes == 0) + return (NULL); + #ifdef USEENDGUARD bytes += MALLOCALIGN + 1; #else From owner-svn-src-all@freebsd.org Mon Sep 16 20:41: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 E62F0EBE8E; Mon, 16 Sep 2019 20:41:37 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XJ7P5vJkz471w; Mon, 16 Sep 2019 20:41:37 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD96D25C03; Mon, 16 Sep 2019 20:41:37 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GKfboh071793; Mon, 16 Sep 2019 20:41:37 GMT (envelope-from dmgk@FreeBSD.org) Received: (from dmgk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GKfbmT071792; Mon, 16 Sep 2019 20:41:37 GMT (envelope-from dmgk@FreeBSD.org) Message-Id: <201909162041.x8GKfbmT071792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dmgk set sender to dmgk@FreeBSD.org using -f From: Dmitri Goutnik Date: Mon, 16 Sep 2019 20:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352422 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: dmgk X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 352422 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 20:41:38 -0000 Author: dmgk (ports committer) Date: Mon Sep 16 20:41:37 2019 New Revision: 352422 URL: https://svnweb.freebsd.org/changeset/base/352422 Log: Add myself (dmgk) as a ports committer Approved by: tz (mentor) Differential Revision: https://reviews.freebsd.org/D21672 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Mon Sep 16 20:28:08 2019 (r352421) +++ head/share/misc/committers-ports.dot Mon Sep 16 20:41:37 2019 (r352422) @@ -96,6 +96,7 @@ decke [label="Bernhard Froehlich\ndecke@FreeBSD.org\n2 delphij [label="Xin Li\ndelphij@FreeBSD.org\n2006/05/01"] demon [label="Dmitry Sivachenko\ndemon@FreeBSD.org\n2000/11/13"] dhn [label="Dennis Herrmann\ndhn@FreeBSD.org\n2009/03/03"] +dmgk [label="Dmitri Goutnik\dmgk@FreeBSD.org\n2019/09/15"] dryice [label="Dryice Dong Liu\ndryice@FreeBSD.org\n2006/12/25"] dteske [label="Devin Teske\ndteske@FreeBSD.org\n2018/03/01"] dumbbell [label="Jean-Sebastien Pedron\ndumbbell@FreeBSD.org\n2017/01/10"] @@ -304,6 +305,7 @@ amdmi3 -> arrowd antoine -> dumbbell +araujo -> dmgk araujo -> egypcio araujo -> jhixson araujo -> lippe @@ -736,6 +738,7 @@ timur -> kbowling tmclaugh -> itetcu tmclaugh -> xride +tz -> dmgk tz -> joneum tz -> fernape tz -> mfechner From owner-svn-src-all@freebsd.org Mon Sep 16 20:43: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 64A14EBF51; Mon, 16 Sep 2019 20:43:21 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XJ9P20qlz47Ch; Mon, 16 Sep 2019 20:43:21 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 282B125C5D; Mon, 16 Sep 2019 20:43:21 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GKhKkt075769; Mon, 16 Sep 2019 20:43:20 GMT (envelope-from dmgk@FreeBSD.org) Received: (from dmgk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GKhKQn075768; Mon, 16 Sep 2019 20:43:20 GMT (envelope-from dmgk@FreeBSD.org) Message-Id: <201909162043.x8GKhKQn075768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dmgk set sender to dmgk@FreeBSD.org using -f From: Dmitri Goutnik Date: Mon, 16 Sep 2019 20:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352423 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: dmgk X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 352423 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 20:43:21 -0000 Author: dmgk (ports committer) Date: Mon Sep 16 20:43:20 2019 New Revision: 352423 URL: https://svnweb.freebsd.org/changeset/base/352423 Log: Add myself (dmgk) to calendar.freebsd Approved by: tz (mentor) Differential Revision: https://reviews.freebsd.org/D21675 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Sep 16 20:41:37 2019 (r352422) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Sep 16 20:43:20 2019 (r352423) @@ -446,6 +446,7 @@ 11/28 Nik Clayton born in Peterborough, United Kingdom, 1973 11/28 Stanislav Sedov born in Chelyabinsk, USSR, 1985 11/29 Doug Moore born in Arlington, Texas, United States, 1960 +11/30 Dmitri Goutnik born in Minsk, USSR, 1969 12/01 Hajimu Umemoto born in Nara, Japan, 1961 12/01 Alexey Dokuchaev born in Magadan, USSR, 1980 12/02 Ermal Luçi born in Tirane, Albania, 1980 From owner-svn-src-all@freebsd.org Mon Sep 16 21:31: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 BA896ED10B; Mon, 16 Sep 2019 21:31: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 46XKDS4cClz49kp; Mon, 16 Sep 2019 21:31: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 68FEE264C5; Mon, 16 Sep 2019 21:31: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 x8GLV4bC001664; Mon, 16 Sep 2019 21:31:04 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GLV2bt001656; Mon, 16 Sep 2019 21:31:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909162131.x8GLV2bt001656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 16 Sep 2019 21:31:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352424 - in head/sys: cddl/compat/opensolaris/kern kern sys vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: cddl/compat/opensolaris/kern kern sys vm X-SVN-Commit-Revision: 352424 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 21:31:04 -0000 Author: mjg Date: Mon Sep 16 21:31:02 2019 New Revision: 352424 URL: https://svnweb.freebsd.org/changeset/base/352424 Log: vfs: manage mnt_ref with atomics New primitive is introduced to denote sections can operate locklessly on aspects of struct mount, but which can also be disabled if necessary. This provides an opportunity to start scaling common case modifications while providing stable state of the struct when facing unmount, write suspendion or other events. mnt_ref is the first counter to start being managed in this manner with the intent to make it per-cpu. Reviewed by: kib, jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21425 Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/kern/subr_pcpu.c head/sys/kern/vfs_default.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_mountroot.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h head/sys/vm/uma.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 16 21:31:02 2019 (r352424) @@ -242,6 +242,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); VOP_UNLOCK(vp, 0); + vfs_op_exit(mp); vfs_unbusy(mp); *vpp = mvp; return (0); Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/kern/subr_pcpu.c Mon Sep 16 21:31:02 2019 (r352424) @@ -131,15 +131,19 @@ SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_start /* * UMA_PCPU_ZONE zones, that are available for all kernel - * consumers. Right now 64 bit zone is used for counter(9). + * consumers. Right now 64 bit zone is used for counter(9) + * and int zone is used for mount point counters. */ +uma_zone_t pcpu_zone_int; uma_zone_t pcpu_zone_64; static void pcpu_zones_startup(void) { + pcpu_zone_int = uma_zcreate("int pcpu", sizeof(int), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/kern/vfs_default.c Mon Sep 16 21:31:02 2019 (r352424) @@ -601,17 +601,24 @@ vop_stdgetwritemount(ap) */ vp = ap->a_vp; mp = vp->v_mount; - if (mp == NULL) - goto out; - MNT_ILOCK(mp); - if (mp != vp->v_mount) { + if (mp == NULL) { + *(ap->a_mpp) = NULL; + return (0); + } + if (vfs_op_thread_enter(mp)) { + if (mp == vp->v_mount) + MNT_REF_UNLOCKED(mp); + else + mp = NULL; + vfs_op_thread_exit(mp); + } else { + MNT_ILOCK(mp); + if (mp == vp->v_mount) + MNT_REF(mp); + else + mp = NULL; MNT_IUNLOCK(mp); - mp = NULL; - goto out; } - MNT_REF(mp); - MNT_IUNLOCK(mp); -out: *(ap->a_mpp) = mp; return (0); } Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/kern/vfs_mount.c Mon Sep 16 21:31:02 2019 (r352424) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -123,6 +124,10 @@ mount_init(void *mem, int size, int flags) mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); mtx_init(&mp->mnt_listmtx, "struct mount vlist mtx", NULL, MTX_DEF); lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); + mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + M_WAITOK | M_ZERO); + mp->mnt_ref = 0; + mp->mnt_vfs_ops = 1; return (0); } @@ -132,6 +137,7 @@ mount_fini(void *mem, int size) struct mount *mp; mp = (struct mount *)mem; + uma_zfree_pcpu(pcpu_zone_int, mp->mnt_thread_in_ops_pcpu); lockdestroy(&mp->mnt_explock); mtx_destroy(&mp->mnt_listmtx); mtx_destroy(&mp->mnt_mtx); @@ -445,6 +451,12 @@ vfs_ref(struct mount *mp) { CTR2(KTR_VFS, "%s: mp %p", __func__, mp); + if (vfs_op_thread_enter(mp)) { + MNT_REF_UNLOCKED(mp); + vfs_op_thread_exit(mp); + return; + } + MNT_ILOCK(mp); MNT_REF(mp); MNT_IUNLOCK(mp); @@ -455,6 +467,12 @@ vfs_rel(struct mount *mp) { CTR2(KTR_VFS, "%s: mp %p", __func__, mp); + if (vfs_op_thread_enter(mp)) { + MNT_REL_UNLOCKED(mp); + vfs_op_thread_exit(mp); + return; + } + MNT_ILOCK(mp); MNT_REL(mp); MNT_IUNLOCK(mp); @@ -478,7 +496,12 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp mp->mnt_activevnodelistsize = 0; TAILQ_INIT(&mp->mnt_tmpfreevnodelist); mp->mnt_tmpfreevnodelistsize = 0; - mp->mnt_ref = 0; + if (mp->mnt_ref != 0 || mp->mnt_lockref != 0 || + mp->mnt_writeopcount != 0) + panic("%s: non-zero counters on new mp %p\n", __func__, mp); + if (mp->mnt_vfs_ops != 1) + panic("%s: vfs_ops should be 1 but %d found\n", __func__, + mp->mnt_vfs_ops); (void) vfs_busy(mp, MBF_NOWAIT); atomic_add_acq_int(&vfsp->vfc_refcount, 1); mp->mnt_op = vfsp->vfc_vfsops; @@ -507,6 +530,9 @@ void vfs_mount_destroy(struct mount *mp) { + if (mp->mnt_vfs_ops == 0) + panic("%s: entered with zero vfs_ops\n", __func__); + MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_REFEXPIRE; if (mp->mnt_kern_flag & MNTK_MWAIT) { @@ -540,6 +566,11 @@ vfs_mount_destroy(struct mount *mp) if (mp->mnt_lockref != 0) panic("vfs_mount_destroy: nonzero lock refcount"); MNT_IUNLOCK(mp); + + if (mp->mnt_vfs_ops != 1) + panic("%s: vfs_ops should be 1 but %d found\n", __func__, + mp->mnt_vfs_ops); + if (mp->mnt_vnodecovered != NULL) vrele(mp->mnt_vnodecovered); #ifdef MAC @@ -951,6 +982,7 @@ vfs_domount_first( vrele(newdp); if ((mp->mnt_flag & MNT_RDONLY) == 0) vfs_allocate_syncvnode(mp); + vfs_op_exit(mp); vfs_unbusy(mp); return (0); } @@ -1019,6 +1051,8 @@ vfs_domount_update( VI_UNLOCK(vp); VOP_UNLOCK(vp, 0); + vfs_op_enter(mp); + MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { MNT_IUNLOCK(mp); @@ -1100,6 +1134,7 @@ vfs_domount_update( else vfs_deallocate_syncvnode(mp); end: + vfs_op_exit(mp); vfs_unbusy(mp); VI_LOCK(vp); vp->v_iflag &= ~VI_MOUNT; @@ -1328,6 +1363,7 @@ dounmount_cleanup(struct mount *mp, struct vnode *cove mp->mnt_kern_flag &= ~MNTK_MWAIT; wakeup(mp); } + vfs_op_exit_locked(mp); MNT_IUNLOCK(mp); if (coveredvp != NULL) { VOP_UNLOCK(coveredvp, 0); @@ -1337,6 +1373,69 @@ dounmount_cleanup(struct mount *mp, struct vnode *cove } /* + * There are various reference counters associated with the mount point. + * Normally it is permitted to modify them without taking the mnt ilock, + * but this behavior can be temporarily disabled if stable value is needed + * or callers are expected to block (e.g. to not allow new users during + * forced unmount). + */ +void +vfs_op_enter(struct mount *mp) +{ + + MNT_ILOCK(mp); + mp->mnt_vfs_ops++; + if (mp->mnt_vfs_ops > 1) { + MNT_IUNLOCK(mp); + return; + } + /* + * Paired with a fence in vfs_op_thread_enter(). See the comment + * above it for details. + */ + atomic_thread_fence_seq_cst(); + vfs_op_barrier_wait(mp); + MNT_IUNLOCK(mp); +} + +void +vfs_op_exit_locked(struct mount *mp) +{ + + mtx_assert(MNT_MTX(mp), MA_OWNED); + + if (mp->mnt_vfs_ops <= 0) + panic("%s: invalid vfs_ops count %d for mp %p\n", + __func__, mp->mnt_vfs_ops, mp); + mp->mnt_vfs_ops--; +} + +void +vfs_op_exit(struct mount *mp) +{ + + MNT_ILOCK(mp); + vfs_op_exit_locked(mp); + MNT_IUNLOCK(mp); +} + +/* + * It is assumed the caller already posted at least an acquire barrier. + */ +void +vfs_op_barrier_wait(struct mount *mp) +{ + int *in_op; + int cpu; + + CPU_FOREACH(cpu) { + in_op = zpcpu_get_cpu(mp->mnt_thread_in_ops_pcpu, cpu); + while (atomic_load_int(in_op)) + cpu_spinwait(); + } +} + +/* * Do the actual filesystem unmount. */ int @@ -1379,6 +1478,8 @@ dounmount(struct mount *mp, int flags, struct thread * return (error); } + vfs_op_enter(mp); + vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || @@ -1469,6 +1570,7 @@ dounmount(struct mount *mp, int flags, struct thread * mp->mnt_kern_flag &= ~MNTK_MWAIT; wakeup(mp); } + vfs_op_exit_locked(mp); MNT_IUNLOCK(mp); if (coveredvp) VOP_UNLOCK(coveredvp, 0); Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/kern/vfs_mountroot.c Mon Sep 16 21:31:02 2019 (r352424) @@ -273,6 +273,7 @@ vfs_mountroot_devfs(struct thread *td, struct mount ** *mpp = mp; rootdevmp = mp; + vfs_op_exit(mp); } set_rootvnode(); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/kern/vfs_subr.c Mon Sep 16 21:31:02 2019 (r352424) @@ -4032,6 +4032,7 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_secondary_accwrites); db_printf(" mnt_gjprovider = %s\n", mp->mnt_gjprovider != NULL ? mp->mnt_gjprovider : "NULL"); + db_printf(" mnt_vfs_ops = %d\n", mp->mnt_vfs_ops); db_printf("\n\nList of active vnodes\n"); TAILQ_FOREACH(vp, &mp->mnt_activevnodelist, v_actfreelist) { Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/sys/mount.h Mon Sep 16 21:31:02 2019 (r352424) @@ -226,6 +226,8 @@ struct mount { struct lock mnt_explock; /* vfs_export walkers lock */ TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ + int mnt_vfs_ops; /* (i) pending vfs ops */ + int *mnt_thread_in_ops_pcpu; }; /* @@ -265,15 +267,26 @@ void __mnt_vnode_markerfree_active(struct vno #define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx) #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx) #define MNT_MTX(mp) (&(mp)->mnt_mtx) + +#define MNT_REF_UNLOCKED(mp) do { \ + atomic_add_int(&(mp)->mnt_ref, 1); \ +} while (0) +#define MNT_REL_UNLOCKED(mp) do { \ + int _c; \ + _c = atomic_fetchadd_int(&(mp)->mnt_ref, -1) - 1; \ + KASSERT(_c >= 0, ("negative mnt_ref %d", _c)); \ +} while (0) + #define MNT_REF(mp) do { \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ - (mp)->mnt_ref++; \ + atomic_add_int(&(mp)->mnt_ref, 1); \ } while (0) #define MNT_REL(mp) do { \ + int _c; \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ - KASSERT((mp)->mnt_ref > 0, ("negative mnt_ref")); \ - (mp)->mnt_ref--; \ - if ((mp)->mnt_ref == 0) \ + _c = atomic_fetchadd_int(&(mp)->mnt_ref, -1) - 1; \ + KASSERT(_c >= 0, ("negative mnt_ref %d", _c)); \ + if (_c == 0) \ wakeup((mp)); \ } while (0) @@ -940,6 +953,48 @@ vfs_sysctl_t vfs_stdsysctl; void syncer_suspend(void); void syncer_resume(void); + +void vfs_op_barrier_wait(struct mount *); +void vfs_op_enter(struct mount *); +void vfs_op_exit_locked(struct mount *); +void vfs_op_exit(struct mount *); + +/* + * We mark ourselves as entering the section and post a sequentially consistent + * fence, meaning the store is completed before we get into the section and + * mnt_vfs_ops is only read afterwards. + * + * Any thread transitioning the ops counter 0->1 does things in the opposite + * order - first bumps the count, posts a sequentially consistent fence and + * observes all CPUs not executing within the section. + * + * This provides an invariant that by the time the last CPU is observed not + * executing, everyone else entering will see the counter > 0 and exit. + * + * Note there is no barrier between vfs_ops and the rest of the code in the + * section. It is not necessary as the writer has to wait for everyone to drain + * before making any changes or only make changes safe while the section is + * executed. + */ + +#define vfs_op_thread_enter(mp) ({ \ + struct mount *_mp = (mp); \ + bool _retval = true; \ + critical_enter(); \ + *(int *)zpcpu_get(_mp->mnt_thread_in_ops_pcpu) = 1; \ + atomic_thread_fence_seq_cst(); \ + if (__predict_false(_mp->mnt_vfs_ops > 0)) { \ + vfs_op_thread_exit(_mp); \ + _retval = false; \ + } \ + _retval; \ +}) + +#define vfs_op_thread_exit(mp) do { \ + atomic_thread_fence_rel(); \ + *(int *)zpcpu_get(mp->mnt_thread_in_ops_pcpu) = 0; \ + critical_exit(); \ +} while (0) #else /* !_KERNEL */ Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Mon Sep 16 20:43:20 2019 (r352423) +++ head/sys/vm/uma.h Mon Sep 16 21:31:02 2019 (r352424) @@ -650,6 +650,7 @@ int uma_zone_exhausted_nolock(uma_zone_t zone); /* * Common UMA_ZONE_PCPU zones. */ +extern uma_zone_t pcpu_zone_int; extern uma_zone_t pcpu_zone_64; /* From owner-svn-src-all@freebsd.org Mon Sep 16 21:32: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 D758AED210; Mon, 16 Sep 2019 21:32:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XKFx5JRcz4BBf; Mon, 16 Sep 2019 21:32: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 993FE2653F; Mon, 16 Sep 2019 21:32: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 x8GLWLuD003394; Mon, 16 Sep 2019 21:32:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GLWLRu003393; Mon, 16 Sep 2019 21:32:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909162132.x8GLWLRu003393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 16 Sep 2019 21:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352425 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352425 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 21:32:21 -0000 Author: mjg Date: Mon Sep 16 21:32:21 2019 New Revision: 352425 URL: https://svnweb.freebsd.org/changeset/base/352425 Log: vfs: manage mnt_lockref with atomics See r352424. Reviewed by: kib, jeff Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21574 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Sep 16 21:31:02 2019 (r352424) +++ head/sys/kern/vfs_subr.c Mon Sep 16 21:32:21 2019 (r352425) @@ -641,6 +641,18 @@ vfs_busy(struct mount *mp, int flags) MPASS((flags & ~MBF_MASK) == 0); CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags); + if (vfs_op_thread_enter(mp)) { + MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); + MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0); + MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0); + MNT_REF_UNLOCKED(mp); + atomic_add_int(&mp->mnt_lockref, 1); + vfs_op_thread_exit(mp); + if (flags & MBF_MNTLSTLOCK) + mtx_unlock(&mountlist_mtx); + return (0); + } + MNT_ILOCK(mp); MNT_REF(mp); /* @@ -673,7 +685,7 @@ vfs_busy(struct mount *mp, int flags) } if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); - mp->mnt_lockref++; + atomic_add_int(&mp->mnt_lockref, 1); MNT_IUNLOCK(mp); return (0); } @@ -684,13 +696,24 @@ vfs_busy(struct mount *mp, int flags) void vfs_unbusy(struct mount *mp) { + int c; CTR2(KTR_VFS, "%s: mp %p", __func__, mp); + + if (vfs_op_thread_enter(mp)) { + MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); + c = atomic_fetchadd_int(&mp->mnt_lockref, -1) - 1; + KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c)); + MNT_REL_UNLOCKED(mp); + vfs_op_thread_exit(mp); + return; + } + MNT_ILOCK(mp); MNT_REL(mp); - KASSERT(mp->mnt_lockref > 0, ("negative mnt_lockref")); - mp->mnt_lockref--; - if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) { + c = atomic_fetchadd_int(&mp->mnt_lockref, -1) - 1; + KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c)); + if (c == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) { MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT); CTR1(KTR_VFS, "%s: waking up waiters", __func__); mp->mnt_kern_flag &= ~MNTK_DRAINING; From owner-svn-src-all@freebsd.org Mon Sep 16 21:33: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 21916ED40D; Mon, 16 Sep 2019 21:33:17 +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 46XKH06tWRz4BLL; Mon, 16 Sep 2019 21:33: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 CF42126556; Mon, 16 Sep 2019 21:33: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 x8GLXGe8006438; Mon, 16 Sep 2019 21:33:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GLXGrG006436; Mon, 16 Sep 2019 21:33:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909162133.x8GLXGrG006436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 16 Sep 2019 21:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352426 - in head/sys: kern ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern ufs/ffs X-SVN-Commit-Revision: 352426 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 21:33:17 -0000 Author: mjg Date: Mon Sep 16 21:33:16 2019 New Revision: 352426 URL: https://svnweb.freebsd.org/changeset/base/352426 Log: vfs: manage mnt_writeopcount with atomics See r352424. Reviewed by: kib, jeff Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21575 Modified: head/sys/kern/vfs_vnops.c head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Sep 16 21:32:21 2019 (r352425) +++ head/sys/kern/vfs_vnops.c Mon Sep 16 21:33:16 2019 (r352426) @@ -1621,11 +1621,23 @@ vn_suspendable(struct mount *mp) * suspension is over, and then proceed. */ static int -vn_start_write_locked(struct mount *mp, int flags) +vn_start_write_refed(struct mount *mp, int flags, bool mplocked) { int error, mflags; - mtx_assert(MNT_MTX(mp), MA_OWNED); + if (__predict_true(!mplocked) && (flags & V_XSLEEP) == 0 && + vfs_op_thread_enter(mp)) { + MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0); + atomic_add_int(&mp->mnt_writeopcount, 1); + vfs_op_thread_exit(mp); + return (0); + } + + if (mplocked) + mtx_assert(MNT_MTX(mp), MA_OWNED); + else + MNT_ILOCK(mp); + error = 0; /* @@ -1648,7 +1660,7 @@ vn_start_write_locked(struct mount *mp, int flags) } if (flags & V_XSLEEP) goto unlock; - mp->mnt_writeopcount++; + atomic_add_int(&mp->mnt_writeopcount, 1); unlock: if (error != 0 || (flags & V_XSLEEP) != 0) MNT_REL(mp); @@ -1694,11 +1706,10 @@ vn_start_write(struct vnode *vp, struct mount **mpp, i * refcount for the provided mountpoint too, in order to * emulate a vfs_ref(). */ - MNT_ILOCK(mp); if (vp == NULL && (flags & V_MNTREF) == 0) - MNT_REF(mp); + vfs_ref(mp); - return (vn_start_write_locked(mp, flags)); + return (vn_start_write_refed(mp, flags, false)); } /* @@ -1780,15 +1791,26 @@ vn_start_secondary_write(struct vnode *vp, struct moun void vn_finished_write(struct mount *mp) { + int c; + if (mp == NULL || !vn_suspendable(mp)) return; + + if (vfs_op_thread_enter(mp)) { + c = atomic_fetchadd_int(&mp->mnt_writeopcount, -1) - 1; + if (c < 0) + panic("vn_finished_write: invalid writeopcount %d", c); + MNT_REL_UNLOCKED(mp); + vfs_op_thread_exit(mp); + return; + } + MNT_ILOCK(mp); MNT_REL(mp); - mp->mnt_writeopcount--; - if (mp->mnt_writeopcount < 0) - panic("vn_finished_write: neg cnt"); - if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 && - mp->mnt_writeopcount <= 0) + c = atomic_fetchadd_int(&mp->mnt_writeopcount, -1) - 1; + if (c < 0) + panic("vn_finished_write: invalid writeopcount %d", c); + if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 && c == 0) wakeup(&mp->mnt_writeopcount); MNT_IUNLOCK(mp); } @@ -1827,8 +1849,11 @@ vfs_write_suspend(struct mount *mp, int flags) MPASS(vn_suspendable(mp)); + vfs_op_enter(mp); + MNT_ILOCK(mp); if (mp->mnt_susp_owner == curthread) { + vfs_op_exit_locked(mp); MNT_IUNLOCK(mp); return (EALREADY); } @@ -1845,6 +1870,7 @@ vfs_write_suspend(struct mount *mp, int flags) */ if ((flags & VS_SKIP_UNMOUNT) != 0 && (mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + vfs_op_exit_locked(mp); MNT_IUNLOCK(mp); return (EBUSY); } @@ -1856,8 +1882,10 @@ vfs_write_suspend(struct mount *mp, int flags) MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0); else MNT_IUNLOCK(mp); - if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) + if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) { vfs_write_resume(mp, 0); + vfs_op_exit(mp); + } return (error); } @@ -1881,14 +1909,15 @@ vfs_write_resume(struct mount *mp, int flags) curthread->td_pflags &= ~TDP_IGNSUSP; if ((flags & VR_START_WRITE) != 0) { MNT_REF(mp); - mp->mnt_writeopcount++; + atomic_add_int(&mp->mnt_writeopcount, 1); } MNT_IUNLOCK(mp); if ((flags & VR_NO_SUSPCLR) == 0) VFS_SUSP_CLEAN(mp); + vfs_op_exit(mp); } else if ((flags & VR_START_WRITE) != 0) { MNT_REF(mp); - vn_start_write_locked(mp, 0); + vn_start_write_refed(mp, 0, true); } else { MNT_IUNLOCK(mp); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 21:32:21 2019 (r352425) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 21:33:16 2019 (r352426) @@ -2954,17 +2954,26 @@ journal_suspend(ump) { struct jblocks *jblocks; struct mount *mp; + bool set; mp = UFSTOVFS(ump); + if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) + return; + jblocks = ump->softdep_jblocks; + vfs_op_enter(mp); + set = false; MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) == 0) { stat_journal_min++; mp->mnt_kern_flag |= MNTK_SUSPEND; mp->mnt_susp_owner = ump->softdep_flushtd; + set = true; } jblocks->jb_suspended = 1; MNT_IUNLOCK(mp); + if (!set) + vfs_op_exit(mp); } static int From owner-svn-src-all@freebsd.org Mon Sep 16 21:37: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 DE270ED4DD; Mon, 16 Sep 2019 21:37:49 +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 46XKNF6HFGz4BW8; Mon, 16 Sep 2019 21:37:49 +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 B5D7D2655B; Mon, 16 Sep 2019 21:37:49 +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 x8GLbnVX006702; Mon, 16 Sep 2019 21:37:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GLbmqb006694; Mon, 16 Sep 2019 21:37:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909162137.x8GLbmqb006694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 16 Sep 2019 21:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352427 - in head/sys: fs/tmpfs kern sys ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: fs/tmpfs kern sys ufs/ffs X-SVN-Commit-Revision: 352427 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 21:37:49 -0000 Author: mjg Date: Mon Sep 16 21:37:47 2019 New Revision: 352427 URL: https://svnweb.freebsd.org/changeset/base/352427 Log: vfs: convert struct mount counters to per-cpu There are 3 counters modified all the time in this structure - one for keeping the structure alive, one for preventing unmount and one for tracking active writers. Exact values of these counters are very rarely needed, which makes them a prime candidate for conversion to a per-cpu scheme, resulting in much better performance. Sample benchmark performing fstatfs (modifying 2 out of 3 counters) on a 104-way 2 socket Skylake system: before: 852393 ops/s after: 76682077 ops/s Reviewed by: kib, jeff Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21637 Modified: head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/vfs_default.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h head/sys/sys/pcpu.h head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/fs/tmpfs/tmpfs_subr.c Mon Sep 16 21:37:47 2019 (r352427) @@ -190,8 +190,6 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount /* If the root directory of the 'tmp' file system is not yet * allocated, this must be the request to do it. */ MPASS(IMPLIES(tmp->tm_root == NULL, parent == NULL && type == VDIR)); - KASSERT(tmp->tm_root == NULL || mp->mnt_writeopcount > 0, - ("creating node not under vn_start_write")); MPASS(IFF(type == VLNK, target != NULL)); MPASS(IFF(type == VBLK || type == VCHR, rdev != VNOVAL)); Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/kern/vfs_default.c Mon Sep 16 21:37:47 2019 (r352427) @@ -607,7 +607,7 @@ vop_stdgetwritemount(ap) } if (vfs_op_thread_enter(mp)) { if (mp == vp->v_mount) - MNT_REF_UNLOCKED(mp); + vfs_mp_count_add_pcpu(mp, ref, 1); else mp = NULL; vfs_op_thread_exit(mp); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/kern/vfs_mount.c Mon Sep 16 21:37:47 2019 (r352427) @@ -126,6 +126,12 @@ mount_init(void *mem, int size, int flags) lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_int, M_WAITOK | M_ZERO); + mp->mnt_ref_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + M_WAITOK | M_ZERO); + mp->mnt_lockref_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + M_WAITOK | M_ZERO); + mp->mnt_writeopcount_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + M_WAITOK | M_ZERO); mp->mnt_ref = 0; mp->mnt_vfs_ops = 1; return (0); @@ -137,6 +143,9 @@ mount_fini(void *mem, int size) struct mount *mp; mp = (struct mount *)mem; + uma_zfree_pcpu(pcpu_zone_int, mp->mnt_writeopcount_pcpu); + uma_zfree_pcpu(pcpu_zone_int, mp->mnt_lockref_pcpu); + uma_zfree_pcpu(pcpu_zone_int, mp->mnt_ref_pcpu); uma_zfree_pcpu(pcpu_zone_int, mp->mnt_thread_in_ops_pcpu); lockdestroy(&mp->mnt_explock); mtx_destroy(&mp->mnt_listmtx); @@ -452,7 +461,7 @@ vfs_ref(struct mount *mp) CTR2(KTR_VFS, "%s: mp %p", __func__, mp); if (vfs_op_thread_enter(mp)) { - MNT_REF_UNLOCKED(mp); + vfs_mp_count_add_pcpu(mp, ref, 1); vfs_op_thread_exit(mp); return; } @@ -468,7 +477,7 @@ vfs_rel(struct mount *mp) CTR2(KTR_VFS, "%s: mp %p", __func__, mp); if (vfs_op_thread_enter(mp)) { - MNT_REL_UNLOCKED(mp); + vfs_mp_count_sub_pcpu(mp, ref, 1); vfs_op_thread_exit(mp); return; } @@ -533,6 +542,8 @@ vfs_mount_destroy(struct mount *mp) if (mp->mnt_vfs_ops == 0) panic("%s: entered with zero vfs_ops\n", __func__); + vfs_assert_mount_counters(mp); + MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_REFEXPIRE; if (mp->mnt_kern_flag & MNTK_MWAIT) { @@ -1382,6 +1393,7 @@ dounmount_cleanup(struct mount *mp, struct vnode *cove void vfs_op_enter(struct mount *mp) { + int cpu; MNT_ILOCK(mp); mp->mnt_vfs_ops++; @@ -1395,7 +1407,20 @@ vfs_op_enter(struct mount *mp) */ atomic_thread_fence_seq_cst(); vfs_op_barrier_wait(mp); + /* + * Paired with a fence in vfs_op_thread_exit(). + */ + atomic_thread_fence_acq(); + CPU_FOREACH(cpu) { + mp->mnt_ref += + zpcpu_replace_cpu(mp->mnt_ref_pcpu, 0, cpu); + mp->mnt_lockref += + zpcpu_replace_cpu(mp->mnt_lockref_pcpu, 0, cpu); + mp->mnt_writeopcount += + zpcpu_replace_cpu(mp->mnt_writeopcount_pcpu, 0, cpu); + } MNT_IUNLOCK(mp); + vfs_assert_mount_counters(mp); } void @@ -1433,6 +1458,93 @@ vfs_op_barrier_wait(struct mount *mp) while (atomic_load_int(in_op)) cpu_spinwait(); } +} + +#ifdef DIAGNOSTIC +void +vfs_assert_mount_counters(struct mount *mp) +{ + int cpu; + + if (mp->mnt_vfs_ops == 0) + return; + + CPU_FOREACH(cpu) { + if (*(int *)zpcpu_get_cpu(mp->mnt_ref_pcpu, cpu) != 0 || + *(int *)zpcpu_get_cpu(mp->mnt_lockref_pcpu, cpu) != 0 || + *(int *)zpcpu_get_cpu(mp->mnt_writeopcount_pcpu, cpu) != 0) + vfs_dump_mount_counters(mp); + } +} + +void +vfs_dump_mount_counters(struct mount *mp) +{ + int cpu, *count; + int ref, lockref, writeopcount; + + printf("%s: mp %p vfs_ops %d\n", __func__, mp, mp->mnt_vfs_ops); + + printf(" ref : "); + ref = mp->mnt_ref; + CPU_FOREACH(cpu) { + count = zpcpu_get_cpu(mp->mnt_ref_pcpu, cpu); + printf("%d ", *count); + ref += *count; + } + printf("\n"); + printf(" lockref : "); + lockref = mp->mnt_lockref; + CPU_FOREACH(cpu) { + count = zpcpu_get_cpu(mp->mnt_lockref_pcpu, cpu); + printf("%d ", *count); + lockref += *count; + } + printf("\n"); + printf("writeopcount: "); + writeopcount = mp->mnt_writeopcount; + CPU_FOREACH(cpu) { + count = zpcpu_get_cpu(mp->mnt_writeopcount_pcpu, cpu); + printf("%d ", *count); + writeopcount += *count; + } + printf("\n"); + + printf("counter struct total\n"); + printf("ref %-5d %-5d\n", mp->mnt_ref, ref); + printf("lockref %-5d %-5d\n", mp->mnt_lockref, lockref); + printf("writeopcount %-5d %-5d\n", mp->mnt_writeopcount, writeopcount); + + panic("invalid counts on struct mount"); +} +#endif + +int +vfs_mount_fetch_counter(struct mount *mp, enum mount_counter which) +{ + int *base, *pcpu; + int cpu, sum; + + switch (which) { + case MNT_COUNT_REF: + base = &mp->mnt_ref; + pcpu = mp->mnt_ref_pcpu; + break; + case MNT_COUNT_LOCKREF: + base = &mp->mnt_lockref; + pcpu = mp->mnt_lockref_pcpu; + break; + case MNT_COUNT_WRITEOPCOUNT: + base = &mp->mnt_writeopcount; + pcpu = mp->mnt_writeopcount_pcpu; + break; + } + + sum = *base; + CPU_FOREACH(cpu) { + sum += *(int *)zpcpu_get_cpu(pcpu, cpu); + } + return (sum); } /* Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/kern/vfs_subr.c Mon Sep 16 21:37:47 2019 (r352427) @@ -645,8 +645,8 @@ vfs_busy(struct mount *mp, int flags) MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0); MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0); - MNT_REF_UNLOCKED(mp); - atomic_add_int(&mp->mnt_lockref, 1); + vfs_mp_count_add_pcpu(mp, ref, 1); + vfs_mp_count_add_pcpu(mp, lockref, 1); vfs_op_thread_exit(mp); if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); @@ -654,6 +654,7 @@ vfs_busy(struct mount *mp, int flags) } MNT_ILOCK(mp); + vfs_assert_mount_counters(mp); MNT_REF(mp); /* * If mount point is currently being unmounted, sleep until the @@ -685,7 +686,7 @@ vfs_busy(struct mount *mp, int flags) } if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); - atomic_add_int(&mp->mnt_lockref, 1); + mp->mnt_lockref++; MNT_IUNLOCK(mp); return (0); } @@ -702,17 +703,23 @@ vfs_unbusy(struct mount *mp) if (vfs_op_thread_enter(mp)) { MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); - c = atomic_fetchadd_int(&mp->mnt_lockref, -1) - 1; - KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c)); - MNT_REL_UNLOCKED(mp); + vfs_mp_count_sub_pcpu(mp, lockref, 1); + vfs_mp_count_sub_pcpu(mp, ref, 1); vfs_op_thread_exit(mp); return; } MNT_ILOCK(mp); + vfs_assert_mount_counters(mp); MNT_REL(mp); - c = atomic_fetchadd_int(&mp->mnt_lockref, -1) - 1; - KASSERT(c >= 0, ("%s: negative mnt_lockref %d\n", __func__, c)); + c = --mp->mnt_lockref; + if (mp->mnt_vfs_ops == 0) { + MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0); + MNT_IUNLOCK(mp); + return; + } + if (c < 0) + vfs_dump_mount_counters(mp); if (c == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) { MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT); CTR1(KTR_VFS, "%s: waking up waiters", __func__); @@ -4040,16 +4047,19 @@ DB_SHOW_COMMAND(mount, db_show_mount) if (jailed(mp->mnt_cred)) db_printf(", jail=%d", mp->mnt_cred->cr_prison->pr_id); db_printf(" }\n"); - db_printf(" mnt_ref = %d\n", mp->mnt_ref); + db_printf(" mnt_ref = %d (with %d in the struct)\n", + vfs_mount_fetch_counter(mp, MNT_COUNT_REF), mp->mnt_ref); db_printf(" mnt_gen = %d\n", mp->mnt_gen); db_printf(" mnt_nvnodelistsize = %d\n", mp->mnt_nvnodelistsize); db_printf(" mnt_activevnodelistsize = %d\n", mp->mnt_activevnodelistsize); - db_printf(" mnt_writeopcount = %d\n", mp->mnt_writeopcount); + db_printf(" mnt_writeopcount = %d (with %d in the struct)\n", + vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), mp->mnt_writeopcount); db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); - db_printf(" mnt_lockref = %d\n", mp->mnt_lockref); + db_printf(" mnt_lockref = %d (with %d in the struct)\n", + vfs_mount_fetch_counter(mp, MNT_COUNT_LOCKREF), mp->mnt_lockref); db_printf(" mnt_secondary_writes = %d\n", mp->mnt_secondary_writes); db_printf(" mnt_secondary_accwrites = %d\n", mp->mnt_secondary_accwrites); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/kern/vfs_vnops.c Mon Sep 16 21:37:47 2019 (r352427) @@ -1628,7 +1628,7 @@ vn_start_write_refed(struct mount *mp, int flags, bool if (__predict_true(!mplocked) && (flags & V_XSLEEP) == 0 && vfs_op_thread_enter(mp)) { MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0); - atomic_add_int(&mp->mnt_writeopcount, 1); + vfs_mp_count_add_pcpu(mp, writeopcount, 1); vfs_op_thread_exit(mp); return (0); } @@ -1660,7 +1660,7 @@ vn_start_write_refed(struct mount *mp, int flags, bool } if (flags & V_XSLEEP) goto unlock; - atomic_add_int(&mp->mnt_writeopcount, 1); + mp->mnt_writeopcount++; unlock: if (error != 0 || (flags & V_XSLEEP) != 0) MNT_REL(mp); @@ -1797,19 +1797,23 @@ vn_finished_write(struct mount *mp) return; if (vfs_op_thread_enter(mp)) { - c = atomic_fetchadd_int(&mp->mnt_writeopcount, -1) - 1; - if (c < 0) - panic("vn_finished_write: invalid writeopcount %d", c); - MNT_REL_UNLOCKED(mp); + vfs_mp_count_sub_pcpu(mp, writeopcount, 1); + vfs_mp_count_sub_pcpu(mp, ref, 1); vfs_op_thread_exit(mp); return; } MNT_ILOCK(mp); + vfs_assert_mount_counters(mp); MNT_REL(mp); - c = atomic_fetchadd_int(&mp->mnt_writeopcount, -1) - 1; + c = --mp->mnt_writeopcount; + if (mp->mnt_vfs_ops == 0) { + MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0); + MNT_IUNLOCK(mp); + return; + } if (c < 0) - panic("vn_finished_write: invalid writeopcount %d", c); + vfs_dump_mount_counters(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0 && c == 0) wakeup(&mp->mnt_writeopcount); MNT_IUNLOCK(mp); @@ -1852,6 +1856,7 @@ vfs_write_suspend(struct mount *mp, int flags) vfs_op_enter(mp); MNT_ILOCK(mp); + vfs_assert_mount_counters(mp); if (mp->mnt_susp_owner == curthread) { vfs_op_exit_locked(mp); MNT_IUNLOCK(mp); @@ -1909,7 +1914,7 @@ vfs_write_resume(struct mount *mp, int flags) curthread->td_pflags &= ~TDP_IGNSUSP; if ((flags & VR_START_WRITE) != 0) { MNT_REF(mp); - atomic_add_int(&mp->mnt_writeopcount, 1); + mp->mnt_writeopcount++; } MNT_IUNLOCK(mp); if ((flags & VR_NO_SUSPCLR) == 0) Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/sys/mount.h Mon Sep 16 21:37:47 2019 (r352427) @@ -228,6 +228,9 @@ struct mount { TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ int mnt_vfs_ops; /* (i) pending vfs ops */ int *mnt_thread_in_ops_pcpu; + int *mnt_ref_pcpu; + int *mnt_lockref_pcpu; + int *mnt_writeopcount_pcpu; }; /* @@ -268,25 +271,16 @@ void __mnt_vnode_markerfree_active(struct vno #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx) #define MNT_MTX(mp) (&(mp)->mnt_mtx) -#define MNT_REF_UNLOCKED(mp) do { \ - atomic_add_int(&(mp)->mnt_ref, 1); \ -} while (0) -#define MNT_REL_UNLOCKED(mp) do { \ - int _c; \ - _c = atomic_fetchadd_int(&(mp)->mnt_ref, -1) - 1; \ - KASSERT(_c >= 0, ("negative mnt_ref %d", _c)); \ -} while (0) - #define MNT_REF(mp) do { \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ - atomic_add_int(&(mp)->mnt_ref, 1); \ + mp->mnt_ref++; \ } while (0) #define MNT_REL(mp) do { \ - int _c; \ mtx_assert(MNT_MTX(mp), MA_OWNED); \ - _c = atomic_fetchadd_int(&(mp)->mnt_ref, -1) - 1; \ - KASSERT(_c >= 0, ("negative mnt_ref %d", _c)); \ - if (_c == 0) \ + (mp)->mnt_ref--; \ + if ((mp)->mnt_vfs_ops && (mp)->mnt_ref < 0) \ + vfs_dump_mount_counters(mp); \ + if ((mp)->mnt_ref == 0 && (mp)->mnt_vfs_ops) \ wakeup((mp)); \ } while (0) @@ -959,6 +953,17 @@ void vfs_op_enter(struct mount *); void vfs_op_exit_locked(struct mount *); void vfs_op_exit(struct mount *); +#ifdef DIAGNOSTIC +void vfs_assert_mount_counters(struct mount *); +void vfs_dump_mount_counters(struct mount *); +#else +#define vfs_assert_mount_counters(mp) do { } while (0) +#define vfs_dump_mount_counters(mp) do { } while (0) +#endif + +enum mount_counter { MNT_COUNT_REF, MNT_COUNT_LOCKREF, MNT_COUNT_WRITEOPCOUNT }; +int vfs_mount_fetch_counter(struct mount *, enum mount_counter); + /* * We mark ourselves as entering the section and post a sequentially consistent * fence, meaning the store is completed before we get into the section and @@ -976,24 +981,39 @@ void vfs_op_exit(struct mount *); * before making any changes or only make changes safe while the section is * executed. */ +#define vfs_op_thread_entered(mp) ({ \ + MPASS(curthread->td_critnest > 0); \ + *(int *)zpcpu_get(mp->mnt_thread_in_ops_pcpu) == 1; \ +}) #define vfs_op_thread_enter(mp) ({ \ - struct mount *_mp = (mp); \ bool _retval = true; \ critical_enter(); \ - *(int *)zpcpu_get(_mp->mnt_thread_in_ops_pcpu) = 1; \ + MPASS(!vfs_op_thread_entered(mp)); \ + *(int *)zpcpu_get(mp->mnt_thread_in_ops_pcpu) = 1; \ atomic_thread_fence_seq_cst(); \ - if (__predict_false(_mp->mnt_vfs_ops > 0)) { \ - vfs_op_thread_exit(_mp); \ + if (__predict_false(mp->mnt_vfs_ops > 0)) { \ + vfs_op_thread_exit(mp); \ _retval = false; \ } \ _retval; \ }) #define vfs_op_thread_exit(mp) do { \ + MPASS(vfs_op_thread_entered(mp)); \ atomic_thread_fence_rel(); \ *(int *)zpcpu_get(mp->mnt_thread_in_ops_pcpu) = 0; \ critical_exit(); \ +} while (0) + +#define vfs_mp_count_add_pcpu(mp, count, val) do { \ + MPASS(vfs_op_thread_entered(mp)); \ + (*(int *)zpcpu_get(mp->mnt_##count##_pcpu)) += val; \ +} while (0) + +#define vfs_mp_count_sub_pcpu(mp, count, val) do { \ + MPASS(vfs_op_thread_entered(mp)); \ + (*(int *)zpcpu_get(mp->mnt_##count##_pcpu)) -= val; \ } while (0) #else /* !_KERNEL */ Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/sys/pcpu.h Mon Sep 16 21:37:47 2019 (r352427) @@ -243,6 +243,18 @@ zpcpu_get_cpu(void *base, int cpu) } /* + * This operation is NOT atomic and does not post any barriers. + * If you use this the assumption is that the target CPU will not + * be modifying this variable. + * If you need atomicity use xchg. + * */ +#define zpcpu_replace_cpu(base, val, cpu) ({ \ + __typeof(val) _old = *(__typeof(val) *)zpcpu_get_cpu(base, cpu);\ + *(__typeof(val) *)zpcpu_get_cpu(base, cpu) = val; \ + _old; \ +}) + +/* * Machine dependent callouts. cpu_pcpu_init() is responsible for * initializing machine dependent fields of struct pcpu, and * db_show_mdpcpu() is responsible for handling machine dependent Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 21:33:16 2019 (r352426) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Sep 16 21:37:47 2019 (r352427) @@ -13403,10 +13403,11 @@ softdep_request_cleanup(fs, vp, cred, resource) * (fs_minfree). */ if (resource == FLUSH_INODES_WAIT) { - needed = vp->v_mount->mnt_writeopcount + 2; + needed = vfs_mount_fetch_counter(vp->v_mount, + MNT_COUNT_WRITEOPCOUNT) + 2; } else if (resource == FLUSH_BLOCKS_WAIT) { - needed = (vp->v_mount->mnt_writeopcount + 2) * - fs->fs_contigsumsize; + needed = (vfs_mount_fetch_counter(vp->v_mount, + MNT_COUNT_WRITEOPCOUNT) + 2) * fs->fs_contigsumsize; if (priv_check_cred(cred, PRIV_VFS_BLOCKRESERVE)) needed += fragstoblks(fs, roundup((fs->fs_dsize * fs->fs_minfree / 100) - From owner-svn-src-all@freebsd.org Mon Sep 16 22:00: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 31E51EDB0D; Mon, 16 Sep 2019 22:00:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XKtQ0KlZz4CKV; Mon, 16 Sep 2019 22:00:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E417426907; Mon, 16 Sep 2019 22:00:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GM0Tqg018606; Mon, 16 Sep 2019 22:00:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GM0TfG018605; Mon, 16 Sep 2019 22:00:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909162200.x8GM0TfG018605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 16 Sep 2019 22:00: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: r352428 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 352428 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 22:00:30 -0000 Author: mhorne Date: Mon Sep 16 22:00:29 2019 New Revision: 352428 URL: https://svnweb.freebsd.org/changeset/base/352428 Log: MFC r352048: Fix cpuwhich_t column width Modified: stable/12/lib/libc/sys/cpuset.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/cpuset.2 ============================================================================== --- stable/12/lib/libc/sys/cpuset.2 Mon Sep 16 21:37:47 2019 (r352427) +++ stable/12/lib/libc/sys/cpuset.2 Mon Sep 16 22:00:29 2019 (r352428) @@ -96,7 +96,7 @@ is interpreted and is of type The .Fa which argument may have the following values: -.Bl -column CPU_WHICH_CPUSET -offset indent +.Bl -column CPU_WHICH_INTRHANDLER -offset indent .It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)" .It Dv CPU_WHICH_PID Ta "id is pid_t (process id)" .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)" From owner-svn-src-all@freebsd.org Mon Sep 16 22:02: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 1976FEDD53; Mon, 16 Sep 2019 22:02:15 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XKwQ6wjrz4Cf5; Mon, 16 Sep 2019 22:02:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1B9C26A93; Mon, 16 Sep 2019 22:02:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GM2ECI023350; Mon, 16 Sep 2019 22:02:14 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GM2Eso023349; Mon, 16 Sep 2019 22:02:14 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909162202.x8GM2Eso023349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 16 Sep 2019 22:02: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: r352429 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 352429 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 22:02:15 -0000 Author: mhorne Date: Mon Sep 16 22:02:14 2019 New Revision: 352429 URL: https://svnweb.freebsd.org/changeset/base/352429 Log: MFC r352048: Fix cpuwhich_t column width Modified: stable/11/lib/libc/sys/cpuset.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/cpuset.2 ============================================================================== --- stable/11/lib/libc/sys/cpuset.2 Mon Sep 16 22:00:29 2019 (r352428) +++ stable/11/lib/libc/sys/cpuset.2 Mon Sep 16 22:02:14 2019 (r352429) @@ -95,7 +95,7 @@ is interpreted and is of type The .Fa which argument may have the following values: -.Bl -column CPU_WHICH_CPUSET -offset indent +.Bl -column CPU_WHICH_INTRHANDLER -offset indent .It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)" .It Dv CPU_WHICH_PID Ta "id is pid_t (process id)" .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)" From owner-svn-src-all@freebsd.org Mon Sep 16 22:17: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 184C5EE18B; Mon, 16 Sep 2019 22:17:18 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XLFn6qdGz4D9l; Mon, 16 Sep 2019 22:17:17 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C997F26C65; Mon, 16 Sep 2019 22:17:17 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GMHHdf030199; Mon, 16 Sep 2019 22:17:17 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GMHHat030196; Mon, 16 Sep 2019 22:17:17 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909162217.x8GMHHat030196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 16 Sep 2019 22:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352430 - in head/sys/riscv: conf riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/riscv: conf riscv X-SVN-Commit-Revision: 352430 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 22:17:18 -0000 Author: mhorne Date: Mon Sep 16 22:17:16 2019 New Revision: 352430 URL: https://svnweb.freebsd.org/changeset/base/352430 Log: RISC-V: Support EARLY_AP_STARTUP The EARLY_AP_STARTUP option initializes non-boot processors much sooner during startup. This adds support for this option on RISC-V and enables it by default for GENERIC. Reviewed by: jhb, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21661 Modified: head/sys/riscv/conf/GENERIC head/sys/riscv/riscv/clock.c head/sys/riscv/riscv/mp_machdep.c Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/conf/GENERIC Mon Sep 16 22:17:16 2019 (r352430) @@ -71,6 +71,7 @@ options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits options SMP +options EARLY_AP_STARTUP options INTRNG # RISC-V SBI console Modified: head/sys/riscv/riscv/clock.c ============================================================================== --- head/sys/riscv/riscv/clock.c Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/riscv/clock.c Mon Sep 16 22:17:16 2019 (r352430) @@ -37,10 +37,34 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include void cpu_initclocks(void) { +#ifdef EARLY_AP_STARTUP + struct thread *td; + int i; + td = curthread; cpu_initclocks_bsp(); + CPU_FOREACH(i) { + if (i == 0) + continue; + thread_lock(td); + sched_bind(td, i); + thread_unlock(td); + cpu_initclocks_ap(); + } + thread_lock(td); + if (sched_is_bound(td)) + sched_unbind(td); + thread_unlock(td); +#else + cpu_initclocks_bsp(); +#endif } Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Mon Sep 16 22:02:14 2019 (r352429) +++ head/sys/riscv/riscv/mp_machdep.c Mon Sep 16 22:17:16 2019 (r352430) @@ -257,8 +257,10 @@ init_secondary(uint64_t hart) /* Enable software interrupts */ riscv_unmask_ipi(); +#ifndef EARLY_AP_STARTUP /* Start per-CPU event timers. */ cpu_initclocks_ap(); +#endif /* Enable external (PLIC) interrupts */ csr_set(sie, SIE_SEIE); From owner-svn-src-all@freebsd.org Mon Sep 16 22:48: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 2DD13EE9AA; Mon, 16 Sep 2019 22:48:41 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XLy108bHz4FPt; Mon, 16 Sep 2019 22:48:41 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC366271BC; Mon, 16 Sep 2019 22:48:40 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8GMmeVg047831; Mon, 16 Sep 2019 22:48:40 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8GMme2M047830; Mon, 16 Sep 2019 22:48:40 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201909162248.x8GMme2M047830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Mon, 16 Sep 2019 22:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352431 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 352431 X-SVN-Commit-Repository: base MIME-Version: 1.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, 16 Sep 2019 22:48:41 -0000 Author: jmg Date: Mon Sep 16 22:48:40 2019 New Revision: 352431 URL: https://svnweb.freebsd.org/changeset/base/352431 Log: fix the article to be correct... Modified: head/libexec/rc/rc.d/growfs Modified: head/libexec/rc/rc.d/growfs ============================================================================== --- head/libexec/rc/rc.d/growfs Mon Sep 16 22:17:16 2019 (r352430) +++ head/libexec/rc/rc.d/growfs Mon Sep 16 22:48:40 2019 (r352431) @@ -31,7 +31,7 @@ # BEFORE: sysctl # KEYWORD: firstboot -# This allows us to distribute a image +# This allows us to distribute an image # and have it work on essentially any size drive. # # TODO: Figure out where this should really be ordered. From owner-svn-src-all@freebsd.org Tue Sep 17 00:22: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 2B0ECF0AB0; Tue, 17 Sep 2019 00:22:21 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XP250Qggz4K0g; Tue, 17 Sep 2019 00:22:21 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E76B83AB; Tue, 17 Sep 2019 00:22:20 +0000 (UTC) (envelope-from dmgk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8H0MK23005313; Tue, 17 Sep 2019 00:22:20 GMT (envelope-from dmgk@FreeBSD.org) Received: (from dmgk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H0MKf3005312; Tue, 17 Sep 2019 00:22:20 GMT (envelope-from dmgk@FreeBSD.org) Message-Id: <201909170022.x8H0MKf3005312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dmgk set sender to dmgk@FreeBSD.org using -f From: Dmitri Goutnik Date: Tue, 17 Sep 2019 00:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352432 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: dmgk X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 352432 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 00:22:21 -0000 Author: dmgk (ports committer) Date: Tue Sep 17 00:22:20 2019 New Revision: 352432 URL: https://svnweb.freebsd.org/changeset/base/352432 Log: Amend r352422, add missing 'n' Reported by: yuripv Approved by: araujo (mentor) Differential Revision: https://reviews.freebsd.org/D21679 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Mon Sep 16 22:48:40 2019 (r352431) +++ head/share/misc/committers-ports.dot Tue Sep 17 00:22:20 2019 (r352432) @@ -96,7 +96,7 @@ decke [label="Bernhard Froehlich\ndecke@FreeBSD.org\n2 delphij [label="Xin Li\ndelphij@FreeBSD.org\n2006/05/01"] demon [label="Dmitry Sivachenko\ndemon@FreeBSD.org\n2000/11/13"] dhn [label="Dennis Herrmann\ndhn@FreeBSD.org\n2009/03/03"] -dmgk [label="Dmitri Goutnik\dmgk@FreeBSD.org\n2019/09/15"] +dmgk [label="Dmitri Goutnik\ndmgk@FreeBSD.org\n2019/09/15"] dryice [label="Dryice Dong Liu\ndryice@FreeBSD.org\n2006/12/25"] dteske [label="Devin Teske\ndteske@FreeBSD.org\n2018/03/01"] dumbbell [label="Jean-Sebastien Pedron\ndumbbell@FreeBSD.org\n2017/01/10"] From owner-svn-src-all@freebsd.org Tue Sep 17 02:10: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 28937F3578 for ; Tue, 17 Sep 2019 02:10:39 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660041.outbound.protection.outlook.com [40.107.66.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46XRR21M4vz4PCR; Tue, 17 Sep 2019 02:10:37 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGiQWyctk5o2Lq6edgMGyuE7nYouER8Y5FRmlNGqfr5sAZBRavKWlvWIeN50dH62x81/PwUQCKJq700K5g4kSqec8MrMXG4aD+0FGtFVWU6Sda63ARFnQmiQ/Yafwb6JXiwpt5z7r+AZYdgnxC5eZI+o+322l5LnBNpxisrn/4rNwUeIluvnCF/V2h0Z5f4akVsr3bbHy/p5Am3SO/iJ3Gpui3z/DJ3l0BrGsTgTDIyORXO5n0tlojAY+Mkug/P/6l+0MsF19ebPQ3LX/ztxgh4WFPNKqRmqCgbE6TPqoavyC1yQ/Nepry+BuF1xV9Jv1LbLaibMg6WsbDTJ5SC9oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F9PnDxaEkNaaFQ1IShCbUYBUSNdDjMH+dMU2lcr7ECI=; b=fwF8hbYJ4eQ/HTdZIsQ5IMKqePle+urXMHteV2RorEfVRlpAaWZTR0QcNvdb0r1485Q4jaeYIAsHQxtvKh2ltJ1UOOKiEGU+d3wiDidzz6ALPKJFxeANzcGz8T9uVwlDEgZv0SBHvd3/oGXDEORwypf33iYX+9LmmErWVN2gowTZQIlVkQjKz6WNNd/i1kVbYn2cIaUJFDGlDft4arQ5xXsHH0vTFFfq5cAa35s8xrRgTepn1EY7LuiCvMvy2a7n6azEL6ZgugxAkfVjgbeywykNu5zOXeTD+38PwBmB3IY+IY8gKq2iDVZzVFopXZozWKBMPOF6Wyoe+m1AY8qFGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none Received: from YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM (52.132.39.22) by YTXPR0101MB0926.CANPRD01.PROD.OUTLOOK.COM (52.132.40.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Tue, 17 Sep 2019 02:10:36 +0000 Received: from YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM ([fe80::5413:22e8:7013:d8b9]) by YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM ([fe80::5413:22e8:7013:d8b9%5]) with mapi id 15.20.2263.023; Tue, 17 Sep 2019 02:10:36 +0000 From: Rick Macklem To: Konstantin Belousov CC: "peterj@freebsd.org" , "svn-src-all@freebsd.org" Subject: Re: Re; svn commit: r352393 - head/sys/fs/nfsclient Thread-Topic: Re; svn commit: r352393 - head/sys/fs/nfsclient Thread-Index: AQHVbKIrGKQ8rOwi4UavHi4KjNkUJKcueR6AgAClTws= Date: Tue, 17 Sep 2019 02:10:36 +0000 Message-ID: References: , <20190916161001.GV2559@kib.kiev.ua> In-Reply-To: <20190916161001.GV2559@kib.kiev.ua> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 744e273d-78ef-4252-36c8-08d73b143a97 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:YTXPR0101MB0926; x-ms-traffictypediagnostic: YTXPR0101MB0926: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 01630974C0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(39860400002)(396003)(366004)(199004)(189003)(8676002)(8936002)(33656002)(478600001)(71200400001)(71190400001)(186003)(102836004)(6246003)(256004)(74316002)(25786009)(54906003)(2906002)(1411001)(11346002)(7696005)(99286004)(52536014)(76116006)(14454004)(26005)(6506007)(64756008)(66446008)(305945005)(9686003)(66476007)(66946007)(66556008)(86362001)(76176011)(6436002)(229853002)(446003)(476003)(486006)(55016002)(4326008)(14444005)(81166006)(81156014)(316002)(5660300002)(6916009)(786003); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR0101MB0926; H:YTXPR0101MB2189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 84I4Lu3NsFIByNmOCfwzktW0bQOew7N4X8ISHEj9Hj19P/rfaGVir33N6IBo9npXd+VfMgUO/qXPWao6y1m+RpMr336krAA37uof/jFWCxH2j45JXX5DfiLFd4Mn+XqN+bv7C4ribGUgO7mjS4Ss+lA+4+sC93kNIxyww+P4FZEu9iZoWYw+XJHy/Zm5NeEXuZWO+Q2EV64bIHV6sjVhkliJKnQA4wwXZ+f9G9mbvUSYwyHQNi3gj06o+uXhz7gbEnY+tnh6hxZA482PX23xzfg+WU5ggRMn2HVUSzLBwwSq5OCzY7zg9Dywj6SqBBfhk9yXIwfaYizphCVwWbv39/O7PaeQJ006l3bEXSqS+RSgWD2gSCH/komm0IY7dPMZCm3wr00R4bAk50i25v/dBIlvgy1JkIsWT8JfZYL7/c4= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 744e273d-78ef-4252-36c8-08d73b143a97 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2019 02:10:36.3298 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4T5WFUv1QNBCpipy1hAjoR1XxfCUVEaQ+SrLxvJ7LQnPIanldJsxgKGr9C7MqRDZtKbkil4vN1cFopbmYeMbBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR0101MB0926 X-Rspamd-Queue-Id: 46XRR21M4vz4PCR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.66.41 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-4.54 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[uoguelph.ca]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[41.66.107.40.list.dnswl.org : 127.0.3.0]; IP_SCORE(-1.24)[ipnet: 40.64.0.0/10(-3.65), asn: 8075(-2.51), country: US(-0.05)]; 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:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[i=1] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 17 Sep 2019 02:10:39 -0000 Konstantin Belousov wrote:=0A= >On Mon, Sep 16, 2019 at 03:27:02PM +0000, Rick Macklem wrote:=0A= >> Hi Kostik,=0A= >>=0A= >> I'm afraid there was a reason that only certain cases (where the file wa= s=0A= >> being shrunk) did the vnode_pager_setsize() call after the NFS node=0A= >> lock is released.=0A= >>=0A= >> See the commit log message for r252528.=0A= >>=0A= >> If vnode_pager_setsize() now acquires a sleep lock for the case where th= e=0A= >> size is increasing, it sounds like the NFS node lock will have to become= a=0A= >> sleep lock instead of a mutex.=0A= >> (If needed, I can get working on this in a day or two.)=0A= >I suspect that the reason for the bug mentioned in r252528 is the fact=0A= >that NFS calls vnode_pager_setsize() without owning the vnode lock. AFAIR= =0A= >this happens when iod thread performs RPCs. If you look at the start of= =0A= >the vnode_pager_setsize() function, you would note a commented out assert= =0A= >that the vnode is exclusively locked.=0A= >=0A= >Indeed, changing node lock to sleepable lock is a lot of work. But may=0A= >be we should get rid of this mutex at all ? If you state that we should= =0A= >change it to some sleepable lock, then vnode lock should already serve=0A= >the purpose.=0A= >=0A= >The only issue I see is that we would need to add missed vnode locks=0A= >acquires in iod, and upgrade vnode lock shared to exclusive as needed.=0A= >An ugly intermediate solution might be to make NFS vnode locks always=0A= >exclusive.=0A= Well, the reason that the readahead/writebehind RPCs done by the iod thread= s=0A= haven't acquired the vnode lock was to allow them to occur concurrently.=0A= --> Now that there are LK_SHARED vnode locks, those could be used for=0A= the readaheads.=0A= --> For writebehinds, which is where the file's size changes, holding an=0A= exclusive vnode lock for the entire RPC would serialize them and that= =0A= could be a large performance hit.=0A= --> However, holding an exclusive vnode lock for short periods (but n= ot=0A= while the RPC is being done on the server) should be ok.=0A= The NFS node mutex may still be needed to serialize use of fiel= ds=0A= in the NFS part of the vnode, but if the exclusive vnode lock c= an be=0A= held for the code section in question and the other places wher= e=0A= the n_size field is used (instead of depending on the NFS node = mutex),=0A= that should work, I think.=0A= --> I'll take a look at the code tomorrow.=0A= =0A= rick=0A= From owner-svn-src-all@freebsd.org Tue Sep 17 02:54: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 C0CDFF4A74; Tue, 17 Sep 2019 02:54:00 +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 46XSP43X9zz4Qy7; Tue, 17 Sep 2019 02:54:00 +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 5D8DF1EAF; Tue, 17 Sep 2019 02:54:00 +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 x8H2s0pA094732; Tue, 17 Sep 2019 02:54:00 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H2s02p094731; Tue, 17 Sep 2019 02:54:00 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201909170254.x8H2s02p094731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 17 Sep 2019 02:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352433 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352433 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 02:54:00 -0000 Author: dougm Date: Tue Sep 17 02:53:59 2019 New Revision: 352433 URL: https://svnweb.freebsd.org/changeset/base/352433 Log: Remove dead code from vm_map_unlink_entry made dead by r351476, and also a no-longer-used enumerant. Reviewed by: alc Approved by: markj (mentor, implicit) Tested by: pho (as part of a larger change) Differential Revision: https://reviews.freebsd.org/D21668 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Sep 17 00:22:20 2019 (r352432) +++ head/sys/vm/vm_map.c Tue Sep 17 02:53:59 2019 (r352433) @@ -1250,7 +1250,6 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) } enum unlink_merge_type { - UNLINK_MERGE_PREV, UNLINK_MERGE_NONE, UNLINK_MERGE_NEXT }; @@ -1266,17 +1265,9 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry KASSERT(root != NULL, ("vm_map_entry_unlink: unlink object not mapped")); + vm_map_splay_findnext(root, &rlist); switch (op) { - case UNLINK_MERGE_PREV: - vm_map_splay_findprev(root, &llist); - llist->end = root->end; - y = root->right; - root = llist; - llist = root->right; - root->right = y; - break; case UNLINK_MERGE_NEXT: - vm_map_splay_findnext(root, &rlist); rlist->start = root->start; rlist->offset = root->offset; y = root->left; @@ -1286,7 +1277,6 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry break; case UNLINK_MERGE_NONE: vm_map_splay_findprev(root, &llist); - vm_map_splay_findnext(root, &rlist); if (llist != &map->header) { root = llist; llist = root->right; From owner-svn-src-all@freebsd.org Tue Sep 17 03: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 320F8F59FC; Tue, 17 Sep 2019 03:39:32 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46XTPc0Nkqz4Swm; Tue, 17 Sep 2019 03:39:32 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E482126B2; Tue, 17 Sep 2019 03:39:31 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8H3dVBh020033; Tue, 17 Sep 2019 03:39:31 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H3dVnI020032; Tue, 17 Sep 2019 03:39:31 GMT (envelope-from jah@FreeBSD.org) Message-Id: <201909170339.x8H3dVnI020032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Tue, 17 Sep 2019 03:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352434 - in head/sys/mips: include mips X-SVN-Group: head X-SVN-Commit-Author: jah X-SVN-Commit-Paths: in head/sys/mips: include mips X-SVN-Commit-Revision: 352434 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 03:39:32 -0000 Author: jah Date: Tue Sep 17 03:39:31 2019 New Revision: 352434 URL: https://svnweb.freebsd.org/changeset/base/352434 Log: mips: move support for temporary mappings above KSEG0 to per-CPU data This is derived from similar work done in r310481 for i386 and r312610 for armv6/armv7. Additionally, use a critical section to keep the thread pinned for per-CPU operations instead of completely disabling local interrupts. No objections from: adrian, jmallett, imp Differential Revision: https://reviews.freebsd.org/D18593 Modified: head/sys/mips/include/pcpu.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/pcpu.h ============================================================================== --- head/sys/mips/include/pcpu.h Tue Sep 17 02:53:59 2019 (r352433) +++ head/sys/mips/include/pcpu.h Tue Sep 17 03:39:31 2019 (r352434) @@ -51,7 +51,13 @@ #else #define PCPU_MD_MIPS32_FIELDS \ PCPU_MD_COMMON_FIELDS \ - char __pad[125] + pt_entry_t *pc_cmap1_ptep; /* PTE for copy window 1 KVA */ \ + pt_entry_t *pc_cmap2_ptep; /* PTE for copy window 2 KVA */ \ + vm_offset_t pc_cmap1_addr; /* KVA page for copy window 1 */ \ + vm_offset_t pc_cmap2_addr; /* KVA page for copy window 2 */ \ + vm_offset_t pc_qmap_addr; /* KVA page for temporary mappings */ \ + pt_entry_t *pc_qmap_ptep; /* PTE for temporary mapping KVA */ \ + char __pad[101] #endif #ifdef __mips_n64 Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Sep 17 02:53:59 2019 (r352433) +++ head/sys/mips/mips/pmap.c Tue Sep 17 03:39:31 2019 (r352434) @@ -138,6 +138,8 @@ pd_entry_t *kernel_segmap; vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ +static int need_local_mappings; + static int nkpt; unsigned pmap_max_asid; /* max ASID supported by the system */ @@ -187,104 +189,96 @@ static void pmap_invalidate_range_action(void *arg); static void pmap_update_page_action(void *arg); #ifndef __mips_n64 + +static vm_offset_t crashdumpva; + /* - * This structure is for high memory (memory above 512Meg in 32 bit) support. + * These functions are for high memory (memory above 512Meg in 32 bit) support. * The highmem area does not have a KSEG0 mapping, and we need a mechanism to * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc. * * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To * access a highmem physical address on a CPU, we map the physical address to - * the reserved virtual address for the CPU in the kernel pagetable. This is - * done with interrupts disabled(although a spinlock and sched_pin would be - * sufficient). + * the reserved virtual address for the CPU in the kernel pagetable. */ -struct local_sysmaps { - vm_offset_t base; - uint32_t saved_intr; - uint16_t valid1, valid2; -}; -static struct local_sysmaps sysmap_lmem[MAXCPU]; +static void +pmap_init_reserved_pages(void) +{ + struct pcpu *pc; + vm_offset_t pages; + int i; + + if (need_local_mappings == 0) + return; + + CPU_FOREACH(i) { + pc = pcpu_find(i); + /* + * Skip if the mapping has already been initialized, + * i.e. this is the BSP. + */ + if (pc->pc_cmap1_addr != 0) + continue; + pages = kva_alloc(PAGE_SIZE * 3); + if (pages == 0) + panic("%s: unable to allocate KVA", __func__); + pc->pc_cmap1_ptep = pmap_pte(kernel_pmap, pages); + pc->pc_cmap2_ptep = pmap_pte(kernel_pmap, pages + PAGE_SIZE); + pc->pc_qmap_ptep = + pmap_pte(kernel_pmap, pages + (PAGE_SIZE * 2)); + pc->pc_cmap1_addr = pages; + pc->pc_cmap2_addr = pages + PAGE_SIZE; + pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); + } +} +SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); + static __inline void pmap_alloc_lmem_map(void) { - int i; - - for (i = 0; i < MAXCPU; i++) { - sysmap_lmem[i].base = virtual_avail; - virtual_avail += PAGE_SIZE * 2; - sysmap_lmem[i].valid1 = sysmap_lmem[i].valid2 = 0; - } + PCPU_SET(cmap1_addr, virtual_avail); + PCPU_SET(cmap2_addr, virtual_avail + PAGE_SIZE); + PCPU_SET(cmap1_ptep, pmap_pte(kernel_pmap, virtual_avail)); + PCPU_SET(cmap2_ptep, pmap_pte(kernel_pmap, virtual_avail + PAGE_SIZE)); + PCPU_SET(qmap_addr, virtual_avail + (2 * PAGE_SIZE)); + PCPU_SET(qmap_ptep, pmap_pte(kernel_pmap, virtual_avail + (2 * PAGE_SIZE))); + crashdumpva = virtual_avail + (3 * PAGE_SIZE); + virtual_avail += PAGE_SIZE * 4; } static __inline vm_offset_t pmap_lmem_map1(vm_paddr_t phys) { - struct local_sysmaps *sysm; - pt_entry_t *pte, npte; - vm_offset_t va; - uint32_t intr; - int cpu; - - intr = intr_disable(); - cpu = PCPU_GET(cpuid); - sysm = &sysmap_lmem[cpu]; - sysm->saved_intr = intr; - va = sysm->base; - npte = TLBLO_PA_TO_PFN(phys) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; - pte = pmap_pte(kernel_pmap, va); - *pte = npte; - sysm->valid1 = 1; - return (va); + critical_enter(); + *PCPU_GET(cmap1_ptep) = + TLBLO_PA_TO_PFN(phys) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; + return (PCPU_GET(cmap1_addr)); } static __inline vm_offset_t pmap_lmem_map2(vm_paddr_t phys1, vm_paddr_t phys2) { - struct local_sysmaps *sysm; - pt_entry_t *pte, npte; - vm_offset_t va1, va2; - uint32_t intr; - int cpu; - - intr = intr_disable(); - cpu = PCPU_GET(cpuid); - sysm = &sysmap_lmem[cpu]; - sysm->saved_intr = intr; - va1 = sysm->base; - va2 = sysm->base + PAGE_SIZE; - npte = TLBLO_PA_TO_PFN(phys1) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; - pte = pmap_pte(kernel_pmap, va1); - *pte = npte; - npte = TLBLO_PA_TO_PFN(phys2) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; - pte = pmap_pte(kernel_pmap, va2); - *pte = npte; - sysm->valid1 = 1; - sysm->valid2 = 1; - return (va1); + critical_enter(); + *PCPU_GET(cmap1_ptep) = + TLBLO_PA_TO_PFN(phys1) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; + *PCPU_GET(cmap2_ptep) = + TLBLO_PA_TO_PFN(phys2) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; + return (PCPU_GET(cmap1_addr)); } static __inline void pmap_lmem_unmap(void) { - struct local_sysmaps *sysm; - pt_entry_t *pte; - int cpu; - - cpu = PCPU_GET(cpuid); - sysm = &sysmap_lmem[cpu]; - pte = pmap_pte(kernel_pmap, sysm->base); - *pte = PTE_G; - tlb_invalidate_address(kernel_pmap, sysm->base); - sysm->valid1 = 0; - if (sysm->valid2) { - pte = pmap_pte(kernel_pmap, sysm->base + PAGE_SIZE); - *pte = PTE_G; - tlb_invalidate_address(kernel_pmap, sysm->base + PAGE_SIZE); - sysm->valid2 = 0; - } - intr_restore(sysm->saved_intr); + *PCPU_GET(cmap1_ptep) = PTE_G; + tlb_invalidate_address(kernel_pmap, PCPU_GET(cmap1_addr)); + if (*PCPU_GET(cmap2_ptep) != PTE_G) { + *PCPU_GET(cmap2_ptep) = PTE_G; + tlb_invalidate_address(kernel_pmap, PCPU_GET(cmap2_addr)); + } + critical_exit(); } + #else /* __mips_n64 */ static __inline void @@ -495,7 +489,6 @@ void pmap_bootstrap(void) { int i; - int need_local_mappings = 0; /* Sort. */ again: @@ -588,9 +581,9 @@ again: printf("pcpu is available at virtual address %p.\n", pcpup); #endif + pmap_create_kernel_pagetable(); if (need_local_mappings) pmap_alloc_lmem_map(); - pmap_create_kernel_pagetable(); pmap_max_asid = VMNUM_PIDS; mips_wr_entryhi(0); mips_wr_pagemask(0); @@ -2381,28 +2374,16 @@ pmap_kenter_temporary(vm_paddr_t pa, int i) va = MIPS_PHYS_TO_DIRECT(pa); } else { #ifndef __mips_n64 /* XXX : to be converted to new style */ - int cpu; - register_t intr; - struct local_sysmaps *sysm; pt_entry_t *pte, npte; - /* If this is used other than for dumps, we may need to leave - * interrupts disasbled on return. If crash dumps don't work when - * we get to this point, we might want to consider this (leaving things - * disabled as a starting point ;-) - */ - intr = intr_disable(); - cpu = PCPU_GET(cpuid); - sysm = &sysmap_lmem[cpu]; + pte = pmap_pte(kernel_pmap, crashdumpva); + /* Since this is for the debugger, no locks or any other fun */ npte = TLBLO_PA_TO_PFN(pa) | PTE_C_CACHE | PTE_D | PTE_V | PTE_G; - pte = pmap_pte(kernel_pmap, sysm->base); *pte = npte; - sysm->valid1 = 1; - pmap_update_page(kernel_pmap, sysm->base, npte); - va = sysm->base; - intr_restore(intr); + pmap_update_page(kernel_pmap, crashdumpva, npte); + va = crashdumpva; #endif } return ((void *)va); @@ -2411,29 +2392,17 @@ pmap_kenter_temporary(vm_paddr_t pa, int i) void pmap_kenter_temporary_free(vm_paddr_t pa) { -#ifndef __mips_n64 /* XXX : to be converted to new style */ - int cpu; - register_t intr; - struct local_sysmaps *sysm; -#endif - + #ifndef __mips_n64 /* XXX : to be converted to new style */ + pt_entry_t *pte; + #endif if (MIPS_DIRECT_MAPPABLE(pa)) { /* nothing to do for this case */ return; } #ifndef __mips_n64 /* XXX : to be converted to new style */ - cpu = PCPU_GET(cpuid); - sysm = &sysmap_lmem[cpu]; - if (sysm->valid1) { - pt_entry_t *pte; - - intr = intr_disable(); - pte = pmap_pte(kernel_pmap, sysm->base); - *pte = PTE_G; - pmap_invalidate_page(kernel_pmap, sysm->base); - intr_restore(intr); - sysm->valid1 = 0; - } + pte = pmap_pte(kernel_pmap, crashdumpva); + *pte = PTE_G; + pmap_invalidate_page(kernel_pmap, crashdumpva); #endif } @@ -2687,8 +2656,8 @@ pmap_quick_enter_page(vm_page_t m) #if defined(__mips_n64) return MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); #else + vm_offset_t qaddr; vm_paddr_t pa; - struct local_sysmaps *sysm; pt_entry_t *pte, npte; pa = VM_PAGE_TO_PHYS(m); @@ -2700,17 +2669,16 @@ pmap_quick_enter_page(vm_page_t m) return (MIPS_PHYS_TO_DIRECT(pa)); } critical_enter(); - sysm = &sysmap_lmem[PCPU_GET(cpuid)]; + qaddr = PCPU_GET(qmap_addr); + pte = PCPU_GET(qmap_ptep); - KASSERT(sysm->valid1 == 0, ("pmap_quick_enter_page: PTE busy")); + KASSERT(*pte == PTE_G, ("pmap_quick_enter_page: PTE busy")); - pte = pmap_pte(kernel_pmap, sysm->base); npte = TLBLO_PA_TO_PFN(pa) | PTE_D | PTE_V | PTE_G; PMAP_PTE_SET_CACHE_BITS(npte, pa, m); *pte = npte; - sysm->valid1 = 1; - return (sysm->base); + return (qaddr); #endif } @@ -2720,23 +2688,20 @@ pmap_quick_remove_page(vm_offset_t addr) mips_dcache_wbinv_range(addr, PAGE_SIZE); #if !defined(__mips_n64) - struct local_sysmaps *sysm; pt_entry_t *pte; if (addr >= MIPS_KSEG0_START && addr < MIPS_KSEG0_END) return; - sysm = &sysmap_lmem[PCPU_GET(cpuid)]; + pte = PCPU_GET(qmap_ptep); - KASSERT(sysm->valid1 != 0, + KASSERT(*pte != PTE_G, ("pmap_quick_remove_page: PTE not in use")); - KASSERT(sysm->base == addr, + KASSERT(PCPU_GET(qmap_addr) == addr, ("pmap_quick_remove_page: invalid address")); - pte = pmap_pte(kernel_pmap, addr); *pte = PTE_G; tlb_invalidate_address(kernel_pmap, addr); - sysm->valid1 = 0; critical_exit(); #endif } From owner-svn-src-all@freebsd.org Tue Sep 17 08:09: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 EDACDFB69A; Tue, 17 Sep 2019 08:09:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46XbPH62kNz3C40; Tue, 17 Sep 2019 08:09:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE56C586A; Tue, 17 Sep 2019 08:09:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8H89dJM079227; Tue, 17 Sep 2019 08:09:39 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H89ddk079226; Tue, 17 Sep 2019 08:09:39 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909170809.x8H89ddk079226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 17 Sep 2019 08:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352437 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352437 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 08:09:40 -0000 Author: mjg Date: Tue Sep 17 08:09:39 2019 New Revision: 352437 URL: https://svnweb.freebsd.org/changeset/base/352437 Log: vfs: fix braino resulting in NULL pointer deref in r352424 The breakage was added after all the testing and the testing which followed was not sufficient to find it. Reported by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Tue Sep 17 06:08:15 2019 (r352436) +++ head/sys/kern/vfs_default.c Tue Sep 17 08:09:39 2019 (r352437) @@ -613,11 +613,13 @@ vop_stdgetwritemount(ap) vfs_op_thread_exit(mp); } else { MNT_ILOCK(mp); - if (mp == vp->v_mount) + if (mp == vp->v_mount) { MNT_REF(mp); - else + MNT_IUNLOCK(mp); + } else { + MNT_IUNLOCK(mp); mp = NULL; - MNT_IUNLOCK(mp); + } } *(ap->a_mpp) = mp; return (0); From owner-svn-src-all@freebsd.org Tue Sep 17 08:56: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 1171EFC206; Tue, 17 Sep 2019 08:56:49 +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 46XcRh5qp9z3F6N; Tue, 17 Sep 2019 08:56:48 +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 x8H8ufiJ095262 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 17 Sep 2019 11:56:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x8H8ufiJ095262 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x8H8uf9w095261; Tue, 17 Sep 2019 11:56:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Sep 2019 11:56:41 +0300 From: Konstantin Belousov To: Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r352421 - head/stand/libsa Message-ID: <20190917085641.GY2559@kib.kiev.ua> References: <201909162028.x8GKS9jK064079@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201909162028.x8GKS9jK064079@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: 46XcRh5qp9z3F6N X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,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: Tue, 17 Sep 2019 08:56:49 -0000 On Mon, Sep 16, 2019 at 08:28:09PM +0000, Toomas Soome wrote: > Author: tsoome > Date: Mon Sep 16 20:28:08 2019 > New Revision: 352421 > URL: https://svnweb.freebsd.org/changeset/base/352421 > > Log: > loader: Malloc(0) should return NULL. > > We really should not allocate anything with size 0. Why ? This is quite unexpected from other environments, where malloc(0) returns unique object. > > Modified: > head/stand/libsa/zalloc_malloc.c > > Modified: head/stand/libsa/zalloc_malloc.c > ============================================================================== > --- head/stand/libsa/zalloc_malloc.c Mon Sep 16 20:26:53 2019 (r352420) > +++ head/stand/libsa/zalloc_malloc.c Mon Sep 16 20:28:08 2019 (r352421) > @@ -55,6 +55,9 @@ Malloc(size_t bytes, const char *file, int line) > { > Guard *res; > > + if (bytes == 0) > + return (NULL); > + > #ifdef USEENDGUARD > bytes += MALLOCALIGN + 1; > #else From owner-svn-src-all@freebsd.org Tue Sep 17 09:05: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 E8953FC670 for ; Tue, 17 Sep 2019 09:05:36 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-hyfv10011601.me.com (pv50p00im-hyfv10011601.me.com [17.58.6.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46Xcdr18Xrz3FZh for ; Tue, 17 Sep 2019 09:05:35 +0000 (UTC) (envelope-from tsoome@me.com) Received: from [192.168.150.41] (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-hyfv10011601.me.com (Postfix) with ESMTPSA id 6319F380397; Tue, 17 Sep 2019 09:05:31 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r352421 - head/stand/libsa From: Toomas Soome In-Reply-To: <20190917085641.GY2559@kib.kiev.ua> Date: Tue, 17 Sep 2019 12:05:26 +0300 Cc: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6762A429-F17F-46D1-A55B-BD9C627D6903@me.com> References: <201909162028.x8GKS9jK064079@repo.freebsd.org> <20190917085641.GY2559@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=476 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909170097 X-Rspamd-Queue-Id: 46Xcdr18Xrz3FZh X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.20 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[me.com]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; MV_CASE(0.50)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_IN_DNSWL_MED(-0.20)[43.6.58.17.list.dnswl.org : 127.0.5.2]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-5.74), ipnet: 17.58.0.0/20(-3.33), asn: 714(-2.91), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[me.com]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; 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, 17 Sep 2019 09:05:37 -0000 > On 17 Sep 2019, at 11:56, Konstantin Belousov = wrote: >=20 > On Mon, Sep 16, 2019 at 08:28:09PM +0000, Toomas Soome wrote: >> Author: tsoome >> Date: Mon Sep 16 20:28:08 2019 >> New Revision: 352421 >> URL: https://svnweb.freebsd.org/changeset/base/352421 >>=20 >> Log: >> loader: Malloc(0) should return NULL. >>=20 >> We really should not allocate anything with size 0. > Why ? This is quite unexpected from other environments, where > malloc(0) returns unique object. >=20 Hiding bugs. And, we are not getting unique object, we are getting chunk = of memory with payload length of 0 and the memory content depends on if = head and tail guards are used - the chunk is with size at least = MALLOCALIGN (16 or 64 bytes) and the chunk is from random location of = heap. rgds, toomas= From owner-svn-src-all@freebsd.org Tue Sep 17 09:46: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 B54C5FD22C; Tue, 17 Sep 2019 09:46:43 +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 46XdYH4HDhz3HXJ; Tue, 17 Sep 2019 09:46:43 +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 726096A03; Tue, 17 Sep 2019 09:46:43 +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 x8H9khRM037961; Tue, 17 Sep 2019 09:46:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H9khmT037960; Tue, 17 Sep 2019 09:46:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909170946.x8H9khmT037960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 17 Sep 2019 09:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352438 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 352438 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 09:46:43 -0000 Author: tuexen Date: Tue Sep 17 09:46:42 2019 New Revision: 352438 URL: https://svnweb.freebsd.org/changeset/base/352438 Log: Only allow a SCTP-AUTH shared key to be updated by the application if it is not deactivated and not used. This avoids a use-after-free problem. Reported by: da_cheng_shao@yeah.net MFC after: 3 days Modified: head/sys/netinet/sctp_auth.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Tue Sep 17 08:09:39 2019 (r352437) +++ head/sys/netinet/sctp_auth.c Tue Sep 17 09:46:42 2019 (r352438) @@ -523,7 +523,7 @@ sctp_insert_sharedkey(struct sctp_keyhead *shared_keys } else if (new_skey->keyid == skey->keyid) { /* replace the existing key */ /* verify this key *can* be replaced */ - if ((skey->deactivated) && (skey->refcount > 1)) { + if ((skey->deactivated) || (skey->refcount > 1)) { SCTPDBG(SCTP_DEBUG_AUTH1, "can't replace shared key id %u\n", new_skey->keyid); From owner-svn-src-all@freebsd.org Tue Sep 17 09:47: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 B1252FD2A6; Tue, 17 Sep 2019 09:47:35 +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 46XdZH4DvQz3HgH; Tue, 17 Sep 2019 09:47:35 +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 75B956A04; Tue, 17 Sep 2019 09:47:35 +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 x8H9lZ3r038046; Tue, 17 Sep 2019 09:47:35 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8H9lZe6038045; Tue, 17 Sep 2019 09:47:35 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909170947.x8H9lZe6038045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 09:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352439 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352439 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 09:47:35 -0000 Author: tsoome Date: Tue Sep 17 09:47:35 2019 New Revision: 352439 URL: https://svnweb.freebsd.org/changeset/base/352439 Log: loader: factor out guard location setup from Realloc To simplify and make it easier to read, use ga_Bytes field from guard structure. Modified: head/stand/libsa/zalloc_malloc.c Modified: head/stand/libsa/zalloc_malloc.c ============================================================================== --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 09:46:42 2019 (r352438) +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 09:47:35 2019 (r352439) @@ -156,7 +156,9 @@ Realloc(void *ptr, size_t size, const char *file, int if ((res = Malloc(size, file, line)) != NULL) { if (ptr) { - old = *(size_t *)((char *)ptr - MALLOCALIGN) - MALLOCALIGN; + Guard *g = (Guard *)((char *)ptr - MALLOCALIGN); + + old = g->ga_Bytes - MALLOCALIGN; if (old < size) bcopy(ptr, res, old); else From owner-svn-src-all@freebsd.org Tue Sep 17 10:00: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 A6401FD7AD; Tue, 17 Sep 2019 10:00:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Xdsf3vBBz3JLD; Tue, 17 Sep 2019 10:00:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68F796BF3; Tue, 17 Sep 2019 10:00:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HA0sF2044603; Tue, 17 Sep 2019 10:00:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HA0sx1044602; Tue, 17 Sep 2019 10:00:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909171000.x8HA0sx1044602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 17 Sep 2019 10:00:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352440 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352440 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 10:00:54 -0000 Author: andrew Date: Tue Sep 17 10:00:53 2019 New Revision: 352440 URL: https://svnweb.freebsd.org/changeset/base/352440 Log: MFC r342552: Pass VM_PROT_EXECUTE to vm_fault for instruction faults. We need to tell vm_fault the reason for the fault was because we tried to execute from the memory location. Without this it may return with success as we only request read-only memory, then we return to the same location and try to execute from the same memory address. This leads to an infinite loop raising the same fault and returning to the same invalid location. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18511 Modified: stable/12/sys/arm64/arm64/trap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/trap.c ============================================================================== --- stable/12/sys/arm64/arm64/trap.c Tue Sep 17 09:47:35 2019 (r352439) +++ stable/12/sys/arm64/arm64/trap.c Tue Sep 17 10:00:53 2019 (r352440) @@ -151,7 +151,7 @@ svc_handler(struct thread *td, struct trapframe *frame static void data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, - uint64_t far, int lower) + uint64_t far, int lower, int exec) { struct vm_map *map; struct proc *p; @@ -231,6 +231,8 @@ no_pmap_fault: va = trunc_page(far); ftype = ((esr >> 6) & 1) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ; + if (exec) + ftype |= VM_PROT_EXECUTE; /* Fault in the page. */ error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); @@ -338,7 +340,8 @@ do_el1h_sync(struct thread *td, struct trapframe *fram case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); intr_enable(); - data_abort(td, frame, esr, far, 0); + data_abort(td, frame, esr, far, 0, + exception == EXCP_INSN_ABORT); break; case EXCP_BRK: #ifdef KDTRACE_HOOKS @@ -435,7 +438,8 @@ do_el0_sync(struct thread *td, struct trapframe *frame case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: - data_abort(td, frame, esr, far, 1); + data_abort(td, frame, esr, far, 1, + exception == EXCP_INSN_ABORT_L); break; case EXCP_UNKNOWN: if (!undef_insn(0, frame)) From owner-svn-src-all@freebsd.org Tue Sep 17 10:10: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 27901FDC89; Tue, 17 Sep 2019 10:10:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Xf480CbHz3K2F; Tue, 17 Sep 2019 10:10:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D851C6D8B; Tue, 17 Sep 2019 10:09:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HA9xn3049796; Tue, 17 Sep 2019 10:09:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HA9xLK049795; Tue, 17 Sep 2019 10:09:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201909171009.x8HA9xLK049795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 17 Sep 2019 10:09: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: r352441 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352441 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 10:10:00 -0000 Author: andrew Date: Tue Sep 17 10:09:59 2019 New Revision: 352441 URL: https://svnweb.freebsd.org/changeset/base/352441 Log: MFC r343042, r343875 r343042: Ensure the I-Cache is correctly handled in arm64_icache_sync_range The cache_handle_range macro to handle the arm64 instruction and data cache operations would return when it was complete. This causes problems for arm64_icache_sync_range and arm64_icache_sync_range_checked as they assume they can execute the i-cache handling instruction after it has been called. Fix this by making this assumption correct. While here add missing instruction barriers and adjust the style to match the rest of the assembly. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18838 r343875: Add a missing data barrier to the start of arm64_tlb_flushID. We need to ensure the page table store has happened before the tlbi. Reported by: jchandra Tested by: jchandra Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19097 Modified: stable/12/sys/arm64/arm64/cpufunc_asm.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- stable/12/sys/arm64/arm64/cpufunc_asm.S Tue Sep 17 10:00:53 2019 (r352440) +++ stable/12/sys/arm64/arm64/cpufunc_asm.S Tue Sep 17 10:09:59 2019 (r352441) @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); .if \ic != 0 isb .endif - ret .endm ENTRY(arm64_nullop) @@ -93,6 +92,7 @@ ENTRY(arm64_setttb) END(arm64_setttb) ENTRY(arm64_tlb_flushID) + dsb ishst #ifdef SMP tlbi vmalle1is #else @@ -108,6 +108,7 @@ END(arm64_tlb_flushID) */ ENTRY(arm64_dcache_wb_range) cache_handle_range dcop = cvac + ret END(arm64_dcache_wb_range) /* @@ -115,6 +116,7 @@ END(arm64_dcache_wb_range) */ ENTRY(arm64_dcache_wbinv_range) cache_handle_range dcop = civac + ret END(arm64_dcache_wbinv_range) /* @@ -125,6 +127,7 @@ END(arm64_dcache_wbinv_range) */ ENTRY(arm64_dcache_inv_range) cache_handle_range dcop = ivac + ret END(arm64_dcache_inv_range) /* @@ -132,6 +135,7 @@ END(arm64_dcache_inv_range) */ ENTRY(arm64_idcache_wbinv_range) cache_handle_range dcop = civac, ic = 1, icop = ivau + ret END(arm64_idcache_wbinv_range) /* @@ -146,4 +150,6 @@ ENTRY(arm64_icache_sync_range) cache_handle_range dcop = cvau ic ialluis dsb ish + isb + ret END(arm64_icache_sync_range) From owner-svn-src-all@freebsd.org Tue Sep 17 11:20: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 95DDBFFAB1; Tue, 17 Sep 2019 11:20:54 +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 46Xgdy3Rj4z3P3p; Tue, 17 Sep 2019 11:20:54 +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 5978B79E7; Tue, 17 Sep 2019 11:20:54 +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 x8HBKs6K090934; Tue, 17 Sep 2019 11:20:54 GMT (envelope-from ray@FreeBSD.org) Received: (from ray@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HBKssp090933; Tue, 17 Sep 2019 11:20:54 GMT (envelope-from ray@FreeBSD.org) Message-Id: <201909171120.x8HBKssp090933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ray set sender to ray@FreeBSD.org using -f From: Aleksandr Rybalko Date: Tue, 17 Sep 2019 11:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352442 - stable/12/sys/arm/arm X-SVN-Group: stable-12 X-SVN-Commit-Author: ray X-SVN-Commit-Paths: stable/12/sys/arm/arm X-SVN-Commit-Revision: 352442 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 11:20:54 -0000 Author: ray Date: Tue Sep 17 11:20:53 2019 New Revision: 352442 URL: https://svnweb.freebsd.org/changeset/base/352442 Log: MFC r351649 Check for region dups. Modified: stable/12/sys/arm/arm/physmem.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/arm/physmem.c ============================================================================== --- stable/12/sys/arm/arm/physmem.c Tue Sep 17 10:09:59 2019 (r352441) +++ stable/12/sys/arm/arm/physmem.c Tue Sep 17 11:20:53 2019 (r352442) @@ -287,6 +287,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 Tue Sep 17 11:35: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 F1B2812121A; Tue, 17 Sep 2019 11:35:54 +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 46XgzG6tsQz3Pxm; Tue, 17 Sep 2019 11:35:54 +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 CCA2C7D2F; Tue, 17 Sep 2019 11:35:54 +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 x8HBZst4002707; Tue, 17 Sep 2019 11:35:54 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HBZrKt002702; Tue, 17 Sep 2019 11:35:54 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171135.x8HBZrKt002702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 11:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352443 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352443 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 11:35:55 -0000 Author: tsoome Date: Tue Sep 17 11:35:53 2019 New Revision: 352443 URL: https://svnweb.freebsd.org/changeset/base/352443 Log: loader: cstyle cleanup libsa zalloc sources Clean up libstand zalloc* sources. Note that it is not 100% whitespace cleanup. I also reduced block in znalloc and zfree as those were obvious simplifications and did help to save one level of indent. Modified: head/stand/libsa/zalloc.c head/stand/libsa/zalloc_defs.h head/stand/libsa/zalloc_malloc.c head/stand/libsa/zalloc_mem.h head/stand/libsa/zalloc_protos.h Modified: head/stand/libsa/zalloc.c ============================================================================== --- head/stand/libsa/zalloc.c Tue Sep 17 11:20:53 2019 (r352442) +++ head/stand/libsa/zalloc.c Tue Sep 17 11:35:53 2019 (r352443) @@ -1,5 +1,5 @@ /* - * This module derived from code donated to the FreeBSD Project by + * This module derived from code donated to the FreeBSD Project by * Matthew Dillon * * Copyright (c) 1998 The FreeBSD Project @@ -31,10 +31,10 @@ __FBSDID("$FreeBSD$"); /* - * LIB/MEMORY/ZALLOC.C - self contained low-overhead memory pool/allocation + * LIB/MEMORY/ZALLOC.C - self contained low-overhead memory pool/allocation * subsystem * - * This subsystem implements memory pools and memory allocation + * This subsystem implements memory pools and memory allocation * routines. * * Pools are managed via a linked list of 'free' areas. Allocating @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); * to allocate the entire pool without incuring any structural overhead. * * The system works best when allocating similarly-sized chunks of - * memory. Care must be taken to avoid fragmentation when + * memory. Care must be taken to avoid fragmentation when * allocating/deallocating dissimilar chunks. * * When a memory pool is first allocated, the entire pool is marked as @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); * available. * * z[n]xalloc() works like z[n]alloc() but the allocation is made from - * within the specified address range. If the segment could not be + * within the specified address range. If the segment could not be * allocated, NULL is returned. WARNING! The address range will be * aligned to an 8 or 16 byte boundry depending on the cpu so if you * give an unaligned address range, unexpected results may occur. @@ -88,56 +88,54 @@ typedef char assert_align[(sizeof(struct MemNode) <= M void * znalloc(MemPool *mp, uintptr_t bytes) { - /* - * align according to pool object size (can be 0). This is - * inclusive of the MEMNODE_SIZE_MASK minimum alignment. - * - */ - bytes = (bytes + MEMNODE_SIZE_MASK) & ~MEMNODE_SIZE_MASK; - - if (bytes == 0) - return((void *)-1); - - /* - * locate freelist entry big enough to hold the object. If all objects - * are the same size, this is a constant-time function. - */ - - if (bytes <= mp->mp_Size - mp->mp_Used) { MemNode **pmn; MemNode *mn; - for (pmn = &mp->mp_First; (mn=*pmn) != NULL; pmn = &mn->mr_Next) { - if (bytes > mn->mr_Bytes) - continue; + /* + * align according to pool object size (can be 0). This is + * inclusive of the MEMNODE_SIZE_MASK minimum alignment. + * + */ + bytes = (bytes + MEMNODE_SIZE_MASK) & ~MEMNODE_SIZE_MASK; - /* - * Cut a chunk of memory out of the beginning of this - * block and fixup the link appropriately. - */ + if (bytes == 0) + return ((void *)-1); - { + /* + * locate freelist entry big enough to hold the object. If all objects + * are the same size, this is a constant-time function. + */ + + if (bytes > mp->mp_Size - mp->mp_Used) + return (NULL); + + for (pmn = &mp->mp_First; (mn = *pmn) != NULL; pmn = &mn->mr_Next) { char *ptr = (char *)mn; + if (bytes > mn->mr_Bytes) + continue; + + /* + * Cut a chunk of memory out of the beginning of this + * block and fixup the link appropriately. + */ if (mn->mr_Bytes == bytes) { - *pmn = mn->mr_Next; + *pmn = mn->mr_Next; } else { - mn = (MemNode *)((char *)mn + bytes); - mn->mr_Next = ((MemNode *)ptr)->mr_Next; - mn->mr_Bytes = ((MemNode *)ptr)->mr_Bytes - bytes; - *pmn = mn; + mn = (MemNode *)((char *)mn + bytes); + mn->mr_Next = ((MemNode *)ptr)->mr_Next; + mn->mr_Bytes = ((MemNode *)ptr)->mr_Bytes - bytes; + *pmn = mn; } mp->mp_Used += bytes; return(ptr); - } } - } - /* - * Memory pool is full, return NULL. - */ + /* + * Memory pool is full, return NULL. + */ - return(NULL); + return (NULL); } /* @@ -147,99 +145,97 @@ znalloc(MemPool *mp, uintptr_t bytes) void zfree(MemPool *mp, void *ptr, uintptr_t bytes) { - /* - * align according to pool object size (can be 0). This is - * inclusive of the MEMNODE_SIZE_MASK minimum alignment. - */ - bytes = (bytes + MEMNODE_SIZE_MASK) & ~MEMNODE_SIZE_MASK; + MemNode **pmn; + MemNode *mn; - if (bytes == 0) - return; + /* + * align according to pool object size (can be 0). This is + * inclusive of the MEMNODE_SIZE_MASK minimum alignment. + */ + bytes = (bytes + MEMNODE_SIZE_MASK) & ~MEMNODE_SIZE_MASK; - /* - * panic if illegal pointer - */ + if (bytes == 0) + return; - if ((char *)ptr < (char *)mp->mp_Base || - (char *)ptr + bytes > (char *)mp->mp_End || - ((uintptr_t)ptr & MEMNODE_SIZE_MASK) != 0) - panic("zfree(%p,%ju): wild pointer", ptr, (uintmax_t)bytes); + /* + * panic if illegal pointer + */ - /* - * free the segment - */ + if ((char *)ptr < (char *)mp->mp_Base || + (char *)ptr + bytes > (char *)mp->mp_End || + ((uintptr_t)ptr & MEMNODE_SIZE_MASK) != 0) + panic("zfree(%p,%ju): wild pointer", ptr, (uintmax_t)bytes); - { - MemNode **pmn; - MemNode *mn; - + /* + * free the segment + */ mp->mp_Used -= bytes; for (pmn = &mp->mp_First; (mn = *pmn) != NULL; pmn = &mn->mr_Next) { - /* - * If area between last node and current node - * - check range - * - check merge with next area - * - check merge with previous area - */ - if ((char *)ptr <= (char *)mn) { /* - * range check + * If area between last node and current node + * - check range + * - check merge with next area + * - check merge with previous area */ - if ((char *)ptr + bytes > (char *)mn) { - panic("zfree(%p,%ju): corrupt memlist1", ptr, - (uintmax_t)bytes); - } + if ((char *)ptr <= (char *)mn) { + /* + * range check + */ + if ((char *)ptr + bytes > (char *)mn) { + panic("zfree(%p,%ju): corrupt memlist1", ptr, + (uintmax_t)bytes); + } - /* - * merge against next area or create independant area - */ + /* + * merge against next area or create independant area + */ - if ((char *)ptr + bytes == (char *)mn) { - ((MemNode *)ptr)->mr_Next = mn->mr_Next; - ((MemNode *)ptr)->mr_Bytes= bytes + mn->mr_Bytes; - } else { - ((MemNode *)ptr)->mr_Next = mn; - ((MemNode *)ptr)->mr_Bytes= bytes; - } - *pmn = mn = (MemNode *)ptr; + if ((char *)ptr + bytes == (char *)mn) { + ((MemNode *)ptr)->mr_Next = mn->mr_Next; + ((MemNode *)ptr)->mr_Bytes = + bytes + mn->mr_Bytes; + } else { + ((MemNode *)ptr)->mr_Next = mn; + ((MemNode *)ptr)->mr_Bytes = bytes; + } + *pmn = mn = (MemNode *)ptr; - /* - * merge against previous area (if there is a previous - * area). - */ + /* + * merge against previous area (if there is a previous + * area). + */ - if (pmn != &mp->mp_First) { - if ((char*)pmn + ((MemNode*)pmn)->mr_Bytes == (char*)ptr) { - ((MemNode *)pmn)->mr_Next = mn->mr_Next; - ((MemNode *)pmn)->mr_Bytes += mn->mr_Bytes; - mn = (MemNode *)pmn; - } + if (pmn != &mp->mp_First) { + if ((char *)pmn + ((MemNode*)pmn)->mr_Bytes == + (char *)ptr) { + ((MemNode *)pmn)->mr_Next = mn->mr_Next; + ((MemNode *)pmn)->mr_Bytes += + mn->mr_Bytes; + mn = (MemNode *)pmn; + } + } + return; } - return; - /* NOT REACHED */ - } - if ((char *)ptr < (char *)mn + mn->mr_Bytes) { - panic("zfree(%p,%ju): corrupt memlist2", ptr, - (uintmax_t)bytes); - } + if ((char *)ptr < (char *)mn + mn->mr_Bytes) { + panic("zfree(%p,%ju): corrupt memlist2", ptr, + (uintmax_t)bytes); + } } /* * We are beyond the last MemNode, append new MemNode. Merge against * previous area if possible. */ - if (pmn == &mp->mp_First || - (char *)pmn + ((MemNode *)pmn)->mr_Bytes != (char *)ptr - ) { - ((MemNode *)ptr)->mr_Next = NULL; - ((MemNode *)ptr)->mr_Bytes = bytes; - *pmn = (MemNode *)ptr; - mn = (MemNode *)ptr; + if (pmn == &mp->mp_First || + (char *)pmn + ((MemNode *)pmn)->mr_Bytes != (char *)ptr) { + ((MemNode *)ptr)->mr_Next = NULL; + ((MemNode *)ptr)->mr_Bytes = bytes; + *pmn = (MemNode *)ptr; + mn = (MemNode *)ptr; } else { - ((MemNode *)pmn)->mr_Bytes += bytes; - mn = (MemNode *)pmn; + ((MemNode *)pmn)->mr_Bytes += bytes; + mn = (MemNode *)pmn; } - } } /* @@ -256,26 +252,26 @@ zfree(MemPool *mp, void *ptr, uintptr_t bytes) void zextendPool(MemPool *mp, void *base, uintptr_t bytes) { - if (mp->mp_Size == 0) { - mp->mp_Base = base; - mp->mp_Used = bytes; - mp->mp_End = (char *)base + bytes; - mp->mp_Size = bytes; - } else { - void *pend = (char *)mp->mp_Base + mp->mp_Size; + if (mp->mp_Size == 0) { + mp->mp_Base = base; + mp->mp_Used = bytes; + mp->mp_End = (char *)base + bytes; + mp->mp_Size = bytes; + } else { + void *pend = (char *)mp->mp_Base + mp->mp_Size; - if (base < mp->mp_Base) { - mp->mp_Size += (char *)mp->mp_Base - (char *)base; - mp->mp_Used += (char *)mp->mp_Base - (char *)base; - mp->mp_Base = base; + if (base < mp->mp_Base) { + mp->mp_Size += (char *)mp->mp_Base - (char *)base; + mp->mp_Used += (char *)mp->mp_Base - (char *)base; + mp->mp_Base = base; + } + base = (char *)base + bytes; + if (base > pend) { + mp->mp_Size += (char *)base - (char *)pend; + mp->mp_Used += (char *)base - (char *)pend; + mp->mp_End = (char *)base; + } } - base = (char *)base + bytes; - if (base > pend) { - mp->mp_Size += (char *)base - (char *)pend; - mp->mp_Used += (char *)base - (char *)pend; - mp->mp_End = (char *)base; - } - } } #ifdef ZALLOCDEBUG @@ -283,34 +279,32 @@ zextendPool(MemPool *mp, void *base, uintptr_t bytes) void zallocstats(MemPool *mp) { - int abytes = 0; - int hbytes = 0; - int fcount = 0; - MemNode *mn; + int abytes = 0; + int hbytes = 0; + int fcount = 0; + MemNode *mn; - printf("%d bytes reserved", (int) mp->mp_Size); + printf("%d bytes reserved", (int)mp->mp_Size); - mn = mp->mp_First; + mn = mp->mp_First; - if ((void *)mn != (void *)mp->mp_Base) { - abytes += (char *)mn - (char *)mp->mp_Base; - } + if ((void *)mn != (void *)mp->mp_Base) { + abytes += (char *)mn - (char *)mp->mp_Base; + } - while (mn) { - if ((char *)mn + mn->mr_Bytes != mp->mp_End) { - hbytes += mn->mr_Bytes; - ++fcount; + while (mn != NULL) { + if ((char *)mn + mn->mr_Bytes != mp->mp_End) { + hbytes += mn->mr_Bytes; + ++fcount; + } + if (mn->mr_Next != NULL) { + abytes += (char *)mn->mr_Next - + ((char *)mn + mn->mr_Bytes); + } + mn = mn->mr_Next; } - if (mn->mr_Next) - abytes += (char *)mn->mr_Next - ((char *)mn + mn->mr_Bytes); - mn = mn->mr_Next; - } - printf(" %d bytes allocated\n%d fragments (%d bytes fragmented)\n", - abytes, - fcount, - hbytes - ); + printf(" %d bytes allocated\n%d fragments (%d bytes fragmented)\n", + abytes, fcount, hbytes); } #endif - Modified: head/stand/libsa/zalloc_defs.h ============================================================================== --- head/stand/libsa/zalloc_defs.h Tue Sep 17 11:20:53 2019 (r352442) +++ head/stand/libsa/zalloc_defs.h Tue Sep 17 11:35:53 2019 (r352443) @@ -1,5 +1,5 @@ /* - * This module derived from code donated to the FreeBSD Project by + * This module derived from code donated to the FreeBSD Project by * Matthew Dillon * * Copyright (c) 1998 The FreeBSD Project @@ -33,23 +33,26 @@ * DEFS.H */ -#define USEGUARD /* use stard/end guard bytes */ -#define USEENDGUARD -#define DMALLOCDEBUG /* add debugging code to gather stats */ -#define ZALLOCDEBUG +#ifndef _ZALLOC_DEFS_H +#define _ZALLOC_DEFS_H +#define USEGUARD /* use stard/end guard bytes */ +#define USEENDGUARD +#define DMALLOCDEBUG /* add debugging code to gather stats */ +#define ZALLOCDEBUG + #include #include "stand.h" #include "zalloc_mem.h" -#define Library extern +#define Library extern /* * block extension for sbrk() */ -#define BLKEXTEND (4 * 1024) -#define BLKEXTENDMASK (BLKEXTEND - 1) +#define BLKEXTEND (4 * 1024) +#define BLKEXTENDMASK (BLKEXTEND - 1) /* * Required malloc alignment. @@ -68,11 +71,13 @@ #define MALLOCALIGN_MASK (MALLOCALIGN - 1) typedef struct Guard { - size_t ga_Bytes; - size_t ga_Magic; /* must be at least 32 bits */ + size_t ga_Bytes; + size_t ga_Magic; /* must be at least 32 bits */ } Guard; -#define GAMAGIC 0x55FF44FD -#define GAFREE 0x5F54F4DF +#define GAMAGIC 0x55FF44FD +#define GAFREE 0x5F54F4DF #include "zalloc_protos.h" + +#endif /* _ZALLOC_DEFS_H */ Modified: head/stand/libsa/zalloc_malloc.c ============================================================================== --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 11:20:53 2019 (r352442) +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 11:35:53 2019 (r352443) @@ -1,5 +1,5 @@ /* - * This module derived from code donated to the FreeBSD Project by + * This module derived from code donated to the FreeBSD Project by * Matthew Dillon * * Copyright (c) 1998 The FreeBSD Project @@ -53,141 +53,145 @@ void mallocstats(void); void * Malloc(size_t bytes, const char *file, int line) { - Guard *res; + Guard *res; - if (bytes == 0) - return (NULL); + if (bytes == 0) + return (NULL); #ifdef USEENDGUARD - bytes += MALLOCALIGN + 1; + bytes += MALLOCALIGN + 1; #else - bytes += MALLOCALIGN; + bytes += MALLOCALIGN; #endif - while ((res = znalloc(&MallocPool, bytes)) == NULL) { - int incr = (bytes + BLKEXTENDMASK) & ~BLKEXTENDMASK; - char *base; + while ((res = znalloc(&MallocPool, bytes)) == NULL) { + int incr = (bytes + BLKEXTENDMASK) & ~BLKEXTENDMASK; + char *base; - if ((base = sbrk(incr)) == (char *)-1) - return(NULL); - zextendPool(&MallocPool, base, incr); - zfree(&MallocPool, base, incr); - } + if ((base = sbrk(incr)) == (char *)-1) + return (NULL); + zextendPool(&MallocPool, base, incr); + zfree(&MallocPool, base, incr); + } #ifdef DMALLOCDEBUG - if (++MallocCount > MallocMax) - MallocMax = MallocCount; + if (++MallocCount > MallocMax) + MallocMax = MallocCount; #endif #ifdef USEGUARD - res->ga_Magic = GAMAGIC; + res->ga_Magic = GAMAGIC; #endif - res->ga_Bytes = bytes; + res->ga_Bytes = bytes; #ifdef USEENDGUARD - *((signed char *)res + bytes - 1) = -2; + *((signed char *)res + bytes - 1) = -2; #endif - return((char *)res + MALLOCALIGN); + return ((char *)res + MALLOCALIGN); } void Free(void *ptr, const char *file, int line) { - size_t bytes; + size_t bytes; - if (ptr != NULL) { - Guard *res = (void *)((char *)ptr - MALLOCALIGN); + if (ptr != NULL) { + Guard *res = (void *)((char *)ptr - MALLOCALIGN); - if (file == NULL) - file = "unknown"; + if (file == NULL) + file = "unknown"; #ifdef USEGUARD - if (res->ga_Magic == GAFREE) { - printf("free: duplicate free @ %p from %s:%d\n", ptr, file, line); - return; - } - if (res->ga_Magic != GAMAGIC) - panic("free: guard1 fail @ %p from %s:%d", ptr, file, line); - res->ga_Magic = GAFREE; + if (res->ga_Magic == GAFREE) { + printf("free: duplicate free @ %p from %s:%d\n", + ptr, file, line); + return; + } + if (res->ga_Magic != GAMAGIC) + panic("free: guard1 fail @ %p from %s:%d", + ptr, file, line); + res->ga_Magic = GAFREE; #endif #ifdef USEENDGUARD - if (*((signed char *)res + res->ga_Bytes - 1) == -1) { - printf("free: duplicate2 free @ %p from %s:%d\n", ptr, file, line); - return; - } - if (*((signed char *)res + res->ga_Bytes - 1) != -2) - panic("free: guard2 fail @ %p + %zu from %s:%d", ptr, res->ga_Bytes - MALLOCALIGN, file, line); - *((signed char *)res + res->ga_Bytes - 1) = -1; + if (*((signed char *)res + res->ga_Bytes - 1) == -1) { + printf("free: duplicate2 free @ %p from %s:%d\n", + ptr, file, line); + return; + } + if (*((signed char *)res + res->ga_Bytes - 1) != -2) + panic("free: guard2 fail @ %p + %zu from %s:%d", + ptr, res->ga_Bytes - MALLOCALIGN, file, line); + *((signed char *)res + res->ga_Bytes - 1) = -1; #endif - bytes = res->ga_Bytes; - zfree(&MallocPool, res, bytes); + bytes = res->ga_Bytes; + zfree(&MallocPool, res, bytes); #ifdef DMALLOCDEBUG - --MallocCount; + --MallocCount; #endif - } + } } void * Calloc(size_t n1, size_t n2, const char *file, int line) { - uintptr_t bytes = (uintptr_t)n1 * (uintptr_t)n2; - void *res; + uintptr_t bytes = (uintptr_t)n1 * (uintptr_t)n2; + void *res; - if ((res = Malloc(bytes, file, line)) != NULL) { - bzero(res, bytes); + if ((res = Malloc(bytes, file, line)) != NULL) { + bzero(res, bytes); #ifdef DMALLOCDEBUG - if (++MallocCount > MallocMax) - MallocMax = MallocCount; + if (++MallocCount > MallocMax) + MallocMax = MallocCount; #endif - } - return(res); + } + return (res); } /* * realloc() - I could be fancier here and free the old buffer before - * allocating the new one (saving potential fragmentation + * allocating the new one (saving potential fragmentation * and potential buffer copies). But I don't bother. */ void * Realloc(void *ptr, size_t size, const char *file, int line) { - void *res; - size_t old; + void *res; + size_t old; - if ((res = Malloc(size, file, line)) != NULL) { - if (ptr) { - Guard *g = (Guard *)((char *)ptr - MALLOCALIGN); + if ((res = Malloc(size, file, line)) != NULL) { + if (ptr != NULL) { + Guard *g = (Guard *)((char *)ptr - MALLOCALIGN); - old = g->ga_Bytes - MALLOCALIGN; - if (old < size) - bcopy(ptr, res, old); - else - bcopy(ptr, res, size); - Free(ptr, file, line); - } else { + old = g->ga_Bytes - MALLOCALIGN; + if (old < size) + bcopy(ptr, res, old); + else + bcopy(ptr, res, size); + Free(ptr, file, line); + } else { #ifdef DMALLOCDEBUG - if (++MallocCount > MallocMax) - MallocMax = MallocCount; + if (++MallocCount > MallocMax) + MallocMax = MallocCount; #ifdef EXITSTATS - if (DidAtExit == 0) { - DidAtExit = 1; - atexit(mallocstats); - } + if (DidAtExit == 0) { + DidAtExit = 1; + atexit(mallocstats); + } #endif #endif + } } - } - return(res); + return (res); } void * Reallocf(void *ptr, size_t size, const char *file, int line) { - void *res; + void *res; - if ((res = Realloc(ptr, size, file, line)) == NULL) - Free(ptr, file, line); - return(res); + if ((res = Realloc(ptr, size, file, line)) == NULL) + Free(ptr, file, line); + return (res); } #ifdef DMALLOCDEBUG @@ -195,11 +199,10 @@ Reallocf(void *ptr, size_t size, const char *file, int void mallocstats(void) { - printf("Active Allocations: %d/%d\n", MallocCount, MallocMax); + printf("Active Allocations: %d/%d\n", MallocCount, MallocMax); #ifdef ZALLOCDEBUG - zallocstats(&MallocPool); + zallocstats(&MallocPool); #endif } #endif - Modified: head/stand/libsa/zalloc_mem.h ============================================================================== --- head/stand/libsa/zalloc_mem.h Tue Sep 17 11:20:53 2019 (r352442) +++ head/stand/libsa/zalloc_mem.h Tue Sep 17 11:35:53 2019 (r352443) @@ -1,5 +1,5 @@ /* - * This module derived from code donated to the FreeBSD Project by + * This module derived from code donated to the FreeBSD Project by * Matthew Dillon * * Copyright (c) 1998 The FreeBSD Project @@ -34,20 +34,23 @@ * * Basic memory pool / memory node structures. */ +#ifndef _ZALLOC_MEM_H +#define _ZALLOC_MEM_H typedef struct MemNode { - struct MemNode *mr_Next; - uintptr_t mr_Bytes; + struct MemNode *mr_Next; + uintptr_t mr_Bytes; } MemNode; typedef struct MemPool { - void *mp_Base; - void *mp_End; - MemNode *mp_First; - uintptr_t mp_Size; - uintptr_t mp_Used; + void *mp_Base; + void *mp_End; + MemNode *mp_First; + uintptr_t mp_Size; + uintptr_t mp_Used; } MemPool; -#define ZNOTE_FREE 0 -#define ZNOTE_REUSE 1 +#define ZNOTE_FREE 0 +#define ZNOTE_REUSE 1 +#endif /* _ZALLOC_MEM_H */ Modified: head/stand/libsa/zalloc_protos.h ============================================================================== --- head/stand/libsa/zalloc_protos.h Tue Sep 17 11:20:53 2019 (r352442) +++ head/stand/libsa/zalloc_protos.h Tue Sep 17 11:35:53 2019 (r352443) @@ -1,5 +1,5 @@ /* - * This module derived from code donated to the FreeBSD Project by + * This module derived from code donated to the FreeBSD Project by * Matthew Dillon * * Copyright (c) 1998 The FreeBSD Project @@ -29,7 +29,12 @@ * $FreeBSD$ */ +#ifndef _ZALLOC_PROTOS_H +#define _ZALLOC_PROTOS_H + Library void *znalloc(struct MemPool *mpool, uintptr_t bytes); Library void zfree(struct MemPool *mpool, void *ptr, uintptr_t bytes); Library void zextendPool(MemPool *mp, void *base, uintptr_t bytes); Library void zallocstats(struct MemPool *mp); + +#endif /* _ZALLOC_PROTOS_H */ From owner-svn-src-all@freebsd.org Tue Sep 17 13:07: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 8F1B31239F9; Tue, 17 Sep 2019 13:07:03 +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 46Xk0R3JzRz40Zv; Tue, 17 Sep 2019 13:07:03 +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 55FCE8D50; Tue, 17 Sep 2019 13:07:03 +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 x8HD73Z6055211; Tue, 17 Sep 2019 13:07:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HD73Pd055210; Tue, 17 Sep 2019 13:07:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171307.x8HD73Pd055210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 13:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352444 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352444 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 13:07:03 -0000 Author: tsoome Date: Tue Sep 17 13:07:02 2019 New Revision: 352444 URL: https://svnweb.freebsd.org/changeset/base/352444 Log: loader: stand.h should define reallocf as Reallocf Use the same approach as other zalloc functions. Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Tue Sep 17 11:35:53 2019 (r352443) +++ head/stand/libsa/stand.h Tue Sep 17 13:07:02 2019 (r352444) @@ -264,9 +264,6 @@ static __inline int tolower(int c) extern void setheap(void *base, void *top); extern char *sbrk(int incr); -extern void *reallocf(void *ptr, size_t size); -extern void mallocstats(void); - extern int printf(const char *fmt, ...) __printflike(1, 2); extern int asprintf(char **buf, const char *cfmt, ...) __printflike(2, 3); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); @@ -433,17 +430,20 @@ void *Malloc(size_t, const char *, int); void *Calloc(size_t, size_t, const char *, int); void *Realloc(void *, size_t, const char *, int); void Free(void *, const char *, int); +extern void mallocstats(void); #ifdef DEBUG_MALLOC #define malloc(x) Malloc(x, __FILE__, __LINE__) #define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) #define free(x) Free(x, __FILE__, __LINE__) #define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) +#define reallocf(x, y) Reallocf(x, y, __FILE__, __LINE__) #else #define malloc(x) Malloc(x, NULL, 0) #define calloc(x, y) Calloc(x, y, NULL, 0) #define free(x) Free(x, NULL, 0) #define realloc(x, y) Realloc(x, y, NULL, 0) +#define reallocf(x, y) Reallocf(x, y, NULL, 0) #endif #endif /* STAND_H */ From owner-svn-src-all@freebsd.org Tue Sep 17 13:15: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 C915C123D73; Tue, 17 Sep 2019 13:15:28 +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 46XkB84w7sz418S; Tue, 17 Sep 2019 13:15:28 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88F9A8F2F; Tue, 17 Sep 2019 13:15:28 +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 x8HDFS0h061174; Tue, 17 Sep 2019 13:15:28 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HDFRo1061168; Tue, 17 Sep 2019 13:15:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171315.x8HDFRo1061168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 13:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352445 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352445 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 13:15:28 -0000 Author: tsoome Date: Tue Sep 17 13:15:27 2019 New Revision: 352445 URL: https://svnweb.freebsd.org/changeset/base/352445 Log: loader: add memalign() to libsa Implement memalign(size_t alignment, size_t size) to allocate aligned memory. Modified: head/stand/libsa/stand.h head/stand/libsa/zalloc.c head/stand/libsa/zalloc_malloc.c head/stand/libsa/zalloc_protos.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Tue Sep 17 13:07:02 2019 (r352444) +++ head/stand/libsa/stand.h Tue Sep 17 13:15:27 2019 (r352445) @@ -427,19 +427,23 @@ extern uint16_t ntohs(uint16_t); #endif void *Malloc(size_t, const char *, int); +void *Memalign(size_t, size_t, const char *, int); void *Calloc(size_t, size_t, const char *, int); void *Realloc(void *, size_t, const char *, int); +void *Reallocf(void *, size_t, const char *, int); void Free(void *, const char *, int); extern void mallocstats(void); #ifdef DEBUG_MALLOC #define malloc(x) Malloc(x, __FILE__, __LINE__) +#define memalign(x, y) Memalign(x, y, __FILE__, __LINE__) #define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) #define free(x) Free(x, __FILE__, __LINE__) #define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) #define reallocf(x, y) Reallocf(x, y, __FILE__, __LINE__) #else #define malloc(x) Malloc(x, NULL, 0) +#define memalign(x, y) Memalign(x, y, NULL, 0) #define calloc(x, y) Calloc(x, y, NULL, 0) #define free(x) Free(x, NULL, 0) #define realloc(x, y) Realloc(x, y, NULL, 0) Modified: head/stand/libsa/zalloc.c ============================================================================== --- head/stand/libsa/zalloc.c Tue Sep 17 13:07:02 2019 (r352444) +++ head/stand/libsa/zalloc.c Tue Sep 17 13:15:27 2019 (r352445) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include + /* * LIB/MEMORY/ZALLOC.C - self contained low-overhead memory pool/allocation * subsystem @@ -86,7 +88,7 @@ typedef char assert_align[(sizeof(struct MemNode) <= M */ void * -znalloc(MemPool *mp, uintptr_t bytes) +znalloc(MemPool *mp, uintptr_t bytes, size_t align) { MemNode **pmn; MemNode *mn; @@ -111,14 +113,40 @@ znalloc(MemPool *mp, uintptr_t bytes) for (pmn = &mp->mp_First; (mn = *pmn) != NULL; pmn = &mn->mr_Next) { char *ptr = (char *)mn; + uintptr_t dptr; + char *aligned; + size_t extra; - if (bytes > mn->mr_Bytes) + dptr = (uintptr_t)(ptr + MALLOCALIGN); /* pointer to data */ + aligned = (char *)(roundup2(dptr, align) - MALLOCALIGN); + extra = aligned - ptr; + + if (bytes + extra > mn->mr_Bytes) continue; /* + * Cut extra from head and create new memory node from reminder. + */ + + if (extra != 0) { + MemNode *new; + + new = (MemNode *)aligned; + new->mr_Next = mn->mr_Next; + new->mr_Bytes = mn->mr_Bytes - extra; + + /* And update current memory node */ + mn->mr_Bytes = extra; + mn->mr_Next = new; + /* In next iteration, we will get our aligned address */ + continue; + } + + /* * Cut a chunk of memory out of the beginning of this * block and fixup the link appropriately. */ + if (mn->mr_Bytes == bytes) { *pmn = mn->mr_Next; } else { Modified: head/stand/libsa/zalloc_malloc.c ============================================================================== --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 13:07:02 2019 (r352444) +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 13:15:27 2019 (r352445) @@ -50,9 +50,27 @@ void mallocstats(void); #undef free #endif +static void *Malloc_align(size_t, size_t); + void * -Malloc(size_t bytes, const char *file, int line) +Malloc(size_t bytes, const char *file __unused, int line __unused) { + return (Malloc_align(bytes, 1)); +} + +void * +Memalign(size_t alignment, size_t bytes, const char *file __unused, + int line __unused) +{ + if (alignment == 0) + alignment = 1; + + return (Malloc_align(bytes, alignment)); +} + +static void * +Malloc_align(size_t bytes, size_t alignment) +{ Guard *res; if (bytes == 0) @@ -64,7 +82,7 @@ Malloc(size_t bytes, const char *file, int line) bytes += MALLOCALIGN; #endif - while ((res = znalloc(&MallocPool, bytes)) == NULL) { + while ((res = znalloc(&MallocPool, bytes, alignment)) == NULL) { int incr = (bytes + BLKEXTENDMASK) & ~BLKEXTENDMASK; char *base; Modified: head/stand/libsa/zalloc_protos.h ============================================================================== --- head/stand/libsa/zalloc_protos.h Tue Sep 17 13:07:02 2019 (r352444) +++ head/stand/libsa/zalloc_protos.h Tue Sep 17 13:15:27 2019 (r352445) @@ -32,7 +32,7 @@ #ifndef _ZALLOC_PROTOS_H #define _ZALLOC_PROTOS_H -Library void *znalloc(struct MemPool *mpool, uintptr_t bytes); +Library void *znalloc(struct MemPool *mpool, uintptr_t bytes, size_t align); Library void zfree(struct MemPool *mpool, void *ptr, uintptr_t bytes); Library void zextendPool(MemPool *mp, void *base, uintptr_t bytes); Library void zallocstats(struct MemPool *mp); From owner-svn-src-all@freebsd.org Tue Sep 17 13: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 CCF5E124702; Tue, 17 Sep 2019 13:50:25 +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 46XkyT5621z42NM; Tue, 17 Sep 2019 13:50:25 +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 8EEC49454; Tue, 17 Sep 2019 13:50:25 +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 x8HDoP2S078666; Tue, 17 Sep 2019 13:50:25 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HDoPJB078665; Tue, 17 Sep 2019 13:50:25 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171350.x8HDoPJB078665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 13:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352446 - 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: 352446 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 13:50:25 -0000 Author: tsoome Date: Tue Sep 17 13:50:25 2019 New Revision: 352446 URL: https://svnweb.freebsd.org/changeset/base/352446 Log: loader.efi: efipart needs to use ioalign UEFI specification 2.7A, EFI_BLOCK_IO_PROTOCOL, page 566. The ioalign property does define the alignment of data buffer. If the alignment is required and our buffer is not aligned, or if the data buffer is not multiple of Blocksize, we need to use bounce buffer to perform the block IO. This is much like with BIOS version, except there the INT13 needs buffer to be located in low memory. Additionally, we need to handle disk writes properly. Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Tue Sep 17 13:15:27 2019 (r352445) +++ head/stand/efi/libefi/efipart.c Tue Sep 17 13:50:25 2019 (r352446) @@ -64,6 +64,9 @@ static int efipart_printhd(int); #define PNP0700 0x700 #define PNP0701 0x701 +/* Bounce buffer max size */ +#define BIO_BUFFER_SIZE 0x4000 + struct devsw efipart_fddev = { .dv_name = "fd", .dv_type = DEVT_FD, @@ -266,6 +269,12 @@ efipart_inithandles(void) continue; } + /* Allowed values are 0, 1 and power of 2. */ + if (blkio->Media->IoAlign > 1 && + !powerof2(blkio->Media->IoAlign)) { + continue; + } + /* This is bad. */ if ((pd = calloc(1, sizeof(*pd))) == NULL) { printf("efipart_inithandles: Out of memory.\n"); @@ -979,8 +988,10 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl EFI_BLOCK_IO *blkio; uint64_t off, disk_blocks, d_offset = 0; char *blkbuf; - size_t blkoff, blksz; - int error; + size_t blkoff, blksz, bio_size; + unsigned ioalign; + bool need_buf; + int rc; uint64_t diskend, readstart; if (dev == NULL || blk < 0) @@ -1028,40 +1039,118 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl size = size * blkio->Media->BlockSize; } - if (rsize != NULL) - *rsize = size; - + need_buf = true; + /* Do we need bounce buffer? */ if ((size % blkio->Media->BlockSize == 0) && (off % blkio->Media->BlockSize == 0)) - return (efipart_readwrite(blkio, rw, - off / blkio->Media->BlockSize, - size / blkio->Media->BlockSize, buf)); + need_buf = false; - /* - * The buffer size is not a multiple of the media block size. - */ - blkbuf = malloc(blkio->Media->BlockSize); + /* Do we have IO alignment requirement? */ + ioalign = blkio->Media->IoAlign; + if (ioalign == 0) + ioalign++; + + if (ioalign > 1 && (uintptr_t)buf != roundup2((uintptr_t)buf, ioalign)) + need_buf = true; + + if (need_buf) { + for (bio_size = BIO_BUFFER_SIZE; bio_size > 0; + bio_size -= blkio->Media->BlockSize) { + blkbuf = memalign(ioalign, bio_size); + if (blkbuf != NULL) + break; + } + } else { + blkbuf = buf; + bio_size = size; + } + if (blkbuf == NULL) return (ENOMEM); - error = 0; + if (rsize != NULL) + *rsize = size; + + rc = 0; blk = off / blkio->Media->BlockSize; blkoff = off % blkio->Media->BlockSize; - blksz = blkio->Media->BlockSize - blkoff; + while (size > 0) { - error = efipart_readwrite(blkio, rw, blk, 1, blkbuf); - if (error) + size_t x = min(size, bio_size); + + if (x < blkio->Media->BlockSize) + x = 1; + else + x /= blkio->Media->BlockSize; + + switch (rw & F_MASK) { + case F_READ: + blksz = blkio->Media->BlockSize * x - blkoff; + if (size < blksz) + blksz = size; + + rc = efipart_readwrite(blkio, rw, blk, x, blkbuf); + if (rc != 0) + goto error; + + if (need_buf) + bcopy(blkbuf + blkoff, buf, blksz); break; - if (size < blksz) - blksz = size; - bcopy(blkbuf + blkoff, buf, blksz); + case F_WRITE: + rc = 0; + if (blkoff != 0) { + /* + * We got offset to sector, read 1 sector to + * blkbuf. + */ + x = 1; + blksz = blkio->Media->BlockSize - blkoff; + blksz = min(blksz, size); + rc = efipart_readwrite(blkio, F_READ, blk, x, + blkbuf); + } else if (size < blkio->Media->BlockSize) { + /* + * The remaining block is not full + * sector. Read 1 sector to blkbuf. + */ + x = 1; + blksz = size; + rc = efipart_readwrite(blkio, F_READ, blk, x, + blkbuf); + } else { + /* We can write full sector(s). */ + blksz = blkio->Media->BlockSize * x; + } + + if (rc != 0) + goto error; + /* + * Put your Data In, Put your Data out, + * Put your Data In, and shake it all about + */ + if (need_buf) + bcopy(buf, blkbuf + blkoff, blksz); + rc = efipart_readwrite(blkio, F_WRITE, blk, x, blkbuf); + if (rc != 0) + goto error; + break; + default: + /* DO NOTHING */ + rc = EROFS; + goto error; + } + + blkoff = 0; buf += blksz; size -= blksz; - blk++; - blkoff = 0; - blksz = blkio->Media->BlockSize; + blk += x; } - free(blkbuf); - return (error); +error: + if (rsize != NULL) + *rsize -= size; + + if (need_buf) + free(blkbuf); + return (rc); } From owner-svn-src-all@freebsd.org Tue Sep 17 13:58: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 8AAC5124BEF; Tue, 17 Sep 2019 13:58:16 +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 46Xl7X2vzyz42tp; Tue, 17 Sep 2019 13:58:16 +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 477C7960C; Tue, 17 Sep 2019 13:58:16 +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 x8HDwGj1084493; Tue, 17 Sep 2019 13:58:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HDwFI9084489; Tue, 17 Sep 2019 13:58:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909171358.x8HDwFI9084489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 17 Sep 2019 13:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352447 - in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Commit-Revision: 352447 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 13:58:16 -0000 Author: avg Date: Tue Sep 17 13:58:15 2019 New Revision: 352447 URL: https://svnweb.freebsd.org/changeset/base/352447 Log: MFZoL: Add -vnP support to 'zfs send' for bookmarks zfsonlinux/zfs@835db58592d7d947e5818eb7281882e2a46073e0 We have long supported estimating a size of an incremental stream from a snapshot. We should do the same for bookmarks as well. Obtained from: ZoL Author: loli10K MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Sep 17 13:50:25 2019 (r352446) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Sep 17 13:58:15 2019 (r352447) @@ -190,8 +190,8 @@ .Ar snapshot .Nm .Cm send -.Op Fl Lce -.Op Fl i Ar snapshot Ns | Ns bookmark +.Op Fl LPcenv +.Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm send @@ -2766,7 +2766,7 @@ on future versions of .It Xo .Nm .Cm send -.Op Fl Lce +.Op Fl LPcenv .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2780,7 +2780,7 @@ stream generated from a filesystem or volume is receiv name will be .Pq --head-- . .Bl -tag -width indent -.It Fl i Ar snapshot Ns | Ns bookmark +.It Fl i Ar snapshot Ns | Ns Ar bookmark Generate an incremental send stream. The incremental source must be an earlier snapshot in the destination's history. @@ -2792,6 +2792,23 @@ specified as the last component of the name If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. +.It Fl n, -dryrun +Do a dry-run +.Pq Qq No-op +send. +Do not generate any actual send data. +This is useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +In this case, the verbose output will be written to standard output +.Po contrast with a non-dry-run, where the stream is written to standard output +and the verbose output goes to standard error +.Pc . +.It Fl v, -verbose +Print verbose information about the stream package generated. +This information includes a per-second report of how much data has been sent. .It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag @@ -2808,6 +2825,8 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. +.It Fl P, -parsable +Print machine-parsable verbose information about the stream package generated. .It Fl c, -compressed Generate a more compact stream by using compressed WRITE records for blocks which are compressed on disk and in memory (see the Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Sep 17 13:50:25 2019 (r352446) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Sep 17 13:58:15 2019 (r352447) @@ -3928,13 +3928,11 @@ zfs_do_send(int argc, char **argv) if (strchr(argv[0], '@') == NULL || (fromname && strchr(fromname, '#') != NULL)) { char frombuf[ZFS_MAX_DATASET_NAME_LEN]; - enum lzc_send_flags lzc_flags = 0; if (flags.replicate || flags.doall || flags.props || - flags.dedup || flags.dryrun || flags.verbose || - flags.progress) { - (void) fprintf(stderr, - gettext("Error: " + flags.dedup || (strchr(argv[0], '@') == NULL && + (flags.dryrun || flags.verbose || flags.progress))) { + (void) fprintf(stderr, gettext("Error: " "Unsupported flag with filesystem or bookmark.\n")); return (1); } @@ -3943,13 +3941,6 @@ zfs_do_send(int argc, char **argv) if (zhp == NULL) return (1); - if (flags.largeblock) - lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; - if (flags.embed_data) - lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; - if (flags.compress) - lzc_flags |= LZC_SEND_FLAG_COMPRESS; - if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { /* @@ -3963,7 +3954,7 @@ zfs_do_send(int argc, char **argv) (void) strlcat(frombuf, fromname, sizeof (frombuf)); fromname = frombuf; } - err = zfs_send_one(zhp, fromname, STDOUT_FILENO, lzc_flags); + err = zfs_send_one(zhp, fromname, STDOUT_FILENO, flags); zfs_close(zhp); return (err != 0); } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Sep 17 13:50:25 2019 (r352446) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Sep 17 13:58:15 2019 (r352447) @@ -660,7 +660,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, vo extern int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); -extern int zfs_send_one(zfs_handle_t *, const char *, int, enum lzc_send_flags); +extern int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t flags); extern int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd, const char *); extern nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl, Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Sep 17 13:50:25 2019 (r352446) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Sep 17 13:58:15 2019 (r352447) @@ -1190,16 +1190,14 @@ send_print_verbose(FILE *fout, const char *tosnap, con } } - if (size != 0) { - if (parsable) { - (void) fprintf(fout, "\t%llu", - (longlong_t)size); - } else { - char buf[16]; - zfs_nicenum(size, buf, sizeof (buf)); - (void) fprintf(fout, dgettext(TEXT_DOMAIN, - " estimated size is %s"), buf); - } + if (parsable) { + (void) fprintf(fout, "\t%llu", + (longlong_t)size); + } else if (size != 0) { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + " estimated size is %s"), buf); } (void) fprintf(fout, "\n"); } @@ -2037,17 +2035,40 @@ err_out: } int -zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, - enum lzc_send_flags flags) +zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t flags) { - int err; + int err = 0; libzfs_handle_t *hdl = zhp->zfs_hdl; - + enum lzc_send_flags lzc_flags = 0; + FILE *fout = (flags.verbose && flags.dryrun) ? stdout : stderr; char errbuf[1024]; + + if (flags.largeblock) + lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; + if (flags.embed_data) + lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags.compress) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; + + if (flags.verbose) { + uint64_t size = 0; + err = lzc_send_space(zhp->zfs_name, from, lzc_flags, &size); + if (err == 0) { + send_print_verbose(fout, zhp->zfs_name, from, size, + flags.parsable); + } else { + (void) fprintf(stderr, "Cannot estimate send size: " + "%s\n", strerror(errno)); + } + } + + if (flags.dryrun) + return (err); + (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "warning: cannot send '%s'"), zhp->zfs_name); - err = lzc_send(zhp->zfs_name, from, fd, flags); + err = lzc_send(zhp->zfs_name, from, fd, lzc_flags); if (err != 0) { switch (errno) { case EXDEV: From owner-svn-src-all@freebsd.org Tue Sep 17 14:08: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 04572125078; Tue, 17 Sep 2019 14:08:10 +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 46XlLx5d4Qz43WB; Tue, 17 Sep 2019 14:08:09 +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 A45AE97CD; Tue, 17 Sep 2019 14:08:09 +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 x8HE899p090325; Tue, 17 Sep 2019 14:08:09 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HE89OK090324; Tue, 17 Sep 2019 14:08:09 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909171408.x8HE89OK090324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 17 Sep 2019 14:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352448 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libc/sys X-SVN-Commit-Revision: 352448 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 14:08:10 -0000 Author: lwhsu Date: Tue Sep 17 14:08:09 2019 New Revision: 352448 URL: https://svnweb.freebsd.org/changeset/base/352448 Log: Temporarily skip flakey test case lib.libc.sys.stat_test.stat_socket PR: 240621 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_stat.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Tue Sep 17 13:58:15 2019 (r352447) +++ head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Tue Sep 17 14:08:09 2019 (r352448) @@ -332,6 +332,9 @@ ATF_TC_BODY(stat_socket, tc) uint32_t iaddr; int fd, flags; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/240621"); + (void)memset(&st, 0, sizeof(struct stat)); (void)memset(&addr, 0, sizeof(struct sockaddr_in)); From owner-svn-src-all@freebsd.org Tue Sep 17 14:15: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 55898125544; Tue, 17 Sep 2019 14:15:49 +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 46XlWn1bsVz44Ql; Tue, 17 Sep 2019 14:15:49 +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 1AC1999A2; Tue, 17 Sep 2019 14:15:49 +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 x8HEFmQD096366; Tue, 17 Sep 2019 14:15:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HEFmTk096365; Tue, 17 Sep 2019 14:15:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909171415.x8HEFmTk096365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 17 Sep 2019 14:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352449 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 352449 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 14:15:49 -0000 Author: avg Date: Tue Sep 17 14:15:48 2019 New Revision: 352449 URL: https://svnweb.freebsd.org/changeset/base/352449 Log: fixup up fallout from r352447 in libbe I totally forgot that we now have another in-tree consumer of libzfs. MFC after: 3 days X-MFC with: r352447 Modified: head/lib/libbe/be.c Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Tue Sep 17 14:08:09 2019 (r352448) +++ head/lib/libbe/be.c Tue Sep 17 14:15:48 2019 (r352449) @@ -775,6 +775,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in char snap_name[BE_MAXPATHLEN]; char buf[BE_MAXPATHLEN]; zfs_handle_t *zfs; + sendflags_t flags = { 0 }; int err; if ((err = be_snapshot(lbh, bootenv, NULL, true, snap_name)) != 0) @@ -786,7 +787,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - err = zfs_send_one(zfs, NULL, fd, 0); + err = zfs_send_one(zfs, NULL, fd, flags); zfs_close(zfs); return (err); From owner-svn-src-all@freebsd.org Tue Sep 17 14:27: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 E2076125863; Tue, 17 Sep 2019 14:27:59 +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 46Xlnp6tVKz44w8; Tue, 17 Sep 2019 14:27:58 +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 x8HERnIR071898 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 17 Sep 2019 17:27:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x8HERnIR071898 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x8HERni2071897; Tue, 17 Sep 2019 17:27:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Sep 2019 17:27:49 +0300 From: Konstantin Belousov To: Toomas Soome Cc: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r352421 - head/stand/libsa Message-ID: <20190917142749.GB2559@kib.kiev.ua> References: <201909162028.x8GKS9jK064079@repo.freebsd.org> <20190917085641.GY2559@kib.kiev.ua> <6762A429-F17F-46D1-A55B-BD9C627D6903@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6762A429-F17F-46D1-A55B-BD9C627D6903@me.com> 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: 46Xlnp6tVKz44w8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.66), ipnet: 2001:470::/32(-4.46), asn: 6939(-3.22), country: US(-0.05)]; FREEMAIL_TO(0.00)[me.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(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: Tue, 17 Sep 2019 14:27:59 -0000 On Tue, Sep 17, 2019 at 12:05:26PM +0300, Toomas Soome wrote: > > > > On 17 Sep 2019, at 11:56, Konstantin Belousov wrote: > > > > On Mon, Sep 16, 2019 at 08:28:09PM +0000, Toomas Soome wrote: > >> Author: tsoome > >> Date: Mon Sep 16 20:28:08 2019 > >> New Revision: 352421 > >> URL: https://svnweb.freebsd.org/changeset/base/352421 > >> > >> Log: > >> loader: Malloc(0) should return NULL. > >> > >> We really should not allocate anything with size 0. > > Why ? This is quite unexpected from other environments, where > > malloc(0) returns unique object. > > > > Hiding bugs. And, we are not getting unique object, we are getting chunk of memory with payload length of 0 and the memory content depends on if head and tail guards are used - the chunk is with size at least MALLOCALIGN (16 or 64 bytes) and the chunk is from random location of heap. > Yes, exactly, this is how all other mallocs behave. From owner-svn-src-all@freebsd.org Tue Sep 17 15:53: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 3BDEB127E9E; Tue, 17 Sep 2019 15:53:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Xnhj0rpbz4BJ3; Tue, 17 Sep 2019 15:53:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 008F9ABBA; Tue, 17 Sep 2019 15:53:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HFre2c054198; Tue, 17 Sep 2019 15:53:40 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HFre1x054197; Tue, 17 Sep 2019 15:53:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909171553.x8HFre1x054197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 17 Sep 2019 15:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352450 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352450 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 15:53:41 -0000 Author: mjg Date: Tue Sep 17 15:53:40 2019 New Revision: 352450 URL: https://svnweb.freebsd.org/changeset/base/352450 Log: vfs: apply r352437 to the fast path as well This one is very hard to run into. If the filesystem is being unmounted or the mount point is freed the vfs_op_thread_enter will fail. For it to succeed the mount point itself would have to be reallocated in the time window between the initial read and the attempt to enter. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Tue Sep 17 14:15:48 2019 (r352449) +++ head/sys/kern/vfs_default.c Tue Sep 17 15:53:40 2019 (r352450) @@ -606,11 +606,13 @@ vop_stdgetwritemount(ap) return (0); } if (vfs_op_thread_enter(mp)) { - if (mp == vp->v_mount) + if (mp == vp->v_mount) { vfs_mp_count_add_pcpu(mp, ref, 1); - else + vfs_op_thread_exit(mp); + } else { + vfs_op_thread_exit(mp); mp = NULL; - vfs_op_thread_exit(mp); + } } else { MNT_ILOCK(mp); if (mp == vp->v_mount) { From owner-svn-src-all@freebsd.org Tue Sep 17 16: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 744411287E9; Tue, 17 Sep 2019 16:16:47 +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 46XpCM2W2mz4CSn; Tue, 17 Sep 2019 16:16:47 +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 3AB06AF32; Tue, 17 Sep 2019 16:16:47 +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 x8HGGlAr066219; Tue, 17 Sep 2019 16:16:47 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HGGlkb066218; Tue, 17 Sep 2019 16:16:47 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171616.x8HGGlkb066218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 16:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352451 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352451 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 16:16:47 -0000 Author: tsoome Date: Tue Sep 17 16:16:46 2019 New Revision: 352451 URL: https://svnweb.freebsd.org/changeset/base/352451 Log: loader: revert r352421 As insisted by kib, malloc(0) is quite legal. Modified: head/stand/libsa/zalloc_malloc.c Modified: head/stand/libsa/zalloc_malloc.c ============================================================================== --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 (r352450) +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 (r352451) @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment) { Guard *res; - if (bytes == 0) - return (NULL); - #ifdef USEENDGUARD bytes += MALLOCALIGN + 1; #else From owner-svn-src-all@freebsd.org Tue Sep 17 16:21: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 A4E241289F6 for ; Tue, 17 Sep 2019 16:21:03 +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 46XpJH20cCz4Cfy for ; Tue, 17 Sep 2019 16:21:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1568737262; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=ksNqlmxOdBzsjYxaiFlg2ZmCWhCpXaXP0grG+1PEoSRqWRtqnfW6mvuesQaOWtgr1TrwQPHR8mpEJ VEvrQk5uhWTArs8Mgh6fbydEq7S8gUm3/1E+u4vApOqNFFoTN7idPIuzmGECeG8Rq+AiTbOSNEPliW qq+4gnMXAFbIMh74apRKsrBor1isCLzfaE+o5/B2gxyLDq2wOc/ZUivIrstGBFEotKaXapjIiOjqzl hy/4oCVTua8y6l/8XctDg+alvvvPAGqMdBSYtwc4VpwletAZ5llxUfXVI+EB2uJzrOY9Cdpg6OGJOz T65Wmb9iz3ixLayoese2pEgeooS9v/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=RidBFvt1egsvG4iczwVRR+rQwzBd4Y2CJVwPGpoZJeI=; b=lGWDzEI4RjAy7TW0TpIM0AxDLmcsdoZdEz31sCzJtvPvIjlxitKohm1yA7CTfRSYezlgcEbJb0SlX MOXPhaPWGOPG3Fl5c+YyOTklodT7EwHCVRv1zzyhNebc+rX9kVLG8RPfvS4kBo8+VjmttDNH0upjbq UCXtSjH+eFrmE3TrObvKZ8irJi/15930p+FFI2N/nOuhHWvv5mNeshg6NukuysbaJPS2u4ziU2i1Ck hlxNrCAT+kEWpUT1Dio5LwX0qaDjlTtV29glNfI/ZchFG/8hlYhkwu5lzcQN0JlVwiwhjNPauKC1/T z6KPvp/9+4Lj6fNq6zaYTF689uftE4w== 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:to:from:subject:message-id:from; bh=RidBFvt1egsvG4iczwVRR+rQwzBd4Y2CJVwPGpoZJeI=; b=VNzvE1ZVvvLo8RSwAR2ZFAFmWx+Qr88uAOG9pKYN7ZkxCIxOOQ2vZARvkU0kZP8s8Ab5veWzC4BQz jlHOL9hCxk35giTjZEis7LpL7bX8E1SS7LYsSbszcJNqveAym2FTE3rI/+Q2HtmWDMaduPJZPAqTvK xaJtNvz1bMhULpBgcFGvx4wvml+zirYGJq9exCq/fT+YWbtcxLI91MkV1gy23mmo67A9n89XCDIU8Y 028qtyY7D+ZYoUZ2T717zMMqW//GD32I50lIAoAgNu6BPQYBMH1bcLDqm2YEOF9R0zxhGIGNeg5yw7 jleiB/ixxhWD9LMG96Z8WRh+4uZkXjg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 222a285a-d967-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 222a285a-d967-11e9-85ed-13b9aae3a1d2; Tue, 17 Sep 2019 16:21:00 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x8HGKwS2099761; Tue, 17 Sep 2019 10:20:58 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r352451 - head/stand/libsa From: Ian Lepore To: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 17 Sep 2019 10:20:58 -0600 In-Reply-To: <201909171616.x8HGGlkb066218@repo.freebsd.org> References: <201909171616.x8HGGlkb066218@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: 46XpJH20cCz4Cfy X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; 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, 17 Sep 2019 16:21:03 -0000 On Tue, 2019-09-17 at 16:16 +0000, Toomas Soome wrote: > Author: tsoome > Date: Tue Sep 17 16:16:46 2019 > New Revision: 352451 > URL: https://svnweb.freebsd.org/changeset/base/352451 > > Log: > loader: revert r352421 > > As insisted by kib, malloc(0) is quite legal. > > Modified: > head/stand/libsa/zalloc_malloc.c > > Modified: head/stand/libsa/zalloc_malloc.c > ============================================================================== > --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 (r352450) > +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 (r352451) > @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment) > { > Guard *res; > > - if (bytes == 0) > - return (NULL); > - > #ifdef USEENDGUARD > bytes += MALLOCALIGN + 1; > #else For the record, you're both right. In both the C and posix standards for malloc(), an implementation is allowed to return either NULL or a unique pointer which cannot be used to access any memory but must be passed to free(). -- Ian From owner-svn-src-all@freebsd.org Tue Sep 17 16:53: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 CF963129419; Tue, 17 Sep 2019 16:53:56 +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 46Xq2D4FP4z4FTH; Tue, 17 Sep 2019 16:53:56 +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 x8HGrlbD017005 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 17 Sep 2019 19:53:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x8HGrlbD017005 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x8HGrlEP017004; Tue, 17 Sep 2019 19:53:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Sep 2019 19:53:47 +0300 From: Konstantin Belousov To: Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r352451 - head/stand/libsa Message-ID: <20190917165347.GD2559@kib.kiev.ua> References: <201909171616.x8HGGlkb066218@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201909171616.x8HGGlkb066218@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: 46Xq2D4FP4z4FTH X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,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: Tue, 17 Sep 2019 16:53:56 -0000 On Tue, Sep 17, 2019 at 04:16:47PM +0000, Toomas Soome wrote: > Author: tsoome > Date: Tue Sep 17 16:16:46 2019 > New Revision: 352451 > URL: https://svnweb.freebsd.org/changeset/base/352451 > > Log: > loader: revert r352421 > > As insisted by kib, malloc(0) is quite legal. Thank you. > > Modified: > head/stand/libsa/zalloc_malloc.c > > Modified: head/stand/libsa/zalloc_malloc.c > ============================================================================== > --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 (r352450) > +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 (r352451) > @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment) > { > Guard *res; > > - if (bytes == 0) > - return (NULL); > - > #ifdef USEENDGUARD > bytes += MALLOCALIGN + 1; > #else From owner-svn-src-all@freebsd.org Tue Sep 17 17:28: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 08227129F3B; Tue, 17 Sep 2019 17:28:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46XqpP00w4z4Gs1; Tue, 17 Sep 2019 17:28:45 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D717ABD1B; Tue, 17 Sep 2019 17:28:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HHSijf007584; Tue, 17 Sep 2019 17:28:44 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HHSiwe007582; Tue, 17 Sep 2019 17:28:44 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909171728.x8HHSiwe007582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 17 Sep 2019 17:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352452 - in stable/12/sys/arm64: arm64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/12/sys/arm64: arm64 include X-SVN-Commit-Revision: 352452 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 17:28:45 -0000 Author: alc Date: Tue Sep 17 17:28:44 2019 New Revision: 352452 URL: https://svnweb.freebsd.org/changeset/base/352452 Log: MFC r349117, r349122, r349183, r349897, r349943, r350004, r350029, r350038, r350191, r350202, r350422, r350427, r350525 r349117: Three enhancements to arm64's pmap_protect(): Implement protection changes on superpage mappings. Previously, a superpage mapping was unconditionally demoted by pmap_protect(), even if the protection change applied to the entire superpage mapping. Precompute the bit mask describing the protection changes rather than recomputing it for every page table entry that is changed. Skip page table entries that already have the requested protection changes in place. r349122: Three changes to arm64's pmap_unwire(): Implement wiring changes on superpage mappings. Previously, a superpage mapping was unconditionally demoted by pmap_unwire(), even if the wiring change applied to the entire superpage mapping. Rewrite a comment to use the arm64 names for bits in a page table entry. Previously, the bits were referred to by their x86 names. Use atomic_"op"_64() instead of atomic_"op"_long() to update a page table entry in order to match the prevailing style in this file. r349183: Correct an error in r349122. pmap_unwire() should update the pmap's wired count, not its resident count. r349897: (by markj) Rename pmap_page_dirty() to pmap_pte_dirty(). This is a precursor to implementing dirty bit management. r349943: (by markj) Apply some light cleanup to uses of pmap_pte_dirty(). - Check for ATTR_SW_MANAGED before anything else. - Use pmap_pte_dirty() in pmap_remove_pages(). r350004: (by markj) Implement software access and dirty bit management for arm64. Previously the arm64 pmap did no reference or modification tracking; all mappings were treated as referenced and all read-write mappings were treated as dirty. This change implements software management of these attributes. Dirty bit management is implemented to emulate ARMv8.1's optional hardware dirty bit modifier management, following a suggestion from alc. In particular, a mapping with ATTR_SW_DBM set is logically writeable and is dirty if the ATTR_AP_RW_BIT bit is clear. Mappings with ATTR_AP_RW_BIT set are write-protected, and a write access will trigger a permission fault. pmap_fault() handles permission faults for such mappings and marks the page dirty by clearing ATTR_AP_RW_BIT, thus mapping the page read-write. r350029: (by markj) Propagate attribute changes during demotion. After r349117 and r349122, some mapping attribute changes do not trigger superpage demotion. However, pmap_demote_l2() was not updated to ensure that the replacement L3 entries carry any attribute changes that occurred since promotion. r350038: (by markj) Always use the software DBM bit for now. r350004 added most of the machinery needed to support hardware DBM management, but it did not intend to actually enable use of the hardware DBM bit. r350191: Introduce pmap_store(), and use it to replace pmap_load_store() in places where the page table entry was previously invalid. (Note that I did not replace pmap_load_store() when it was followed by a TLB invalidation, even if we are not using the return value from pmap_load_store().) Correct an error in pmap_enter(). A test for determining when to set PGA_WRITEABLE was always true, even if the mapping was read only. In pmap_enter_l2(), when replacing an empty kernel page table page by a superpage mapping, clear the old l2 entry and issue a TLB invalidation. My reading of the ARM architecture manual leads me to believe that the TLB could hold an intermediate entry referencing the empty kernel page table page even though it contains no valid mappings. Replace a couple direct uses of atomic_clear_64() by the new pmap_clear_bits(). In a couple comments, replace the term "paging-structure caches", which is an Intel-specific term for the caches that hold intermediate entries in the page table, with wording that is more consistent with the ARM architecture manual. r350202: With the introduction of software dirty bit emulation for managed mappings, we should test ATTR_SW_DBM, not ATTR_AP_RW, to determine whether to set PGA_WRITEABLE. In effect, we are currently setting PGA_WRITEABLE based on whether the dirty bit is preset, not whether the mapping is writeable. Correct this mistake. r350422: (by markj) Remove an unneeded trunc_page() in pmap_fault(). r350427: (by markj) Have arm64's pmap_fault() handle WnR faults on dirty PTEs. If we take a WnR permission fault on a managed, writeable and dirty PTE, simply return success without calling the main fault handler. This situation can occur if multiple threads simultaneously access a clean writeable mapping and trigger WnR faults; losers of the race to mark the PTE dirty would end up calling the main fault handler, which had no work to do. r350525: (by markj) Use ATTR_DBM even when hardware dirty bit management is not enabled. The ARMv8 reference manual only states that the bit is reserved in this case; following Linux's example, use it instead of a software-defined bit for the purpose of indicating that a managed mapping is writable. Modified: stable/12/sys/arm64/arm64/pmap.c stable/12/sys/arm64/arm64/trap.c stable/12/sys/arm64/include/pte.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Tue Sep 17 16:16:46 2019 (r352451) +++ stable/12/sys/arm64/arm64/pmap.c Tue Sep 17 17:28:44 2019 (r352452) @@ -217,6 +217,16 @@ __FBSDID("$FreeBSD$"); #define VM_PAGE_TO_PV_LIST_LOCK(m) \ PHYS_TO_PV_LIST_LOCK(VM_PAGE_TO_PHYS(m)) +/* + * The presence of this flag indicates that the mapping is writeable. + * If the ATTR_AP_RO bit is also set, then the mapping is clean, otherwise it is + * dirty. This flag may only be set on managed mappings. + * + * The DBM bit is reserved on ARMv8.0 but it seems we can safely treat it + * as a software managed bit. + */ +#define ATTR_SW_DBM ATTR_DBM + struct pmap kernel_pmap_store; /* Used for mapping ACPI memory before VM is initialized */ @@ -315,11 +325,13 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p * They need to be atomic as the System MMU may write to the table at * the same time as the CPU. */ -#define pmap_clear(table) atomic_store_64(table, 0) -#define pmap_load_store(table, entry) atomic_swap_64(table, entry) -#define pmap_set(table, mask) atomic_set_64(table, mask) -#define pmap_load_clear(table) atomic_swap_64(table, 0) -#define pmap_load(table) (*table) +#define pmap_clear(table) atomic_store_64(table, 0) +#define pmap_clear_bits(table, bits) atomic_clear_64(table, bits) +#define pmap_load(table) (*table) +#define pmap_load_clear(table) atomic_swap_64(table, 0) +#define pmap_load_store(table, entry) atomic_swap_64(table, entry) +#define pmap_set_bits(table, bits) atomic_set_64(table, bits) +#define pmap_store(table, entry) atomic_store_64(table, entry) /********************/ /* Inline functions */ @@ -532,15 +544,18 @@ pmap_l3_valid(pt_entry_t l3) CTASSERT(L1_BLOCK == L2_BLOCK); /* - * Checks if the page is dirty. We currently lack proper tracking of this on - * arm64 so for now assume is a page mapped as rw was accessed it is. + * Checks if the PTE is dirty. */ static inline int -pmap_page_dirty(pt_entry_t pte) +pmap_pte_dirty(pt_entry_t pte) { - return ((pte & (ATTR_AF | ATTR_AP_RW_BIT)) == - (ATTR_AF | ATTR_AP(ATTR_AP_RW))); + KASSERT((pte & ATTR_SW_MANAGED) != 0, ("pte %#lx is unmanaged", pte)); + KASSERT((pte & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) != 0, + ("pte %#lx is writeable and missing ATTR_SW_DBM", pte)); + + return ((pte & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) == + (ATTR_AP(ATTR_AP_RW) | ATTR_SW_DBM)); } static __inline void @@ -626,7 +641,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi (vm_offset_t)l2); freemempos += PAGE_SIZE; - pmap_load_store(&pagetable_dmap[l1_slot], + pmap_store(&pagetable_dmap[l1_slot], (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); memset(l2, 0, PAGE_SIZE); @@ -644,7 +659,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi l2_slot = pmap_l2_index(va); KASSERT(l2_slot != 0, ("...")); - pmap_load_store(&l2[l2_slot], + pmap_store(&l2[l2_slot], (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); } @@ -656,7 +671,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi (physmap[i + 1] - pa) >= L1_SIZE; pa += L1_SIZE, va += L1_SIZE) { l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT); - pmap_load_store(&pagetable_dmap[l1_slot], + pmap_store(&pagetable_dmap[l1_slot], (pa & ~L1_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L1_BLOCK); } @@ -671,7 +686,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi (vm_offset_t)l2); freemempos += PAGE_SIZE; - pmap_load_store(&pagetable_dmap[l1_slot], + pmap_store(&pagetable_dmap[l1_slot], (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); memset(l2, 0, PAGE_SIZE); @@ -681,7 +696,7 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t mi for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1]; pa += L2_SIZE, va += L2_SIZE) { l2_slot = pmap_l2_index(va); - pmap_load_store(&l2[l2_slot], + pmap_store(&l2[l2_slot], (pa & ~L2_OFFSET) | ATTR_DEFAULT | ATTR_XN | ATTR_IDX(CACHED_MEMORY) | L2_BLOCK); } @@ -716,7 +731,7 @@ pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm KASSERT(l1_slot < Ln_ENTRIES, ("Invalid L1 index")); pa = pmap_early_vtophys(l1pt, l2pt); - pmap_load_store(&l1[l1_slot], + pmap_store(&l1[l1_slot], (pa & ~Ln_TABLE_MASK) | L1_TABLE); l2pt += PAGE_SIZE; } @@ -746,7 +761,7 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm KASSERT(l2_slot < Ln_ENTRIES, ("Invalid L2 index")); pa = pmap_early_vtophys(l1pt, l3pt); - pmap_load_store(&l2[l2_slot], + pmap_store(&l2[l2_slot], (pa & ~Ln_TABLE_MASK) | L2_TABLE); l3pt += PAGE_SIZE; } @@ -765,11 +780,11 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ vm_size_t kernlen) { u_int l1_slot, l2_slot; - uint64_t kern_delta; pt_entry_t *l2; vm_offset_t va, freemempos; vm_offset_t dpcpu, msgbufpv; vm_paddr_t start_pa, pa, min_pa; + uint64_t kern_delta; int i; kern_delta = KERNBASE - kernstart; @@ -1520,7 +1535,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str l0index = ptepindex - (NUL2E + NUL1E); l0 = &pmap->pm_l0[l0index]; - pmap_load_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); + pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; pd_entry_t *l0, *l1; @@ -1546,7 +1561,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str l1 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l0) & ~ATTR_MASK); l1 = &l1[ptepindex & Ln_ADDR_MASK]; - pmap_load_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE); + pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE); } else { vm_pindex_t l0index, l1index; pd_entry_t *l0, *l1, *l2; @@ -1588,7 +1603,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; - pmap_load_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); + pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); } pmap_resident_count_inc(pmap, 1); @@ -1761,7 +1776,7 @@ pmap_growkernel(vm_offset_t addr) if ((nkpg->flags & PG_ZERO) == 0) pmap_zero_page(nkpg); paddr = VM_PAGE_TO_PHYS(nkpg); - pmap_load_store(l1, paddr | L1_TABLE); + pmap_store(l1, paddr | L1_TABLE); continue; /* try again */ } l2 = pmap_l1_to_l2(l1, kernel_vm_end); @@ -1952,7 +1967,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2449,7 +2464,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ eva = sva + L2_SIZE; for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); va < eva; va += PAGE_SIZE, m++) { - if (pmap_page_dirty(old_l2)) + if (pmap_pte_dirty(old_l2)) vm_page_dirty(m); if (old_l2 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2478,7 +2493,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ /* * pmap_remove_l3: do the things to unmap a page in a process */ -static int +static int __unused pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { @@ -2494,7 +2509,7 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ pmap_resident_count_dec(pmap, 1); if (old_l3 & ATTR_SW_MANAGED) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if (old_l3 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2542,7 +2557,7 @@ pmap_remove_l3_range(pmap_t pmap, pd_entry_t l2e, vm_o pmap_resident_count_dec(pmap, 1); if ((old_l3 & ATTR_SW_MANAGED) != 0) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if ((old_l3 & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2771,7 +2786,7 @@ retry: /* * Update the vm_page_t clean and reference bits. */ - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); pmap_unuse_pt(pmap, pv->pv_va, tpde, &free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); @@ -2785,6 +2800,53 @@ retry: } /* + * pmap_protect_l2: do the things to protect a 2MB page in a pmap + */ +static void +pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pt_entry_t mask, + pt_entry_t nbits) +{ + pd_entry_t old_l2; + vm_page_t m, mt; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT((sva & L2_OFFSET) == 0, + ("pmap_protect_l2: sva is not 2mpage aligned")); + old_l2 = pmap_load(l2); + KASSERT((old_l2 & ATTR_DESCR_MASK) == L2_BLOCK, + ("pmap_protect_l2: L2e %lx is not a block mapping", old_l2)); + + /* + * Return if the L2 entry already has the desired access restrictions + * in place. + */ +retry: + if ((old_l2 & mask) == nbits) + return; + + /* + * When a dirty read/write superpage mapping is write protected, + * update the dirty field of each of the superpage's constituent 4KB + * pages. + */ + if ((old_l2 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(old_l2)) { + m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); + for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) + vm_page_dirty(mt); + } + + if (!atomic_fcmpset_64(l2, &old_l2, (old_l2 & ~mask) | nbits)) + goto retry; + + /* + * Since a promotion must break the 4KB page mappings before making + * the 2MB page mapping, a pmap_invalidate_page() suffices. + */ + pmap_invalidate_page(pmap, sva); +} + +/* * Set the physical protection on the * specified range of this map as requested. */ @@ -2793,7 +2855,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t { vm_offset_t va, va_next; pd_entry_t *l0, *l1, *l2; - pt_entry_t *l3p, l3, nbits; + pt_entry_t *l3p, l3, mask, nbits; KASSERT((prot & ~VM_PROT_ALL) == 0, ("invalid prot %x", prot)); if (prot == VM_PROT_NONE) { @@ -2801,8 +2863,16 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t return; } - if ((prot & (VM_PROT_WRITE | VM_PROT_EXECUTE)) == - (VM_PROT_WRITE | VM_PROT_EXECUTE)) + mask = nbits = 0; + if ((prot & VM_PROT_WRITE) == 0) { + mask |= ATTR_AP_RW_BIT | ATTR_SW_DBM; + nbits |= ATTR_AP(ATTR_AP_RO); + } + if ((prot & VM_PROT_EXECUTE) == 0) { + mask |= ATTR_XN; + nbits |= ATTR_XN; + } + if (mask == 0) return; PMAP_LOCK(pmap); @@ -2833,9 +2903,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t continue; if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK) { - l3p = pmap_demote_l2(pmap, l2, sva); - if (l3p == NULL) + if (sva + L2_SIZE == va_next && eva >= va_next) { + pmap_protect_l2(pmap, l2, sva, mask, nbits); continue; + } else if (pmap_demote_l2(pmap, l2, sva) == NULL) + continue; } KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_protect: Invalid L2 entry after demotion")); @@ -2847,29 +2919,36 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t for (l3p = pmap_l2_to_l3(l2, sva); sva != va_next; l3p++, sva += L3_SIZE) { l3 = pmap_load(l3p); - if (!pmap_l3_valid(l3)) { +retry: + /* + * Go to the next L3 entry if the current one is + * invalid or already has the desired access + * restrictions in place. (The latter case occurs + * frequently. For example, in a "buildworld" + * workload, almost 1 out of 4 L3 entries already + * have the desired restrictions.) + */ + if (!pmap_l3_valid(l3) || (l3 & mask) == nbits) { if (va != va_next) { pmap_invalidate_range(pmap, va, sva); va = va_next; } continue; } - if (va == va_next) - va = sva; - nbits = 0; - if ((prot & VM_PROT_WRITE) == 0) { - if ((l3 & ATTR_SW_MANAGED) && - pmap_page_dirty(l3)) { - vm_page_dirty(PHYS_TO_VM_PAGE(l3 & - ~ATTR_MASK)); - } - nbits |= ATTR_AP(ATTR_AP_RO); - } - if ((prot & VM_PROT_EXECUTE) == 0) - nbits |= ATTR_XN; + /* + * When a dirty read/write mapping is write protected, + * update the page's dirty field. + */ + if ((l3 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && + pmap_pte_dirty(l3)) + vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); - pmap_set(l3p, nbits); + if (!atomic_fcmpset_64(l3p, &l3, (l3 & ~mask) | nbits)) + goto retry; + if (va == va_next) + va = sva; } if (va != va_next) pmap_invalidate_range(pmap, va, sva); @@ -2934,7 +3013,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ - pmap_load_store(pte, newpte); + pmap_store(pte, newpte); dsb(ishst); critical_exit(); @@ -3004,17 +3083,32 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset firstl3 = pmap_l2_to_l3(l2, sva); newl2 = pmap_load(firstl3); - /* Check the alingment is valid */ - if (((newl2 & ~ATTR_MASK) & L2_OFFSET) != 0) { +setl2: + if (((newl2 & (~ATTR_MASK | ATTR_AF)) & L2_OFFSET) != ATTR_AF) { atomic_add_long(&pmap_l2_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" " in pmap %p", va, pmap); return; } + if ((newl2 & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) == + (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM)) { + if (!atomic_fcmpset_64(l2, &newl2, newl2 & ~ATTR_SW_DBM)) + goto setl2; + newl2 &= ~ATTR_SW_DBM; + } + pa = newl2 + L2_SIZE - PAGE_SIZE; for (l3 = firstl3 + NL3PG - 1; l3 > firstl3; l3--) { oldl3 = pmap_load(l3); +setl3: + if ((oldl3 & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) == + (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM)) { + if (!atomic_fcmpset_64(l3, &oldl3, oldl3 & + ~ATTR_SW_DBM)) + goto setl3; + oldl3 &= ~ATTR_SW_DBM; + } if (oldl3 != pa) { atomic_add_long(&pmap_l2_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" @@ -3097,8 +3191,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v new_l3 |= ATTR_SW_WIRED; if (va < VM_MAXUSER_ADDRESS) new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; - if ((m->oflags & VPO_UNMANAGED) == 0) + if ((m->oflags & VPO_UNMANAGED) == 0) { new_l3 |= ATTR_SW_MANAGED; + if ((prot & VM_PROT_WRITE) != 0) { + new_l3 |= ATTR_SW_DBM; + if ((flags & VM_PROT_WRITE) == 0) + new_l3 |= ATTR_AP(ATTR_AP_RO); + } + } CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); @@ -3199,12 +3299,9 @@ havel3: /* * No, might be a protection or wiring change. */ - if ((orig_l3 & ATTR_SW_MANAGED) != 0) { - if ((new_l3 & ATTR_AP(ATTR_AP_RW)) == - ATTR_AP(ATTR_AP_RW)) { - vm_page_aflag_set(m, PGA_WRITEABLE); - } - } + if ((orig_l3 & ATTR_SW_MANAGED) != 0 && + (new_l3 & ATTR_SW_DBM) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); goto validate; } @@ -3223,7 +3320,7 @@ havel3: * concurrent calls to pmap_page_test_mappings() and * pmap_ts_referenced(). */ - if (pmap_page_dirty(orig_l3)) + if (pmap_pte_dirty(orig_l3)) vm_page_dirty(om); if ((orig_l3 & ATTR_AF) != 0) vm_page_aflag_set(om, PGA_REFERENCED); @@ -3258,7 +3355,7 @@ havel3: CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; - if ((new_l3 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) + if ((new_l3 & ATTR_SW_DBM) != 0) vm_page_aflag_set(m, PGA_WRITEABLE); } @@ -3286,10 +3383,11 @@ validate: KASSERT(opa == pa, ("pmap_enter: invalid update")); if ((orig_l3 & ~ATTR_AF) != (new_l3 & ~ATTR_AF)) { /* same PA, different attributes */ + /* XXXMJ need to reload orig_l3 for hardware DBM. */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); - if (pmap_page_dirty(orig_l3) && - (orig_l3 & ATTR_SW_MANAGED) != 0) + if ((orig_l3 & ATTR_SW_MANAGED) != 0 && + pmap_pte_dirty(orig_l3)) vm_page_dirty(m); } else { /* @@ -3309,7 +3407,7 @@ validate: } } else { /* New mapping */ - pmap_load_store(l3, new_l3); + pmap_store(l3, new_l3); dsb(ishst); } @@ -3348,8 +3446,10 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page new_l2 = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) | ATTR_AP(ATTR_AP_RO) | L2_BLOCK); - if ((m->oflags & VPO_UNMANAGED) == 0) + if ((m->oflags & VPO_UNMANAGED) == 0) { new_l2 |= ATTR_SW_MANAGED; + new_l2 &= ~ATTR_AF; + } if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY) new_l2 |= ATTR_XN; if (va < VM_MAXUSER_ADDRESS) @@ -3409,12 +3509,16 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t vm_page_free_pages_toq(&free, true); if (va >= VM_MAXUSER_ADDRESS) { /* - * Both pmap_remove_l2() and pmap_remove_l3() will - * leave the kernel page table page zero filled. + * Both pmap_remove_l2() and pmap_remove_l3_range() + * will leave the kernel page table page zero filled. + * Nonetheless, the TLB could have an intermediate + * entry for the kernel page table page. */ mt = PHYS_TO_VM_PAGE(pmap_load(l2) & ~ATTR_MASK); if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_l2: trie insert failed"); + pmap_clear(l2); + pmap_invalidate_page(pmap, va); } else KASSERT(pmap_load(l2) == 0, ("pmap_enter_l2: non-zero L2 entry %p", l2)); @@ -3428,10 +3532,13 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t SLIST_INIT(&free); if (pmap_unwire_l3(pmap, va, l2pg, &free)) { /* - * Although "va" is not mapped, paging-structure - * caches could nonetheless have entries that + * Although "va" is not mapped, the TLB could + * nonetheless have intermediate entries that * refer to the freed page table pages. * Invalidate those entries. + * + * XXX redundant invalidation (See + * _pmap_unwire_l3().) */ pmap_invalidate_page(pmap, va); vm_page_free_pages_toq(&free, true); @@ -3441,7 +3548,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t va, pmap); return (KERN_RESOURCE_SHORTAGE); } - if ((new_l2 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) + if ((new_l2 & ATTR_SW_DBM) != 0) for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) vm_page_aflag_set(mt, PGA_WRITEABLE); } @@ -3456,7 +3563,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t /* * Map the superpage. */ - (void)pmap_load_store(l2, new_l2); + pmap_store(l2, new_l2); dsb(ishst); atomic_add_long(&pmap_l2_mappings, 1); @@ -3649,15 +3756,17 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v /* * Now validate mapping with RO protection */ - if ((m->oflags & VPO_UNMANAGED) == 0) + if ((m->oflags & VPO_UNMANAGED) == 0) { l3_val |= ATTR_SW_MANAGED; + l3_val &= ~ATTR_AF; + } /* Sync icache before the mapping is stored to PTE */ if ((prot & VM_PROT_EXECUTE) && pmap != kernel_pmap && m->md.pv_memattr == VM_MEMATTR_WRITE_BACK) cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); - pmap_load_store(l3, l3_val); + pmap_store(l3, l3_val); dsb(ishst); return (mpte); @@ -3721,9 +3830,21 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t continue; if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK) { - l3 = pmap_demote_l2(pmap, l2, sva); - if (l3 == NULL) + if ((pmap_load(l2) & ATTR_SW_WIRED) == 0) + panic("pmap_unwire: l2 %#jx is missing " + "ATTR_SW_WIRED", (uintmax_t)pmap_load(l2)); + + /* + * Are we unwiring the entire large page? If not, + * demote the mapping and fall through. + */ + if (sva + L2_SIZE == va_next && eva >= va_next) { + pmap_clear_bits(l2, ATTR_SW_WIRED); + pmap->pm_stats.wired_count -= L2_SIZE / + PAGE_SIZE; continue; + } else if (pmap_demote_l2(pmap, l2, sva) == NULL) + panic("pmap_unwire: demotion failed"); } KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_unwire: Invalid l2 entry after demotion")); @@ -3739,11 +3860,11 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t "ATTR_SW_WIRED", (uintmax_t)pmap_load(l3)); /* - * PG_W must be cleared atomically. Although the pmap - * lock synchronizes access to PG_W, another processor - * could be setting PG_M and/or PG_A concurrently. + * ATTR_SW_WIRED must be cleared atomically. Although + * the pmap lock synchronizes access to ATTR_SW_WIRED, + * the System MMU may write to the entry concurrently. */ - atomic_clear_long(l3, ATTR_SW_WIRED); + pmap_clear_bits(l3, ATTR_SW_WIRED); pmap->pm_stats.wired_count--; } } @@ -3767,7 +3888,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ struct rwlock *lock; struct spglist free; pd_entry_t *l0, *l1, *l2, srcptepaddr; - pt_entry_t *dst_pte, ptetemp, *src_pte; + pt_entry_t *dst_pte, mask, nbits, ptetemp, *src_pte; vm_offset_t addr, end_addr, va_next; vm_page_t dst_l2pg, dstmpte, srcmpte; @@ -3818,8 +3939,11 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - (void)pmap_load_store(l2, srcptepaddr & - ~ATTR_SW_WIRED); + mask = ATTR_AF | ATTR_SW_WIRED; + nbits = 0; + if ((srcptepaddr & ATTR_SW_DBM) != 0) + nbits |= ATTR_AP_RW_BIT; + pmap_store(l2, (srcptepaddr & ~mask) | nbits); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1); @@ -3863,11 +3987,12 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ /* * Clear the wired, modified, and accessed * (referenced) bits during the copy. - * - * XXX not yet */ - (void)pmap_load_store(dst_pte, ptetemp & - ~ATTR_SW_WIRED); + mask = ATTR_AF | ATTR_SW_WIRED; + nbits = 0; + if ((ptetemp & ATTR_SW_DBM) != 0) + nbits |= ATTR_AP_RW_BIT; + pmap_store(dst_pte, (ptetemp & ~mask) | nbits); pmap_resident_count_inc(dst_pmap, 1); } else { SLIST_INIT(&free); @@ -3875,8 +4000,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ &free)) { /* * Although "addr" is not mapped, - * paging-structure caches could - * nonetheless have entries that refer + * the TLB could nonetheless have + * intermediate entries that refer * to the freed page table pages. * Invalidate those entries. * @@ -4218,8 +4343,7 @@ pmap_remove_pages(pmap_t pmap) /* * Update the vm_page_t clean/reference bits. */ - if ((tpte & ATTR_AP_RW_BIT) == - ATTR_AP(ATTR_AP_RW)) { + if (pmap_pte_dirty(tpte)) { switch (lvl) { case 1: for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) @@ -4494,7 +4618,7 @@ retry_pv_loop: } va = pv->pv_va; pte = pmap_pte(pmap, pv->pv_va, &lvl); - if ((pmap_load(pte) & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) + if ((pmap_load(pte) & ATTR_SW_DBM) != 0) (void)pmap_demote_l2_locked(pmap, pte, va, &lock); KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), ("inconsistent pv lock %p %p for page %p", @@ -4517,13 +4641,14 @@ retry_pv_loop: } } pte = pmap_pte(pmap, pv->pv_va, &lvl); -retry: oldpte = pmap_load(pte); - if ((oldpte & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) { - if (!atomic_cmpset_long(pte, oldpte, - oldpte | ATTR_AP(ATTR_AP_RO))) +retry: + if ((oldpte & ATTR_SW_DBM) != 0) { + if (!atomic_fcmpset_long(pte, &oldpte, + (oldpte | ATTR_AP_RW_BIT) & ~ATTR_SW_DBM)) goto retry; - if ((oldpte & ATTR_AF) != 0) + if ((oldpte & ATTR_AP_RW_BIT) == + ATTR_AP(ATTR_AP_RW)) vm_page_dirty(m); pmap_invalidate_page(pmap, pv->pv_va); } @@ -4533,13 +4658,6 @@ retry: vm_page_aflag_clear(m, PGA_WRITEABLE); } -static __inline boolean_t -safe_to_clear_referenced(pmap_t pmap, pt_entry_t pte) -{ - - return (FALSE); -} - /* * pmap_ts_referenced: * @@ -4565,12 +4683,10 @@ pmap_ts_referenced(vm_page_t m) struct rwlock *lock; pd_entry_t *pde, tpde; pt_entry_t *pte, tpte; - pt_entry_t *l3; vm_offset_t va; vm_paddr_t pa; - int cleared, md_gen, not_cleared, lvl, pvh_gen; + int cleared, lvl, md_gen, not_cleared, pvh_gen; struct spglist free; - bool demoted; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); @@ -4609,7 +4725,7 @@ retry: ("pmap_ts_referenced: found an invalid l1 table")); pte = pmap_l1_to_l2(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) { + if (pmap_pte_dirty(tpte)) { /* * Although "tpte" is mapping a 2MB page, because * this function is called at a 4KB page granularity, @@ -4617,17 +4733,18 @@ retry: */ vm_page_dirty(m); } + if ((tpte & ATTR_AF) != 0) { /* - * Since this reference bit is shared by 512 4KB - * pages, it should not be cleared every time it is - * tested. Apply a simple "hash" function on the - * physical page number, the virtual superpage number, - * and the pmap address to select one 4KB page out of - * the 512 on which testing the reference bit will - * result in clearing that reference bit. This - * function is designed to avoid the selection of the - * same 4KB page for every 2MB page mapping. + * Since this reference bit is shared by 512 4KB pages, + * it should not be cleared every time it is tested. + * Apply a simple "hash" function on the physical page + * number, the virtual superpage number, and the pmap + * address to select one 4KB page out of the 512 on + * which testing the reference bit will result in + * clearing that reference bit. This function is + * designed to avoid the selection of the same 4KB page + * for every 2MB page mapping. * * On demotion, a mapping that hasn't been referenced * is simply destroyed. To avoid the possibility of a @@ -4639,39 +4756,9 @@ retry: if ((((pa >> PAGE_SHIFT) ^ (pv->pv_va >> L2_SHIFT) ^ (uintptr_t)pmap) & (Ln_ENTRIES - 1)) == 0 && (tpte & ATTR_SW_WIRED) == 0) { - if (safe_to_clear_referenced(pmap, tpte)) { - /* - * TODO: We don't handle the access - * flag at all. We need to be able - * to set it in the exception handler. - */ - panic("ARM64TODO: " - "safe_to_clear_referenced\n"); - } else if (pmap_demote_l2_locked(pmap, pte, - pv->pv_va, &lock) != NULL) { - demoted = true; - va += VM_PAGE_TO_PHYS(m) - - (tpte & ~ATTR_MASK); - l3 = pmap_l2_to_l3(pte, va); - pmap_remove_l3(pmap, l3, va, - pmap_load(pte), NULL, &lock); - } else - demoted = true; - - if (demoted) { - /* - * The superpage mapping was removed - * entirely and therefore 'pv' is no - * longer valid. - */ - if (pvf == pv) - pvf = NULL; - pv = NULL; - } + pmap_clear_bits(pte, ATTR_AF); + pmap_invalidate_page(pmap, pv->pv_va); cleared++; - KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), - ("inconsistent pv lock %p %p for page %p", - lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); } else not_cleared++; } @@ -4713,32 +4800,13 @@ small_mappings: ("pmap_ts_referenced: found an invalid l2 table")); pte = pmap_l2_to_l3(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) { - if (safe_to_clear_referenced(pmap, tpte)) { - /* - * TODO: We don't handle the access flag - * at all. We need to be able to set it in - * the exception handler. - */ - panic("ARM64TODO: safe_to_clear_referenced\n"); - } else if ((tpte & ATTR_SW_WIRED) == 0) { - /* - * Wired pages cannot be paged out so - * doing accessed bit emulation for - * them is wasted effort. We do the - * hard work for unwired pages only. - */ - pmap_remove_l3(pmap, pte, pv->pv_va, tpde, - &free, &lock); + if ((tpte & ATTR_SW_WIRED) == 0) { + pmap_clear_bits(pte, ATTR_AF); + pmap_invalidate_page(pmap, pv->pv_va); cleared++; - if (pvf == pv) - pvf = NULL; - pv = NULL; - KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), - ("inconsistent pv lock %p %p for page %p", - lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); } else not_cleared++; } @@ -4773,6 +4841,14 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t void pmap_clear_modify(vm_page_t m) { + struct md_page *pvh; + struct rwlock *lock; + pmap_t pmap; + pv_entry_t next_pv, pv; + pd_entry_t *l2, oldl2; + pt_entry_t *l3, oldl3; + vm_offset_t va; + int md_gen, pvh_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); @@ -4781,14 +4857,81 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is exclusive busied", m)); /* - * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. - * If the object containing the page is locked and the page is not + * If the page is not PGA_WRITEABLE, then no PTEs can have ATTR_SW_DBM + * set. If the object containing the page is locked and the page is not * exclusive busied, then PGA_WRITEABLE cannot be concurrently set. */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - - /* ARM64TODO: We lack support for tracking if a page is modified */ + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_wlock(lock); +restart: + TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen) { + PMAP_UNLOCK(pmap); + goto restart; + } + } + va = pv->pv_va; + l2 = pmap_l2(pmap, va); + oldl2 = pmap_load(l2); + if ((oldl2 & ATTR_SW_DBM) != 0) { + if (pmap_demote_l2_locked(pmap, l2, va, &lock)) { + if ((oldl2 & ATTR_SW_WIRED) == 0) { + /* + * Write protect the mapping to a + * single page so that a subsequent + * write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - + (oldl2 & ~ATTR_MASK); + l3 = pmap_l2_to_l3(l2, va); + oldl3 = pmap_load(l3); + if (pmap_l3_valid(oldl3)) { + while (!atomic_fcmpset_long(l3, + &oldl3, (oldl3 & ~ATTR_SW_DBM) | + ATTR_AP(ATTR_AP_RO))) + cpu_spinwait(); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); + } + } + } + } + PMAP_UNLOCK(pmap); + } + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + md_gen = m->md.pv_gen; + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen || md_gen != m->md.pv_gen) { + PMAP_UNLOCK(pmap); + goto restart; + } + } + l2 = pmap_l2(pmap, pv->pv_va); + l3 = pmap_l2_to_l3(l2, pv->pv_va); + oldl3 = pmap_load(l3); + if (pmap_l3_valid(oldl3) && + (oldl3 & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) == ATTR_SW_DBM) { + pmap_set_bits(l3, ATTR_AP(ATTR_AP_RO)); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } + rw_wunlock(lock); } void * @@ -5168,6 +5311,17 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_ } static void +pmap_fill_l3(pt_entry_t *firstl3, pt_entry_t newl3) +{ + pt_entry_t *l3; + + for (l3 = firstl3; l3 - firstl3 < Ln_ENTRIES; l3++) { + *l3 = newl3; + newl3 += L3_SIZE; + } +} + +static void pmap_demote_l2_abort(pmap_t pmap, vm_offset_t va, pt_entry_t *l2, struct rwlock **lockp) { @@ -5188,9 +5342,8 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ { pt_entry_t *l3, newl3, oldl2; vm_offset_t tmpl2; - vm_paddr_t l3phys, phys; + vm_paddr_t l3phys; vm_page_t ml3; - int i; PMAP_LOCK_ASSERT(pmap, MA_OWNED); l3 = NULL; @@ -5262,28 +5415,19 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ pmap_resident_count_inc(pmap, 1); } } - l3phys = VM_PAGE_TO_PHYS(ml3); l3 = (pt_entry_t *)PHYS_TO_DMAP(l3phys); + newl3 = (oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE; + KASSERT((oldl2 & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) != + (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM), + ("pmap_demote_l2: L2 entry is writeable but not dirty")); - /* Address the range points at */ - phys = oldl2 & ~ATTR_MASK; - /* The attributed from the old l2 table to be copied */ - newl3 = (oldl2 & (ATTR_MASK & ~ATTR_DESCR_MASK)) | L3_PAGE; - /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Sep 17 17:44: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 928E012A56C; Tue, 17 Sep 2019 17:44:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Xr8z3KZ9z4HtD; Tue, 17 Sep 2019 17:44:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37665C096; Tue, 17 Sep 2019 17:44:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HHipLd019777; Tue, 17 Sep 2019 17:44:51 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HHipJ4019776; Tue, 17 Sep 2019 17:44:51 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201909171744.x8HHipJ4019776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 17 Sep 2019 17:44:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352453 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352453 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 17:44:51 -0000 Author: mckusick Date: Tue Sep 17 17:44:50 2019 New Revision: 352453 URL: https://svnweb.freebsd.org/changeset/base/352453 Log: The VFS-level clustering code collects together sequential blocks by issuing delayed-writes (bdwrite()) until a non-sequential block is written or the maximum cluster size is reached. At that point it collects the delayed buffers together (using bread()) to write them in a single operation. The assumption was that since we just looked at them they will still be in memory so there is no need to check for a read error from bread(). Very occationally (apparently every 10-hours or so when being pounded by Peter Holm's tests) this assumption is wrong. The fix is to check for errors from bread() and fail the cluster write thus falling back to the default individual flushing of any still dirty buffers. Reported by: Peter Holm and Chuck Silvers Reviewed by: kib MFC after: 3 days Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Tue Sep 17 17:28:44 2019 (r352452) +++ head/sys/kern/vfs_cluster.c Tue Sep 17 17:44:50 2019 (r352453) @@ -718,6 +718,14 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad struct cluster_save *buflist; buflist = cluster_collectbufs(vp, bp, gbflags); + if (buflist == NULL) { + /* + * Cluster build failed so just write + * it now. + */ + bawrite(bp); + return; + } endbp = &buflist->bs_children [buflist->bs_nchildren - 1]; if (VOP_REALLOCBLKS(vp, buflist)) { @@ -1056,7 +1064,7 @@ cluster_collectbufs(struct vnode *vp, struct buf *last struct cluster_save *buflist; struct buf *bp; daddr_t lbn; - int i, len; + int i, j, len, error; len = vp->v_lastw - vp->v_cstart + 1; buflist = malloc(sizeof(struct buf *) * (len + 1) + sizeof(*buflist), @@ -1064,8 +1072,18 @@ cluster_collectbufs(struct vnode *vp, struct buf *last buflist->bs_nchildren = 0; buflist->bs_children = (struct buf **) (buflist + 1); for (lbn = vp->v_cstart, i = 0; i < len; lbn++, i++) { - (void)bread_gb(vp, lbn, last_bp->b_bcount, NOCRED, + error = bread_gb(vp, lbn, last_bp->b_bcount, NOCRED, gbflags, &bp); + if (error != 0) { + /* + * If read fails, release collected buffers + * and return failure. + */ + for (j = 0; j < i; j++) + brelse(buflist->bs_children[j]); + free(buflist, M_SEGMENT); + return (NULL); + } buflist->bs_children[i] = bp; if (bp->b_blkno == bp->b_lblkno) VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, From owner-svn-src-all@freebsd.org Tue Sep 17 18:05: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 05F5912AB98; Tue, 17 Sep 2019 18:05:34 +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 46Xrcs6PHMz4K5Y; Tue, 17 Sep 2019 18:05:33 +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 BBD73C421; Tue, 17 Sep 2019 18:05:33 +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 x8HI5X0R031567; Tue, 17 Sep 2019 18:05:33 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HI5XRM031566; Tue, 17 Sep 2019 18:05:33 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909171805.x8HI5XRM031566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 17 Sep 2019 18:05:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352454 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 352454 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:05:34 -0000 Author: tsoome Date: Tue Sep 17 18:05:33 2019 New Revision: 352454 URL: https://svnweb.freebsd.org/changeset/base/352454 Log: loader: provide u> and xemit words if needed We have external interpreter (userboot.so) which may be lagging behind with updates and may be missing u> xemit words. Modified: head/stand/forth/loader.4th Modified: head/stand/forth/loader.4th ============================================================================== --- head/stand/forth/loader.4th Tue Sep 17 17:44:50 2019 (r352453) +++ head/stand/forth/loader.4th Tue Sep 17 18:05:33 2019 (r352454) @@ -27,6 +27,29 @@ only forth definitions +\ provide u> if needed +s" u>" sfind [if] drop [else] + drop +: u> + 2dup u< if 2drop 0 exit then + swap u< if -1 exit then + 0 +; +[then] + +\ provide xemit if needed +s" xemit" sfind [if] drop [else] + drop +: xemit + dup 0x80 u< if emit exit then + 0 swap 0x3F + begin 2dup u> while + 2/ >r dup 0x3F and 0x80 or swap 6 rshift r> + repeat 0x7F xor 2* or + begin dup 0x80 u< 0= while emit repeat drop +; +[then] + s" arch-i386" environment? [if] [if] s" loader_version" environment? [if] 11 < [if] From owner-svn-src-all@freebsd.org Tue Sep 17 18:32: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 035E712B64B; Tue, 17 Sep 2019 18:32:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46XsCl6NXFz4Whl; Tue, 17 Sep 2019 18:32: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 BE66718E4A; Tue, 17 Sep 2019 18:32: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 x8HIWJgJ049619; Tue, 17 Sep 2019 18:32:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HIWJeY049304; Tue, 17 Sep 2019 18:32:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909171832.x8HIWJeY049304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Sep 2019 18:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352455 - in head: lib/libc/sys sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libc/sys sys/kern X-SVN-Commit-Revision: 352455 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:32:20 -0000 Author: kib Date: Tue Sep 17 18:32:18 2019 New Revision: 352455 URL: https://svnweb.freebsd.org/changeset/base/352455 Log: Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY. Reviewed by: bcr (man page), emaste (previous version) PR: 240452 Sponsored by: The FreeBSD Foundation MFC after: 1 week DIfferential revision: https://reviews.freebsd.org/D21634 Modified: head/lib/libc/sys/open.2 head/sys/kern/vfs_vnops.c Modified: head/lib/libc/sys/open.2 ============================================================================== --- head/lib/libc/sys/open.2 Tue Sep 17 18:05:33 2019 (r352454) +++ head/lib/libc/sys/open.2 Tue Sep 17 18:32:18 2019 (r352455) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd June 14, 2019 +.Dd September 17, 2019 .Dt OPEN 2 .Os .Sh NAME @@ -419,6 +419,11 @@ Too many symbolic links were encountered in translatin .It Bq Er EISDIR The named file is a directory, and the arguments specify it is to be modified. +.It Bq Er EISDIR +The named file is a directory, and the flags specified +.Dv O_CREAT +without +.Dv O_DIRECTORY . .It Bq Er EROFS The named file resides on a read-only file system, and the file is to be modified. Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Sep 17 18:05:33 2019 (r352454) +++ head/sys/kern/vfs_vnops.c Tue Sep 17 18:32:18 2019 (r352455) @@ -264,6 +264,10 @@ restart: error = EEXIST; goto bad; } + if (vp->v_type == VDIR) { + error = EISDIR; + goto bad; + } fmode &= ~O_CREAT; } } else { From owner-svn-src-all@freebsd.org Tue Sep 17 18:36: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 A902212B7DC; Tue, 17 Sep 2019 18:36:30 +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 46XsJZ2Wpsz4X7N; Tue, 17 Sep 2019 18:36:30 +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 3B46018E76; Tue, 17 Sep 2019 18:36:30 +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 x8HIaUGK050111; Tue, 17 Sep 2019 18:36:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HIaUhL050110; Tue, 17 Sep 2019 18:36:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909171836.x8HIaUhL050110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Sep 2019 18:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352456 - head/contrib/jemalloc/src X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/contrib/jemalloc/src X-SVN-Commit-Revision: 352456 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:36:30 -0000 Author: kib Date: Tue Sep 17 18:36:29 2019 New Revision: 352456 URL: https://svnweb.freebsd.org/changeset/base/352456 Log: realloc(x, 0) should not return NULL. See http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400. Upstream jemalloc issue is opened by emaste at https://github.com/jemalloc/jemalloc/issues/1629. Reviewed by: emaste PR: 240456 Sponsored by: The FreeBSD Foundation MFC after: 1 week DIfferential revision: https://reviews.freebsd.org/D21632 Modified: head/contrib/jemalloc/src/jemalloc.c Modified: head/contrib/jemalloc/src/jemalloc.c ============================================================================== --- head/contrib/jemalloc/src/jemalloc.c Tue Sep 17 18:32:18 2019 (r352455) +++ head/contrib/jemalloc/src/jemalloc.c Tue Sep 17 18:36:29 2019 (r352456) @@ -2299,21 +2299,6 @@ je_realloc(void *ptr, size_t size) { LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size); if (unlikely(size == 0)) { - if (ptr != NULL) { - /* realloc(ptr, 0) is equivalent to free(ptr). */ - UTRACE(ptr, 0, 0); - tcache_t *tcache; - tsd_t *tsd = tsd_fetch(); - if (tsd_reentrancy_level_get(tsd) == 0) { - tcache = tcache_get(tsd); - } else { - tcache = NULL; - } - ifree(tsd, ptr, tcache, true); - - LOG("core.realloc.exit", "result: %p", NULL); - return NULL; - } size = 1; } From owner-svn-src-all@freebsd.org Tue Sep 17 18:41: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 AAED912BB07; Tue, 17 Sep 2019 18:41:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46XsQX46xQz4XW6; Tue, 17 Sep 2019 18:41: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 576A018EF8; Tue, 17 Sep 2019 18:41: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 x8HIfejf054293; Tue, 17 Sep 2019 18:41:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HIfeUj054292; Tue, 17 Sep 2019 18:41:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909171841.x8HIfeUj054292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Sep 2019 18:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352457 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 352457 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:41:40 -0000 Author: kib Date: Tue Sep 17 18:41:39 2019 New Revision: 352457 URL: https://svnweb.freebsd.org/changeset/base/352457 Log: Further refine r352393, only call vnode_pager_setsize() outside the node lock when shrinking. This is similar to r252528, applied to the above commit. Apparently there is a race which makes necessary at least to keep the n_size and pager size consistent when extending. Current suspect is that iod threads perform vnode_pager_setsize() without taking the vnode lock, which corrupts the file content. Reported and tested by: Masachika ISHIZUKA Discussed with: rmacklem (related issues) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Tue Sep 17 18:36:29 2019 (r352456) +++ head/sys/fs/nfsclient/nfs_clport.c Tue Sep 17 18:41:39 2019 (r352457) @@ -414,12 +414,12 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; + vm_object_t object; u_quad_t nsize; - int setnsize, error, force_fid_err; + int error, force_fid_err; + bool setnsize; error = 0; - setnsize = 0; - nsize = 0; /* * If v_type == VNON it is a new node, so fill in the v_type, @@ -511,8 +511,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt * zero np->n_attrstamp to indicate that * the attributes are stale. */ - nsize = vap->va_size = np->n_size; - setnsize = 1; + vap->va_size = np->n_size; np->n_attrstamp = 0; KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); } else if (np->n_flag & NMODIFIED) { @@ -526,22 +525,9 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - nsize = np->n_size; - setnsize = 1; - } else if (vap->va_size < np->n_size) { - /* - * When shrinking the size, the call to - * vnode_pager_setsize() cannot be done - * with the mutex held, so delay it until - * after the mtx_unlock call. - */ - nsize = np->n_size = vap->va_size; - np->n_flag |= NSIZECHANGED; - setnsize = 1; } else { - nsize = np->n_size = vap->va_size; + np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; - setnsize = 1; } } else { np->n_size = vap->va_size; @@ -579,6 +565,23 @@ out: if (np->n_attrstamp != 0) KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error); #endif + nsize = vap->va_size; + object = vp->v_object; + setnsize = false; + if (object != NULL) { + if (OFF_TO_IDX(nsize + PAGE_MASK) < object->size) { + /* + * When shrinking the size, the call to + * vnode_pager_setsize() cannot be done with + * the mutex held, because we might need to + * wait for a busy page. Delay it until after + * the node is unlocked. + */ + setnsize = true; + } else { + vnode_pager_setsize(vp, nsize); + } + } NFSUNLOCKNODE(np); if (setnsize) vnode_pager_setsize(vp, nsize); From owner-svn-src-all@freebsd.org Tue Sep 17 18:49: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 2D80912BD07; Tue, 17 Sep 2019 18:49: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 46XsbG0PnVz4Y1X; Tue, 17 Sep 2019 18:49: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 E0C6A1905F; Tue, 17 Sep 2019 18:49:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HInDDT056281; Tue, 17 Sep 2019 18:49:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HInDBn056278; Tue, 17 Sep 2019 18:49:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909171849.x8HInDBn056278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Sep 2019 18:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352458 - in head/sys: net sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: net sys X-SVN-Commit-Revision: 352458 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:49:14 -0000 Author: kib Date: Tue Sep 17 18:49:13 2019 New Revision: 352458 URL: https://svnweb.freebsd.org/changeset/base/352458 Log: Add SIOCGIFDOWNREASON. The ioctl(2) is intended to provide more details about the cause of the down for the link. Eventually we might define a comprehensive list of codes for the situations. But interface also allows the driver to provide free-form null-terminated ASCII string to provide arbitrary non-formalized information. Sample implementation exists for mlx5(4), where the string is fetched from firmware controlling the port. Reviewed by: hselasky, rrs Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21527 Modified: head/sys/net/if.c head/sys/net/if.h head/sys/sys/sockio.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Sep 17 18:41:39 2019 (r352457) +++ head/sys/net/if.c Tue Sep 17 18:49:13 2019 (r352458) @@ -2891,6 +2891,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, case SIOCGIFGENERIC: case SIOCGIFRSSKEY: case SIOCGIFRSSHASH: + case SIOCGIFDOWNREASON: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Tue Sep 17 18:41:39 2019 (r352457) +++ head/sys/net/if.h Tue Sep 17 18:49:13 2019 (r352458) @@ -585,6 +585,16 @@ struct ifrsshash { #define IFNET_PCP_NONE 0xff /* PCP disabled */ +#define IFDR_MSG_SIZE 64 +#define IFDR_REASON_MSG 1 +#define IFDR_REASON_VENDOR 2 +struct ifdownreason { + char ifdr_name[IFNAMSIZ]; + uint32_t ifdr_reason; + uint32_t ifdr_vendor; + char ifdr_msg[IFDR_MSG_SIZE]; +}; + #endif /* __BSD_VISIBLE */ #ifdef _KERNEL Modified: head/sys/sys/sockio.h ============================================================================== --- head/sys/sys/sockio.h Tue Sep 17 18:41:39 2019 (r352457) +++ head/sys/sys/sockio.h Tue Sep 17 18:49:13 2019 (r352458) @@ -143,4 +143,6 @@ #define SIOCGLANPCP _IOWR('i', 152, struct ifreq) /* Get (V)LAN PCP */ #define SIOCSLANPCP _IOW('i', 153, struct ifreq) /* Set (V)LAN PCP */ +#define SIOCGIFDOWNREASON _IOWR('i', 154, struct ifdownreason) + #endif /* !_SYS_SOCKIO_H_ */ From owner-svn-src-all@freebsd.org Tue Sep 17 18:51: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 0A00212BEBD; Tue, 17 Sep 2019 18:51:11 +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 46XsdV6D7Cz4YCt; Tue, 17 Sep 2019 18:51: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 9EF6E190C9; Tue, 17 Sep 2019 18:51: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 x8HIpArD057247; Tue, 17 Sep 2019 18:51:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HIpA2X057246; Tue, 17 Sep 2019 18:51:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909171851.x8HIpA2X057246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 17 Sep 2019 18:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352459 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 352459 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 18:51:11 -0000 Author: kib Date: Tue Sep 17 18:51:10 2019 New Revision: 352459 URL: https://svnweb.freebsd.org/changeset/base/352459 Log: ifconfig: add report of the string from SIOCGIFDOWNREASON. Sample output: # ifconfig mce0 mce0: flags=8802 metric 0 mtu 1500 options=3ed07bb ether e4:1d:2d:e7:10:0a media: Ethernet autoselect status: no carrier (Negotiation failure) nd6 options=21 Reviewed by: hselasky, rrs Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21527 Modified: head/sbin/ifconfig/ifmedia.c Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Tue Sep 17 18:49:13 2019 (r352458) +++ head/sbin/ifconfig/ifmedia.c Tue Sep 17 18:51:10 2019 (r352459) @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -110,18 +111,20 @@ static void media_status(int s) { struct ifmediareq ifmr; + struct ifdownreason ifdr; int *media_list, i; - int xmedia = 1; + bool no_carrier, xmedia; (void) memset(&ifmr, 0, sizeof(ifmr)); (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + xmedia = true; /* * Check if interface supports extended media types. */ if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = 0; - if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { + xmedia = false; + if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { /* * Interface doesn't support SIOC{G,S}IFMEDIA. */ @@ -158,6 +161,7 @@ media_status(int s) putchar('\n'); if (ifmr.ifm_status & IFM_AVALID) { + no_carrier = false; printf("\tstatus: "); switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: @@ -165,7 +169,7 @@ media_status(int s) if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else - printf("no carrier"); + no_carrier = true; break; case IFM_IEEE80211: @@ -176,8 +180,26 @@ media_status(int s) else printf("running"); } else - printf("no carrier"); + no_carrier = true; break; + } + if (no_carrier) { + printf("no carrier"); + memset(&ifdr, 0, sizeof(ifdr)); + strlcpy(ifdr.ifdr_name, name, sizeof(ifdr.ifdr_name)); + if (ioctl(s, SIOCGIFDOWNREASON, (caddr_t)&ifdr) == 0) { + switch (ifdr.ifdr_reason) { + case IFDR_REASON_MSG: + printf(" (%s)", ifdr.ifdr_msg); + break; + case IFDR_REASON_VENDOR: + printf(" (vendor code %d)", + ifdr.ifdr_vendor); + break; + default: + break; + } + } } putchar('\n'); } From owner-svn-src-all@freebsd.org Tue Sep 17 20:03: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 3B9D012D805; Tue, 17 Sep 2019 20:03:21 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XvDn0qBWz4dJB; Tue, 17 Sep 2019 20:03:21 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F41EA19F3F; Tue, 17 Sep 2019 20:03:20 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HK3KxN005911; Tue, 17 Sep 2019 20:03:20 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HK3K4P005909; Tue, 17 Sep 2019 20:03:20 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201909172003.x8HK3K4P005909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Tue, 17 Sep 2019 20:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352460 - in head/usr.sbin: newsyslog syslogd X-SVN-Group: head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: in head/usr.sbin: newsyslog syslogd X-SVN-Commit-Revision: 352460 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 20:03:21 -0000 Author: swills (ports committer) Date: Tue Sep 17 20:03:20 2019 New Revision: 352460 URL: https://svnweb.freebsd.org/changeset/base/352460 Log: log daemon.info to /var/log/daemon.log by default log daemon facility now that daemon(8) has syslog support which defaults to daemon facility, info priority Reviewed by: bapt Approved by: bapt Differential Revision: https://reviews.freebsd.org/D21561 Modified: head/usr.sbin/newsyslog/newsyslog.conf head/usr.sbin/syslogd/syslog.conf Modified: head/usr.sbin/newsyslog/newsyslog.conf ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.conf Tue Sep 17 18:51:10 2019 (r352459) +++ head/usr.sbin/newsyslog/newsyslog.conf Tue Sep 17 20:03:20 2019 (r352460) @@ -30,6 +30,7 @@ /var/log/security 600 10 1000 * JC /var/log/utx.log 644 3 * @01T05 B /var/log/weekly.log 640 5 * $W6D0 JN +/var/log/daemon 644 5 1000 @0101T JC /etc/newsyslog.conf.d/[!.]*.conf /usr/local/etc/newsyslog.conf.d/[!.]*.conf Modified: head/usr.sbin/syslogd/syslog.conf ============================================================================== --- head/usr.sbin/syslogd/syslog.conf Tue Sep 17 18:51:10 2019 (r352459) +++ head/usr.sbin/syslogd/syslog.conf Tue Sep 17 20:03:20 2019 (r352460) @@ -14,6 +14,7 @@ cron.* /var/log/cron !-devd *.=debug /var/log/debug.log *.emerg * +daemon.info /var/log/daemon.log # uncomment this to log all writes to /dev/console to /var/log/console.log # touch /var/log/console.log and chmod it to mode 600 before it will work #console.info /var/log/console.log From owner-svn-src-all@freebsd.org Tue Sep 17 20:05: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 5FE6312D899; Tue, 17 Sep 2019 20:05:07 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46XvGq1vm9z4dRM; Tue, 17 Sep 2019 20:05:07 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F9719F42; Tue, 17 Sep 2019 20:05:07 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8HK574e006044; Tue, 17 Sep 2019 20:05:07 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HK57Di006043; Tue, 17 Sep 2019 20:05:07 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201909172005.x8HK57Di006043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Tue, 17 Sep 2019 20:05:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352461 - head/usr.sbin/newsyslog X-SVN-Group: head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: head/usr.sbin/newsyslog X-SVN-Commit-Revision: 352461 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 20:05:07 -0000 Author: swills (ports committer) Date: Tue Sep 17 20:05:06 2019 New Revision: 352461 URL: https://svnweb.freebsd.org/changeset/base/352461 Log: Use correct filename in newsyslog.conf Approved by: bapt (implicit) Differential Revision: https://reviews.freebsd.org/D21561 Modified: head/usr.sbin/newsyslog/newsyslog.conf Modified: head/usr.sbin/newsyslog/newsyslog.conf ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.conf Tue Sep 17 20:03:20 2019 (r352460) +++ head/usr.sbin/newsyslog/newsyslog.conf Tue Sep 17 20:05:06 2019 (r352461) @@ -30,7 +30,7 @@ /var/log/security 600 10 1000 * JC /var/log/utx.log 644 3 * @01T05 B /var/log/weekly.log 640 5 * $W6D0 JN -/var/log/daemon 644 5 1000 @0101T JC +/var/log/daemon.log 644 5 1000 @0101T JC /etc/newsyslog.conf.d/[!.]*.conf /usr/local/etc/newsyslog.conf.d/[!.]*.conf From owner-svn-src-all@freebsd.org Tue Sep 17 22:08: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 3578EE8576; Tue, 17 Sep 2019 22:08:17 +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 46Xy0x0gk8z4l3C; Tue, 17 Sep 2019 22:08:17 +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 EFE2D1B5CA; Tue, 17 Sep 2019 22:08:16 +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 x8HM8GGD076393; Tue, 17 Sep 2019 22:08:16 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HM8Gnr076392; Tue, 17 Sep 2019 22:08:16 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909172208.x8HM8Gnr076392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 17 Sep 2019 22:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352462 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 352462 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 22:08:17 -0000 Author: lwhsu Date: Tue Sep 17 22:08:16 2019 New Revision: 352462 URL: https://svnweb.freebsd.org/changeset/base/352462 Log: Temporarily skip sys.netpfil.common.forward.pf_v4 on i386 CI as it always fails PR: 240085 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/common/forward.sh Modified: head/tests/sys/netpfil/common/forward.sh ============================================================================== --- head/tests/sys/netpfil/common/forward.sh Tue Sep 17 20:05:06 2019 (r352461) +++ head/tests/sys/netpfil/common/forward.sh Tue Sep 17 22:08:16 2019 (r352462) @@ -40,6 +40,10 @@ v4_head() v4_body() { firewall=$1 + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "i386" ] && [ "${firewall}" = "pf" ]; then + atf_skip "https://bugs.freebsd.org/240085" + fi firewall_init $firewall epair_send=$(vnet_mkepair) From owner-svn-src-all@freebsd.org Tue Sep 17 22:09: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 00622E8636; Tue, 17 Sep 2019 22:09:15 +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 46Xy226CrPz4lBk; Tue, 17 Sep 2019 22:09:14 +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 B885F1B5D0; Tue, 17 Sep 2019 22:09:14 +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 x8HM9ELa076494; Tue, 17 Sep 2019 22:09:14 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8HM9ELi076493; Tue, 17 Sep 2019 22:09:14 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909172209.x8HM9ELi076493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 17 Sep 2019 22:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352463 - head/tests/sys/netpfil/common X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netpfil/common X-SVN-Commit-Revision: 352463 X-SVN-Commit-Repository: base MIME-Version: 1.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, 17 Sep 2019 22:09:15 -0000 Author: lwhsu Date: Tue Sep 17 22:09:14 2019 New Revision: 352463 URL: https://svnweb.freebsd.org/changeset/base/352463 Log: Temporarily skip sys.netpfil.common.tos.pf_tos on i386 CI as it always fails PR: 240086 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netpfil/common/tos.sh Modified: head/tests/sys/netpfil/common/tos.sh ============================================================================== --- head/tests/sys/netpfil/common/tos.sh Tue Sep 17 22:08:16 2019 (r352462) +++ head/tests/sys/netpfil/common/tos.sh Tue Sep 17 22:09:14 2019 (r352463) @@ -40,6 +40,10 @@ tos_head() tos_body() { firewall=$1 + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "i386" ] && [ "${firewall}" = "pf" ]; then + atf_skip "https://bugs.freebsd.org/240086" + fi firewall_init $firewall epair_send=$(vnet_mkepair) From owner-svn-src-all@freebsd.org Tue Sep 17 23:18: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 E81DCEA08B; Tue, 17 Sep 2019 23:18:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (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 46XzYq5rLlz4pB9; Tue, 17 Sep 2019 23:18:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f41.google.com with SMTP id q10so11798777iop.2; Tue, 17 Sep 2019 16:18:23 -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=510hRvj20U2t/iOIkqm++Rn80Ilexx8vJrOB+SdJdCs=; b=De/7+lQAgeTD0ynkebGaN4L3mU1wKna+p7UKwlJqycybxIRDK99S6v8vY7YHm+fkpN XUj0wQ799SnRpG7iPGOvMJ6NhSCNJfBVpCeF3+zcOmrUbC6ZWysKR4+Kqdik/uE9PXR5 Lr6B0fWTP/BxkvOfDy0PLFWMgF41kkbgYjO/QUdOfAeUM9psH3PHcONXMIkIj7wsWCsq nKraPFGSN3yoNHP6TvdkYjDHAViDuZEY3AFCAtkUSpbotgyFruCznvZziH4YjEQcNVms VgVXrrHang6mZI/evlm0j4rD6X5S+PpAkf08lpwOGhoDTOdTG/5hHtwmEtqdrDWn/nh3 AvTQ== X-Gm-Message-State: APjAAAXJiRH/THqStrVvOjJj8K3omMl47u3P0TpdRCVZGSU48483S/vh 8QO95gwbRFy31CG5MY6hdU3wnXfD X-Google-Smtp-Source: APXvYqwZF7VI2ncr0Cl4BzYd2bj/9rh+C007Nsj+MNp5dQE/Pu67aXqPlBt+8nI6kP2Ug6JM5XFHDQ== X-Received: by 2002:a5d:964f:: with SMTP id d15mr1743204ios.230.1568762302394; Tue, 17 Sep 2019 16:18:22 -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 w22sm3563475ior.79.2019.09.17.16.18.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Sep 2019 16:18:21 -0700 (PDT) Received: by mail-io1-f48.google.com with SMTP id j4so11629024iog.11; Tue, 17 Sep 2019 16:18:21 -0700 (PDT) X-Received: by 2002:a6b:5b0a:: with SMTP id v10mr1789018ioh.80.1568762301761; Tue, 17 Sep 2019 16:18:21 -0700 (PDT) MIME-Version: 1.0 References: <201909171616.x8HGGlkb066218@repo.freebsd.org> In-Reply-To: <201909171616.x8HGGlkb066218@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 17 Sep 2019 16:18:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352451 - head/stand/libsa To: Toomas Soome Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46XzYq5rLlz4pB9 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,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, 17 Sep 2019 23:18:24 -0000 Well, hang on; it's also perfectly legal for a malloc implementation to return NULL for requests of zero bytes. You can access exactly the number of bytes requested in the allocation; and free(NULL) works as expected. NULL (0) is also aligned to any size you could want. Best, Conrad On Tue, Sep 17, 2019 at 9:16 AM Toomas Soome wrote: > > Author: tsoome > Date: Tue Sep 17 16:16:46 2019 > New Revision: 352451 > URL: https://svnweb.freebsd.org/changeset/base/352451 > > Log: > loader: revert r352421 > > As insisted by kib, malloc(0) is quite legal. > > Modified: > head/stand/libsa/zalloc_malloc.c > > Modified: head/stand/libsa/zalloc_malloc.c > ============================================================================== > --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 (r352450) > +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 (r352451) > @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment) > { > Guard *res; > > - if (bytes == 0) > - return (NULL); > - > #ifdef USEENDGUARD > bytes += MALLOCALIGN + 1; > #else From owner-svn-src-all@freebsd.org Wed Sep 18 01:33: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 89F65ED4C2; Wed, 18 Sep 2019 01:33:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Y2YV33SSz4vQy; Wed, 18 Sep 2019 01:33:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C59C1DB03; Wed, 18 Sep 2019 01:33:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I1XIA8098807; Wed, 18 Sep 2019 01:33:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I1XI63098806; Wed, 18 Sep 2019 01:33:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909180133.x8I1XI63098806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 18 Sep 2019 01:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352464 - head/stand/mips/uboot X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/mips/uboot X-SVN-Commit-Revision: 352464 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 01:33:18 -0000 Author: kevans Date: Wed Sep 18 01:33:17 2019 New Revision: 352464 URL: https://svnweb.freebsd.org/changeset/base/352464 Log: mips: ubldr: use truncated load address for mips32 BFD appears to silently truncate 0xffffffff80800000 when it processes the ldscript for 32-bit mips, but LLD chokes on it as the linker script tries to place elements above 32-bit range. It's unclear to me if silent truncation is kosher or not and whether this patch is really what we want to do, but it is one approach at least. Reviewed by: imp, mizhka Differential Revision: https://reviews.freebsd.org/D21487 Modified: head/stand/mips/uboot/Makefile Modified: head/stand/mips/uboot/Makefile ============================================================================== --- head/stand/mips/uboot/Makefile Tue Sep 17 22:09:14 2019 (r352463) +++ head/stand/mips/uboot/Makefile Wed Sep 18 01:33:17 2019 (r352464) @@ -19,7 +19,11 @@ INSTALLFLAGS= -b WARNS?= 1 # Address at which ubldr will be loaded. # This varies for different boards and SOCs. +.if ${MACHINE_ARCH:Mmips64*} UBLDR_LOADADDR?= 0xffffffff80800000 +.else +UBLDR_LOADADDR?= 0x80800000 +.endif # Architecture-specific loader code SRCS= start.S conf.c vers.c From owner-svn-src-all@freebsd.org Wed Sep 18 01:58: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 62C45EDA7F; Wed, 18 Sep 2019 01:58:57 +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 46Y3751zk1z3Bxn; Wed, 18 Sep 2019 01:58:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2300D1DE85; Wed, 18 Sep 2019 01:58:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I1wuPY011259; Wed, 18 Sep 2019 01:58:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I1wuZu011258; Wed, 18 Sep 2019 01:58:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909180158.x8I1wuZu011258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 18 Sep 2019 01:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352465 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 352465 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 01:58:57 -0000 Author: kevans Date: Wed Sep 18 01:58:56 2019 New Revision: 352465 URL: https://svnweb.freebsd.org/changeset/base/352465 Log: googletest: default-disable on all of MIPS for now Parts of the fusefs tests trigger a bug in current versions of llvm: IR representation of some routine for the MIPS targets is a function with a large number of arguments. This then leads the compiler on an hour+ long goose chase, which is OK if you build the current tree but less-so if you're trying external toolchain or doing a universe build involving mips when it eventually gets switched over to LLVM. Better, accurate details can be found in LLVM PR43263. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Sep 18 01:33:17 2019 (r352464) +++ head/share/mk/src.opts.mk Wed Sep 18 01:58:56 2019 (r352465) @@ -108,7 +108,6 @@ __DEFAULT_YES_OPTIONS = \ GDB \ GNU_DIFF \ GNU_GREP \ - GOOGLETEST \ GPIO \ HAST \ HTML \ @@ -258,6 +257,15 @@ __T=${MACHINE_ARCH} __TT=${TARGET} .else __TT=${MACHINE} +.endif + +# Default GOOGLETEST to off for MIPS while LLVM PR 43263 is active. Part +# of the fusefs tests trigger excessively long compile times. It does +# eventually succeed, but this shouldn't be forced on those building by default. +.if ${__TT} == "mips" +__DEFAULT_NO_OPTIONS+= GOOGLETEST +.else +__DEFAULT_YES_OPTIONS+= GOOGLETEST .endif # All supported backends for LLVM_TARGET_XXX From owner-svn-src-all@freebsd.org Wed Sep 18 02:03: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 A7349EDD2F; Wed, 18 Sep 2019 02:03:40 +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 46Y3DX3xYZz3CMf; Wed, 18 Sep 2019 02:03:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BD471E03C; Wed, 18 Sep 2019 02:03:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I23eeI016637; Wed, 18 Sep 2019 02:03:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I23eew016636; Wed, 18 Sep 2019 02:03:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909180203.x8I23eew016636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 18 Sep 2019 02:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352466 - head/tools/build/options X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tools/build/options X-SVN-Commit-Revision: 352466 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 02:03:40 -0000 Author: kevans Date: Wed Sep 18 02:03:39 2019 New Revision: 352466 URL: https://svnweb.freebsd.org/changeset/base/352466 Log: Add description for WITH_GOOGLETEST This is the logical negation of WITHOUT_GOOGLETEST, and helpful to have as we now have different per-arch defaults for this option. Added: head/tools/build/options/WITH_GOOGLETEST (contents, props changed) Added: head/tools/build/options/WITH_GOOGLETEST ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_GOOGLETEST Wed Sep 18 02:03:39 2019 (r352466) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to build and install +.Lb libgmock , +.Lb libgtest , +and dependent tests. From owner-svn-src-all@freebsd.org Wed Sep 18 02:04: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 712FAEDDB8; Wed, 18 Sep 2019 02:04:42 +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 46Y3Fk2H4zz3CVG; Wed, 18 Sep 2019 02:04:42 +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 317831E03D; Wed, 18 Sep 2019 02:04:42 +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 x8I24giJ016732; Wed, 18 Sep 2019 02:04:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I24gIV016731; Wed, 18 Sep 2019 02:04:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909180204.x8I24gIV016731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 18 Sep 2019 02:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352467 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 352467 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 02:04:42 -0000 Author: kevans Date: Wed Sep 18 02:04:41 2019 New Revision: 352467 URL: https://svnweb.freebsd.org/changeset/base/352467 Log: src.conf(5): regenerate after r352465, r352466 These changed the defaults for the GOOGLETEST knob and added a description for WITH_GOOGLETEST. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Sep 18 02:03:39 2019 (r352466) +++ head/share/man/man5/src.conf.5 Wed Sep 18 02:04:41 2019 (r352467) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd August 16, 2019 +.Dd September 17, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -831,6 +831,17 @@ Set to neither build nor install .Lb libgmock , .Lb libgtest , and dependent tests. +.Pp +This is a default setting on +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +.It Va WITH_GOOGLETEST +Set to build and install +.Lb libgmock , +.Lb libgtest , +and dependent tests. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 From owner-svn-src-all@freebsd.org Wed Sep 18 06:50: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 0F746F3B98; Wed, 18 Sep 2019 06:50:31 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Y9bV6gPlz3Qd1; Wed, 18 Sep 2019 06:50:30 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C82372127B; Wed, 18 Sep 2019 06:50:30 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I6oUQh082370; Wed, 18 Sep 2019 06:50:30 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I6oTit082365; Wed, 18 Sep 2019 06:50:29 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909180650.x8I6oTit082365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 06:50: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: r352468 - stable/12/sys/dev/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/dev/pci X-SVN-Commit-Revision: 352468 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 06:50:31 -0000 Author: jchandra Date: Wed Sep 18 06:50:29 2019 New Revision: 352468 URL: https://svnweb.freebsd.org/changeset/base/352468 Log: MFC r340595-r340597 r340595: pci_host_generic: remove unneeded ThunderX2 quirk The current quirk implementation writes a fixed address to the PCI BAR to fix a firmware bug. The PCI BARs are allocated by firmware and will change depending on PCI devices present. So using a fixed address here is not correct. This quirk worked around a firmware bug that programmed the MSI-X bar of the SATA controller incorrectly. The newer firmware does not have this issue, so it is better to drop this quirk altogether. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17655 r340596: pci_host_generic: allocate resources against devices Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate resources against devices that requested them. Currently the allocation happens against the pcib, which is incorrect. This is needed for the upcoming changes for fixing up pci_host_generic_acpi.c Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17656 r340597: pci_host_generic*: basic implementation of bus range Both ACPI and FDT support bus ranges for pci host bridges. Update pci_host_generic*.[ch] with a default implementation to support this. This will be used in the next set of changes for ACPI based host bridge. No functional changes in this commit. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17657 Modified: stable/12/sys/dev/pci/pci_host_generic.c stable/12/sys/dev/pci/pci_host_generic.h stable/12/sys/dev/pci/pci_host_generic_acpi.c stable/12/sys/dev/pci/pci_host_generic_fdt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/pci/pci_host_generic.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic.c Wed Sep 18 02:04:41 2019 (r352467) +++ stable/12/sys/dev/pci/pci_host_generic.c Wed Sep 18 06:50:29 2019 (r352468) @@ -69,25 +69,6 @@ __FBSDID("$FreeBSD$"); (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \ ((reg) & PCIE_REG_MASK)) -typedef void (*pci_host_generic_quirk_function)(device_t); - -struct pci_host_generic_quirk_entry { - int impl; - int part; - int var; - int rev; - pci_host_generic_quirk_function func; -}; - -struct pci_host_generic_block_entry { - int impl; - int part; - int var; - int rev; - int bus; - int slot; -}; - /* Forward prototypes */ static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, @@ -100,24 +81,6 @@ static int generic_pcie_read_ivar(device_t dev, device static int generic_pcie_write_ivar(device_t dev, device_t child, int index, uintptr_t value); -#if defined(__aarch64__) -static void pci_host_generic_apply_quirks(device_t); -static void thunderx2_ahci_bar_quirk(device_t); - -struct pci_host_generic_quirk_entry pci_host_generic_quirks[] = -{ - {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, thunderx2_ahci_bar_quirk}, - {0, 0, 0, 0, NULL} -}; - -struct pci_host_generic_block_entry pci_host_generic_blocked[] = -{ - /* ThunderX2 AHCI on second socket */ - {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, - {0, 0, 0, 0, 0, 0} -}; -#endif - int pci_host_generic_core_attach(device_t dev) { @@ -171,34 +134,9 @@ pci_host_generic_core_attach(device_t dev) return (error); } -#if defined(__aarch64__) - pci_host_generic_apply_quirks(dev); -#endif - return (0); } -#if defined(__aarch64__) -static void -pci_host_generic_apply_quirks(device_t dev) -{ - struct pci_host_generic_quirk_entry *quirk; - - quirk = pci_host_generic_quirks; - while (1) { - if (quirk->impl == 0) - break; - - if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, - quirk->impl, quirk->part, quirk->var, quirk->rev) && - quirk->func != NULL) - quirk->func(dev); - - quirk++; - } -} -#endif - static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, int bytes) @@ -208,32 +146,15 @@ generic_pcie_read_config(device_t dev, u_int bus, u_in bus_space_tag_t t; uint64_t offset; uint32_t data; -#if defined(__aarch64__) - struct pci_host_generic_block_entry *block; -#endif - if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || - (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) + sc = device_get_softc(dev); + if ((bus < sc->bus_start) || (bus > sc->bus_end)) return (~0U); + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCIE_REGMAX)) + return (~0U); -#if defined(__aarch64__) - block = pci_host_generic_blocked; - while (1) { - if (block->impl == 0) - break; - - if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, - block->impl, block->part, block->var, block->rev) && - block->bus == bus && block->slot == slot) - return (~0); - - block++; - } -#endif - - sc = device_get_softc(dev); - - offset = PCIE_ADDR_OFFSET(bus, slot, func, reg); + offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg); t = sc->bst; h = sc->bsh; @@ -263,14 +184,15 @@ generic_pcie_write_config(device_t dev, u_int bus, u_i bus_space_tag_t t; uint64_t offset; - if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || - (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) + sc = device_get_softc(dev); + if ((bus < sc->bus_start) || (bus > sc->bus_end)) return; + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCIE_REGMAX)) + return; - sc = device_get_softc(dev); + offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg); - offset = PCIE_ADDR_OFFSET(bus, slot, func, reg); - t = sc->bst; h = sc->bsh; @@ -301,14 +223,11 @@ generic_pcie_read_ivar(device_t dev, device_t child, i uintptr_t *result) { struct generic_pcie_core_softc *sc; - int secondary_bus; sc = device_get_softc(dev); if (index == PCIB_IVAR_BUS) { - /* this pcib adds only pci bus 0 as child */ - secondary_bus = 0; - *result = secondary_bus; + *result = sc->bus_start; return (0); } @@ -390,7 +309,7 @@ pci_host_generic_core_alloc_resource(device_t dev, dev rm = generic_pcie_rman(sc, type); if (rm == NULL) - return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, start, end, count, flags)); if (bootverbose) { @@ -472,22 +391,3 @@ static device_method_t generic_pcie_methods[] = { DEFINE_CLASS_0(pcib, generic_pcie_core_driver, generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); - -#if defined(__aarch64__) -static void thunderx2_ahci_bar_quirk(device_t dev) -{ - - /* - * XXX: - * On ThunderX2, AHCI BAR2 address is wrong. It needs to precisely - * match the one described in datasheet. Fixup it unconditionally. - */ - if (device_get_unit(dev) == 0) { - device_printf(dev, "running AHCI BAR fixup\n"); - PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x18, 0x01440000, 4); - PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x1c, 0x40, 4); - PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x18, 0x01450000, 4); - PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); - } -} -#endif Modified: stable/12/sys/dev/pci/pci_host_generic.h ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic.h Wed Sep 18 02:04:41 2019 (r352467) +++ stable/12/sys/dev/pci/pci_host_generic.h Wed Sep 18 06:50:29 2019 (r352468) @@ -56,6 +56,8 @@ struct generic_pcie_core_softc { struct rman io_rman; struct resource *res; struct resource *res1; + int bus_start; + int bus_end; int ecam; bus_space_tag_t bst; bus_space_handle_t bsh; Modified: stable/12/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 02:04:41 2019 (r352467) +++ stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 06:50:29 2019 (r352468) @@ -125,7 +125,7 @@ pci_host_generic_acpi_attach(device_t dev) struct generic_pcie_acpi_softc *sc; ACPI_HANDLE handle; ACPI_STATUS status; - int error; + int error, bus_start; sc = device_get_softc(dev); @@ -136,10 +136,14 @@ pci_host_generic_acpi_attach(device_t dev) device_printf(dev, "Bus is%s cache-coherent\n", sc->base.coherent ? "" : " not"); - if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &sc->base.ecam))) - sc->base.ecam >>= 7; - else + if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &bus_start))) { + sc->base.ecam = bus_start >> 7; + sc->base.bus_start = bus_start & 0x7F; + } else { sc->base.ecam = 0; + sc->base.bus_start = 0; + } + sc->base.bus_end = 0xFF; acpi_pcib_fetch_prt(dev, &sc->ap_prt); @@ -194,17 +198,12 @@ static int generic_pcie_acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { - ACPI_HANDLE handle; struct generic_pcie_acpi_softc *sc; - int secondary_bus; sc = device_get_softc(dev); if (index == PCIB_IVAR_BUS) { - handle = acpi_get_handle(dev); - if (ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &secondary_bus))) - secondary_bus = sc->base.ecam * 0x80; - *result = secondary_bus; + *result = sc->base.ecam * 0x80 + sc->base.bus_start; return (0); } Modified: stable/12/sys/dev/pci/pci_host_generic_fdt.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic_fdt.c Wed Sep 18 02:04:41 2019 (r352467) +++ stable/12/sys/dev/pci/pci_host_generic_fdt.c Wed Sep 18 06:50:29 2019 (r352468) @@ -152,6 +152,9 @@ pci_host_generic_attach(device_t dev) device_printf(dev, "Bus is%s cache-coherent\n", sc->base.coherent ? "" : " not"); + /* TODO parse FDT bus ranges */ + sc->base.bus_start = 0; + sc->base.bus_end = 0xFF; error = pci_host_generic_core_attach(dev); if (error != 0) return (error); @@ -423,6 +426,7 @@ generic_pcie_fdt_activate_resource(device_t dev, devic } break; case SYS_RES_MEMORY: + case SYS_RES_IRQ: res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, type, rid, r); break; @@ -445,6 +449,7 @@ generic_pcie_fdt_deactivate_resource(device_t dev, dev switch(type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: + case SYS_RES_IRQ: res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child, type, rid, r); break; From owner-svn-src-all@freebsd.org Wed Sep 18 07:01: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 E24D6F3ECF; Wed, 18 Sep 2019 07:01:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Y9qd5k2xz3R3s; Wed, 18 Sep 2019 07:01:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A91C221464; Wed, 18 Sep 2019 07:01:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I711mD090278; Wed, 18 Sep 2019 07:01:01 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I711FH090277; Wed, 18 Sep 2019 07:01:01 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909180701.x8I711FH090277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 18 Sep 2019 07:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352469 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352469 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:01:01 -0000 Author: alc Date: Wed Sep 18 07:01:01 2019 New Revision: 352469 URL: https://svnweb.freebsd.org/changeset/base/352469 Log: MFC r350347 Implement pmap_advise(). (Without a working pmap_advise() implementation madvise(MADV_DONTNEED) and madvise(MADV_FREE) are NOPs.) Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 06:50:29 2019 (r352468) +++ stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 07:01:01 2019 (r352469) @@ -2493,7 +2493,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ /* * pmap_remove_l3: do the things to unmap a page in a process */ -static int __unused +static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { @@ -4833,6 +4833,110 @@ out: void pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) { + struct rwlock *lock; + vm_offset_t va, va_next; + vm_page_t m; + pd_entry_t *l0, *l1, *l2, oldl2; + pt_entry_t *l3, oldl3; + + if (advice != MADV_DONTNEED && advice != MADV_FREE) + return; + + PMAP_LOCK(pmap); + for (; sva < eva; sva = va_next) { + l0 = pmap_l0(pmap, sva); + if (pmap_load(l0) == 0) { + va_next = (sva + L0_SIZE) & ~L0_OFFSET; + if (va_next < sva) + va_next = eva; + continue; + } + l1 = pmap_l0_to_l1(l0, sva); + if (pmap_load(l1) == 0) { + va_next = (sva + L1_SIZE) & ~L1_OFFSET; + if (va_next < sva) + va_next = eva; + continue; + } + va_next = (sva + L2_SIZE) & ~L2_OFFSET; + if (va_next < sva) + va_next = eva; + l2 = pmap_l1_to_l2(l1, sva); + oldl2 = pmap_load(l2); + if (oldl2 == 0) + continue; + if ((oldl2 & ATTR_DESCR_MASK) == L2_BLOCK) { + if ((oldl2 & ATTR_SW_MANAGED) == 0) + continue; + lock = NULL; + if (!pmap_demote_l2_locked(pmap, l2, sva, &lock)) { + if (lock != NULL) + rw_wunlock(lock); + + /* + * The 2MB page mapping was destroyed. + */ + continue; + } + + /* + * Unless the page mappings are wired, remove the + * mapping to a single page so that a subsequent + * access may repromote. Since the underlying page + * table page is fully populated, this removal never + * frees a page table page. + */ + if ((oldl2 & ATTR_SW_WIRED) == 0) { + l3 = pmap_l2_to_l3(l2, sva); + KASSERT(pmap_load(l3) != 0, + ("pmap_advise: invalid PTE")); + pmap_remove_l3(pmap, l3, sva, pmap_load(l2), + NULL, &lock); + } + if (lock != NULL) + rw_wunlock(lock); + } + KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE, + ("pmap_advise: invalid L2 entry after demotion")); + if (va_next > eva) + va_next = eva; + va = va_next; + for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++, + sva += L3_SIZE) { + oldl3 = pmap_load(l3); + if ((oldl3 & (ATTR_SW_MANAGED | ATTR_DESCR_MASK)) != + (ATTR_SW_MANAGED | L3_PAGE)) + goto maybe_invlrng; + else if (pmap_pte_dirty(oldl3)) { + if (advice == MADV_DONTNEED) { + /* + * Future calls to pmap_is_modified() + * can be avoided by making the page + * dirty now. + */ + m = PHYS_TO_VM_PAGE(oldl3 & ~ATTR_MASK); + vm_page_dirty(m); + } + while (!atomic_fcmpset_long(l3, &oldl3, + (oldl3 & ~ATTR_AF) | ATTR_AP(ATTR_AP_RO))) + cpu_spinwait(); + } else if ((oldl3 & ATTR_AF) != 0) + pmap_clear_bits(l3, ATTR_AF); + else + goto maybe_invlrng; + if (va == va_next) + va = sva; + continue; +maybe_invlrng: + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } + } + if (va != va_next) + pmap_invalidate_range(pmap, va, sva); + } + PMAP_UNLOCK(pmap); } /* From owner-svn-src-all@freebsd.org Wed Sep 18 07:09: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 213EBF4188; Wed, 18 Sep 2019 07:09:18 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YB1B03kXz3wbg; Wed, 18 Sep 2019 07:09:18 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D995A215FD; Wed, 18 Sep 2019 07:09:17 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I79HcZ094364; Wed, 18 Sep 2019 07:09:17 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I79Gc2094359; Wed, 18 Sep 2019 07:09:16 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909180709.x8I79Gc2094359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 07:09: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: r352470 - in stable/12/sys: arm/arm dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in stable/12/sys: arm/arm dev/acpica X-SVN-Commit-Revision: 352470 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:09:18 -0000 Author: jchandra Date: Wed Sep 18 07:09:16 2019 New Revision: 352470 URL: https://svnweb.freebsd.org/changeset/base/352470 Log: MFC r340598: acpica: rework INTRNG interrupts On arm64 (where INTRNG is enabled), the interrupts have to be mapped with ACPI_BUS_MAP_INTR() before adding them as resources to devices. The earlier code did the mapping before calling acpi_set_resource(), which bypassed code that checked for PCI link interrupts. To fix this, move the call to map interrupts into acpi_set_resource() and that requires additional work to lookup interrupt properties. The changes here are to: * extend acpi_lookup_irq_handler() to lookup an irq in the ACPI resources * create a helper function acpi_map_intr() which uses the updated acpi_lookup_irq_handler() to look up an irq, and then map it with ACPI_BUS_MAP_INTR() * use acpi_map_intr() in acpi_pcib_route_interrupt() to map pci link interrupts. With these changes, we can drop the ifdefs in acpi_resource.c, and we can also drop the call for mapping interrupts in generic_timer.c Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17790 Modified: stable/12/sys/arm/arm/generic_timer.c stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/acpica/acpi_pcib.c stable/12/sys/dev/acpica/acpi_resource.c stable/12/sys/dev/acpica/acpivar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/arm/generic_timer.c ============================================================================== --- stable/12/sys/arm/arm/generic_timer.c Wed Sep 18 07:01:01 2019 (r352469) +++ stable/12/sys/arm/arm/generic_timer.c Wed Sep 18 07:09:16 2019 (r352470) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #ifdef DEV_ACPI #include #include -#include "acpi_bus_if.h" #endif #define GT_CTRL_ENABLE (1 << 0) @@ -340,8 +339,6 @@ static void arm_tmr_acpi_add_irq(device_t parent, device_t dev, int rid, u_int irq) { - irq = ACPI_BUS_MAP_INTR(parent, dev, irq, - INTR_TRIGGER_LEVEL, INTR_POLARITY_HIGH); BUS_SET_RESOURCE(parent, dev, SYS_RES_IRQ, rid, irq, 1); } Modified: stable/12/sys/dev/acpica/acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi.c Wed Sep 18 07:01:01 2019 (r352469) +++ stable/12/sys/dev/acpica/acpi.c Wed Sep 18 07:09:16 2019 (r352470) @@ -1318,6 +1318,13 @@ acpi_set_resource(device_t dev, device_t child, int ty } #endif +#ifdef INTRNG + /* map with default for now */ + if (type == SYS_RES_IRQ) + start = (rman_res_t)acpi_map_intr(child, (u_int)start, + acpi_get_handle(child)); +#endif + /* If the resource is already allocated, fail. */ if (resource_list_busy(rl, type, rid)) return (EBUSY); Modified: stable/12/sys/dev/acpica/acpi_pcib.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pcib.c Wed Sep 18 07:01:01 2019 (r352469) +++ stable/12/sys/dev/acpica/acpi_pcib.c Wed Sep 18 07:09:16 2019 (r352470) @@ -188,6 +188,7 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + lnkdev = NULL; interrupt = PCI_INVALID_IRQ; /* ACPI numbers pins 0-3, not 1-4 like the BIOS. */ @@ -252,7 +253,12 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, out: ACPI_SERIAL_END(pcib); - +#ifdef INTRNG + if (PCI_INTERRUPT_VALID(interrupt)) { + interrupt = acpi_map_intr(dev, interrupt, lnkdev); + KASSERT(PCI_INTERRUPT_VALID(interrupt), ("mapping fail")); + } +#endif return_VALUE(interrupt); } Modified: stable/12/sys/dev/acpica/acpi_resource.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_resource.c Wed Sep 18 07:01:01 2019 (r352469) +++ stable/12/sys/dev/acpica/acpi_resource.c Wed Sep 18 07:09:16 2019 (r352470) @@ -55,10 +55,13 @@ ACPI_MODULE_NAME("RESOURCE") struct lookup_irq_request { ACPI_RESOURCE *acpi_res; - struct resource *res; + u_int irq; int counter; int rid; int found; + int checkrid; + int trig; + int pol; }; static ACPI_STATUS @@ -66,18 +69,22 @@ acpi_lookup_irq_handler(ACPI_RESOURCE *res, void *cont { struct lookup_irq_request *req; size_t len; - u_int irqnum, irq; + u_int irqnum, irq, trig, pol; switch (res->Type) { case ACPI_RESOURCE_TYPE_IRQ: irqnum = res->Data.Irq.InterruptCount; irq = res->Data.Irq.Interrupts[0]; len = ACPI_RS_SIZE(ACPI_RESOURCE_IRQ); + trig = res->Data.Irq.Triggering; + pol = res->Data.Irq.Polarity; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: irqnum = res->Data.ExtendedIrq.InterruptCount; irq = res->Data.ExtendedIrq.Interrupts[0]; len = ACPI_RS_SIZE(ACPI_RESOURCE_EXTENDED_IRQ); + trig = res->Data.ExtendedIrq.Triggering; + pol = res->Data.ExtendedIrq.Polarity; break; default: return (AE_OK); @@ -85,14 +92,21 @@ acpi_lookup_irq_handler(ACPI_RESOURCE *res, void *cont if (irqnum != 1) return (AE_OK); req = (struct lookup_irq_request *)context; - if (req->counter != req->rid) { - req->counter++; - return (AE_OK); + if (req->checkrid) { + if (req->counter != req->rid) { + req->counter++; + return (AE_OK); + } + KASSERT(irq == req->irq, ("IRQ resources do not match")); + } else { + if (req->irq != irq) + return (AE_OK); } req->found = 1; - KASSERT(irq == rman_get_start(req->res), - ("IRQ resources do not match")); - bcopy(res, req->acpi_res, len); + req->pol = pol; + req->trig = trig; + if (req->acpi_res != NULL) + bcopy(res, req->acpi_res, len); return (AE_CTRL_TERMINATE); } @@ -104,10 +118,11 @@ acpi_lookup_irq_resource(device_t dev, int rid, struct ACPI_STATUS status; req.acpi_res = acpi_res; - req.res = res; + req.irq = rman_get_start(res); req.counter = 0; req.rid = rid; req.found = 0; + req.checkrid = 1; status = AcpiWalkResources(acpi_get_handle(dev), "_CRS", acpi_lookup_irq_handler, &req); if (ACPI_SUCCESS(status) && req.found == 0) @@ -155,6 +170,34 @@ acpi_config_intr(device_t dev, ACPI_RESOURCE *res) INTR_POLARITY_HIGH : INTR_POLARITY_LOW); } +#ifdef INTRNG +int +acpi_map_intr(device_t dev, u_int irq, ACPI_HANDLE handle) +{ + struct lookup_irq_request req; + int trig, pol; + + trig = ACPI_LEVEL_SENSITIVE; + pol = ACPI_ACTIVE_HIGH; + if (handle != NULL) { + req.found = 0; + req.acpi_res = NULL; + req.irq = irq; + req.counter = 0; + req.rid = 0; + req.checkrid = 0; + AcpiWalkResources(handle, "_CRS", acpi_lookup_irq_handler, &req); + if (req.found != 0) { + trig = req.trig; + pol = req.pol; + } + } + return ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, irq, + (trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, + (pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); +} +#endif + struct acpi_resource_context { struct acpi_parse_resource_set *set; device_t dev; @@ -601,13 +644,7 @@ acpi_res_set_irq(device_t dev, void *context, uint8_t if (count != 1) return; -#ifdef INTRNG - intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, - (trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, - (pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); -#else intr = *irq; -#endif bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); } @@ -625,13 +662,7 @@ acpi_res_set_ext_irq(device_t dev, void *context, uint if (count != 1) return; -#ifdef INTRNG - intr = ACPI_BUS_MAP_INTR(device_get_parent(dev), dev, *irq, - (trig == ACPI_EDGE_SENSITIVE) ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, - (pol == ACPI_ACTIVE_HIGH) ? INTR_POLARITY_HIGH : INTR_POLARITY_LOW); -#else intr = *irq; -#endif bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, intr, 1); } Modified: stable/12/sys/dev/acpica/acpivar.h ============================================================================== --- stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 07:01:01 2019 (r352469) +++ stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 07:09:16 2019 (r352470) @@ -399,6 +399,9 @@ extern struct acpi_parse_resource_set acpi_res_parse_s int acpi_identify(void); void acpi_config_intr(device_t dev, ACPI_RESOURCE *res); +#ifdef INTRNG +int acpi_map_intr(device_t dev, u_int irq, ACPI_HANDLE handle); +#endif ACPI_STATUS acpi_lookup_irq_resource(device_t dev, int rid, struct resource *res, ACPI_RESOURCE *acpi_res); ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle, From owner-svn-src-all@freebsd.org Wed Sep 18 07:16: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 C748AF4526; Wed, 18 Sep 2019 07:16:01 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YB8x5YbGz3x3B; Wed, 18 Sep 2019 07:16:01 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A186D217B4; Wed, 18 Sep 2019 07:16:01 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7G1Qj099870; Wed, 18 Sep 2019 07:16:01 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7G04n099865; Wed, 18 Sep 2019 07:16:00 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909180716.x8I7G04n099865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 07:16: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: r352471 - in stable/12/sys/dev: acpica pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in stable/12/sys/dev: acpica pci X-SVN-Commit-Revision: 352471 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:16:01 -0000 Author: jchandra Date: Wed Sep 18 07:16:00 2019 New Revision: 352471 URL: https://svnweb.freebsd.org/changeset/base/352471 Log: MFC r340599-r340601 r340599: acpica, pci_host_generic_acpi: redo pci_host_generic_acpi.c This is a major update for pci_host_generic_acpi.c, the current implementation has some gaps that are better fixed up in one go. The changes are to: * Follow x86 method of not adding PCI resources to PCI host bridge in ACPI code. This has been moved to pci_host_generic_acpi.c, where we walk thru its resources of the host bridge and add them. * Fixup code in pci_host_generic_acpi.c to read all decoded ranges and update the 'ranges' property. This allows us to share most of the code with generic implementation (and the FDT one). * Parse and setup IO ranges and bus ranges when walking the resources above. Drop most of the changes related to this from acpica code. * Add the ECAM memory area as mem resource 0. Implement the logic to get the ECAM area from MCFG (using bus range which we now decode), or from _CBA (using _BBN/bus range). Drop aarch64 ifdefs from acpica code which did part of this. * Switch resource activation to similar code as FDT implementation, this can be moved into generic implementation in a later pass. * Drop the mechanism of using the 7th bit of bus number as the domain, this is not correct and will work only in very specific cases. Use _SEG as PCI domain and use the bus ranges of the host bridge to provide start bus number. This commit should not make any functional change to dev/acpica/acpi.c for other architectures, almost all the changes there are to revert earlier additions in this file done for aarch64. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17791 r340600: pci_host_generic, acpi_resource: drop unneeded code Now that we are handling PCI resources in pci_host_generic_acpi.c, we don't need these change (made by r336129) Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17792 r340601: pci_host_generic : move activate/release to generic code Now that the ACPI and FDT implementations for activating and deactivating resources are the same, we can move it to pci_host_generic.c. No functional changes. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17793 Modified: stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/acpica/acpi_resource.c stable/12/sys/dev/pci/pci_host_generic.c stable/12/sys/dev/pci/pci_host_generic_acpi.c stable/12/sys/dev/pci/pci_host_generic_fdt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi.c Wed Sep 18 07:09:16 2019 (r352470) +++ stable/12/sys/dev/acpica/acpi.c Wed Sep 18 07:16:00 2019 (r352471) @@ -179,9 +179,7 @@ static int acpi_child_location_str_method(device_t acd char *buf, size_t buflen); static int acpi_child_pnpinfo_str_method(device_t acdev, device_t child, char *buf, size_t buflen); -#if defined(__i386__) || defined(__amd64__) static void acpi_enable_pcie(void); -#endif static void acpi_hint_device_unit(device_t acdev, device_t child, const char *name, int *unitp); static void acpi_reset_interfaces(device_t dev); @@ -502,10 +500,8 @@ acpi_attach(device_t dev) goto out; } -#if defined(__i386__) || defined(__amd64__) /* Handle MCFG table if present. */ acpi_enable_pcie(); -#endif /* * Note that some systems (specifically, those with namespace evaluation @@ -1286,11 +1282,10 @@ acpi_set_resource(device_t dev, device_t child, int ty struct acpi_softc *sc = device_get_softc(dev); struct acpi_device *ad = device_get_ivars(child); struct resource_list *rl = &ad->ad_rl; -#if defined(__i386__) || defined(__amd64__) ACPI_DEVICE_INFO *devinfo; -#endif rman_res_t end; - + int allow; + /* Ignore IRQ resources for PCI link devices. */ if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL) return (0); @@ -1304,11 +1299,15 @@ acpi_set_resource(device_t dev, device_t child, int ty * x86 of a PCI bridge claiming the I/O ports used for PCI config * access. */ -#if defined(__i386__) || defined(__amd64__) if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { if (ACPI_SUCCESS(AcpiGetObjectInfo(ad->ad_handle, &devinfo))) { if ((devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0) { - if (!(type == SYS_RES_IOPORT && start == CONF1_ADDR_PORT)) { +#if defined(__i386__) || defined(__amd64__) + allow = (type == SYS_RES_IOPORT && start == CONF1_ADDR_PORT); +#else + allow = 0; +#endif + if (!allow) { AcpiOsFree(devinfo); return (0); } @@ -1316,7 +1315,6 @@ acpi_set_resource(device_t dev, device_t child, int ty AcpiOsFree(devinfo); } } -#endif #ifdef INTRNG /* map with default for now */ @@ -1873,15 +1871,18 @@ acpi_isa_pnp_probe(device_t bus, device_t child, struc return_VALUE (result); } -#if defined(__i386__) || defined(__amd64__) /* * Look for a MCFG table. If it is present, use the settings for * domain (segment) 0 to setup PCI config space access via the memory * map. + * + * On non-x86 architectures (arm64 for now), this will be done from the + * PCI host bridge driver. */ static void acpi_enable_pcie(void) { +#if defined(__i386__) || defined(__amd64__) ACPI_TABLE_HEADER *hdr; ACPI_MCFG_ALLOCATION *alloc, *end; ACPI_STATUS status; @@ -1900,32 +1901,9 @@ acpi_enable_pcie(void) } alloc++; } +#endif } -#elif defined(__aarch64__) -static void -acpi_enable_pcie(device_t child, int segment) -{ - ACPI_TABLE_HEADER *hdr; - ACPI_MCFG_ALLOCATION *alloc, *end; - ACPI_STATUS status; - status = AcpiGetTable(ACPI_SIG_MCFG, 1, &hdr); - if (ACPI_FAILURE(status)) - return; - - end = (ACPI_MCFG_ALLOCATION *)((char *)hdr + hdr->Length); - alloc = (ACPI_MCFG_ALLOCATION *)((ACPI_TABLE_MCFG *)hdr + 1); - while (alloc < end) { - if (alloc->PciSegment == segment) { - bus_set_resource(child, SYS_RES_MEMORY, 0, - alloc->Address, 0x10000000); - return; - } - alloc++; - } -} -#endif - /* * Scan all of the ACPI namespace and attach child devices. * @@ -2015,9 +1993,6 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, voi { ACPI_DEVICE_INFO *devinfo; struct acpi_device *ad; -#ifdef __aarch64__ - int segment; -#endif struct acpi_prw_data prw; ACPI_OBJECT_TYPE type; ACPI_HANDLE h; @@ -2120,13 +2095,6 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, voi ad->ad_cls_class = strtoul(devinfo->ClassCode.String, NULL, 16); } -#ifdef __aarch64__ - if ((devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0) { - if (ACPI_SUCCESS(acpi_GetInteger(handle, "_SEG", &segment))) { - acpi_enable_pcie(child, segment); - } - } -#endif AcpiOsFree(devinfo); } break; Modified: stable/12/sys/dev/acpica/acpi_resource.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_resource.c Wed Sep 18 07:09:16 2019 (r352470) +++ stable/12/sys/dev/acpica/acpi_resource.c Wed Sep 18 07:16:00 2019 (r352471) @@ -612,10 +612,6 @@ acpi_res_set_memory(device_t dev, void *context, uint6 if (cp == NULL) return; - - while (bus_get_resource_start(dev, SYS_RES_MEMORY, cp->ar_nmem)) - cp->ar_nmem++; - bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length); } Modified: stable/12/sys/dev/pci/pci_host_generic.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic.c Wed Sep 18 07:09:16 2019 (r352470) +++ stable/12/sys/dev/pci/pci_host_generic.c Wed Sep 18 07:16:00 2019 (r352471) @@ -107,7 +107,7 @@ pci_host_generic_core_attach(device_t dev) return (error); rid = 0; - sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_SHAREABLE); + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->res == NULL) { device_printf(dev, "could not map memory.\n"); return (ENXIO); @@ -341,6 +341,82 @@ fail: } static int +generic_pcie_activate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r) +{ + struct generic_pcie_core_softc *sc; + uint64_t phys_base; + uint64_t pci_base; + uint64_t size; + int found; + int res; + int i; + + sc = device_get_softc(dev); + + if ((res = rman_activate_resource(r)) != 0) + return (res); + + switch (type) { + case SYS_RES_IOPORT: + found = 0; + for (i = 0; i < MAX_RANGES_TUPLES; i++) { + pci_base = sc->ranges[i].pci_base; + phys_base = sc->ranges[i].phys_base; + size = sc->ranges[i].size; + + if ((rid > pci_base) && (rid < (pci_base + size))) { + found = 1; + break; + } + } + if (found) { + rman_set_start(r, rman_get_start(r) + phys_base); + rman_set_end(r, rman_get_end(r) + phys_base); + res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), + child, type, rid, r); + } else { + device_printf(dev, + "Failed to activate IOPORT resource\n"); + res = 0; + } + break; + case SYS_RES_MEMORY: + case SYS_RES_IRQ: + res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, + type, rid, r); + break; + default: + break; + } + + return (res); +} + +static int +generic_pcie_deactivate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r) +{ + int res; + + if ((res = rman_deactivate_resource(r)) != 0) + return (res); + + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + case SYS_RES_IRQ: + res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child, + type, rid, r); + break; + default: + break; + } + + return (res); +} + +static int generic_pcie_adjust_resource(device_t dev, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { @@ -375,6 +451,8 @@ static device_method_t generic_pcie_methods[] = { DEVMETHOD(bus_write_ivar, generic_pcie_write_ivar), DEVMETHOD(bus_alloc_resource, pci_host_generic_core_alloc_resource), DEVMETHOD(bus_adjust_resource, generic_pcie_adjust_resource), + DEVMETHOD(bus_activate_resource, generic_pcie_activate_resource), + DEVMETHOD(bus_deactivate_resource, generic_pcie_deactivate_resource), DEVMETHOD(bus_release_resource, pci_host_generic_core_release_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), Modified: stable/12/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 07:09:16 2019 (r352470) +++ stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 07:16:00 2019 (r352471) @@ -63,9 +63,8 @@ __FBSDID("$FreeBSD$"); #include #include "pcib_if.h" +#include "acpi_bus_if.h" -int pci_host_generic_acpi_attach(device_t); - /* Assembling ECAM Configuration Address */ #define PCIE_BUS_SHIFT 20 #define PCIE_SLOT_SHIFT 15 @@ -100,6 +99,9 @@ static int generic_pcie_acpi_probe(device_t dev); static ACPI_STATUS pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *, void *); static int generic_pcie_acpi_read_ivar(device_t, device_t, int, uintptr_t *); +/* + * generic_pcie_acpi_probe - look for root bridge flag + */ static int generic_pcie_acpi_probe(device_t dev) { @@ -119,81 +121,201 @@ generic_pcie_acpi_probe(device_t dev) return (BUS_PROBE_GENERIC); } -int -pci_host_generic_acpi_attach(device_t dev) +/* + * pci_host_generic_acpi_parse_resource - parse PCI memory, IO and bus spaces + * 'produced' by this bridge + */ +static ACPI_STATUS +pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) { + device_t dev = (device_t)arg; struct generic_pcie_acpi_softc *sc; + struct rman *rm; + rman_res_t min, max, off; + int r; + + rm = NULL; + sc = device_get_softc(dev); + r = sc->base.nranges; + switch (res->Type) { + case ACPI_RESOURCE_TYPE_ADDRESS16: + min = res->Data.Address16.Address.Minimum; + max = res->Data.Address16.Address.Maximum; + break; + case ACPI_RESOURCE_TYPE_ADDRESS32: + min = res->Data.Address32.Address.Minimum; + max = res->Data.Address32.Address.Maximum; + off = res->Data.Address32.Address.TranslationOffset; + break; + case ACPI_RESOURCE_TYPE_ADDRESS64: + if (res->Data.Address.ResourceType != ACPI_MEMORY_RANGE) + break; + min = res->Data.Address64.Address.Minimum; + max = res->Data.Address64.Address.Maximum; + off = res->Data.Address64.Address.TranslationOffset; + break; + default: + return (AE_OK); + } + + /* Save detected ranges */ + if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE || + res->Data.Address.ResourceType == ACPI_IO_RANGE) { + sc->base.ranges[r].pci_base = min; + sc->base.ranges[r].phys_base = min + off; + sc->base.ranges[r].size = max - min + 1; + if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) + sc->base.ranges[r].flags |= FLAG_MEM; + else if (res->Data.Address.ResourceType == ACPI_IO_RANGE) + sc->base.ranges[r].flags |= FLAG_IO; + sc->base.nranges++; + } else if (res->Data.Address.ResourceType == ACPI_BUS_NUMBER_RANGE) { + sc->base.bus_start = min; + sc->base.bus_end = max; + } + return (AE_OK); +} + +static int +pci_host_acpi_get_ecam_resource(device_t dev) +{ + struct generic_pcie_acpi_softc *sc; + struct acpi_device *ad; + struct resource_list *rl; + ACPI_TABLE_HEADER *hdr; + ACPI_MCFG_ALLOCATION *mcfg_entry, *mcfg_end; ACPI_HANDLE handle; ACPI_STATUS status; - int error, bus_start; + rman_res_t base, start, end; + int found, val; sc = device_get_softc(dev); + handle = acpi_get_handle(dev); + /* Try MCFG first */ + status = AcpiGetTable(ACPI_SIG_MCFG, 1, &hdr); + if (ACPI_SUCCESS(status)) { + found = FALSE; + mcfg_end = (ACPI_MCFG_ALLOCATION *)((char *)hdr + hdr->Length); + mcfg_entry = (ACPI_MCFG_ALLOCATION *)((ACPI_TABLE_MCFG *)hdr + 1); + while (mcfg_entry < mcfg_end && !found) { + if (mcfg_entry->PciSegment == sc->base.ecam && + mcfg_entry->StartBusNumber <= sc->base.bus_start && + mcfg_entry->EndBusNumber >= sc->base.bus_start) + found = TRUE; + else + mcfg_entry++; + } + if (found) { + if (mcfg_entry->EndBusNumber < sc->base.bus_end) { + device_printf(dev, "bus end mismatch! expected %d found %d.\n", + sc->base.bus_end, (int)mcfg_entry->EndBusNumber); + sc->base.bus_end = mcfg_entry->EndBusNumber; + } + base = mcfg_entry->Address; + } else { + device_printf(dev, "MCFG exists, but does not have bus %d-%d\n", + sc->base.bus_start, sc->base.bus_end); + return (ENXIO); + } + } else { + status = acpi_GetInteger(handle, "_CBA", &val); + if (ACPI_SUCCESS(status)) + base = val; + else + return (ENXIO); + } + + /* add as MEM rid 0 */ + ad = device_get_ivars(dev); + rl = &ad->ad_rl; + start = base + (sc->base.bus_start << PCIE_BUS_SHIFT); + end = base + ((sc->base.bus_end + 1) << PCIE_BUS_SHIFT) - 1; + resource_list_add(rl, SYS_RES_MEMORY, 0, start, end, end - start + 1); + if (bootverbose) + device_printf(dev, "ECAM for bus %d-%d at mem %jx-%jx\n", + sc->base.bus_start, sc->base.bus_end, start, end); + return (0); +} + +static int +pci_host_generic_acpi_attach(device_t dev) +{ + struct generic_pcie_acpi_softc *sc; + ACPI_HANDLE handle; + uint64_t phys_base; + uint64_t pci_base; + uint64_t size; + ACPI_STATUS status; + int error; + int tuple; + + sc = device_get_softc(dev); handle = acpi_get_handle(dev); + + /* Get Start bus number for the PCI host bus is from _BBN method */ + status = acpi_GetInteger(handle, "_BBN", &sc->base.bus_start); + if (ACPI_FAILURE(status)) { + device_printf(dev, "No _BBN, using start bus 0\n"); + sc->base.bus_start = 0; + } + sc->base.bus_end = 255; + + /* Get PCI Segment (domain) needed for MCFG lookup */ + status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam); + if (ACPI_FAILURE(status)) { + device_printf(dev, "No _SEG for PCI Bus, using segment 0\n"); + sc->base.ecam = 0; + } + + /* Bus decode ranges */ + status = AcpiWalkResources(handle, "_CRS", + pci_host_generic_acpi_parse_resource, (void *)dev); + if (ACPI_FAILURE(status)) + return (ENXIO); + + /* Coherency attribute */ if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &sc->base.coherent))) sc->base.coherent = 0; if (bootverbose) device_printf(dev, "Bus is%s cache-coherent\n", sc->base.coherent ? "" : " not"); - if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &bus_start))) { - sc->base.ecam = bus_start >> 7; - sc->base.bus_start = bus_start & 0x7F; - } else { - sc->base.ecam = 0; - sc->base.bus_start = 0; - } - sc->base.bus_end = 0xFF; - + /* add config space resource */ + pci_host_acpi_get_ecam_resource(dev); acpi_pcib_fetch_prt(dev, &sc->ap_prt); error = pci_host_generic_core_attach(dev); if (error != 0) return (error); - status = AcpiWalkResources(handle, "_CRS", - pci_host_generic_acpi_parse_resource, (void *)dev); + for (tuple = 0; tuple < MAX_RANGES_TUPLES; tuple++) { + phys_base = sc->base.ranges[tuple].phys_base; + pci_base = sc->base.ranges[tuple].pci_base; + size = sc->base.ranges[tuple].size; + if (phys_base == 0 || size == 0) + continue; /* empty range element */ + if (sc->base.ranges[tuple].flags & FLAG_MEM) { + error = rman_manage_region(&sc->base.mem_rman, + phys_base, phys_base + size - 1); + } else if (sc->base.ranges[tuple].flags & FLAG_IO) { + error = rman_manage_region(&sc->base.io_rman, + pci_base + PCI_IO_WINDOW_OFFSET, + pci_base + PCI_IO_WINDOW_OFFSET + size - 1); + } else + continue; + if (error) { + device_printf(dev, "rman_manage_region() failed." + "error = %d\n", error); + rman_fini(&sc->base.mem_rman); + return (error); + } + } - if (ACPI_FAILURE(status)) - return (ENXIO); - device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } -static ACPI_STATUS -pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) -{ - device_t dev = (device_t)arg; - struct generic_pcie_acpi_softc *sc; - rman_res_t min, max; - int error; - - switch (res->Type) { - case ACPI_RESOURCE_TYPE_ADDRESS32: - min = (rman_res_t)res->Data.Address32.Address.Minimum; - max = (rman_res_t)res->Data.Address32.Address.Maximum; - break; - case ACPI_RESOURCE_TYPE_ADDRESS64: - min = (rman_res_t)res->Data.Address64.Address.Minimum; - max = (rman_res_t)res->Data.Address64.Address.Maximum; - break; - default: - return (AE_OK); - } - - sc = device_get_softc(dev); - - error = rman_manage_region(&sc->base.mem_rman, min, max); - if (error) { - device_printf(dev, "unable to allocate %lx-%lx range\n", min, max); - return (AE_NOT_FOUND); - } - device_printf(dev, "allocating %lx-%lx range\n", min, max); - - return (AE_OK); -} - static int generic_pcie_acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) @@ -203,7 +325,7 @@ generic_pcie_acpi_read_ivar(device_t dev, device_t chi sc = device_get_softc(dev); if (index == PCIB_IVAR_BUS) { - *result = sc->base.ecam * 0x80 + sc->base.bus_start; + *result = sc->base.bus_start; return (0); } @@ -223,68 +345,10 @@ generic_pcie_acpi_route_interrupt(device_t bus, device struct generic_pcie_acpi_softc *sc; sc = device_get_softc(bus); - return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt)); } -static struct resource * -pci_host_generic_acpi_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct resource *res = NULL; - -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) - struct generic_pcie_acpi_softc *sc; - - if (type == PCI_RES_BUS) { - sc = device_get_softc(dev); - return (pci_domain_alloc_bus(sc->base.ecam, child, rid, start, - end, count, flags)); - } -#endif - - if (type == SYS_RES_MEMORY) - res = pci_host_generic_core_alloc_resource(dev, child, type, - rid, start, end, count, flags); - - if (res == NULL) - res = bus_generic_alloc_resource(dev, child, type, rid, start, end, - count, flags); - - return (res); -} - static int -generic_pcie_acpi_activate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - struct generic_pcie_acpi_softc *sc; - int res; - - sc = device_get_softc(dev); - - if ((res = rman_activate_resource(r)) != 0) - return (res); - - res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, type, rid,r); - return (res); -} - -static int -generic_pcie_acpi_deactivate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - int res; - - if ((res = rman_deactivate_resource(r)) != 0) - return (res); - - res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child, type, - rid, r); - return (res); -} - -static int generic_pcie_acpi_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) { @@ -347,29 +411,22 @@ static int generic_pcie_acpi_get_id(device_t pci, device_t child, enum pci_id_type type, uintptr_t *id) { - struct generic_pcie_acpi_softc *sc; - int err; - /* Use the PCI RID to find the MSI ID */ - if (type == PCI_ID_MSI) { - sc = device_get_softc(pci); - type = PCI_ID_RID; - err = pcib_get_id(pci, child, type, id); - if (err != 0) - return (err); - *id |= sc->base.ecam << 16; - return (0); - } - - return (pcib_get_id(pci, child, type, id)); + /* + * Use the PCI RID to find the MSI ID for now, we support only 1:1 + * mapping + * + * On aarch64, more complex mapping would come from IORT table + */ + if (type == PCI_ID_MSI) + return (pcib_get_id(pci, child, PCI_ID_RID, id)); + else + return (pcib_get_id(pci, child, type, id)); } static device_method_t generic_pcie_acpi_methods[] = { DEVMETHOD(device_probe, generic_pcie_acpi_probe), DEVMETHOD(device_attach, pci_host_generic_acpi_attach), - DEVMETHOD(bus_alloc_resource, pci_host_generic_acpi_alloc_resource), - DEVMETHOD(bus_activate_resource, generic_pcie_acpi_activate_resource), - DEVMETHOD(bus_deactivate_resource, generic_pcie_acpi_deactivate_resource), DEVMETHOD(bus_read_ivar, generic_pcie_acpi_read_ivar), /* pcib interface */ Modified: stable/12/sys/dev/pci/pci_host_generic_fdt.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic_fdt.c Wed Sep 18 07:09:16 2019 (r352470) +++ stable/12/sys/dev/pci/pci_host_generic_fdt.c Wed Sep 18 07:16:00 2019 (r352471) @@ -385,82 +385,6 @@ pci_host_generic_alloc_resource(device_t dev, device_t } static int -generic_pcie_fdt_activate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - struct generic_pcie_fdt_softc *sc; - uint64_t phys_base; - uint64_t pci_base; - uint64_t size; - int found; - int res; - int i; - - sc = device_get_softc(dev); - - if ((res = rman_activate_resource(r)) != 0) - return (res); - - switch(type) { - case SYS_RES_IOPORT: - found = 0; - for (i = 0; i < MAX_RANGES_TUPLES; i++) { - pci_base = sc->base.ranges[i].pci_base; - phys_base = sc->base.ranges[i].phys_base; - size = sc->base.ranges[i].size; - - if ((rid > pci_base) && (rid < (pci_base + size))) { - found = 1; - break; - } - } - if (found) { - rman_set_start(r, rman_get_start(r) + phys_base); - rman_set_end(r, rman_get_end(r) + phys_base); - res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), - child, type, rid, r); - } else { - device_printf(dev, - "Failed to activate IOPORT resource\n"); - res = 0; - } - break; - case SYS_RES_MEMORY: - case SYS_RES_IRQ: - res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, - type, rid, r); - break; - default: - break; - } - - return (res); -} - -static int -generic_pcie_fdt_deactivate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - int res; - - if ((res = rman_deactivate_resource(r)) != 0) - return (res); - - switch(type) { - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - case SYS_RES_IRQ: - res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child, - type, rid, r); - break; - default: - break; - } - - return (res); -} - -static int generic_pcie_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) { @@ -630,8 +554,6 @@ static device_method_t generic_pcie_fdt_methods[] = { DEVMETHOD(device_attach, pci_host_generic_attach), DEVMETHOD(bus_alloc_resource, pci_host_generic_alloc_resource), DEVMETHOD(bus_release_resource, generic_pcie_fdt_release_resource), - DEVMETHOD(bus_activate_resource, generic_pcie_fdt_activate_resource), - DEVMETHOD(bus_deactivate_resource,generic_pcie_fdt_deactivate_resource), /* pcib interface */ DEVMETHOD(pcib_route_interrupt, generic_pcie_fdt_route_interrupt), From owner-svn-src-all@freebsd.org Wed Sep 18 07:21: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 00D0AF47A1; Wed, 18 Sep 2019 07:21:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBGr5tdXz3xLp; Wed, 18 Sep 2019 07:21:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEB5521804; Wed, 18 Sep 2019 07:21:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7L8G9001635; Wed, 18 Sep 2019 07:21:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7L8Ww001634; Wed, 18 Sep 2019 07:21:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180721.x8I7L8Ww001634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:21: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: r352472 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352472 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:21:09 -0000 Author: hselasky Date: Wed Sep 18 07:21:08 2019 New Revision: 352472 URL: https://svnweb.freebsd.org/changeset/base/352472 Log: MFC r352205: Fix broken DECLARE_TASKLET() macro after r347852. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h Wed Sep 18 07:16:00 2019 (r352471) +++ stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h Wed Sep 18 07:21:08 2019 (r352472) @@ -197,8 +197,8 @@ struct tasklet_struct { unsigned long data; }; -#define DECLARE_TASKLET(name, func, data) \ -struct tasklet_struct name = { { NULL, NULL }, func, ATOMIC_INIT(0), data } +#define DECLARE_TASKLET(_name, _func, _data) \ +struct tasklet_struct _name = { .func = (_func), .data = (_data) } #define tasklet_hi_schedule(t) tasklet_schedule(t) From owner-svn-src-all@freebsd.org Wed Sep 18 07:22: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 B5FBFF49E6; Wed, 18 Sep 2019 07:22:38 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YBJZ4RCJz3xgv; Wed, 18 Sep 2019 07:22:38 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B91C21979; Wed, 18 Sep 2019 07:22:38 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7McT7005663; Wed, 18 Sep 2019 07:22:38 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7Mcjn005662; Wed, 18 Sep 2019 07:22:38 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909180722.x8I7Mcjn005662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 07:22: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: r352473 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352473 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:22:38 -0000 Author: jchandra Date: Wed Sep 18 07:22:37 2019 New Revision: 352473 URL: https://svnweb.freebsd.org/changeset/base/352473 Log: MFC r340602: gitv3_its: fixes for multiple GIC ITS blocks First pass of support for multiple GIC ITS blocks with ACPI. Changes are to: * register the correct subset of interrupts with pic_register in case of ACPI. * initialize just the cpu interface for the first ITS, when domain information is not avialable. This has to be done until we split the per-CPU init to do LPI setup just once. * remove duplicate check for the GIC ITS domain, the sc_cpus are setup from domain, so the check again in per-CPU init seems unnecessary. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17841 Modified: stable/12/sys/arm64/arm64/gicv3_its.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/gicv3_its.c ============================================================================== --- stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 07:21:08 2019 (r352472) +++ stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 07:22:37 2019 (r352473) @@ -580,18 +580,11 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) uint64_t xbaser, tmp; uint32_t ctlr; u_int cpuid; - int domain; - if (!CPU_ISSET(PCPU_GET(cpuid), &sc->sc_cpus)) - return (0); - - if (bus_get_domain(dev, &domain) == 0) { - if (PCPU_GET(domain) != domain) - return (0); - } - gicv3 = device_get_parent(dev); cpuid = PCPU_GET(cpuid); + if (!CPU_ISSET(cpuid, &sc->sc_cpus)) + return (0); /* Check if the ITS is enabled on this CPU */ if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) { @@ -729,12 +722,14 @@ gicv3_its_attach(device_t dev) /* Protects access to the ITS command circular buffer. */ mtx_init(&sc->sc_its_cmd_lock, "ITS cmd lock", NULL, MTX_SPIN); + CPU_ZERO(&sc->sc_cpus); if (bus_get_domain(dev, &domain) == 0) { - CPU_ZERO(&sc->sc_cpus); if (domain < MAXMEMDOM) CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); } else { - CPU_COPY(&all_cpus, &sc->sc_cpus); + /* XXX : cannot handle more than one ITS per cpu */ + if (device_get_unit(dev) == 0) + CPU_COPY(&all_cpus, &sc->sc_cpus); } /* Allocate the command circular buffer */ @@ -1737,7 +1732,7 @@ gicv3_its_acpi_attach(device_t dev) sc->sc_pic = intr_pic_register(dev, device_get_unit(dev) + ACPI_MSI_XREF); intr_pic_add_handler(device_get_parent(dev), sc->sc_pic, - gicv3_its_intr, sc, GIC_FIRST_LPI, LPI_NIRQS); + gicv3_its_intr, sc, sc->sc_irq_base, sc->sc_irq_length); /* Register this device to handle MSI interrupts */ intr_msi_register(dev, device_get_unit(dev) + ACPI_MSI_XREF); From owner-svn-src-all@freebsd.org Wed Sep 18 07:24: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 4FCA2F4AD0; Wed, 18 Sep 2019 07:24:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBLp1Mjtz3xtZ; Wed, 18 Sep 2019 07:24:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11E9B2197C; Wed, 18 Sep 2019 07:24:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7OXYB005994; Wed, 18 Sep 2019 07:24:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7OXn1005993; Wed, 18 Sep 2019 07:24:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180724.x8I7OXn1005993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:24:33 +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: r352474 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352474 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:24:34 -0000 Author: hselasky Date: Wed Sep 18 07:24:33 2019 New Revision: 352474 URL: https://svnweb.freebsd.org/changeset/base/352474 Log: MFC r352205: Fix broken DECLARE_TASKLET() macro after r347852. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Wed Sep 18 07:22:37 2019 (r352473) +++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Wed Sep 18 07:24:33 2019 (r352474) @@ -194,8 +194,8 @@ struct tasklet_struct { unsigned long data; }; -#define DECLARE_TASKLET(name, func, data) \ -struct tasklet_struct name = { { NULL, NULL }, func, data } +#define DECLARE_TASKLET(_name, _func, _data) \ +struct tasklet_struct _name = { .func = (_func), .data = (_data) } #define tasklet_hi_schedule(t) tasklet_schedule(t) From owner-svn-src-all@freebsd.org Wed Sep 18 07:25: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 EA316F4B51; Wed, 18 Sep 2019 07:25:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YBMP5tdBz3y1g; Wed, 18 Sep 2019 07:25:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD4872197D; Wed, 18 Sep 2019 07:25:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7P5BY006078; Wed, 18 Sep 2019 07:25:05 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7P5NE006075; Wed, 18 Sep 2019 07:25:05 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909180725.x8I7P5NE006075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 18 Sep 2019 07:25:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352475 - in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 X-SVN-Commit-Revision: 352475 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:25:06 -0000 Author: alc Date: Wed Sep 18 07:25:04 2019 New Revision: 352475 URL: https://svnweb.freebsd.org/changeset/base/352475 Log: MFC r350463 In pmap_advise(), when we encounter a superpage mapping, we first demote the mapping and then destroy one of the 4 KB page mappings so that there is a potential trigger for repromotion. Currently, we destroy the first 4 KB page mapping that falls within the (current) superpage mapping or the virtual address range [sva, eva). However, I have found empirically that destroying the last 4 KB mapping produces slightly better results, specifically, more promotions and fewer failed promotion attempts. Accordingly, this revision changes pmap_advise() to destroy the last 4 KB page mapping. It also replaces some nearby uses of boolean_t with bool. Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/arm64/arm64/pmap.c stable/12/sys/i386/i386/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Wed Sep 18 07:24:33 2019 (r352474) +++ stable/12/sys/amd64/amd64/pmap.c Wed Sep 18 07:25:04 2019 (r352475) @@ -7462,7 +7462,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t pt_entry_t *pte, PG_A, PG_G, PG_M, PG_RW, PG_V; vm_offset_t va, va_next; vm_page_t m; - boolean_t anychanged; + bool anychanged; if (advice != MADV_DONTNEED && advice != MADV_FREE) return; @@ -7481,7 +7481,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t PG_M = pmap_modified_bit(pmap); PG_V = pmap_valid_bit(pmap); PG_RW = pmap_rw_bit(pmap); - anychanged = FALSE; + anychanged = false; pmap_delayed_invl_start(); PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { @@ -7523,17 +7523,25 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t /* * Unless the page mappings are wired, remove the * mapping to a single page so that a subsequent - * access may repromote. Since the underlying page - * table page is fully populated, this removal never - * frees a page table page. + * access may repromote. Choosing the last page + * within the address range [sva, min(va_next, eva)) + * generally results in more repromotions. Since the + * underlying page table page is fully populated, this + * removal never frees a page table page. */ if ((oldpde & PG_W) == 0) { - pte = pmap_pde_to_pte(pde, sva); + va = eva; + if (va > va_next) + va = va_next; + va -= PAGE_SIZE; + KASSERT(va >= sva, + ("pmap_advise: no address gap")); + pte = pmap_pde_to_pte(pde, va); KASSERT((*pte & PG_V) != 0, ("pmap_advise: invalid PTE")); - pmap_remove_pte(pmap, pte, sva, *pde, NULL, + pmap_remove_pte(pmap, pte, va, *pde, NULL, &lock); - anychanged = TRUE; + anychanged = true; } if (lock != NULL) rw_wunlock(lock); @@ -7565,7 +7573,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t if (va == va_next) va = sva; } else - anychanged = TRUE; + anychanged = true; continue; maybe_invlrng: if (va != va_next) { Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 07:24:33 2019 (r352474) +++ stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 07:25:04 2019 (r352475) @@ -4882,15 +4882,23 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t /* * Unless the page mappings are wired, remove the * mapping to a single page so that a subsequent - * access may repromote. Since the underlying page - * table page is fully populated, this removal never - * frees a page table page. + * access may repromote. Choosing the last page + * within the address range [sva, min(va_next, eva)) + * generally results in more repromotions. Since the + * underlying page table page is fully populated, this + * removal never frees a page table page. */ if ((oldl2 & ATTR_SW_WIRED) == 0) { - l3 = pmap_l2_to_l3(l2, sva); + va = eva; + if (va > va_next) + va = va_next; + va -= PAGE_SIZE; + KASSERT(va >= sva, + ("pmap_advise: no address gap")); + l3 = pmap_l2_to_l3(l2, va); KASSERT(pmap_load(l3) != 0, ("pmap_advise: invalid PTE")); - pmap_remove_l3(pmap, l3, sva, pmap_load(l2), + pmap_remove_l3(pmap, l3, va, pmap_load(l2), NULL, &lock); } if (lock != NULL) Modified: stable/12/sys/i386/i386/pmap.c ============================================================================== --- stable/12/sys/i386/i386/pmap.c Wed Sep 18 07:24:33 2019 (r352474) +++ stable/12/sys/i386/i386/pmap.c Wed Sep 18 07:25:04 2019 (r352475) @@ -5246,19 +5246,19 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t pt_entry_t *pte; vm_offset_t va, pdnxt; vm_page_t m; - boolean_t anychanged, pv_lists_locked; + bool anychanged, pv_lists_locked; if (advice != MADV_DONTNEED && advice != MADV_FREE) return; if (pmap_is_current(pmap)) - pv_lists_locked = FALSE; + pv_lists_locked = false; else { - pv_lists_locked = TRUE; + pv_lists_locked = true; resume: rw_wlock(&pvh_global_lock); sched_pin(); } - anychanged = FALSE; + anychanged = false; PMAP_LOCK(pmap); for (; sva < eva; sva = pdnxt) { pdnxt = (sva + NBPDR) & ~PDRMASK; @@ -5272,7 +5272,7 @@ resume: if ((oldpde & PG_MANAGED) == 0) continue; if (!pv_lists_locked) { - pv_lists_locked = TRUE; + pv_lists_locked = true; if (!rw_try_wlock(&pvh_global_lock)) { if (anychanged) pmap_invalidate_all(pmap); @@ -5291,16 +5291,24 @@ resume: /* * Unless the page mappings are wired, remove the * mapping to a single page so that a subsequent - * access may repromote. Since the underlying page - * table page is fully populated, this removal never - * frees a page table page. + * access may repromote. Choosing the last page + * within the address range [sva, min(pdnxt, eva)) + * generally results in more repromotions. Since the + * underlying page table page is fully populated, this + * removal never frees a page table page. */ if ((oldpde & PG_W) == 0) { - pte = pmap_pte_quick(pmap, sva); + va = eva; + if (va > pdnxt) + va = pdnxt; + va -= PAGE_SIZE; + KASSERT(va >= sva, + ("pmap_advise: no address gap")); + pte = pmap_pte_quick(pmap, va); KASSERT((*pte & PG_V) != 0, ("pmap_advise: invalid PTE")); - pmap_remove_pte(pmap, pte, sva, NULL); - anychanged = TRUE; + pmap_remove_pte(pmap, pte, va, NULL); + anychanged = true; } } if (pdnxt > eva) @@ -5329,7 +5337,7 @@ resume: if (va == pdnxt) va = sva; } else - anychanged = TRUE; + anychanged = true; continue; maybe_invlrng: if (va != pdnxt) { From owner-svn-src-all@freebsd.org Wed Sep 18 07:25: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 A87A0F4C8B; Wed, 18 Sep 2019 07:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBNP3sgyz3yDB; Wed, 18 Sep 2019 07:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67EFF21984; Wed, 18 Sep 2019 07:25:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7Pvcs006179; Wed, 18 Sep 2019 07:25:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7PvA1006178; Wed, 18 Sep 2019 07:25:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180725.x8I7PvA1006178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352476 - stable/11/sys/compat/linuxkpi/common/src X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 352476 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:25:57 -0000 Author: hselasky Date: Wed Sep 18 07:25:56 2019 New Revision: 352476 URL: https://svnweb.freebsd.org/changeset/base/352476 Log: MFC r352206: Fix synchronous work drain issue in the LinuxKPI. A work callback may restart itself. Loop in the drain function to see if the work has been rescheduled and stop the subsequent reschedules, if any. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:25:04 2019 (r352475) +++ stable/11/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:25:56 2019 (r352476) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Hans Petter Selasky + * Copyright (c) 2017-2019 Hans Petter Selasky * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -323,24 +323,26 @@ linux_cancel_work_sync(struct work_struct *work) [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; + bool retval = false; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_cancel_work_sync() might sleep"); - +retry: switch (linux_update_state(&work->state, states)) { case WORK_ST_IDLE: case WORK_ST_TIMER: - return (0); + return (retval); case WORK_ST_EXEC: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) taskqueue_drain(tq, &work->work_task); - return (0); + goto retry; /* work may have restarted itself */ default: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) taskqueue_drain(tq, &work->work_task); - return (1); + retval = true; + goto retry; } } @@ -421,18 +423,19 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; + bool retval = false; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_cancel_delayed_work_sync() might sleep"); - +retry: switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_IDLE: - return (0); + return (retval); case WORK_ST_EXEC: tq = dwork->work.work_queue->taskqueue; if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) taskqueue_drain(tq, &dwork->work.work_task); - return (0); + goto retry; /* work may have restarted itself */ case WORK_ST_TIMER: case WORK_ST_CANCEL: if (linux_cancel_timer(dwork, 1)) { @@ -442,14 +445,16 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw */ tq = dwork->work.work_queue->taskqueue; taskqueue_drain(tq, &dwork->work.work_task); - return (1); + retval = true; + goto retry; } /* FALLTHROUGH */ default: tq = dwork->work.work_queue->taskqueue; if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) taskqueue_drain(tq, &dwork->work.work_task); - return (1); + retval = true; + goto retry; } } From owner-svn-src-all@freebsd.org Wed Sep 18 07: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 6DE50F4D4B; Wed, 18 Sep 2019 07:26:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBPJ2Fkbz3yLs; Wed, 18 Sep 2019 07:26:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31D3921985; Wed, 18 Sep 2019 07:26:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7QiGg006275; Wed, 18 Sep 2019 07:26:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7Qirk006274; Wed, 18 Sep 2019 07:26:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180726.x8I7Qirk006274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352477 - stable/12/sys/compat/linuxkpi/common/src X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 352477 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:26:44 -0000 Author: hselasky Date: Wed Sep 18 07:26:43 2019 New Revision: 352477 URL: https://svnweb.freebsd.org/changeset/base/352477 Log: MFC r352206: Fix synchronous work drain issue in the LinuxKPI. A work callback may restart itself. Loop in the drain function to see if the work has been rescheduled and stop the subsequent reschedules, if any. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/src/linux_work.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:25:56 2019 (r352476) +++ stable/12/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:26:43 2019 (r352477) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Hans Petter Selasky + * Copyright (c) 2017-2019 Hans Petter Selasky * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -323,24 +323,26 @@ linux_cancel_work_sync(struct work_struct *work) [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; + bool retval = false; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_cancel_work_sync() might sleep"); - +retry: switch (linux_update_state(&work->state, states)) { case WORK_ST_IDLE: case WORK_ST_TIMER: - return (0); + return (retval); case WORK_ST_EXEC: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) taskqueue_drain(tq, &work->work_task); - return (0); + goto retry; /* work may have restarted itself */ default: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) taskqueue_drain(tq, &work->work_task); - return (1); + retval = true; + goto retry; } } @@ -421,18 +423,19 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; + bool retval = false; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_cancel_delayed_work_sync() might sleep"); - +retry: switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_IDLE: - return (0); + return (retval); case WORK_ST_EXEC: tq = dwork->work.work_queue->taskqueue; if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) taskqueue_drain(tq, &dwork->work.work_task); - return (0); + goto retry; /* work may have restarted itself */ case WORK_ST_TIMER: case WORK_ST_CANCEL: if (linux_cancel_timer(dwork, 1)) { @@ -442,14 +445,16 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw */ tq = dwork->work.work_queue->taskqueue; taskqueue_drain(tq, &dwork->work.work_task); - return (1); + retval = true; + goto retry; } /* FALLTHROUGH */ default: tq = dwork->work.work_queue->taskqueue; if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) taskqueue_drain(tq, &dwork->work.work_task); - return (1); + retval = true; + goto retry; } } From owner-svn-src-all@freebsd.org Wed Sep 18 07:28: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 2C0E4F4E0E; Wed, 18 Sep 2019 07:28:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBRq0LFfz3yTR; Wed, 18 Sep 2019 07:28:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4A4D21986; Wed, 18 Sep 2019 07:28:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7SsoT006446; Wed, 18 Sep 2019 07:28:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7SsJS006445; Wed, 18 Sep 2019 07:28:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180728.x8I7SsJS006445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352478 - stable/12/sys/compat/linuxkpi/common/src X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 352478 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:28:55 -0000 Author: hselasky Date: Wed Sep 18 07:28:54 2019 New Revision: 352478 URL: https://svnweb.freebsd.org/changeset/base/352478 Log: MFC r352207: Use true and false when dealing with bool type in the LinuxKPI. No functional change. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/src/linux_work.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:26:43 2019 (r352477) +++ stable/12/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:28:54 2019 (r352478) @@ -92,7 +92,7 @@ linux_work_exec_unblock(struct work_struct *work) { struct workqueue_struct *wq; struct work_exec *exec; - bool retval = 0; + bool retval = false; wq = work->work_queue; if (unlikely(wq == NULL)) @@ -102,7 +102,7 @@ linux_work_exec_unblock(struct work_struct *work) TAILQ_FOREACH(exec, &wq->exec_head, entry) { if (exec->target == work) { exec->target = NULL; - retval = 1; + retval = true; break; } } @@ -144,14 +144,14 @@ linux_queue_work_on(int cpu __unused, struct workqueue case WORK_ST_EXEC: case WORK_ST_CANCEL: if (linux_work_exec_unblock(work) != 0) - return (1); + return (true); /* FALLTHROUGH */ case WORK_ST_IDLE: work->work_queue = wq; taskqueue_enqueue(wq->taskqueue, &work->work_task); - return (1); + return (true); default: - return (0); /* already on a queue */ + return (false); /* already on a queue */ } } @@ -181,7 +181,7 @@ linux_queue_delayed_work_on(int cpu, struct workqueue_ case WORK_ST_CANCEL: if (delay == 0 && linux_work_exec_unblock(&dwork->work) != 0) { dwork->timer.expires = jiffies; - return (1); + return (true); } /* FALLTHROUGH */ case WORK_ST_IDLE: @@ -201,9 +201,9 @@ linux_queue_delayed_work_on(int cpu, struct workqueue_ &linux_delayed_work_timer_fn, dwork); mtx_unlock(&dwork->timer.mtx); } - return (1); + return (true); default: - return (0); /* already on a queue */ + return (false); /* already on a queue */ } } @@ -391,7 +391,7 @@ linux_cancel_delayed_work(struct delayed_work *dwork) if (linux_cancel_timer(dwork, 0)) { atomic_cmpxchg(&dwork->work.state, WORK_ST_CANCEL, WORK_ST_IDLE); - return (1); + return (true); } /* FALLTHROUGH */ case WORK_ST_TASK: @@ -399,11 +399,11 @@ linux_cancel_delayed_work(struct delayed_work *dwork) if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) { atomic_cmpxchg(&dwork->work.state, WORK_ST_CANCEL, WORK_ST_IDLE); - return (1); + return (true); } /* FALLTHROUGH */ default: - return (0); + return (false); } } @@ -467,14 +467,14 @@ bool linux_flush_work(struct work_struct *work) { struct taskqueue *tq; - int retval; + bool retval; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_flush_work() might sleep"); switch (atomic_read(&work->state)) { case WORK_ST_IDLE: - return (0); + return (false); default: tq = work->work_queue->taskqueue; retval = taskqueue_poll_is_busy(tq, &work->work_task); @@ -492,14 +492,14 @@ bool linux_flush_delayed_work(struct delayed_work *dwork) { struct taskqueue *tq; - int retval; + bool retval; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_flush_delayed_work() might sleep"); switch (atomic_read(&dwork->work.state)) { case WORK_ST_IDLE: - return (0); + return (false); case WORK_ST_TIMER: if (linux_cancel_timer(dwork, 1)) linux_delayed_work_enqueue(dwork); @@ -523,9 +523,9 @@ linux_work_pending(struct work_struct *work) case WORK_ST_TIMER: case WORK_ST_TASK: case WORK_ST_CANCEL: - return (1); + return (true); default: - return (0); + return (false); } } @@ -539,12 +539,12 @@ linux_work_busy(struct work_struct *work) switch (atomic_read(&work->state)) { case WORK_ST_IDLE: - return (0); + return (false); case WORK_ST_EXEC: tq = work->work_queue->taskqueue; return (taskqueue_poll_is_busy(tq, &work->work_task)); default: - return (1); + return (true); } } From owner-svn-src-all@freebsd.org Wed Sep 18 07:29: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 805ADF4E8D; Wed, 18 Sep 2019 07:29:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBSZ2pFSz3ybc; Wed, 18 Sep 2019 07:29:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A9E121987; Wed, 18 Sep 2019 07:29:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7TYEY006545; Wed, 18 Sep 2019 07:29:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7TY1E006544; Wed, 18 Sep 2019 07:29:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180729.x8I7TY1E006544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:29: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: r352479 - stable/11/sys/compat/linuxkpi/common/src X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 352479 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:29:34 -0000 Author: hselasky Date: Wed Sep 18 07:29:33 2019 New Revision: 352479 URL: https://svnweb.freebsd.org/changeset/base/352479 Log: MFC r352207: Use true and false when dealing with bool type in the LinuxKPI. No functional change. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:28:54 2019 (r352478) +++ stable/11/sys/compat/linuxkpi/common/src/linux_work.c Wed Sep 18 07:29:33 2019 (r352479) @@ -92,7 +92,7 @@ linux_work_exec_unblock(struct work_struct *work) { struct workqueue_struct *wq; struct work_exec *exec; - bool retval = 0; + bool retval = false; wq = work->work_queue; if (unlikely(wq == NULL)) @@ -102,7 +102,7 @@ linux_work_exec_unblock(struct work_struct *work) TAILQ_FOREACH(exec, &wq->exec_head, entry) { if (exec->target == work) { exec->target = NULL; - retval = 1; + retval = true; break; } } @@ -144,14 +144,14 @@ linux_queue_work_on(int cpu __unused, struct workqueue case WORK_ST_EXEC: case WORK_ST_CANCEL: if (linux_work_exec_unblock(work) != 0) - return (1); + return (true); /* FALLTHROUGH */ case WORK_ST_IDLE: work->work_queue = wq; taskqueue_enqueue(wq->taskqueue, &work->work_task); - return (1); + return (true); default: - return (0); /* already on a queue */ + return (false); /* already on a queue */ } } @@ -181,7 +181,7 @@ linux_queue_delayed_work_on(int cpu, struct workqueue_ case WORK_ST_CANCEL: if (delay == 0 && linux_work_exec_unblock(&dwork->work) != 0) { dwork->timer.expires = jiffies; - return (1); + return (true); } /* FALLTHROUGH */ case WORK_ST_IDLE: @@ -201,9 +201,9 @@ linux_queue_delayed_work_on(int cpu, struct workqueue_ &linux_delayed_work_timer_fn, dwork); mtx_unlock(&dwork->timer.mtx); } - return (1); + return (true); default: - return (0); /* already on a queue */ + return (false); /* already on a queue */ } } @@ -391,7 +391,7 @@ linux_cancel_delayed_work(struct delayed_work *dwork) if (linux_cancel_timer(dwork, 0)) { atomic_cmpxchg(&dwork->work.state, WORK_ST_CANCEL, WORK_ST_IDLE); - return (1); + return (true); } /* FALLTHROUGH */ case WORK_ST_TASK: @@ -399,11 +399,11 @@ linux_cancel_delayed_work(struct delayed_work *dwork) if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) { atomic_cmpxchg(&dwork->work.state, WORK_ST_CANCEL, WORK_ST_IDLE); - return (1); + return (true); } /* FALLTHROUGH */ default: - return (0); + return (false); } } @@ -467,14 +467,14 @@ bool linux_flush_work(struct work_struct *work) { struct taskqueue *tq; - int retval; + bool retval; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_flush_work() might sleep"); switch (atomic_read(&work->state)) { case WORK_ST_IDLE: - return (0); + return (false); default: tq = work->work_queue->taskqueue; retval = taskqueue_poll_is_busy(tq, &work->work_task); @@ -492,14 +492,14 @@ bool linux_flush_delayed_work(struct delayed_work *dwork) { struct taskqueue *tq; - int retval; + bool retval; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "linux_flush_delayed_work() might sleep"); switch (atomic_read(&dwork->work.state)) { case WORK_ST_IDLE: - return (0); + return (false); case WORK_ST_TIMER: if (linux_cancel_timer(dwork, 1)) linux_delayed_work_enqueue(dwork); @@ -523,9 +523,9 @@ linux_work_pending(struct work_struct *work) case WORK_ST_TIMER: case WORK_ST_TASK: case WORK_ST_CANCEL: - return (1); + return (true); default: - return (0); + return (false); } } @@ -539,12 +539,12 @@ linux_work_busy(struct work_struct *work) switch (atomic_read(&work->state)) { case WORK_ST_IDLE: - return (0); + return (false); case WORK_ST_EXEC: tq = work->work_queue->taskqueue; return (taskqueue_poll_is_busy(tq, &work->work_task)); default: - return (1); + return (true); } } From owner-svn-src-all@freebsd.org Wed Sep 18 07:31: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 38287F4F36; Wed, 18 Sep 2019 07:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YBVr0mkLz3ynH; Wed, 18 Sep 2019 07:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1FCA219E0; Wed, 18 Sep 2019 07:31:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7VVV5009973; Wed, 18 Sep 2019 07:31:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7VVTT009972; Wed, 18 Sep 2019 07:31:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180731.x8I7VVTT009972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:31: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: r352480 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 352480 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:31:32 -0000 Author: hselasky Date: Wed Sep 18 07:31:31 2019 New Revision: 352480 URL: https://svnweb.freebsd.org/changeset/base/352480 Log: MFC r352137: Callout drain does not have to be followed by a callout stop call. Fix bogus code. Sponsored by: Mellanox Technologies Modified: stable/12/sys/net/if_spppsubr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_spppsubr.c ============================================================================== --- stable/12/sys/net/if_spppsubr.c Wed Sep 18 07:29:33 2019 (r352479) +++ stable/12/sys/net/if_spppsubr.c Wed Sep 18 07:31:31 2019 (r352480) @@ -1060,15 +1060,13 @@ sppp_detach(struct ifnet *ifp) KASSERT(mtx_initialized(&sp->mtx), ("sppp mutex is not initialized")); /* Stop keepalive handler. */ - if (!callout_drain(&sp->keepalive_callout)) - callout_stop(&sp->keepalive_callout); + callout_drain(&sp->keepalive_callout); for (i = 0; i < IDX_COUNT; i++) { - if (!callout_drain(&sp->ch[i])) - callout_stop(&sp->ch[i]); + callout_drain(&sp->ch[i]); } - if (!callout_drain(&sp->pap_my_to_ch)) - callout_stop(&sp->pap_my_to_ch); + callout_drain(&sp->pap_my_to_ch); + mtx_destroy(&sp->pp_cpq.ifq_mtx); mtx_destroy(&sp->pp_fastq.ifq_mtx); mtx_destroy(&sp->mtx); From owner-svn-src-all@freebsd.org Wed Sep 18 07:32: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 E9541F5139; Wed, 18 Sep 2019 07:32:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YBWg5yPkz3yyT; Wed, 18 Sep 2019 07:32:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE4621B3A; Wed, 18 Sep 2019 07:32:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7WFtt011630; Wed, 18 Sep 2019 07:32:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7WFm6011629; Wed, 18 Sep 2019 07:32:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909180732.x8I7WFm6011629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 18 Sep 2019 07:32: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: r352481 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 352481 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:32:16 -0000 Author: hselasky Date: Wed Sep 18 07:32:15 2019 New Revision: 352481 URL: https://svnweb.freebsd.org/changeset/base/352481 Log: MFC r352137: Callout drain does not have to be followed by a callout stop call. Fix bogus code. Sponsored by: Mellanox Technologies Modified: stable/11/sys/net/if_spppsubr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_spppsubr.c ============================================================================== --- stable/11/sys/net/if_spppsubr.c Wed Sep 18 07:31:31 2019 (r352480) +++ stable/11/sys/net/if_spppsubr.c Wed Sep 18 07:32:15 2019 (r352481) @@ -1060,15 +1060,13 @@ sppp_detach(struct ifnet *ifp) KASSERT(mtx_initialized(&sp->mtx), ("sppp mutex is not initialized")); /* Stop keepalive handler. */ - if (!callout_drain(&sp->keepalive_callout)) - callout_stop(&sp->keepalive_callout); + callout_drain(&sp->keepalive_callout); for (i = 0; i < IDX_COUNT; i++) { - if (!callout_drain(&sp->ch[i])) - callout_stop(&sp->ch[i]); + callout_drain(&sp->ch[i]); } - if (!callout_drain(&sp->pap_my_to_ch)) - callout_stop(&sp->pap_my_to_ch); + callout_drain(&sp->pap_my_to_ch); + mtx_destroy(&sp->pp_cpq.ifq_mtx); mtx_destroy(&sp->pp_fastq.ifq_mtx); mtx_destroy(&sp->mtx); From owner-svn-src-all@freebsd.org Wed Sep 18 07: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 965EAF5C83; Wed, 18 Sep 2019 07:57:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YC5K3W4Yz41gh; Wed, 18 Sep 2019 07:57:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BC1721EE4; Wed, 18 Sep 2019 07:57:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I7vvoJ024623; Wed, 18 Sep 2019 07:57:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I7vuYW024620; Wed, 18 Sep 2019 07:57:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909180757.x8I7vuYW024620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 18 Sep 2019 07:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352482 - in head: . lib lib/libarchive X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head: . lib lib/libarchive X-SVN-Commit-Revision: 352482 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 07:57:57 -0000 Author: bapt Date: Wed Sep 18 07:57:56 2019 New Revision: 352482 URL: https://svnweb.freebsd.org/changeset/base/352482 Log: Add native support for zstd to libarchive Note that old pkg will failed to build after this. A recent ports tree (one providing pkg 1.12+) is required to build. Older already built pkg, should continue working as expected PR: 238797 Exp run by: antoine Reviewed by: cem Approved by: cem Differential Revision: https://reviews.freebsd.org/D20752 Modified: head/Makefile.inc1 head/lib/Makefile head/lib/libarchive/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Sep 18 07:32:15 2019 (r352481) +++ head/Makefile.inc1 Wed Sep 18 07:57:56 2019 (r352482) @@ -2770,6 +2770,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libfigpar \ ${_lib_libgssapi} \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ + lib/libzstd \ ${_lib_casper} \ lib/ncurses/ncurses lib/ncurses/ncursesw \ lib/libopie lib/libpam/libpam ${_lib_libthr} \ Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Sep 18 07:32:15 2019 (r352481) +++ head/lib/Makefile Wed Sep 18 07:57:56 2019 (r352482) @@ -102,7 +102,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ # libraries, those libraries should be listed as build order dependencies here. SUBDIR_DEPEND_geom= libufs -SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd +SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd libzstd SUBDIR_DEPEND_libauditdm= libbsm SUBDIR_DEPEND_libbsnmp= ${_libnetgraph} SUBDIR_DEPEND_libc++:= libcxxrt Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Wed Sep 18 07:32:15 2019 (r352481) +++ head/lib/libarchive/Makefile Wed Sep 18 07:57:56 2019 (r352482) @@ -6,8 +6,8 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive LIB= archive -LIBADD= z bz2 lzma bsdxml -CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 +LIBADD= z bz2 lzma bsdxml zstd +CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 -DHAVE_ZSTD_H=1 -DHAVE_LIBZSTD=1 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. # It has no real relation to the libarchive version number. @@ -15,6 +15,7 @@ SHLIB_MAJOR= 7 CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" CFLAGS+= -I${.OBJDIR} +CFLAGS+= -I${SRCTOP}/sys/contrib/zstd/lib .if ${MK_OPENSSL} != "no" CFLAGS+= -DWITH_OPENSSL From owner-svn-src-all@freebsd.org Wed Sep 18 08:02: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 338D3F69D4; Wed, 18 Sep 2019 08:02:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YCB40fWKz428X; Wed, 18 Sep 2019 08:02:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEB2E22077; Wed, 18 Sep 2019 08:02:03 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8I823tW026566; Wed, 18 Sep 2019 08:02:03 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8I823Iu026565; Wed, 18 Sep 2019 08:02:03 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909180802.x8I823Iu026565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 18 Sep 2019 08:02:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352483 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 352483 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 08:02:04 -0000 Author: bapt Date: Wed Sep 18 08:02:03 2019 New Revision: 352483 URL: https://svnweb.freebsd.org/changeset/base/352483 Log: Add the missing bits for LIBADD to properly function now that libarchive is linked to libzstd Pointy hat: bapt Reported by: antoine Modified: head/share/mk/src.libnames.mk Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Wed Sep 18 07:57:56 2019 (r352482) +++ head/share/mk/src.libnames.mk Wed Sep 18 08:02:03 2019 (r352483) @@ -230,7 +230,7 @@ LIBVERIEXEC?= ${LIBVERIEXECDIR}/libveriexec${PIE_SUFFI # Each library's LIBADD needs to be duplicated here for static linkage of # 2nd+ order consumers. Auto-generating this would be better. _DP_80211= sbuf bsdxml -_DP_archive= z bz2 lzma bsdxml +_DP_archive= z bz2 lzma bsdxml zstd _DP_zstd= pthread .if ${MK_BLACKLIST} != "no" _DP_blacklist+= pthread From owner-svn-src-all@freebsd.org Wed Sep 18 08:37: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 14A45F7777 for ; Wed, 18 Sep 2019 08:37:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 46YCyy1t3Mz43j7 for ; Wed, 18 Sep 2019 08:37:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id y144so7157220qkb.7 for ; Wed, 18 Sep 2019 01:37:30 -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=6FYq9RJi/7MgmXDJn8UxswwKOI0zTBhKb78CwHGTUck=; b=o9xUD/YZRQjI/fopRmb3s4TJT7p30L8xmRYd+sc3T2O5qEskKZoWvmL+YtDWfeEQMx Wzgu6c686/OZ0SnI9r8ve/YTPpUOXiQMHFnHoPLomPvcEURf30ceNhzHzpDwHhNuhy7L Jt/AyksfL4FJteqjxx5m+wODB/k6GMhNtUyyXirK62LEgl3+kZDBS6vcM4+ghMcaIwcI DpxNY2khaylU5ESY4wJsYn3u/6VbFHSdNCqcuzk58Kq7JsAv2PDpolnYZRMQhyQUfey0 J0fDSrFzRIjmVnfRPB01ZirW6/+bR0fh4Ud7Kvzpj2YMYB8b4RuEho3RhSP6qnMdmwEr 5Uow== 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=6FYq9RJi/7MgmXDJn8UxswwKOI0zTBhKb78CwHGTUck=; b=cBXxfEqVApMTzvbBhhLg0wQ4crPyiYI5LWmV+/16crnse74JluQwNXWM0T0XkFkVh8 1eM8kFgyYX31i06OCK7vshhWSxkJW5cLZjssvlWV5CgVGSidttUhG0EAyFfBUaPl/KF+ R8GZNe8XLJKazo/H5jepCCx/z6wAC3ICfFjVJ6CFGXFbsCX27aL2IF9OTYrqBBQY+js3 5unxOoW2ISeE94W2xkM0HKukQ+z/4usrvMuk2ZZk/OZZyzeCNZiaMEDz3XBj+vYdIJfq smKaTGn0wqzruPMZlLxpVSU9u/WlXm48Qcl//oUua0jvTqu/bbS3YMMGJOfJZQfdPjYA qEkg== X-Gm-Message-State: APjAAAVcSiCRWcMbpdiacUrN8ZCrb7hYgmSEbolEIBf5y1NlvA7yWhbf QkHeTEuOct1OC/lHpuirOcb93/A38vwIEoakJP7oXA== X-Google-Smtp-Source: APXvYqwYSHKVKaryplEKnx3iTb6hPz102prEOk5j7hRIhLlPuO2pMYjCParu9FijQcXpvak6B4Sei4/5O2tufS/XAZ0= X-Received: by 2002:a37:30f:: with SMTP id 15mr2537199qkd.240.1568795849315; Wed, 18 Sep 2019 01:37:29 -0700 (PDT) MIME-Version: 1.0 References: <201909171616.x8HGGlkb066218@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Wed, 18 Sep 2019 09:37:17 +0100 Message-ID: Subject: Re: svn commit: r352451 - head/stand/libsa To: "Conrad E. Meyer" Cc: Toomas Soome , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46YCyy1t3Mz43j7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=o9xUD/YZ; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.85 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,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:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.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]; 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.85)[ip: (-9.29), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), 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: Wed, 18 Sep 2019 08:37:31 -0000 On Wed, Sep 18, 2019, 12:18 AM Conrad Meyer wrote: > Well, hang on; it's also perfectly legal for a malloc implementation > to return NULL for requests of zero bytes. You can access exactly the > number of bytes requested in the allocation; and free(NULL) works as > expected. NULL (0) is also aligned to any size you could want. > Legal, yes. But it is different than all the other FreeBSD environments, so the loader becomes the odd man out. This restores the consistency. Warner Best, > Conrad > > On Tue, Sep 17, 2019 at 9:16 AM Toomas Soome wrote: > > > > Author: tsoome > > Date: Tue Sep 17 16:16:46 2019 > > New Revision: 352451 > > URL: https://svnweb.freebsd.org/changeset/base/352451 > > > > Log: > > loader: revert r352421 > > > > As insisted by kib, malloc(0) is quite legal. > > > > Modified: > > head/stand/libsa/zalloc_malloc.c > > > > Modified: head/stand/libsa/zalloc_malloc.c > > > ============================================================================== > > --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 > (r352450) > > +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 > (r352451) > > @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment) > > { > > Guard *res; > > > > - if (bytes == 0) > > - return (NULL); > > - > > #ifdef USEENDGUARD > > bytes += MALLOCALIGN + 1; > > #else > From owner-svn-src-all@freebsd.org Wed Sep 18 08:44: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 E637DF79C7; Wed, 18 Sep 2019 08:44:12 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46YD6g3n0lz446f; Wed, 18 Sep 2019 08:44:11 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E54B7260408; Wed, 18 Sep 2019 10:44:02 +0200 (CEST) Subject: Re: svn commit: r352451 - head/stand/libsa To: Warner Losh , "Conrad E. Meyer" Cc: Toomas Soome , src-committers , svn-src-all , svn-src-head References: <201909171616.x8HGGlkb066218@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <347a71f4-bbad-0d39-9e75-0564d06d7a1e@selasky.org> Date: Wed, 18 Sep 2019 10:43:16 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46YD6g3n0lz446f X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-5.48 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; IP_SCORE(-3.18)[ip: (-9.36), ipnet: 88.99.0.0/16(-4.75), asn: 24940(-1.78), 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:88.99.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(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, 18 Sep 2019 08:44:13 -0000 On 2019-09-18 10:37, Warner Losh wrote: > On Wed, Sep 18, 2019, 12:18 AM Conrad Meyer wrote: > >> Well, hang on; it's also perfectly legal for a malloc implementation >> to return NULL for requests of zero bytes. You can access exactly the >> number of bytes requested in the allocation; and free(NULL) works as >> expected. NULL (0) is also aligned to any size you could want. >> > > Legal, yes. But it is different than all the other FreeBSD environments, > so the loader becomes the odd man out. This restores the consistency. > Hi, The problem is the code that use malloc() that take NULL as a failure, even if the size is zero :-) array = malloc(n * sizeof(q)); if (array == NULL) goto failure; --HPS From owner-svn-src-all@freebsd.org Wed Sep 18 11:59: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 B1742FB375 for ; Wed, 18 Sep 2019 11:59:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 46YJRW5sPCz4DW5 for ; Wed, 18 Sep 2019 11:59:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x831.google.com with SMTP id c3so8454451qtv.10 for ; Wed, 18 Sep 2019 04:59:03 -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=XL9ELMHmimsD/QqzRRaugiKqyv4hryLcwg9DlRwDPbA=; b=1y4GU9sKFcWxiSEyRLy+p6zftzcOYHIUHdN0dHW69qCNLtcm/iH5/PPQjSFLXacj3w yOr2IT2jexhEcuAHyZOrotja2Anyma+QPgFUuSicbkedNBpzkLFkKXX7Tj/goPAZ7QQJ UaxfOTmuRkx3zJTRXPs7p2S7cuRwUbdsx0fofI/M/8QkEEKQN8/mkh0078VojHdM8g9b VEho30/UGBB/83zerkuUaTj2W8v9OkNE9SDrisE2fR5XHQ0EaD+0gCLtiCtfAG6bJObU J/LmSDYvSm2qn8DBezLS4zUDOByciuHG6xBNze81ceRfGHkqg7pYjkas8qMyU3Afrx8p AWpQ== 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=XL9ELMHmimsD/QqzRRaugiKqyv4hryLcwg9DlRwDPbA=; b=ayNOubXLEsMEp0q+n5I+fWHR625FaFxDVm9wf9q1vri4OgBgWdYL/PyARI3Rn1Ip1M 5Vg/THxjxeqar+b2WW7LuOU7f3AOsZ1QQv9TETlscXpWyafd5JaTleHd7+BYYCxKG5kZ QxUcB5aD+cuKwaJbknBRqMhANl+kccZkOa6KmMolhfmPYVwCw8RsyRpAJdqqHpJxahdy uPv0yGZbvOHLoJkbnz9AXpiLWbexoCZTxtcBUU19f3fPXyWvFixpT1hiY2Jl8dWZeXls RmdFhwVGQt4n0oLVeCsakIHonpkXlc0i1+JPbwTt7w+om1b1H8vPJwecxzZlSmiNLL9G sE7A== X-Gm-Message-State: APjAAAUiQhL1WWuRCNV8yP+kcEjORnHpyh/Ypaq20y3v3LNjgWpmMBia TlS2NlqijWbS8F+JlKh+Prarw4QOC0xikZnGjSPRFQ== X-Google-Smtp-Source: APXvYqzH5tnewJr2ckSfKkBGjxxZrRHF4lQzTDu867ShZE11DyL/+PVBFZHCoKWViSUVQT+kOeI98uRHquAo1DdH+48= X-Received: by 2002:ac8:44c9:: with SMTP id b9mr3620893qto.175.1568807942530; Wed, 18 Sep 2019 04:59:02 -0700 (PDT) MIME-Version: 1.0 References: <201909171616.x8HGGlkb066218@repo.freebsd.org> <347a71f4-bbad-0d39-9e75-0564d06d7a1e@selasky.org> In-Reply-To: <347a71f4-bbad-0d39-9e75-0564d06d7a1e@selasky.org> From: Warner Losh Date: Wed, 18 Sep 2019 12:58:33 +0100 Message-ID: Subject: Re: svn commit: r352451 - head/stand/libsa To: Hans Petter Selasky Cc: "Conrad E. Meyer" , Toomas Soome , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46YJRW5sPCz4DW5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=1y4GU9sK; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::831) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.86 / 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]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; 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.86)[ip: (-9.33), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), 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: Wed, 18 Sep 2019 11:59:04 -0000 On Wed, Sep 18, 2019, 9:44 AM Hans Petter Selasky wrote: > On 2019-09-18 10:37, Warner Losh wrote: > > On Wed, Sep 18, 2019, 12:18 AM Conrad Meyer wrote: > > > >> Well, hang on; it's also perfectly legal for a malloc implementation > >> to return NULL for requests of zero bytes. You can access exactly the > >> number of bytes requested in the allocation; and free(NULL) works as > >> expected. NULL (0) is also aligned to any size you could want. > >> > > > > Legal, yes. But it is different than all the other FreeBSD environments, > > so the loader becomes the odd man out. This restores the consistency. > > > > Hi, > > The problem is the code that use malloc() that take NULL as a failure, > even if the size is zero :-) > > array = malloc(n * sizeof(q)); > if (array == NULL) > goto failure; > Such code isn't portable... Warner --HPS > > From owner-svn-src-all@freebsd.org Wed Sep 18 12:34: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 6D4BCFC706; Wed, 18 Sep 2019 12:34:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 46YKDR2FKbz4GHV; Wed, 18 Sep 2019 12:34:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pl1-x62f.google.com with SMTP id 4so3089131pld.10; Wed, 18 Sep 2019 05:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=aD9pixccf+aGWsrIGJSgW81goM9b0U0pX7AmH96tl0w=; b=WY1jgBN9bGrhZFzy0rcdUF+L5yQuq11vMkoiiZnz1o/xBwUH7PKBsoHMvDusBtNi3I RLw7+lEctALDs+ZYMMm9oxk09/LEnaF22kr7/BlVYehL//KpA9nvOAiLF12MFfvwS6yd D9cgUWtnYvR1vu15n1deVGzxA8vlRuSeL6iX75ZFML73WuvQ7VnBrBBN8chwKhiSNI2a w2QnFWsj8TCYhZsI0iEXLHJGUXtopEBbBJG0yOIhVRZ7Jq7JjIcecA0lbuy7m9hcKnxK 5SghyjhPNuG7ZTl0Qzh+pSg4wJA0yIv/Cm24zwwSxDDwtagelVu2zMqyZocGnY1dKpeZ KOlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=aD9pixccf+aGWsrIGJSgW81goM9b0U0pX7AmH96tl0w=; b=L9OL8xTb1eBy212p0B2Xa+4K0SrraxBsBJDC0gf3lwk0ALjmrhrJvdOZ0gu9ShzzE4 rZr9/jkkPtTCbpPJ2QyNTVaGAWzwhZg+o1kHfcz8z2LtFrPL82Nf20LiIwpBnqJmb2cZ dChoo/Y+bqhp/ISfAFxaRbGPR9x1IK27AD23vaICIYVN7Ym1yCwBS8nrgNSNAqwKKNJJ zwlV/tAY1Ak0bhPDw5482EUubc16pwc1x1TvBwcQ1Kn5wYjbonAs0RC3QkfzdgIx2uqv LU4xhu3J6QtQiMvTqJYvGpUKxDeN3TRV8qljSkqLvuJum7hFvWsr5tNrbOBTpWO1zSqh eCXg== X-Gm-Message-State: APjAAAXSQ0Tp6KNBfs6YPjL5ARqHrbeIpCUdtdJndD2skE9Q+rArNMxR A5V+4ud54KHq9JJ4RokCjVE8+6xOtaE= X-Google-Smtp-Source: APXvYqyvuVzrku0P0D5jf2Fc5zG3dTm7OdRza7khx9Z/DAoC80Xqt53FlOUpLKBAbkXiXBAujAjSEA== X-Received: by 2002:a17:902:aa43:: with SMTP id c3mr3773454plr.11.1568810068843; Wed, 18 Sep 2019 05:34:28 -0700 (PDT) Received: from [192.168.20.22] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c9sm1393968pfd.100.2019.09.18.05.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 05:34:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r352465 - head/share/mk From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: <201909180158.x8I1wuZu011258@repo.freebsd.org> Date: Wed, 18 Sep 2019 05:34:27 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> References: <201909180158.x8I1wuZu011258@repo.freebsd.org> To: Kyle Evans X-Rspamd-Queue-Id: 46YKDR2FKbz4GHV X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,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, 18 Sep 2019 12:34:31 -0000 > On Sep 17, 2019, at 18:58, Kyle Evans wrote: >=20 > Author: kevans > Date: Wed Sep 18 01:58:56 2019 > New Revision: 352465 > URL: https://svnweb.freebsd.org/changeset/base/352465 >=20 > Log: > googletest: default-disable on all of MIPS for now >=20 > Parts of the fusefs tests trigger a bug in current versions of llvm: IR > representation of some routine for the MIPS targets is a function with a > large number of arguments. This then leads the compiler on an hour+ long > goose chase, which is OK if you build the current tree but less-so if you= 're > trying external toolchain or doing a universe build involving mips when i= t > eventually gets switched over to LLVM. >=20 > Better, accurate details can be found in LLVM PR43263. Uhhhhh... why not do this in tests/sys/... instead? -Enji= From owner-svn-src-all@freebsd.org Wed Sep 18 12:41: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 D0018FC894; Wed, 18 Sep 2019 12:41:10 +0000 (UTC) (envelope-from kevans@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 46YKN65CNSz4GWK; Wed, 18 Sep 2019 12:41:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 86CCDB35; Wed, 18 Sep 2019 12:41:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f179.google.com with SMTP id z67so7780681qkb.12; Wed, 18 Sep 2019 05:41:10 -0700 (PDT) X-Gm-Message-State: APjAAAUUZgb3HwME7Lr8199XMEoQ7yWJodpI6dp8LQkPOl/0YGwiYNhE akZywzljalb7DSYNU80XmgdW6/JBX0cYNsGly84= X-Google-Smtp-Source: APXvYqwM4aMIPsImbYq2hcrZmskdd+GqvjN5vJB4rgwck3Voahpxhe3OoBKHq+ZZG6eBNyCbmfA9HSmbJSPjxcx8458= X-Received: by 2002:ae9:dd81:: with SMTP id r123mr3685582qkf.103.1568810469982; Wed, 18 Sep 2019 05:41:09 -0700 (PDT) MIME-Version: 1.0 References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> In-Reply-To: <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> From: Kyle Evans Date: Wed, 18 Sep 2019 07:40:58 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352465 - head/share/mk To: Enji Cooper Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 18 Sep 2019 12:41:10 -0000 On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrote: > > > > On Sep 17, 2019, at 18:58, Kyle Evans wrote: > > > > Author: kevans > > Date: Wed Sep 18 01:58:56 2019 > > New Revision: 352465 > > URL: https://svnweb.freebsd.org/changeset/base/352465 > > > > Log: > > googletest: default-disable on all of MIPS for now > > > > Parts of the fusefs tests trigger a bug in current versions of llvm: IR > > representation of some routine for the MIPS targets is a function with a > > large number of arguments. This then leads the compiler on an hour+ long > > goose chase, which is OK if you build the current tree but less-so if you're > > trying external toolchain or doing a universe build involving mips when it > > eventually gets switched over to LLVM. > > > > Better, accurate details can be found in LLVM PR43263. > > Uhhhhh... why not do this in tests/sys/... instead? Because there's still value in being able to easily enable these for building/running the complete set of tests through standard build infrastructure, but it's not worth adding a knob specifically for the fusefs tests. I also prefer the communication of it being an off-by-default option and easily deduced from src.conf(5) that this part of the build is default-disabled on mips/mips. From owner-svn-src-all@freebsd.org Wed Sep 18 13:54: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 219E6FE177 for ; Wed, 18 Sep 2019 13:54:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 46YM0F2PNvz4LVH for ; Wed, 18 Sep 2019 13:54:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id 4so8092819qki.6 for ; Wed, 18 Sep 2019 06:54:05 -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=XRwikxn5g6EWbzXQ61TZKQtamW1pm5X3cmdP9+6sIPc=; b=Q/dp0/4nJg5sdqe46wGn1uMCllIoUpd/VWZD0PQ4eKTQUP3LBTCxV5heflulT838+v b4FZuVh6JqUCRRiNAjUQBCADBq8WKmdH7kgfB5gdnrKmqYfOW09tK4/OP8nOXmP9RfqN OoS7kaskAtBEDQlctufYDSqV9FDRU8H7oYMshQMc34kBqcd+gsBL14A/CtwB1XVe/KfD cG8ykfSwhFy2IVZa6s82RyrteLowcTSOOeGtB2g8OoJqKIvWm1CMVFdmXBAZF6HIteOW UjRMlrRTrYH5LhdZS6xYHuVEcSRydmQy5Z7l72H3MzE80cQXYCTYKosO9cZ0f3bTMUzw Ap8A== 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=XRwikxn5g6EWbzXQ61TZKQtamW1pm5X3cmdP9+6sIPc=; b=Bkpos3+bS7gegrMNpopxopWZF0kod9oCEBGr00JrZxEzMp5/Wf4/JOMl4wwDhgxKN8 kuT0IoqBqBQVb0VYVksFOWwtd4lD1aa/fDVuzHdYCPyC/Oo2iKQQv2pGRoFEsjAdBDnC 9SNYmb7FvlaYKv0JU+zGtSuaKRz0aCaiz2YnxnNFYmAaa9nxZQP13LXA8+RYfAbbP6sJ 4wFqJv08xCL3cFB1MRV1doL5h4yvBfIoqRfGDbZijGds63R7pvZBuiKM9kHPPUf/zfDF coXexZGw2FomadHTOk91pJrlyOeiFUIV9VucJ5DdcsHrrQDmRg4xV1TgVFu1g2Ek3xiQ PcAg== X-Gm-Message-State: APjAAAV4wmb/UG2bFRMxgejOzOZDMcKwTkZ8Xo8vaPV67LWh0E3/y7wy C1kaqIgcgkAwy0ujinuddYXFGoroQ/Kg8+AdZP+p93atXD4= X-Google-Smtp-Source: APXvYqzapiM7f4Qn+WdIepd/VJUDO4hSWsPdsk4CY5Q31sgS2kB8DylUMnUrAZ9YHfe44XdfqylZBRZNxlrhd20vssM= X-Received: by 2002:a37:30f:: with SMTP id 15mr3705071qkd.240.1568814844116; Wed, 18 Sep 2019 06:54:04 -0700 (PDT) MIME-Version: 1.0 References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> In-Reply-To: From: Warner Losh Date: Wed, 18 Sep 2019 14:53:49 +0100 Message-ID: Subject: Re: svn commit: r352465 - head/share/mk To: Kyle Evans Cc: Garrett Cooper , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46YM0F2PNvz4LVH X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Q/dp0/4n; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.85 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; 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:+]; RCVD_IN_DNSWL_NONE(0.00)[c.2.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]; 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.86)[ip: (-9.31), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), 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)[]; FREEMAIL_CC(0.00)[gmail.com] 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: Wed, 18 Sep 2019 13:54:06 -0000 On Wed, Sep 18, 2019, 1:41 PM Kyle Evans wrote: > On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrote: > > > > > > > On Sep 17, 2019, at 18:58, Kyle Evans wrote: > > > > > > Author: kevans > > > Date: Wed Sep 18 01:58:56 2019 > > > New Revision: 352465 > > > URL: https://svnweb.freebsd.org/changeset/base/352465 > > > > > > Log: > > > googletest: default-disable on all of MIPS for now > > > > > > Parts of the fusefs tests trigger a bug in current versions of llvm: > IR > > > representation of some routine for the MIPS targets is a function > with a > > > large number of arguments. This then leads the compiler on an hour+ > long > > > goose chase, which is OK if you build the current tree but less-so if > you're > > > trying external toolchain or doing a universe build involving mips > when it > > > eventually gets switched over to LLVM. > > > > > > Better, accurate details can be found in LLVM PR43263. > > > > Uhhhhh... why not do this in tests/sys/... instead? > > Because there's still value in being able to easily enable these for > building/running the complete set of tests through standard build > infrastructure, but it's not worth adding a knob specifically for the > fusefs tests. I also prefer the communication of it being an > off-by-default option and easily deduced from src.conf(5) that this > part of the build is default-disabled on mips/mips. > This is the right way to do this, imho... Warner > From owner-svn-src-all@freebsd.org Wed Sep 18 14:27: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 494D9FED41; Wed, 18 Sep 2019 14:27:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YMkQ1Cn6z4Nds; Wed, 18 Sep 2019 14:27:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0833E2647F; Wed, 18 Sep 2019 14:27:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IER9Gx054405; Wed, 18 Sep 2019 14:27:09 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IER9L7054404; Wed, 18 Sep 2019 14:27:09 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909181427.x8IER9L7054404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 18 Sep 2019 14:27: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: r352484 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352484 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 14:27:10 -0000 Author: alc Date: Wed Sep 18 14:27:09 2019 New Revision: 352484 URL: https://svnweb.freebsd.org/changeset/base/352484 Log: MFC r350546 Because of AArch64's weak memory consistency model, we need to include a memory barrier between the stores for initializing a page table page and the store for adding that page to the page table. Otherwise, a page table walk by another processor's MMU could see the page table page before it sees the initialized entries. Simplify pmap_growkernel(). In particular, eliminate an unnecessary TLB invalidation. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 08:02:03 2019 (r352483) +++ stable/12/sys/arm64/arm64/pmap.c Wed Sep 18 14:27:09 2019 (r352484) @@ -1525,6 +1525,16 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, str pmap_zero_page(m); /* + * Because of AArch64's weak memory consistency model, we must have a + * barrier here to ensure that the stores for zeroing "m", whether by + * pmap_zero_page() or an earlier function, are visible before adding + * "m" to the page table. Otherwise, a page table walk by another + * processor's MMU could see the mapping to "m" and a stale, non-zero + * PTE within "m". + */ + dmb(ishst); + + /* * Map the pagetable page into the process address space, if * it isn't already there. */ @@ -1775,12 +1785,14 @@ pmap_growkernel(vm_offset_t addr) panic("pmap_growkernel: no memory to grow kernel"); if ((nkpg->flags & PG_ZERO) == 0) pmap_zero_page(nkpg); + /* See the dmb() in _pmap_alloc_l3(). */ + dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); pmap_store(l1, paddr | L1_TABLE); continue; /* try again */ } l2 = pmap_l1_to_l2(l1, kernel_vm_end); - if ((pmap_load(l2) & ATTR_AF) != 0) { + if (pmap_load(l2) != 0) { kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { kernel_vm_end = vm_map_max(kernel_map); @@ -1796,9 +1808,10 @@ pmap_growkernel(vm_offset_t addr) panic("pmap_growkernel: no memory to grow kernel"); if ((nkpg->flags & PG_ZERO) == 0) pmap_zero_page(nkpg); + /* See the dmb() in _pmap_alloc_l3(). */ + dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); - pmap_load_store(l2, paddr | L2_TABLE); - pmap_invalidate_page(kernel_pmap, kernel_vm_end); + pmap_store(l2, paddr | L2_TABLE); kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { @@ -5537,6 +5550,10 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ /* * If the page table page is not leftover from an earlier promotion, * or the mapping attributes have changed, (re)initialize the L3 table. + * + * When pmap_update_entry() clears the old L2 mapping, it (indirectly) + * performs a dsb(). That dsb() ensures that the stores for filling + * "l3" are visible before "l3" is added to the page table. */ if (ml3->valid == 0 || (l3[0] & ATTR_MASK) != (newl3 & ATTR_MASK)) pmap_fill_l3(l3, newl3); From owner-svn-src-all@freebsd.org Wed Sep 18 14:33: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 05A57FEFBF; Wed, 18 Sep 2019 14:33:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (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 46YMt84ZS0z4P62; Wed, 18 Sep 2019 14:33:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x434.google.com with SMTP id q7so73473pfh.8; Wed, 18 Sep 2019 07:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=7zG9fsIp5ZWG8t/NVo2n3trzTl/SuNuBBWDv25aQNJU=; b=Son4I8Ztc/iYdP14OFA9Ri7/b8qFfV8lt3hcVwMK3CWPJYS2KtE2oENR+S0V1/WJJu oFpecRmMJpgUkdHJr3M0EFznVVU5aAgWAWJYKOCwZAnRvJeyxhZFhHbts4SDMTIPjGkV sSksOrCTo8q5bbyYfZ56qBCnQsg/fIVhJp8j/Lmv0a+C9mCYVJK5fOYznZJpB4iHmm6x cxGS1kjHcSGivYxa5Almb4VYwU2VIZRxyvPevDCoq1xnuze1EyEYzPXxJTvfNpHJB581 neD6t/a0GSf8jA5VtcEQOt9ULa7U4TF3/yR6pKCKPJKwNCilitPlWPR6VY9bNFWilMYT 4jZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=7zG9fsIp5ZWG8t/NVo2n3trzTl/SuNuBBWDv25aQNJU=; b=kQUb85JsNdM90RDXpgK5HVn6j7ErKiQfISSTicuSNgbs27sYRxfq1iKAN9adF+iQG1 DOsYKoVxR1XijGaz/kz6oZEeHnJl5Odfg61lmRRCXLss4UXiLcgppseCZCkj4h2iSmLW 8bh+XJJ2TIZHCM1vH361Mt07VfHfZ1FpAxFNLu8pIY05AxDEanp/k32e+iZ4c/yh7ruf gMcpKBPoLTueTVufQQNWKELkjanr7xm2Snj+WlLrQSSK1i47ypfk2Gr0T1CAgi1FyuzV SLYNxu+IzLwXnqLJGZCjo2RVX/XoYvNMn35yY76kCbAPkAxtu2Ominxw7Mc8UwBfIFx/ mKTw== X-Gm-Message-State: APjAAAVkbzPXit4XHXsBLld1KJZMM/G1XIeCuE9oM4KBOdyIefjlVmol IkasUIiiXOu8H3anNyleBd5DZhBAVo0= X-Google-Smtp-Source: APXvYqzAhUpWsDG/JXfkfSkPqj16Vk4KoabLoX9tUhE6YLDGehG8NCr/ZGjxB5mJ4tFIUDhiIKjoXQ== X-Received: by 2002:a65:5186:: with SMTP id h6mr4246007pgq.304.1568817230370; Wed, 18 Sep 2019 07:33:50 -0700 (PDT) Received: from ?IPv6:2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d? ([2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d]) by smtp.gmail.com with ESMTPSA id q204sm5304344pfc.11.2019.09.18.07.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 07:33:49 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r352465 - head/share/mk From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: Date: Wed, 18 Sep 2019 07:33:48 -0700 Cc: src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> To: Kyle Evans X-Rspamd-Queue-Id: 46YMt84ZS0z4P62 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Son4I8Zt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::434 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; 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]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-8.95), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/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)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[4.3.4.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]; 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: Wed, 18 Sep 2019 14:33:54 -0000 > On Sep 18, 2019, at 05:40, Kyle Evans wrote: >=20 >> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrote= : >>=20 >>=20 >>> On Sep 17, 2019, at 18:58, Kyle Evans wrote: >>>=20 >>> Author: kevans >>> Date: Wed Sep 18 01:58:56 2019 >>> New Revision: 352465 >>> URL: https://svnweb.freebsd.org/changeset/base/352465 >>>=20 >>> Log: >>> googletest: default-disable on all of MIPS for now >>>=20 >>> Parts of the fusefs tests trigger a bug in current versions of llvm: IR >>> representation of some routine for the MIPS targets is a function with a= >>> large number of arguments. This then leads the compiler on an hour+ long= >>> goose chase, which is OK if you build the current tree but less-so if yo= u're >>> trying external toolchain or doing a universe build involving mips when i= t >>> eventually gets switched over to LLVM. >>>=20 >>> Better, accurate details can be found in LLVM PR43263. >>=20 >> Uhhhhh... why not do this in tests/sys/... instead? >=20 > Because there's still value in being able to easily enable these for > building/running the complete set of tests through standard build > infrastructure, but it's not worth adding a knob specifically for the > fusefs tests. I also prefer the communication of it being an > off-by-default option and easily deduced from src.conf(5) that this > part of the build is default-disabled on mips/mips. Let me rephrase things a bit: is googlemock broken for all of mips, or is it= just the tests? If the latter, the tests should be blacklisted for mips wit= h a justification. If the former, I agree your method of dealing with the si= tuation is ok, but more investigation needs to be done to see whether or not= the port (in general) is broken and mark it broken if need be. The problem with src.opts.mk=E2=80=99s per-architecture options, is that it c= an be very heavy handed enabling/disabling features. I=E2=80=99m not sure th= at everything in there warrants disabling at that level. Thanks, -Enji= From owner-svn-src-all@freebsd.org Wed Sep 18 14:38: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 12A74FF0CC; Wed, 18 Sep 2019 14:38:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YMzk6lnxz4PHM; Wed, 18 Sep 2019 14:38:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6C4A2663B; Wed, 18 Sep 2019 14:38:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IEcghs060658; Wed, 18 Sep 2019 14:38:42 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IEcgMT060657; Wed, 18 Sep 2019 14:38:42 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909181438.x8IEcgMT060657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 18 Sep 2019 14:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352485 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352485 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 14:38:43 -0000 Author: alc Date: Wed Sep 18 14:38:42 2019 New Revision: 352485 URL: https://svnweb.freebsd.org/changeset/base/352485 Log: MFC r349768 Restructure cache_handle_range to avoid repeated barriers. Specifically, restructure cache_handle_range so that all of the data cache operations are performed before any instruction cache operations. Then, we only need one barrier between the data and instruction cache operations and one barrier after the instruction cache operations. On an Amazon EC2 a1.2xlarge instance, this simple change reduces the time for a "make -j8 buildworld" by 9%. Modified: stable/12/sys/arm64/arm64/cpufunc_asm.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- stable/12/sys/arm64/arm64/cpufunc_asm.S Wed Sep 18 14:27:09 2019 (r352484) +++ stable/12/sys/arm64/arm64/cpufunc_asm.S Wed Sep 18 14:38:42 2019 (r352485) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); /* * Macro to handle the cache. This takes the start address in x0, length - * in x1. It will corrupt x0, x1, x2, and x3. + * in x1. It will corrupt x0, x1, x2, x3, and x4. */ .macro cache_handle_range dcop = 0, ic = 0, icop = 0 .if \ic == 0 @@ -60,17 +60,23 @@ __FBSDID("$FreeBSD$"); and x2, x0, x4 /* Get the low bits of the address */ add x1, x1, x2 /* Add these to the size */ bic x0, x0, x4 /* Clear the low bit of the address */ -1: - dc \dcop, x0 - dsb ish .if \ic != 0 - ic \icop, x0 - dsb ish + mov x2, x0 /* Save the address */ + mov x4, x1 /* Save the size */ .endif +1: + dc \dcop, x0 add x0, x0, x3 /* Move to the next line */ subs x1, x1, x3 /* Reduce the size */ b.hi 1b /* Check if we are done */ + dsb ish .if \ic != 0 +2: + ic \icop, x2 + add x2, x2, x3 /* Move to the next line */ + subs x4, x4, x3 /* Reduce the size */ + b.hi 2b /* Check if we are done */ + dsb ish isb .endif .endm From owner-svn-src-all@freebsd.org Wed Sep 18 14:46: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 3C32BFF5CA; Wed, 18 Sep 2019 14:46:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (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 46YN8R37pMz4Pqn; Wed, 18 Sep 2019 14:46:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pl1-x642.google.com with SMTP id d22so52249pll.7; Wed, 18 Sep 2019 07:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fjbIe09aU41TCx2p3bq3Iq5woBQ0Tz1ppj2LdvS6GPw=; b=u61tERG9jFwxUaQtdyWDd/ikpMrOYz4pQUOp/bZGMzOwQtdjPSjeqUiTr74pORW/Co t8zEYrqPfqDqDbz6+jlCNDrlimBKwCjP+cC8suVFPoNlDtZx+17psuJ/cwgG7Oyyb/G7 ZpYVSVDGQTKnMfy/yRF/d3EHGNEzKQUJuS7spvlN9HDTKihIi5/MoBOGkXgCZxUIcvhz CQBXxDc+DfkEL8v4adfGwOZHPoCHEnKv/IPdieWIDqcKS9IgD1uz4vPvpPwR5kLf5DHw vcgwvw25dray0PHFBJo6f5PaRNW0vxhF02YppwakL3y92E1m7SrYJlIRN2Pk50ESRwBS rHZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fjbIe09aU41TCx2p3bq3Iq5woBQ0Tz1ppj2LdvS6GPw=; b=srS1Y9OEqnrnBL1EXc3FrESjBGkGcZRNb+Y6SpU7PfgDHBxceZWORStDV01ci6erbC V5XpNhHoNsRb+doZdUhHe+RokeBCqieQSVK9DFR6ckseDGhrKImcipAM5xwOhIOdyAso qGqUmm6WcXMkwS2lx6WLo800/x+csMYZ1qzzwVmyKX/KSAE61NKp3VbKZ/XKxaCfXsCb /aVRJZDsJsfBcsBImwDoqC39TcV/zE3mie4Pg07w5Lw1rg72vBP0qwvPSqoegv2VsOMz K+0Jyri5htaj8sl9alvrO2PCIIu/kemRg+t8s5ggugMhhb2gZ/vvkMjgvkXwOMsnlbPQ JO8A== X-Gm-Message-State: APjAAAU8AmHhEhdWrAvoasuWlLd+UIdBJgmNh69NuuJgo/RJ05HdlBhn SMqN+MJHRHKyq9Wbo2yGebp0Oh6FrP4= X-Google-Smtp-Source: APXvYqxxMxqMpAIH5lZVv6tuaHv8ZFY5f2VItOVQEu+kA6VV3rzA/4EI6/agU6eN6nemoPFWKao8uQ== X-Received: by 2002:a17:902:9a81:: with SMTP id w1mr4634094plp.124.1568817973395; Wed, 18 Sep 2019 07:46:13 -0700 (PDT) Received: from ?IPv6:2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d? ([2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d]) by smtp.gmail.com with ESMTPSA id g19sm6418874pgm.63.2019.09.18.07.46.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 07:46:12 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r352465 - head/share/mk From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: Date: Wed, 18 Sep 2019 07:46:11 -0700 Cc: src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> To: Kyle Evans X-Rspamd-Queue-Id: 46YN8R37pMz4Pqn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=u61tERG9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::642 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; 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]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-0.32), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/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)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.4.6.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]; 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: Wed, 18 Sep 2019 14:46:16 -0000 > On Sep 18, 2019, at 07:33, Enji Cooper wrote: >=20 >=20 >>> On Sep 18, 2019, at 05:40, Kyle Evans wrote: >>>=20 >>> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrot= e: >>>=20 >>>=20 >>>> On Sep 17, 2019, at 18:58, Kyle Evans wrote: >>>>=20 >>>> Author: kevans >>>> Date: Wed Sep 18 01:58:56 2019 >>>> New Revision: 352465 >>>> URL: https://svnweb.freebsd.org/changeset/base/352465 >>>>=20 >>>> Log: >>>> googletest: default-disable on all of MIPS for now >>>>=20 >>>> Parts of the fusefs tests trigger a bug in current versions of llvm: IR= >>>> representation of some routine for the MIPS targets is a function with a= >>>> large number of arguments. This then leads the compiler on an hour+ lon= g >>>> goose chase, which is OK if you build the current tree but less-so if y= ou're >>>> trying external toolchain or doing a universe build involving mips when= it >>>> eventually gets switched over to LLVM. >>>>=20 >>>> Better, accurate details can be found in LLVM PR43263. >>>=20 >>> Uhhhhh... why not do this in tests/sys/... instead? >>=20 >> Because there's still value in being able to easily enable these for >> building/running the complete set of tests through standard build >> infrastructure, but it's not worth adding a knob specifically for the >> fusefs tests. I also prefer the communication of it being an >> off-by-default option and easily deduced from src.conf(5) that this >> part of the build is default-disabled on mips/mips. >=20 > Let me rephrase things a bit: is googlemock broken for all of mips, or is i= t just the tests? If the latter, the tests should be blacklisted for mips wi= th a justification. If the former, I agree your method of dealing with the s= ituation is ok, but more investigation needs to be done to see whether or no= t the port (in general) is broken and mark it broken if need be. It looks like the latter case, based on the PR, and it=E2=80=99s a build per= formance issue... Is this impacting CI pipelines? > The problem with src.opts.mk=E2=80=99s per-architecture options, is that i= t can be very heavy handed enabling/disabling features. I=E2=80=99m not sure= that everything in there warrants disabling at that level. My investigation suggests that the course of action was overly heavy handed.= While I=E2=80=99m not asking for a revert, it would be really nice if whole= features weren=E2=80=99t disabled, unless there=E2=80=99s an issue with the= feature. Thank you, -Enji= From owner-svn-src-all@freebsd.org Wed Sep 18 14:58: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 AB9F1FF92F; Wed, 18 Sep 2019 14:58:35 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) (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 46YNQf555hz4QMH; Wed, 18 Sep 2019 14:58:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x532.google.com with SMTP id a3so4251984pgm.13; Wed, 18 Sep 2019 07:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oZmj3sDnUKRP7unsUf2M8sYTzWergU3a3/7hSqSxa6U=; b=S17ThCIvC/pnA0B4GAQuJVvdyVAHshxdn75SipwhJKD/xsiOiWRGzG1qkWoyfmmWIx j91ai+uREH0hs44k0/t42ppj46IvaQgS7SQ/uFbvxjA/iCHHrs7WUo9irz7X5hSNcWPg eIksoej63l1U7ovdxLuYXP8gabRpuDufwzqmgAuK0y8bJVhtRzSPp07yxEAtnmlbnJSa pFdYem6uKd7HmdOJJoei4d7pfS1L0eHuHcS0cB5eTY7XMMIJAgP6GNt8RjHrkRThE9Ph 9L51LiB2SN1l/hHoaeYssBpdKn7Gj/OF4ye2WzSqYk2j5rzSG1J/H2sXNh0kWE8iNeMl AAuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oZmj3sDnUKRP7unsUf2M8sYTzWergU3a3/7hSqSxa6U=; b=j2n5Rm2YzDGAJ01WjhLfwVgANCv7hGmJdeY4LIqX/zF0TXR8iyySLTTyY4UzJAYTbo /v7HBYFBfRjhpU51t/cRcSZN9g+F0WaCDf1oLy/HGcFDQRH1XN3y38wg6h8GT0z2HFED CWBENNtQ/nSN2EMsIwwQbHAzW0Cx4IaL08xIx+5MUciXD6559sOJH/tLD+60M5AOTSwG JcNWypyzwm2RnwEwAE504a5Hs7+kRNCA/5tieYrHNefc/la6rAbwyACJbBGVTBmuHx24 KojyUydqp7j3lPstVX3rTlhq/D3INA/Wp8A8sNcnPgPfZXNahwkA0Fio1aMPAIpAaLbI GsHg== X-Gm-Message-State: APjAAAW8IrVnb9m+s8/ggSh41Z+3Ub8atwgqgspQ/c/HdTTjm7Jd5X69 qzcgtaX5AhBwHmY9/ZaJYz23iuiY0RY= X-Google-Smtp-Source: APXvYqyXJVXJBPtN8ndexMipG/kyAlS57UwfI0U1+IQPoaeJGRSQBsopBocM4lm5IDB9q8BgmUFf9w== X-Received: by 2002:a62:e416:: with SMTP id r22mr4629623pfh.145.1568818712856; Wed, 18 Sep 2019 07:58:32 -0700 (PDT) Received: from ?IPv6:2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d? ([2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d]) by smtp.gmail.com with ESMTPSA id f6sm5335867pgk.65.2019.09.18.07.58.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 07:58:32 -0700 (PDT) Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r352465 - head/share/mk From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: Date: Wed, 18 Sep 2019 07:58:30 -0700 Cc: Kyle Evans , src-committers , svn-src-all , svn-src-head Message-Id: <775F2D15-84C0-4347-863A-6C35095F39FF@gmail.com> References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> To: Warner Losh X-Rspamd-Queue-Id: 46YNQf555hz4QMH X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=S17ThCIv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::532 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-1.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; 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]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.07), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), country: US(-0.05)]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/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)[multipart/alternative,text/plain]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] 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: Wed, 18 Sep 2019 14:58:35 -0000 > On Sep 18, 2019, at 06:53, Warner Losh wrote: >=20 >=20 >=20 >> On Wed, Sep 18, 2019, 1:41 PM Kyle Evans wrote: >> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrote= : >> > >> > >> > > On Sep 17, 2019, at 18:58, Kyle Evans wrote: >> > > >> > > Author: kevans >> > > Date: Wed Sep 18 01:58:56 2019 >> > > New Revision: 352465 >> > > URL: https://svnweb.freebsd.org/changeset/base/352465 >> > > >> > > Log: >> > > googletest: default-disable on all of MIPS for now >> > > >> > > Parts of the fusefs tests trigger a bug in current versions of llvm:= IR >> > > representation of some routine for the MIPS targets is a function wi= th a >> > > large number of arguments. This then leads the compiler on an hour+ l= ong >> > > goose chase, which is OK if you build the current tree but less-so i= f you're >> > > trying external toolchain or doing a universe build involving mips w= hen it >> > > eventually gets switched over to LLVM. >> > > >> > > Better, accurate details can be found in LLVM PR43263. >> > >> > Uhhhhh... why not do this in tests/sys/... instead? >>=20 >> Because there's still value in being able to easily enable these for >> building/running the complete set of tests through standard build >> infrastructure, but it's not worth adding a knob specifically for the >> fusefs tests. I also prefer the communication of it being an >> off-by-default option and easily deduced from src.conf(5) that this >> part of the build is default-disabled on mips/mips. >=20 >=20 > This is the right way to do this, imho... I disagree: disabling a framework and all tests dependent on it because of c= ompile times for a single test suite is the wrong approach. I would complain= more loudly (for instance), if MK_TESTS were disabled on mips, just because= of a build or test issue with a single test. This change throws the baby out with the bath water. The only reason why I=E2= =80=99m not asking for a revert is that mips is a tier 2 arch which I haven=E2= =80=99t verified, and the bath tub that=E2=80=99s being emptied is small, as= many folks haven=E2=80=99t written GoogleTest tests yet in the src tree. -Enji= From owner-svn-src-all@freebsd.org Wed Sep 18 14: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 B8BBBFF97A; Wed, 18 Sep 2019 14:58:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YNQz4YZpz4QTf; Wed, 18 Sep 2019 14:58:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 702791AF7; Wed, 18 Sep 2019 14:58:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f175.google.com with SMTP id g16so66895qto.9; Wed, 18 Sep 2019 07:58:51 -0700 (PDT) X-Gm-Message-State: APjAAAWPmmIAP5ERNW/Hb6pjWVeK0T/8UAvuwCv+7GgkwH5sEhufEhLT XZAfT1AHZxL+UMH2jjlQd/MmLQSP//G7Si1kff4= X-Google-Smtp-Source: APXvYqzamkyxn8O+Es7SzdKVmCuZIrjqK26ws4sXws03vZyVRQhQo0clFxjeasqgu9FjjIVDhJPvSsaNewf0eZzZkuc= X-Received: by 2002:a0c:9276:: with SMTP id 51mr3487907qvz.35.1568818730707; Wed, 18 Sep 2019 07:58:50 -0700 (PDT) MIME-Version: 1.0 References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> In-Reply-To: <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> From: Kyle Evans Date: Wed, 18 Sep 2019 09:58:38 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352465 - head/share/mk To: Enji Cooper Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 18 Sep 2019 14:58:51 -0000 On Wed, Sep 18, 2019 at 9:46 AM Enji Cooper wrote: > > > > On Sep 18, 2019, at 07:33, Enji Cooper wrote: > > > > > >>> On Sep 18, 2019, at 05:40, Kyle Evans wrote: > >>> > >>> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper w= rote: > >>> > >>> > >>>> On Sep 17, 2019, at 18:58, Kyle Evans wrote: > >>>> > >>>> Author: kevans > >>>> Date: Wed Sep 18 01:58:56 2019 > >>>> New Revision: 352465 > >>>> URL: https://svnweb.freebsd.org/changeset/base/352465 > >>>> > >>>> Log: > >>>> googletest: default-disable on all of MIPS for now > >>>> > >>>> Parts of the fusefs tests trigger a bug in current versions of llvm:= IR > >>>> representation of some routine for the MIPS targets is a function wi= th a > >>>> large number of arguments. This then leads the compiler on an hour+ = long > >>>> goose chase, which is OK if you build the current tree but less-so i= f you're > >>>> trying external toolchain or doing a universe build involving mips w= hen it > >>>> eventually gets switched over to LLVM. > >>>> > >>>> Better, accurate details can be found in LLVM PR43263. > >>> > >>> Uhhhhh... why not do this in tests/sys/... instead? > >> > >> Because there's still value in being able to easily enable these for > >> building/running the complete set of tests through standard build > >> infrastructure, but it's not worth adding a knob specifically for the > >> fusefs tests. I also prefer the communication of it being an > >> off-by-default option and easily deduced from src.conf(5) that this > >> part of the build is default-disabled on mips/mips. > > > > Let me rephrase things a bit: is googlemock broken for all of mips, or = is it just the tests? If the latter, the tests should be blacklisted for mi= ps with a justification. If the former, I agree your method of dealing with= the situation is ok, but more investigation needs to be done to see whethe= r or not the port (in general) is broken and mark it broken if need be. > > It looks like the latter case, based on the PR, and it=E2=80=99s a build = performance issue... Is this impacting CI pipelines? > It is the latter, and I do not want to *blacklist* them because as far as I can tell, the tests aren't necessarily broken. I want to workaround them for default by now. > > The problem with src.opts.mk=E2=80=99s per-architecture options, is tha= t it can be very heavy handed enabling/disabling features. I=E2=80=99m not = sure that everything in there warrants disabling at that level. > > My investigation suggests that the course of action was overly heavy hand= ed. While I=E2=80=99m not asking for a revert, it would be really nice if w= hole features weren=E2=80=99t disabled, unless there=E2=80=99s an issue wit= h the feature. > We do not have a lighter method for dealing with this that I can tell, because as I said above: I do not want to blacklist them or completely kill them off. I still want the option to build and test them, but as I aim to switch mips over to llvm I do not want to subject CI and the rest of the world to an extra 1.5+ hour build time for this during tinderbox runs. Given that it's mips, so already tier-high, and I'm one of few people that care about it (and I only care about it for the time being), I intend to leave it as-is since it's still a default in the rest of the world. From owner-svn-src-all@freebsd.org Wed Sep 18 15:04: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 E9681FFCAA; Wed, 18 Sep 2019 15:04:12 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 46YNY80tppz4R5J; Wed, 18 Sep 2019 15:04:11 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pl1-x643.google.com with SMTP id 4so68969pld.10; Wed, 18 Sep 2019 08:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MfbK6b4YtIVwe8D8fbxZ4jQBGB/OBUeNzbVqgVBEBFg=; b=ieaScacJuXxCgvMCi8rJ3t8qXjyV6and2P2bYEojiblX3IQxS6RE6zZCznqxZ/lN/1 q98etIidJgS9jX2aJeyEcqejgjmLQo6h0iiAMtrlVSU73nwcTNVsezqNvrOlX/SAYHi+ rhDrqG1sQ+UUI+Zuf6cQSTpJMXd26wUpypuotAVnNQSGm0w7hFreYvDV6q2LWE9v8B5U IIG2/BzAA/vqK0pQk4DwtGRiKfcmu9hyrsEzFYpe+kks7Ofk3qgep/rMONGjhsX3R8lM OGQ0GGlJEW5bBuTSKTAB9UEMOgI1AzMXlw+d/FS2MXrXdA9I/lnUvTKU5jajgQteDgo5 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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MfbK6b4YtIVwe8D8fbxZ4jQBGB/OBUeNzbVqgVBEBFg=; b=EgM7PxDNEl5HxuyvrUw0hYL8dhU508gxlkiSRAw/e0zpl3rf66T/1efeWcq5P/Jhgm 3kFXdiUDf48AGIP7sX4eG9zUY3NHwOkepzgi1I6ed00gyRxa4KioAqhACv5aOhKCtaCE 5ao0Ackb57khvibMLe44h7pvF9oAThOdVXDfOT8iCY3JNZuXD4Gmmee9Cz0/R87eS7uU QLNs9qRkjfAtwNh7xTRqJE9bxZ2eDp2EL35YTwfGwyQxHq7mM7w/GXltb0dkefT58gM2 wjD1JBUdyZFqHxHiYt97RI/Tkg4ON1bS2xcGzwF4DNcKIKymEADgSgVrdtNcqVDzXObU X/Ag== X-Gm-Message-State: APjAAAWh550yF9uljZTvWEGNkt6GQFrXrt8dxUGHnZ8oXmcKtaxJkxTO HrGxdSj3FUja+dfDLjxuFw5AA/WLb8c= X-Google-Smtp-Source: APXvYqwlE0BD3sQvXNyH93tJMZJQZ1Q/VZhPnUvy+kVW0FtbhPy6pg3kKZcTVSxPMMaK/oiwdF/4rQ== X-Received: by 2002:a17:902:a411:: with SMTP id p17mr4654999plq.108.1568819049098; Wed, 18 Sep 2019 08:04:09 -0700 (PDT) Received: from ?IPv6:2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d? ([2607:fb90:8361:37e4:e838:8e5e:c58b:1a9d]) by smtp.gmail.com with ESMTPSA id a8sm9174421pfa.182.2019.09.18.08.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 08:04:08 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r352465 - head/share/mk From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: Date: Wed, 18 Sep 2019 08:04:07 -0700 Cc: src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> To: Kyle Evans X-Rspamd-Queue-Id: 46YNY80tppz4R5J X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ieaScacJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::643 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; 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]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-0.56), ipnet: 2607:f8b0::/32(-2.68), asn: 15169(-2.23), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/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)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.6.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]; 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: Wed, 18 Sep 2019 15:04:13 -0000 > On Sep 18, 2019, at 07:58, Kyle Evans wrote: >=20 >> On Wed, Sep 18, 2019 at 9:46 AM Enji Cooper wrote= : >>=20 >>=20 >>> On Sep 18, 2019, at 07:33, Enji Cooper wrote: >>>=20 >>>=20 >>>>> On Sep 18, 2019, at 05:40, Kyle Evans wrote: >>>>>=20 >>>>> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wr= ote: >>>>>=20 >>>>>=20 >>>>>> On Sep 17, 2019, at 18:58, Kyle Evans wrote: >>>>>>=20 >>>>>> Author: kevans >>>>>> Date: Wed Sep 18 01:58:56 2019 >>>>>> New Revision: 352465 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/352465 >>>>>>=20 >>>>>> Log: >>>>>> googletest: default-disable on all of MIPS for now >>>>>>=20 >>>>>> Parts of the fusefs tests trigger a bug in current versions of llvm: I= R >>>>>> representation of some routine for the MIPS targets is a function wit= h a >>>>>> large number of arguments. This then leads the compiler on an hour+ l= ong >>>>>> goose chase, which is OK if you build the current tree but less-so if= you're >>>>>> trying external toolchain or doing a universe build involving mips wh= en it >>>>>> eventually gets switched over to LLVM. >>>>>>=20 >>>>>> Better, accurate details can be found in LLVM PR43263. >>>>>=20 >>>>> Uhhhhh... why not do this in tests/sys/... instead? >>>>=20 >>>> Because there's still value in being able to easily enable these for >>>> building/running the complete set of tests through standard build >>>> infrastructure, but it's not worth adding a knob specifically for the >>>> fusefs tests. I also prefer the communication of it being an >>>> off-by-default option and easily deduced from src.conf(5) that this >>>> part of the build is default-disabled on mips/mips. >>>=20 >>> Let me rephrase things a bit: is googlemock broken for all of mips, or i= s it just the tests? If the latter, the tests should be blacklisted for mips= with a justification. If the former, I agree your method of dealing with th= e situation is ok, but more investigation needs to be done to see whether or= not the port (in general) is broken and mark it broken if need be. >>=20 >> It looks like the latter case, based on the PR, and it=E2=80=99s a build p= erformance issue... Is this impacting CI pipelines? >>=20 >=20 > It is the latter, and I do not want to *blacklist* them because as far > as I can tell, the tests aren't necessarily broken. I want to > workaround them for default by now. >=20 >>> The problem with src.opts.mk=E2=80=99s per-architecture options, is that= it can be very heavy handed enabling/disabling features. I=E2=80=99m not su= re that everything in there warrants disabling at that level. >>=20 >> My investigation suggests that the course of action was overly heavy hand= ed. While I=E2=80=99m not asking for a revert, it would be really nice if wh= ole features weren=E2=80=99t disabled, unless there=E2=80=99s an issue with t= he feature. >>=20 >=20 > We do not have a lighter method for dealing with this that I can tell, > because as I said above: I do not want to blacklist them or completely > kill them off. I still want the option to build and test them, but as > I aim to switch mips over to llvm I do not want to subject CI and the > rest of the world to an extra 1.5+ hour build time for this during > tinderbox runs. >=20 > Given that it's mips, so already tier-high, and I'm one of few people > that care about it (and I only care about it for the time being), I > intend to leave it as-is since it's still a default in the rest of the > world. Ok, valid straw man argument: in this particular case, should llvm / c++ sup= port be disabled instead, since it=E2=80=99s the real underlying issue? I=E2= =80=99m guessing (non-ancient) g++ doesn=E2=80=99t have this issue. Again, disabling a framework because of a single issue in the tests doesn=E2= =80=99t make sense. Unless you have proof that the build times for all of go= ogletest/googlemock with llvm is an issue, this seems like the wrong remedia= tion to perform. -Enji PS A heads up to asomers and myself would have been nice. I don=E2=80=99t li= ke post-commit nitpicking, since the issue could have been discussed/reviewe= d before commit.= From owner-svn-src-all@freebsd.org Wed Sep 18 15:14: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 05DCEFFF44; Wed, 18 Sep 2019 15:14:08 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YNmb6BQlz4Rb8; Wed, 18 Sep 2019 15:14:07 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id AC06C1D2B; Wed, 18 Sep 2019 15:14:07 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f182.google.com with SMTP id f16so8382423qkl.9; Wed, 18 Sep 2019 08:14:07 -0700 (PDT) X-Gm-Message-State: APjAAAUcYIKRBW11CJoX1AuE93jiBc0w7bgJ+ARa4TOYpr2Twhz3W+Cn XxKghNQLPbWX9ReAkS5BSPyCxNeXiJLrHuL+RU4= X-Google-Smtp-Source: APXvYqwpkQSWSL4spsEZQoIkdy1F0Y+zacGj/wFL1UdNIX8lQ+CwG2Mx9fS0MuEY6rCdkIB/0K+Kc5AuX00v5SFXff0= X-Received: by 2002:ae9:dd81:: with SMTP id r123mr4548667qkf.103.1568819647168; Wed, 18 Sep 2019 08:14:07 -0700 (PDT) MIME-Version: 1.0 References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> In-Reply-To: From: Kyle Evans Date: Wed, 18 Sep 2019 10:13:55 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352465 - head/share/mk To: Enji Cooper Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 18 Sep 2019 15:14:08 -0000 On Wed, Sep 18, 2019 at 10:04 AM Enji Cooper wrote: > > > > On Sep 18, 2019, at 07:58, Kyle Evans wrote: > > > >> On Wed, Sep 18, 2019 at 9:46 AM Enji Cooper wr= ote: > >> > >> > >>> On Sep 18, 2019, at 07:33, Enji Cooper wrote: > >>> > >>> > >>>>> On Sep 18, 2019, at 05:40, Kyle Evans wrote: > >>>>> > >>>>> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper = wrote: > >>>>> > >>>>> > >>>>>> On Sep 17, 2019, at 18:58, Kyle Evans wrote: > >>>>>> > >>>>>> Author: kevans > >>>>>> Date: Wed Sep 18 01:58:56 2019 > >>>>>> New Revision: 352465 > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/352465 > >>>>>> > >>>>>> Log: > >>>>>> googletest: default-disable on all of MIPS for now > >>>>>> > >>>>>> Parts of the fusefs tests trigger a bug in current versions of llv= m: IR > >>>>>> representation of some routine for the MIPS targets is a function = with a > >>>>>> large number of arguments. This then leads the compiler on an hour= + long > >>>>>> goose chase, which is OK if you build the current tree but less-so= if you're > >>>>>> trying external toolchain or doing a universe build involving mips= when it > >>>>>> eventually gets switched over to LLVM. > >>>>>> > >>>>>> Better, accurate details can be found in LLVM PR43263. > >>>>> > >>>>> Uhhhhh... why not do this in tests/sys/... instead? > >>>> > >>>> Because there's still value in being able to easily enable these for > >>>> building/running the complete set of tests through standard build > >>>> infrastructure, but it's not worth adding a knob specifically for th= e > >>>> fusefs tests. I also prefer the communication of it being an > >>>> off-by-default option and easily deduced from src.conf(5) that this > >>>> part of the build is default-disabled on mips/mips. > >>> > >>> Let me rephrase things a bit: is googlemock broken for all of mips, o= r is it just the tests? If the latter, the tests should be blacklisted for = mips with a justification. If the former, I agree your method of dealing wi= th the situation is ok, but more investigation needs to be done to see whet= her or not the port (in general) is broken and mark it broken if need be. > >> > >> It looks like the latter case, based on the PR, and it=E2=80=99s a bui= ld performance issue... Is this impacting CI pipelines? > >> > > > > It is the latter, and I do not want to *blacklist* them because as far > > as I can tell, the tests aren't necessarily broken. I want to > > workaround them for default by now. > > > >>> The problem with src.opts.mk=E2=80=99s per-architecture options, is t= hat it can be very heavy handed enabling/disabling features. I=E2=80=99m no= t sure that everything in there warrants disabling at that level. > >> > >> My investigation suggests that the course of action was overly heavy h= anded. While I=E2=80=99m not asking for a revert, it would be really nice i= f whole features weren=E2=80=99t disabled, unless there=E2=80=99s an issue = with the feature. > >> > > > > We do not have a lighter method for dealing with this that I can tell, > > because as I said above: I do not want to blacklist them or completely > > kill them off. I still want the option to build and test them, but as > > I aim to switch mips over to llvm I do not want to subject CI and the > > rest of the world to an extra 1.5+ hour build time for this during > > tinderbox runs. > > > > Given that it's mips, so already tier-high, and I'm one of few people > > that care about it (and I only care about it for the time being), I > > intend to leave it as-is since it's still a default in the rest of the > > world. > > Ok, valid straw man argument: in this particular case, should llvm / c++ = support be disabled instead, since it=E2=80=99s the real underlying issue? = I=E2=80=99m guessing (non-ancient) g++ doesn=E2=80=99t have this issue. > > Again, disabling a framework because of a single issue in the tests doesn= =E2=80=99t make sense. Unless you have proof that the build times for all o= f googletest/googlemock with llvm is an issue, this seems like the wrong re= mediation to perform. > > -Enji > > PS A heads up to asomers and myself would have been nice. I don=E2=80=99t= like post-commit nitpicking, since the issue could have been discussed/rev= iewed before commit. If this was any less than a temporary workaround that will get reverted in due time, I would sympathize with your argument completely. I had no intention of wasting your time or asomers' time with this tier-2 problem that had already been diagnosed as an LLVM/mips bug. The unfortunate reality is that no one (including CI) is running tests on FreeBSD/mips, and no one will feel the fallout of this decision. From owner-svn-src-all@freebsd.org Wed Sep 18 15:26: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 BB2B4121206 for ; Wed, 18 Sep 2019 15:26:22 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46YP2k4bKQz4S8D for ; Wed, 18 Sep 2019 15:26:22 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 750671E5D for ; Wed, 18 Sep 2019 15:26:22 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id j1so258466qth.1 for ; Wed, 18 Sep 2019 08:26:22 -0700 (PDT) X-Gm-Message-State: APjAAAVguxLO5dnEzsjzUua9iBhTSPIE6KWTqFoF2war2MRuC+46bPS/ s82uA8pGhKeuKrieMcrMOtshLxfyFgzbArc3o+c= X-Received: by 2002:ac8:2bca:: with SMTP id n10mt4641632qtn.242.1568820382118; Wed, 18 Sep 2019 08:26:22 -0700 (PDT) MIME-Version: 1.0 References: <201909180158.x8I1wuZu011258@repo.freebsd.org> <0FBC9A62-AE3B-4F27-AABC-06FF45F415F1@gmail.com> <81382CF5-A928-48EF-93A9-BBBBA174F4BD@gmail.com> In-Reply-To: From: Kyle Evans Date: Wed, 18 Sep 2019 10:26:10 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r352465 - head/share/mk Cc: Enji Cooper , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 18 Sep 2019 15:26:22 -0000 On Wed, Sep 18, 2019 at 10:13 AM Kyle Evans wrote: > > On Wed, Sep 18, 2019 at 10:04 AM Enji Cooper wrot= e: > > > > > > > On Sep 18, 2019, at 07:58, Kyle Evans wrote: > > > > > >> On Wed, Sep 18, 2019 at 9:46 AM Enji Cooper = wrote: > > >> > > >> > > >>> On Sep 18, 2019, at 07:33, Enji Cooper wrot= e: > > >>> > > >>> > > >>>>> On Sep 18, 2019, at 05:40, Kyle Evans wrote: > > >>>>> > > >>>>> On Wed, Sep 18, 2019 at 7:34 AM Enji Cooper wrote: > > >>>>> > > >>>>> > > >>>>>> On Sep 17, 2019, at 18:58, Kyle Evans wrote= : > > >>>>>> > > >>>>>> Author: kevans > > >>>>>> Date: Wed Sep 18 01:58:56 2019 > > >>>>>> New Revision: 352465 > > >>>>>> URL: https://svnweb.freebsd.org/changeset/base/352465 > > >>>>>> > > >>>>>> Log: > > >>>>>> googletest: default-disable on all of MIPS for now > > >>>>>> > > >>>>>> Parts of the fusefs tests trigger a bug in current versions of l= lvm: IR > > >>>>>> representation of some routine for the MIPS targets is a functio= n with a > > >>>>>> large number of arguments. This then leads the compiler on an ho= ur+ long > > >>>>>> goose chase, which is OK if you build the current tree but less-= so if you're > > >>>>>> trying external toolchain or doing a universe build involving mi= ps when it > > >>>>>> eventually gets switched over to LLVM. > > >>>>>> > > >>>>>> Better, accurate details can be found in LLVM PR43263. > > >>>>> > > >>>>> Uhhhhh... why not do this in tests/sys/... instead? > > >>>> > > >>>> Because there's still value in being able to easily enable these f= or > > >>>> building/running the complete set of tests through standard build > > >>>> infrastructure, but it's not worth adding a knob specifically for = the > > >>>> fusefs tests. I also prefer the communication of it being an > > >>>> off-by-default option and easily deduced from src.conf(5) that thi= s > > >>>> part of the build is default-disabled on mips/mips. > > >>> > > >>> Let me rephrase things a bit: is googlemock broken for all of mips,= or is it just the tests? If the latter, the tests should be blacklisted fo= r mips with a justification. If the former, I agree your method of dealing = with the situation is ok, but more investigation needs to be done to see wh= ether or not the port (in general) is broken and mark it broken if need be. > > >> > > >> It looks like the latter case, based on the PR, and it=E2=80=99s a b= uild performance issue... Is this impacting CI pipelines? > > >> > > > > > > It is the latter, and I do not want to *blacklist* them because as fa= r > > > as I can tell, the tests aren't necessarily broken. I want to > > > workaround them for default by now. > > > > > >>> The problem with src.opts.mk=E2=80=99s per-architecture options, is= that it can be very heavy handed enabling/disabling features. I=E2=80=99m = not sure that everything in there warrants disabling at that level. > > >> > > >> My investigation suggests that the course of action was overly heavy= handed. While I=E2=80=99m not asking for a revert, it would be really nice= if whole features weren=E2=80=99t disabled, unless there=E2=80=99s an issu= e with the feature. > > >> > > > > > > We do not have a lighter method for dealing with this that I can tell= , > > > because as I said above: I do not want to blacklist them or completel= y > > > kill them off. I still want the option to build and test them, but as > > > I aim to switch mips over to llvm I do not want to subject CI and the > > > rest of the world to an extra 1.5+ hour build time for this during > > > tinderbox runs. > > > > > > Given that it's mips, so already tier-high, and I'm one of few people > > > that care about it (and I only care about it for the time being), I > > > intend to leave it as-is since it's still a default in the rest of th= e > > > world. > > > > Ok, valid straw man argument: in this particular case, should llvm / c+= + support be disabled instead, since it=E2=80=99s the real underlying issue= ? I=E2=80=99m guessing (non-ancient) g++ doesn=E2=80=99t have this issue. > > > > Again, disabling a framework because of a single issue in the tests doe= sn=E2=80=99t make sense. Unless you have proof that the build times for all= of googletest/googlemock with llvm is an issue, this seems like the wrong = remediation to perform. > > > > -Enji > > > > PS A heads up to asomers and myself would have been nice. I don=E2=80= =99t like post-commit nitpicking, since the issue could have been discussed= /reviewed before commit. > > If this was any less than a temporary workaround that will get > reverted in due time, I would sympathize with your argument > completely. I had no intention of wasting your time or asomers' time > with this tier-2 problem that had already been diagnosed as an > LLVM/mips bug. > > The unfortunate reality is that no one (including CI) is running tests > on FreeBSD/mips, and no one will feel the fallout of this decision. Sorry, this was supposed to read: "this decision, and anyone else will simply flip it back on for MIPS in the meantime." From owner-svn-src-all@freebsd.org Wed Sep 18 16:13: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 94B4B122504; Wed, 18 Sep 2019 16:13:11 +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 46YQ4l3RrMz4Vdj; Wed, 18 Sep 2019 16:13:11 +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 5AC55277B6; Wed, 18 Sep 2019 16:13:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IGDB7D019182; Wed, 18 Sep 2019 16:13:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IGDAFn019180; Wed, 18 Sep 2019 16:13:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909181613.x8IGDAFn019180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 18 Sep 2019 16:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352486 - in head: lib/libc/gen sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libc/gen sys/kern sys/sys X-SVN-Commit-Revision: 352486 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 16:13:11 -0000 Author: kib Date: Wed Sep 18 16:13:10 2019 New Revision: 352486 URL: https://svnweb.freebsd.org/changeset/base/352486 Log: sysctl: use names instead of magic numbers. Replace magic numbers with symbols for internal sysctl operations. Convert in-kernel and libc consumers. Submitted by: Pawel Biernacki MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21693 Modified: head/lib/libc/gen/sysctlnametomib.c head/sys/kern/kern_sysctl.c head/sys/sys/sysctl.h Modified: head/lib/libc/gen/sysctlnametomib.c ============================================================================== --- head/lib/libc/gen/sysctlnametomib.c Wed Sep 18 14:38:42 2019 (r352485) +++ head/lib/libc/gen/sysctlnametomib.c Wed Sep 18 16:13:10 2019 (r352486) @@ -47,8 +47,8 @@ sysctlnametomib(const char *name, int *mibp, size_t *s int oid[2]; int error; - oid[0] = 0; - oid[1] = 3; + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; *sizep *= sizeof(int); error = sysctl(oid, 2, mibp, sizep, name, strlen(name)); Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Sep 18 14:38:42 2019 (r352485) +++ head/sys/kern/kern_sysctl.c Wed Sep 18 16:13:10 2019 (r352486) @@ -935,13 +935,18 @@ SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_re * (be aware though, that the proper interface isn't as obvious as it * may seem, there are various conflicting requirements. * - * {0,0} printf the entire MIB-tree. - * {0,1,...} return the name of the "..." OID. - * {0,2,...} return the next OID. - * {0,3} return the OID of the name in "new" - * {0,4,...} return the kind & format info for the "..." OID. - * {0,5,...} return the description of the "..." OID. - * {0,6,...} return the aggregation label of the "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_DEBUG} printf the entire MIB-tree. + * {CTL_SYSCTL, CTL_SYSCTL_NAME, ...} return the name of the "..." + * OID. + * {CTL_SYSCTL, CTL_SYSCTL_NEXT, ...} return the next OID. + * {CTL_SYSCTL, CTL_SYSCTL_NAME2OID} return the OID of the name in + * "new" + * {CTL_SYSCTL, CTL_SYSCTL_OIDFMT, ...} return the kind & format info + * for the "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_OIDDESCR, ...} return the description of the + * "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_OIDLABEL, ...} return the aggregation label of + * the "..." OID. */ #ifdef SYSCTL_DEBUG @@ -1009,8 +1014,8 @@ sysctl_sysctl_debug(SYSCTL_HANDLER_ARGS) return (ENOENT); } -SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, - 0, 0, sysctl_sysctl_debug, "-", ""); +SYSCTL_PROC(_sysctl, CTL_SYSCTL_DEBUG, debug, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_MPSAFE, 0, 0, sysctl_sysctl_debug, "-", ""); #endif static int @@ -1075,8 +1080,8 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, - sysctl_sysctl_name, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NAME, name, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); static int sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, @@ -1162,8 +1167,8 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return next data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, - sysctl_sysctl_next, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NEXT, next, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) @@ -1249,9 +1254,9 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name2oid data for nodes that we don't permit in * capability mode. */ -SYSCTL_PROC(_sysctl, 3, name2oid, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY | CTLFLAG_MPSAFE - | CTLFLAG_CAPRW, 0, 0, sysctl_sysctl_name2oid, "I", ""); +SYSCTL_PROC(_sysctl, CTL_SYSCTL_NAME2OID, name2oid, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_ANYBODY | CTLFLAG_MPSAFE | CTLFLAG_CAPRW, 0, 0, + sysctl_sysctl_name2oid, "I", ""); static int sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) @@ -1279,8 +1284,8 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) } -static SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, - sysctl_sysctl_oidfmt, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDFMT, oidfmt, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidfmt, ""); static int sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) @@ -1304,8 +1309,8 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) return (error); } -static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, - sysctl_sysctl_oiddescr, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDDESCR, oiddescr, CTLFLAG_RD | + CTLFLAG_MPSAFE|CTLFLAG_CAPRD, sysctl_sysctl_oiddescr, ""); static int sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) @@ -1329,8 +1334,8 @@ sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) return (error); } -static SYSCTL_NODE(_sysctl, 6, oidlabel, - CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidlabel, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDLABEL, oidlabel, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidlabel, ""); /* * Default "handler" functions. @@ -1857,8 +1862,8 @@ kernel_sysctlbyname(struct thread *td, char *name, voi size_t oidlen, plen; int error; - oid[0] = 0; /* sysctl internal magic */ - oid[1] = 3; /* name2oid */ + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; oidlen = sizeof(oid); error = kernel_sysctl(td, oid, 2, oid, &oidlen, @@ -2165,8 +2170,8 @@ kern___sysctlbyname(struct thread *td, const char *ona if (error != 0) goto out; - oid[0] = 0; - oid[1] = 3; + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; oidlen = sizeof(oid); error = kernel_sysctl(td, oid, 2, oid, &oidlen, (void *)name, namelen, retval, flags); @@ -2667,8 +2672,8 @@ db_show_sysctl_all(int *oid, size_t len, int flags) int name1[CTL_MAXNAME + 2], name2[CTL_MAXNAME + 2]; size_t l1, l2; - name1[0] = 0; - name1[1] = 2; + name1[0] = CTL_SYSCTL; + name1[1] = CTL_SYSCTL_NEXT; l1 = 2; if (len) { memcpy(name1+2, oid, len * sizeof(int)); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Wed Sep 18 14:38:42 2019 (r352485) +++ head/sys/sys/sysctl.h Wed Sep 18 16:13:10 2019 (r352486) @@ -889,7 +889,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); /* * Top-level identifiers */ -#define CTL_UNSPEC 0 /* unused */ +#define CTL_SYSCTL 0 /* "magic" numbers */ #define CTL_KERN 1 /* "high kernel": proc, limits */ #define CTL_VM 2 /* virtual memory */ #define CTL_VFS 3 /* filesystem, mount type is next */ @@ -899,6 +899,17 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define CTL_MACHDEP 7 /* machine dependent */ #define CTL_USER 8 /* user-level */ #define CTL_P1003_1B 9 /* POSIX 1003.1B */ + +/* + * CTL_SYSCTL identifiers + */ +#define CTL_SYSCTL_DEBUG 0 /* printf all nodes */ +#define CTL_SYSCTL_NAME 1 /* string name of OID */ +#define CTL_SYSCTL_NEXT 2 /* next OID */ +#define CTL_SYSCTL_NAME2OID 3 /* int array of name */ +#define CTL_SYSCTL_OIDFMT 4 /* OID's kind and format */ +#define CTL_SYSCTL_OIDDESCR 5 /* OID's description */ +#define CTL_SYSCTL_OIDLABEL 6 /* aggregation label */ /* * CTL_KERN identifiers From owner-svn-src-all@freebsd.org Wed Sep 18 16:13: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 F348E122571; Wed, 18 Sep 2019 16:13:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46YQ5W6xQkz4VmT; Wed, 18 Sep 2019 16:13:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7040277BB; Wed, 18 Sep 2019 16:13:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IGDp1I019262; Wed, 18 Sep 2019 16:13:51 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IGDodZ019256; Wed, 18 Sep 2019 16:13:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201909181613.x8IGDodZ019256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 18 Sep 2019 16:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352487 - in head: lib/libpmc sys/conf sys/dev/hwpmc sys/sys X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: lib/libpmc sys/conf sys/dev/hwpmc sys/sys X-SVN-Commit-Revision: 352487 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 16:13:52 -0000 Author: br Date: Wed Sep 18 16:13:50 2019 New Revision: 352487 URL: https://svnweb.freebsd.org/changeset/base/352487 Log: Add support for BERI statcounters. BERI stands for Bluespec Extensible RISC Implementation, based on MIPS. BERI has not implemented standard MIPS perfomance monitoring counters, instead it provides statistical counters. BERI statcounters have a several limitations: - They can't be written - They don't support start/stop operation - None of hardware interrupt is provided on a counter overflow. So make it separate to hwpmc_mips module and support process/system counting mode only. Sponsored by: DARPA, AFRL Added: head/sys/dev/hwpmc/hwpmc_beri.c (contents, props changed) head/sys/dev/hwpmc/hwpmc_beri.h (contents, props changed) Modified: head/lib/libpmc/libpmc.c head/sys/conf/files.mips head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Wed Sep 18 16:13:10 2019 (r352486) +++ head/lib/libpmc/libpmc.c Wed Sep 18 16:13:50 2019 (r352487) @@ -143,6 +143,7 @@ PMC_CLASSDEP_TABLE(k8, K8); PMC_CLASSDEP_TABLE(xscale, XSCALE); PMC_CLASSDEP_TABLE(armv7, ARMV7); PMC_CLASSDEP_TABLE(armv8, ARMV8); +PMC_CLASSDEP_TABLE(beri, BERI); PMC_CLASSDEP_TABLE(mips24k, MIPS24K); PMC_CLASSDEP_TABLE(mips74k, MIPS74K); PMC_CLASSDEP_TABLE(octeon, OCTEON); @@ -187,6 +188,7 @@ static const struct pmc_event_descr cortex_a57_event_t PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); +PMC_MDEP_TABLE(beri, BERI, PMC_CLASS_SOFT, PMC_CLASS_BERI); PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); @@ -235,6 +237,7 @@ PMC_CLASS_TABLE_DESC(cortex_a53, ARMV8, cortex_a53, ar PMC_CLASS_TABLE_DESC(cortex_a57, ARMV8, cortex_a57, arm64); #endif #if defined(__mips__) +PMC_CLASS_TABLE_DESC(beri, BERI, beri, mips); PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); PMC_CLASS_TABLE_DESC(mips74k, MIPS74K, mips74k, mips); PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); @@ -829,6 +832,11 @@ arm64_allocate_pmc(enum pmc_event pe, char *ctrspec __ #if defined(__mips__) +static struct pmc_event_alias beri_aliases[] = { + EV_ALIAS("instructions", "INST"), + EV_ALIAS(NULL, NULL) +}; + static struct pmc_event_alias mips24k_aliases[] = { EV_ALIAS("instructions", "INSTR_EXECUTED"), EV_ALIAS("branches", "BRANCH_COMPLETED"), @@ -1267,6 +1275,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char break; } break; + case PMC_CLASS_BERI: + ev = beri_event_table; + count = PMC_EVENT_TABLE_SIZE(beri); + break; case PMC_CLASS_MIPS24K: ev = mips24k_event_table; count = PMC_EVENT_TABLE_SIZE(mips24k); @@ -1508,6 +1520,10 @@ pmc_init(void) break; #endif #if defined(__mips__) + case PMC_CPU_MIPS_BERI: + PMC_MDEP_INIT(beri); + pmc_class_table[n] = &beri_class_table_descr; + break; case PMC_CPU_MIPS_24K: PMC_MDEP_INIT(mips24k); pmc_class_table[n] = &mips24k_class_table_descr; @@ -1645,6 +1661,9 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype default: /* Unknown CPU type. */ break; } + } else if (pe >= PMC_EV_BERI_FIRST && pe <= PMC_EV_BERI_LAST) { + ev = beri_event_table; + evfence = beri_event_table + PMC_EVENT_TABLE_SIZE(beri); } else if (pe >= PMC_EV_MIPS24K_FIRST && pe <= PMC_EV_MIPS24K_LAST) { ev = mips24k_event_table; evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k); Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Wed Sep 18 16:13:10 2019 (r352486) +++ head/sys/conf/files.mips Wed Sep 18 16:13:50 2019 (r352487) @@ -91,7 +91,9 @@ dev/nvram2env/nvram2env_mips.c optional nvram2env dev/nvram2env/nvram2env.c optional nvram2env # hwpmc support -dev/hwpmc/hwpmc_mips.c optional hwpmc +dev/hwpmc/hwpmc_beri.c optional hwpmc_beri +dev/hwpmc/hwpmc_mips.c optional hwpmc_mips24k | \ + hwpmc_mips74k dev/hwpmc/hwpmc_mips24k.c optional hwpmc_mips24k dev/hwpmc/hwpmc_mips74k.c optional hwpmc_mips74k Added: head/sys/dev/hwpmc/hwpmc_beri.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hwpmc/hwpmc_beri.c Wed Sep 18 16:13:50 2019 (r352487) @@ -0,0 +1,540 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_hwpmc_hooks.h" + +#include +#include + +#include + +#define BERI_NCOUNTERS 56 +#define BERI_PMC_CAPS (PMC_CAP_USER | PMC_CAP_SYSTEM | \ + PMC_CAP_READ | PMC_CAP_WRITE ) + +struct beri_event_code_map { + uint32_t pe_ev; /* enum value */ + uint64_t (*get_func)(void); +}; + +const struct beri_event_code_map beri_event_codes[BERI_NCOUNTERS] = { + { PMC_EV_BERI_CYCLE, + statcounters_get_cycle_count }, + { PMC_EV_BERI_INST, + statcounters_get_inst_count }, + { PMC_EV_BERI_INST_USER, + statcounters_get_inst_user_count }, + { PMC_EV_BERI_INST_KERNEL, + statcounters_get_inst_kernel_count }, + { PMC_EV_BERI_IMPRECISE_SETBOUNDS, + statcounters_get_imprecise_setbounds_count }, + { PMC_EV_BERI_UNREPRESENTABLE_CAPS, + statcounters_get_unrepresentable_caps_count }, + { PMC_EV_BERI_ITLB_MISS, + statcounters_get_itlb_miss_count }, + { PMC_EV_BERI_DTLB_MISS, + statcounters_get_dtlb_miss_count }, + { PMC_EV_BERI_ICACHE_WRITE_HIT, + statcounters_get_icache_write_hit_count }, + { PMC_EV_BERI_ICACHE_WRITE_MISS, + statcounters_get_icache_write_miss_count }, + { PMC_EV_BERI_ICACHE_READ_HIT, + statcounters_get_icache_read_hit_count }, + { PMC_EV_BERI_ICACHE_READ_MISS, + statcounters_get_icache_read_miss_count }, + { PMC_EV_BERI_ICACHE_EVICT, + statcounters_get_icache_evict_count }, + { PMC_EV_BERI_DCACHE_WRITE_HIT, + statcounters_get_dcache_write_hit_count }, + { PMC_EV_BERI_DCACHE_WRITE_MISS, + statcounters_get_dcache_write_miss_count }, + { PMC_EV_BERI_DCACHE_READ_HIT, + statcounters_get_dcache_read_hit_count }, + { PMC_EV_BERI_DCACHE_READ_MISS, + statcounters_get_dcache_read_miss_count }, + { PMC_EV_BERI_DCACHE_EVICT, + statcounters_get_dcache_evict_count }, + { PMC_EV_BERI_DCACHE_SET_TAG_WRITE, + statcounters_get_dcache_set_tag_write_count }, + { PMC_EV_BERI_DCACHE_SET_TAG_READ, + statcounters_get_dcache_set_tag_read_count }, + { PMC_EV_BERI_L2CACHE_WRITE_HIT, + statcounters_get_l2cache_write_hit_count }, + { PMC_EV_BERI_L2CACHE_WRITE_MISS, + statcounters_get_l2cache_write_miss_count }, + { PMC_EV_BERI_L2CACHE_READ_HIT, + statcounters_get_l2cache_read_hit_count }, + { PMC_EV_BERI_L2CACHE_READ_MISS, + statcounters_get_l2cache_read_miss_count }, + { PMC_EV_BERI_L2CACHE_EVICT, + statcounters_get_l2cache_evict_count }, + { PMC_EV_BERI_L2CACHE_SET_TAG_WRITE, + statcounters_get_l2cache_set_tag_write_count }, + { PMC_EV_BERI_L2CACHE_SET_TAG_READ, + statcounters_get_l2cache_set_tag_read_count }, + { PMC_EV_BERI_MEM_BYTE_READ, + statcounters_get_mem_byte_read_count }, + { PMC_EV_BERI_MEM_BYTE_WRITE, + statcounters_get_mem_byte_write_count }, + { PMC_EV_BERI_MEM_HWORD_READ, + statcounters_get_mem_hword_read_count }, + { PMC_EV_BERI_MEM_HWORD_WRITE, + statcounters_get_mem_hword_write_count }, + { PMC_EV_BERI_MEM_WORD_READ, + statcounters_get_mem_word_read_count }, + { PMC_EV_BERI_MEM_WORD_WRITE, + statcounters_get_mem_word_write_count }, + { PMC_EV_BERI_MEM_DWORD_READ, + statcounters_get_mem_dword_read_count }, + { PMC_EV_BERI_MEM_DWORD_WRITE, + statcounters_get_mem_dword_write_count }, + { PMC_EV_BERI_MEM_CAP_READ, + statcounters_get_mem_cap_read_count }, + { PMC_EV_BERI_MEM_CAP_WRITE, + statcounters_get_mem_cap_write_count }, + { PMC_EV_BERI_MEM_CAP_READ_TAG_SET, + statcounters_get_mem_cap_read_tag_set_count }, + { PMC_EV_BERI_MEM_CAP_WRITE_TAG_SET, + statcounters_get_mem_cap_write_tag_set_count }, + { PMC_EV_BERI_TAGCACHE_WRITE_HIT, + statcounters_get_tagcache_write_hit_count }, + { PMC_EV_BERI_TAGCACHE_WRITE_MISS, + statcounters_get_tagcache_write_miss_count }, + { PMC_EV_BERI_TAGCACHE_READ_HIT, + statcounters_get_tagcache_read_hit_count }, + { PMC_EV_BERI_TAGCACHE_READ_MISS, + statcounters_get_tagcache_read_miss_count }, + { PMC_EV_BERI_TAGCACHE_EVICT, + statcounters_get_tagcache_evict_count }, + { PMC_EV_BERI_L2CACHEMASTER_READ_REQ, + statcounters_get_l2cachemaster_read_req_count }, + { PMC_EV_BERI_L2CACHEMASTER_WRITE_REQ, + statcounters_get_l2cachemaster_write_req_count }, + { PMC_EV_BERI_L2CACHEMASTER_WRITE_REQ_FLIT, + statcounters_get_l2cachemaster_write_req_flit_count }, + { PMC_EV_BERI_L2CACHEMASTER_READ_RSP, + statcounters_get_l2cachemaster_read_rsp_count }, + { PMC_EV_BERI_L2CACHEMASTER_READ_RSP_FLIT, + statcounters_get_l2cachemaster_read_rsp_flit_count }, + { PMC_EV_BERI_L2CACHEMASTER_WRITE_RSP, + statcounters_get_l2cachemaster_write_rsp_count }, + { PMC_EV_BERI_TAGCACHEMASTER_READ_REQ, + statcounters_get_tagcachemaster_read_req_count }, + { PMC_EV_BERI_TAGCACHEMASTER_WRITE_REQ, + statcounters_get_tagcachemaster_write_req_count }, + { PMC_EV_BERI_TAGCACHEMASTER_WRITE_REQ_FLIT, + statcounters_get_tagcachemaster_write_req_flit_count }, + { PMC_EV_BERI_TAGCACHEMASTER_READ_RSP, + statcounters_get_tagcachemaster_read_rsp_count }, + { PMC_EV_BERI_TAGCACHEMASTER_READ_RSP_FLIT, + statcounters_get_tagcachemaster_read_rsp_flit_count }, + { PMC_EV_BERI_TAGCACHEMASTER_WRITE_RSP, + statcounters_get_tagcachemaster_write_rsp_count }, +}; + +struct mips_pmc_spec beri_pmc_spec = { + .ps_cpuclass = PMC_CLASS_BERI, + .ps_cputype = PMC_CPU_MIPS_BERI, + .ps_capabilities = BERI_PMC_CAPS, + .ps_counter_width = 64 +}; + +/* + * Per-processor information. + */ +struct beri_cpu { + struct pmc_hw *pc_beripmcs; + uint64_t start_values[BERI_NCOUNTERS]; + uint64_t stop_values[BERI_NCOUNTERS]; + uint64_t saved_values[BERI_NCOUNTERS]; +}; + +int beri_npmcs; +static struct beri_cpu **beri_pcpu; + +static int +beri_allocate_pmc(int cpu, int ri, struct pmc *pm, + const struct pmc_op_pmcallocate *a) +{ + uint32_t config; + int i; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] illegal row index %d", __LINE__, ri)); + + if (a->pm_class != beri_pmc_spec.ps_cpuclass) + return (EINVAL); + + for (i = 0; i < BERI_NCOUNTERS; i++) { + if (beri_event_codes[i].pe_ev == a->pm_ev) { + config = i; + break; + } + } + + if (i == BERI_NCOUNTERS) + return (EINVAL); + + pm->pm_md.pm_mips_evsel = config; + + PMCDBG2(MDP,ALL,2,"beri-allocate ri=%d -> config=0x%x", ri, config); + + return (0); +} + +static int +beri_read_pmc(int cpu, int ri, pmc_value_t *v) +{ + uint32_t config; + struct pmc *pm; + pmc_value_t new; + pmc_value_t start_val; + pmc_value_t stop_val; + pmc_value_t saved_val; + pmc_value_t result; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] illegal row index %d", __LINE__, ri)); + + pm = beri_pcpu[cpu]->pc_beripmcs[ri].phw_pmc; + config = pm->pm_md.pm_mips_evsel; + + start_val = beri_pcpu[cpu]->start_values[config]; + if (PMC_IS_SYSTEM_MODE(PMC_TO_MODE(pm))) { + stop_val = beri_event_codes[config].get_func(); + } else + stop_val = beri_pcpu[cpu]->stop_values[config]; + + if (start_val <= stop_val) + result = stop_val - start_val; + else { + if (config == 0) /* CYCLE counter is 48 bit */ + result = 0x00ffffffffffffffUL; + else + result = 0xffffffffffffffffUL; + result -= start_val; + result += stop_val; + } + + saved_val = beri_pcpu[cpu]->saved_values[config]; + + *v = result + saved_val; + + return (0); +} + +static int +beri_write_pmc(int cpu, int ri, pmc_value_t v) +{ + struct pmc *pm; + uint32_t config; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] illegal row-index %d", __LINE__, ri)); + + pm = beri_pcpu[cpu]->pc_beripmcs[ri].phw_pmc; + config = pm->pm_md.pm_mips_evsel; + + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + v = (1UL << (beri_pmc_spec.ps_counter_width - 1)) - v; + + PMCDBG3(MDP,WRI,1,"beri-write cpu=%d ri=%d v=%jx", cpu, ri, v); + + if (PMC_IS_SYSTEM_MODE(PMC_TO_MODE(pm))) + beri_pcpu[cpu]->saved_values[config] = 0; + else + beri_pcpu[cpu]->saved_values[config] = v; + + return (0); +} + +static int +beri_config_pmc(int cpu, int ri, struct pmc *pm) +{ + struct pmc_hw *phw; + + PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] illegal row-index %d", __LINE__, ri)); + + phw = &beri_pcpu[cpu]->pc_beripmcs[ri]; + + KASSERT(pm == NULL || phw->phw_pmc == NULL, + ("[beri,%d] pm=%p phw->pm=%p hwpmc not unconfigured", + __LINE__, pm, phw->phw_pmc)); + + phw->phw_pmc = pm; + + return (0); +} + +static int +beri_start_pmc(int cpu, int ri) +{ + uint32_t config; + struct pmc *pm; + struct pmc_hw *phw; + pmc_value_t v; + + phw = &beri_pcpu[cpu]->pc_beripmcs[ri]; + pm = phw->phw_pmc; + config = pm->pm_md.pm_mips_evsel; + + v = beri_event_codes[config].get_func(); + beri_pcpu[cpu]->start_values[config] = v; + + return (0); +} + +static int +beri_stop_pmc(int cpu, int ri) +{ + uint32_t config; + struct pmc *pm; + struct pmc_hw *phw; + pmc_value_t v; + + phw = &beri_pcpu[cpu]->pc_beripmcs[ri]; + pm = phw->phw_pmc; + config = pm->pm_md.pm_mips_evsel; + + v = beri_event_codes[config].get_func(); + beri_pcpu[cpu]->stop_values[config] = v; + + return (0); +} + +static int +beri_release_pmc(int cpu, int ri, struct pmc *pmc) +{ + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] illegal row-index %d", __LINE__, ri)); + + phw = &beri_pcpu[cpu]->pc_beripmcs[ri]; + KASSERT(phw->phw_pmc == NULL, + ("[beri,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); + + return (0); +} + +static int +beri_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) +{ + struct pmc_hw *phw; + char beri_name[PMC_NAME_MAX]; + int error; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d], illegal CPU %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < beri_npmcs, + ("[beri,%d] row-index %d out of range", __LINE__, ri)); + + phw = &beri_pcpu[cpu]->pc_beripmcs[ri]; + snprintf(beri_name, sizeof(beri_name), "MIPS-%d", ri); + if ((error = copystr(beri_name, pi->pm_name, PMC_NAME_MAX, + NULL)) != 0) + return error; + pi->pm_class = beri_pmc_spec.ps_cpuclass; + if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { + pi->pm_enabled = TRUE; + *ppmc = phw->phw_pmc; + } else { + pi->pm_enabled = FALSE; + *ppmc = NULL; + } + + return (0); +} + +static int +beri_get_config(int cpu, int ri, struct pmc **ppm) +{ + + *ppm = beri_pcpu[cpu]->pc_beripmcs[ri].phw_pmc; + + return (0); +} + +static int +beri_pmc_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) +{ + + return (0); +} + +static int +beri_pmc_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) +{ + + return (0); +} + +static int +beri_pcpu_init(struct pmc_mdep *md, int cpu) +{ + int first_ri, i; + struct pmc_cpu *pc; + struct beri_cpu *pac; + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[beri,%d] wrong cpu number %d", __LINE__, cpu)); + PMCDBG1(MDP,INI,1,"beri-init cpu=%d", cpu); + + beri_pcpu[cpu] = pac = malloc(sizeof(struct beri_cpu), M_PMC, + M_WAITOK|M_ZERO); + pac->pc_beripmcs = malloc(sizeof(struct pmc_hw) * beri_npmcs, + M_PMC, M_WAITOK|M_ZERO); + pc = pmc_pcpu[cpu]; + first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_MIPS].pcd_ri; + KASSERT(pc != NULL, ("[beri,%d] NULL per-cpu pointer", __LINE__)); + + for (i = 0, phw = pac->pc_beripmcs; i < beri_npmcs; i++, phw++) { + phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | + PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i); + phw->phw_pmc = NULL; + pc->pc_hwpmcs[i + first_ri] = phw; + } + + return (0); +} + +static int +beri_pcpu_fini(struct pmc_mdep *md, int cpu) +{ + + return (0); +} + +struct pmc_mdep * +pmc_beri_initialize() +{ + struct pmc_mdep *pmc_mdep; + struct pmc_classdep *pcd; + + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "beri"); + + beri_npmcs = 2; + + PMCDBG1(MDP,INI,1,"beri-init npmcs=%d", beri_npmcs); + + /* + * Allocate space for pointers to PMC HW descriptors and for + * the MDEP structure used by MI code. + */ + beri_pcpu = malloc(sizeof(struct beri_cpu *) * pmc_cpu_max(), M_PMC, + M_WAITOK|M_ZERO); + + /* Just one class */ + pmc_mdep = pmc_mdep_alloc(1); + + pmc_mdep->pmd_cputype = beri_pmc_spec.ps_cputype; + + pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_MIPS]; + pcd->pcd_caps = beri_pmc_spec.ps_capabilities; + pcd->pcd_class = beri_pmc_spec.ps_cpuclass; + pcd->pcd_num = beri_npmcs; + pcd->pcd_ri = pmc_mdep->pmd_npmc; + pcd->pcd_width = beri_pmc_spec.ps_counter_width; + + pcd->pcd_allocate_pmc = beri_allocate_pmc; + pcd->pcd_config_pmc = beri_config_pmc; + pcd->pcd_pcpu_fini = beri_pcpu_fini; + pcd->pcd_pcpu_init = beri_pcpu_init; + pcd->pcd_describe = beri_describe; + pcd->pcd_get_config = beri_get_config; + pcd->pcd_read_pmc = beri_read_pmc; + pcd->pcd_release_pmc = beri_release_pmc; + pcd->pcd_start_pmc = beri_start_pmc; + pcd->pcd_stop_pmc = beri_stop_pmc; + pcd->pcd_write_pmc = beri_write_pmc; + + pmc_mdep->pmd_intr = NULL; + pmc_mdep->pmd_switch_in = beri_pmc_switch_in; + pmc_mdep->pmd_switch_out = beri_pmc_switch_out; + + pmc_mdep->pmd_npmc += beri_npmcs; + + return (pmc_mdep); +} + +void +pmc_beri_finalize(struct pmc_mdep *md) +{ + +} + +struct pmc_mdep * +pmc_md_initialize() +{ + + return (pmc_beri_initialize()); +} + +void +pmc_md_finalize(struct pmc_mdep *md) +{ + + return (pmc_beri_finalize(md)); +} + +int +pmc_save_kernel_callchain(uintptr_t *cc, int nframes, + struct trapframe *tf) +{ + + return (0); +} + +int +pmc_save_user_callchain(uintptr_t *cc, int nframes, + struct trapframe *tf) +{ + + return (0); +} Added: head/sys/dev/hwpmc/hwpmc_beri.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hwpmc/hwpmc_beri.h Wed Sep 18 16:13:50 2019 (r352487) @@ -0,0 +1,107 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * 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 _DEV_HWPMC_HWPMC_BERI_H_ +#define _DEV_HWPMC_HWPMC_BERI_H_ + +#define STATCOUNTER_ITEM(name, X, Y) \ +static inline uint64_t statcounters_get_##name##_count(void) \ +{ \ + uint64_t ret; \ + __asm __volatile( \ + ".word (0x1f << 26) | (0x0 << 21) | \ + (12 << 16) | ("#X" << 11) | \ + ( "#Y" << 6) | 0x3b\n\t" \ + "move %0,$12" : "=r" (ret) :: "$12"); \ + return (ret); \ +} + +STATCOUNTER_ITEM(cycle,2,0) +STATCOUNTER_ITEM(inst,4,0) +STATCOUNTER_ITEM(inst_user,4,1) +STATCOUNTER_ITEM(inst_kernel,4,2) +STATCOUNTER_ITEM(imprecise_setbounds,4,3) +STATCOUNTER_ITEM(unrepresentable_caps,4,4) +STATCOUNTER_ITEM(itlb_miss,5,0) +STATCOUNTER_ITEM(dtlb_miss,6,0) +STATCOUNTER_ITEM(icache_write_hit,8,0) +STATCOUNTER_ITEM(icache_write_miss,8,1) +STATCOUNTER_ITEM(icache_read_hit,8,2) +STATCOUNTER_ITEM(icache_read_miss,8,3) +STATCOUNTER_ITEM(icache_evict,8,6) +STATCOUNTER_ITEM(dcache_write_hit,9,0) +STATCOUNTER_ITEM(dcache_write_miss,9,1) +STATCOUNTER_ITEM(dcache_read_hit,9,2) +STATCOUNTER_ITEM(dcache_read_miss,9,3) +STATCOUNTER_ITEM(dcache_evict,9,6) +STATCOUNTER_ITEM(dcache_set_tag_write,9,8) +STATCOUNTER_ITEM(dcache_set_tag_read,9,9) +STATCOUNTER_ITEM(l2cache_write_hit,10,0) +STATCOUNTER_ITEM(l2cache_write_miss,10,1) +STATCOUNTER_ITEM(l2cache_read_hit,10,2) +STATCOUNTER_ITEM(l2cache_read_miss,10,3) +STATCOUNTER_ITEM(l2cache_evict,10,6) +STATCOUNTER_ITEM(l2cache_set_tag_write,10,8) +STATCOUNTER_ITEM(l2cache_set_tag_read,10,9) +STATCOUNTER_ITEM(mem_byte_read,11,0) +STATCOUNTER_ITEM(mem_byte_write,11,1) +STATCOUNTER_ITEM(mem_hword_read,11,2) +STATCOUNTER_ITEM(mem_hword_write,11,3) +STATCOUNTER_ITEM(mem_word_read,11,4) +STATCOUNTER_ITEM(mem_word_write,11,5) +STATCOUNTER_ITEM(mem_dword_read,11,6) +STATCOUNTER_ITEM(mem_dword_write,11,7) +STATCOUNTER_ITEM(mem_cap_read,11,8) +STATCOUNTER_ITEM(mem_cap_write,11,9) +STATCOUNTER_ITEM(mem_cap_read_tag_set,11,10) +STATCOUNTER_ITEM(mem_cap_write_tag_set,11,11) +STATCOUNTER_ITEM(tagcache_write_hit,12,0) +STATCOUNTER_ITEM(tagcache_write_miss,12,1) +STATCOUNTER_ITEM(tagcache_read_hit,12,2) +STATCOUNTER_ITEM(tagcache_read_miss,12,3) +STATCOUNTER_ITEM(tagcache_evict,12,6) +STATCOUNTER_ITEM(l2cachemaster_read_req,13,0) +STATCOUNTER_ITEM(l2cachemaster_write_req,13,1) +STATCOUNTER_ITEM(l2cachemaster_write_req_flit,13,2) +STATCOUNTER_ITEM(l2cachemaster_read_rsp,13,3) +STATCOUNTER_ITEM(l2cachemaster_read_rsp_flit,13,4) +STATCOUNTER_ITEM(l2cachemaster_write_rsp,13,5) +STATCOUNTER_ITEM(tagcachemaster_read_req,14,0) +STATCOUNTER_ITEM(tagcachemaster_write_req,14,1) +STATCOUNTER_ITEM(tagcachemaster_write_req_flit,14,2) +STATCOUNTER_ITEM(tagcachemaster_read_rsp,14,3) +STATCOUNTER_ITEM(tagcachemaster_read_rsp_flit,14,4) +STATCOUNTER_ITEM(tagcachemaster_write_rsp,14,5) + +#endif /* !_DEV_HWPMC_HWPMC_BERI_H_ */ Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Sep 18 16:13:10 2019 (r352486) +++ head/sys/dev/hwpmc/pmc_events.h Wed Sep 18 16:13:50 2019 (r352487) @@ -1246,6 +1246,67 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C #define PMC_EV_MIPS74K_FIRST PMC_EV_MIPS74K_CYCLES #define PMC_EV_MIPS74K_LAST PMC_EV_MIPS74K_WBB_25_50_FULL +#define __PMC_EV_BERI() \ + __PMC_EV(BERI, CYCLE) \ + __PMC_EV(BERI, INST) \ + __PMC_EV(BERI, INST_USER) \ + __PMC_EV(BERI, INST_KERNEL) \ + __PMC_EV(BERI, IMPRECISE_SETBOUNDS) \ + __PMC_EV(BERI, UNREPRESENTABLE_CAPS) \ + __PMC_EV(BERI, ITLB_MISS) \ + __PMC_EV(BERI, DTLB_MISS) \ + __PMC_EV(BERI, ICACHE_WRITE_HIT) \ + __PMC_EV(BERI, ICACHE_WRITE_MISS) \ + __PMC_EV(BERI, ICACHE_READ_HIT) \ + __PMC_EV(BERI, ICACHE_READ_MISS) \ + __PMC_EV(BERI, ICACHE_EVICT) \ + __PMC_EV(BERI, DCACHE_WRITE_HIT) \ + __PMC_EV(BERI, DCACHE_WRITE_MISS) \ + __PMC_EV(BERI, DCACHE_READ_HIT) \ + __PMC_EV(BERI, DCACHE_READ_MISS) \ + __PMC_EV(BERI, DCACHE_EVICT) \ + __PMC_EV(BERI, DCACHE_SET_TAG_WRITE) \ + __PMC_EV(BERI, DCACHE_SET_TAG_READ) \ + __PMC_EV(BERI, L2CACHE_WRITE_HIT) \ + __PMC_EV(BERI, L2CACHE_WRITE_MISS) \ + __PMC_EV(BERI, L2CACHE_READ_HIT) \ + __PMC_EV(BERI, L2CACHE_READ_MISS) \ + __PMC_EV(BERI, L2CACHE_EVICT) \ + __PMC_EV(BERI, L2CACHE_SET_TAG_WRITE) \ + __PMC_EV(BERI, L2CACHE_SET_TAG_READ) \ + __PMC_EV(BERI, MEM_BYTE_READ) \ + __PMC_EV(BERI, MEM_BYTE_WRITE) \ + __PMC_EV(BERI, MEM_HWORD_READ) \ + __PMC_EV(BERI, MEM_HWORD_WRITE) \ + __PMC_EV(BERI, MEM_WORD_READ) \ + __PMC_EV(BERI, MEM_WORD_WRITE) \ + __PMC_EV(BERI, MEM_DWORD_READ) \ + __PMC_EV(BERI, MEM_DWORD_WRITE) \ + __PMC_EV(BERI, MEM_CAP_READ) \ + __PMC_EV(BERI, MEM_CAP_WRITE) \ + __PMC_EV(BERI, MEM_CAP_READ_TAG_SET) \ + __PMC_EV(BERI, MEM_CAP_WRITE_TAG_SET) \ + __PMC_EV(BERI, TAGCACHE_WRITE_HIT) \ + __PMC_EV(BERI, TAGCACHE_WRITE_MISS) \ + __PMC_EV(BERI, TAGCACHE_READ_HIT) \ + __PMC_EV(BERI, TAGCACHE_READ_MISS) \ + __PMC_EV(BERI, TAGCACHE_EVICT) \ + __PMC_EV(BERI, L2CACHEMASTER_READ_REQ) \ + __PMC_EV(BERI, L2CACHEMASTER_WRITE_REQ) \ + __PMC_EV(BERI, L2CACHEMASTER_WRITE_REQ_FLIT) \ + __PMC_EV(BERI, L2CACHEMASTER_READ_RSP) \ + __PMC_EV(BERI, L2CACHEMASTER_READ_RSP_FLIT) \ + __PMC_EV(BERI, L2CACHEMASTER_WRITE_RSP) \ + __PMC_EV(BERI, TAGCACHEMASTER_READ_REQ) \ + __PMC_EV(BERI, TAGCACHEMASTER_WRITE_REQ) \ + __PMC_EV(BERI, TAGCACHEMASTER_WRITE_REQ_FLIT) \ + __PMC_EV(BERI, TAGCACHEMASTER_READ_RSP) \ + __PMC_EV(BERI, TAGCACHEMASTER_READ_RSP_FLIT) \ + __PMC_EV(BERI, TAGCACHEMASTER_WRITE_RSP) + +#define PMC_EV_BERI_FIRST PMC_EV_BERI_CYCLE +#define PMC_EV_BERI_LAST PMC_EV_BERI_TAGCACHEMASTER_WRITE_RSP + /* * Cavium Octeon counters. Obtained from cvmx-core.h */ @@ -1774,6 +1835,7 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C * 0x11300 0x00FF MIPS 24K events * 0x11400 0x00FF Octeon events * 0x11500 0x00FF MIPS 74K events + * 0x11600 0x00FF BERI statcounters * 0x13000 0x00FF MPC7450 events * 0x13100 0x00FF IBM PPC970 events * 0x13300 0x00FF Freescale e500 events @@ -1798,6 +1860,8 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C __PMC_EV_OCTEON() \ __PMC_EV_BLOCK(MIPS74K, 0x11500) \ __PMC_EV_MIPS74K() \ + __PMC_EV_BLOCK(BERI, 0x11600) \ + __PMC_EV_BERI() \ __PMC_EV_BLOCK(UCP, 0x12080) \ __PMC_EV_UCP() \ __PMC_EV_BLOCK(PPC7450, 0x13000) \ Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Wed Sep 18 16:13:10 2019 (r352486) +++ head/sys/sys/pmc.h Wed Sep 18 16:13:50 2019 (r352487) @@ -114,6 +114,7 @@ extern char pmc_cpuid[PMC_CPUID_LEN]; __PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") \ __PMC_CPU(MIPS_OCTEON, 0x201, "Cavium Octeon") \ __PMC_CPU(MIPS_74K, 0x202, "MIPS 74K") \ + __PMC_CPU(MIPS_BERI, 0x203, "BERI") \ __PMC_CPU(PPC_7450, 0x300, "PowerPC MPC7450") \ __PMC_CPU(PPC_E500, 0x340, "PowerPC e500 Core") \ __PMC_CPU(PPC_970, 0x380, "IBM PowerPC 970") \ @@ -160,7 +161,8 @@ enum pmc_cputype { __PMC_CLASS(ARMV7, 0x10, "ARMv7") \ __PMC_CLASS(ARMV8, 0x11, "ARMv8") \ __PMC_CLASS(MIPS74K, 0x12, "MIPS 74K") \ - __PMC_CLASS(E500, 0x13, "Freescale e500 class") + __PMC_CLASS(E500, 0x13, "Freescale e500 class") \ + __PMC_CLASS(BERI, 0x14, "MIPS BERI") enum pmc_class { #undef __PMC_CLASS From owner-svn-src-all@freebsd.org Wed Sep 18 16:15: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 1420712260F; Wed, 18 Sep 2019 16:15:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YQ6x6r8pz4Vvh; Wed, 18 Sep 2019 16:15:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE09B277BC; Wed, 18 Sep 2019 16:15:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IGF5UN019376; Wed, 18 Sep 2019 16:15:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IGF5lk019374; Wed, 18 Sep 2019 16:15:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909181615.x8IGF5lk019374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 18 Sep 2019 16:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352488 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 352488 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 16:15:06 -0000 Author: kib Date: Wed Sep 18 16:15:05 2019 New Revision: 352488 URL: https://svnweb.freebsd.org/changeset/base/352488 Log: truss: decode sysctl names. Submitted by: Pawel Biernacki MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21688 Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Wed Sep 18 16:13:50 2019 (r352487) +++ head/usr.bin/truss/syscall.h Wed Sep 18 16:15:05 2019 (r352488) @@ -131,6 +131,7 @@ enum Argtype { Sockprotocol, Socktype, Sysarch, + Sysctl, Umtxop, Waitoptions, Whence, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed Sep 18 16:13:50 2019 (r352487) +++ head/usr.bin/truss/syscalls.c Wed Sep 18 16:15:05 2019 (r352488) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #define _WANT_FREEBSD11_STAT #include +#include #include #include #include @@ -506,6 +507,12 @@ static struct syscall decoded_syscalls[] = { .args = { { Name, 0 }, { Atfd, 1 }, { Name, 2 } } }, { .name = "sysarch", .ret_type = 1, .nargs = 2, .args = { { Sysarch, 0 }, { Ptr, 1 } } }, + { .name = "__sysctl", .ret_type = 1, .nargs = 6, + .args = { { Sysctl, 0 }, { Sizet, 1 }, { Ptr, 2 }, { Ptr, 3 }, + { Ptr, 4 }, { Sizet, 5 } } }, + { .name = "__sysctlbyname", .ret_type = 1, .nargs = 6, + .args = { { Name, 0 }, { Sizet, 1 }, { Ptr, 2 }, { Ptr, 3 }, + { Ptr, 4}, { Sizet, 5 } } }, { .name = "thr_kill", .ret_type = 1, .nargs = 2, .args = { { Long, 0 }, { Signal, 1 } } }, { .name = "thr_self", .ret_type = 1, .nargs = 1, @@ -1551,6 +1558,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct free(cmsgbuf); } +static void +print_sysctl_oid(FILE *fp, int *oid, int len) +{ + int i; + + for (i = 0; i < len; i++) + fprintf(fp, ".%d", oid[i]); +} + /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is @@ -2267,6 +2283,62 @@ print_arg(struct syscall_args *sc, unsigned long *args print_integer_arg(sysdecode_sysarch_number, fp, args[sc->offset]); break; + case Sysctl: { + char name[BUFSIZ]; + int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2]; + size_t i; + int len; + + memset(name, 0, sizeof(name)); + len = args[sc->offset + 1]; + if (get_struct(pid, (void *)args[sc->offset], oid, + len * sizeof(oid[0])) != -1) { + fprintf(fp, "\""); + if (oid[0] == CTL_SYSCTL) { + fprintf(fp, "sysctl."); + switch (oid[1]) { + case CTL_SYSCTL_DEBUG: + fprintf(fp, "debug"); + break; + case CTL_SYSCTL_NAME: + fprintf(fp, "name"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_NEXT: + fprintf(fp, "next"); + break; + case CTL_SYSCTL_NAME2OID: + fprintf(fp, "name2oid"); + break; + case CTL_SYSCTL_OIDFMT: + fprintf(fp, "oidfmt"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_OIDDESCR: + fprintf(fp, "oiddescr"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_OIDLABEL: + fprintf(fp, "oidlabel"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + default: + print_sysctl_oid(fp, oid + 1, len - 1); + } + } else { + qoid[0] = CTL_SYSCTL; + qoid[1] = CTL_SYSCTL_NAME; + memcpy(qoid + 2, oid, len * sizeof(int)); + i = sizeof(name); + if (sysctl(qoid, len + 2, name, &i, 0, 0) == -1) + print_sysctl_oid(fp, qoid + 2, len); + else + fprintf(fp, "%s", name); + } + fprintf(fp, "\""); + } + break; + } case PipeFds: /* * The pipe() system call in the kernel returns its From owner-svn-src-all@freebsd.org Wed Sep 18 17:18: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 E43941235F2; Wed, 18 Sep 2019 17:18:09 +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 46YRWj5K95z4Ymy; Wed, 18 Sep 2019 17:18:09 +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 968FD2E2; Wed, 18 Sep 2019 17:18:09 +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 x8IHI9of055041; Wed, 18 Sep 2019 17:18:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IHI9bi055040; Wed, 18 Sep 2019 17:18:09 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909181718.x8IHI9bi055040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 18 Sep 2019 17:18: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: r352489 - stable/12/usr.sbin/periodic X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/usr.sbin/periodic X-SVN-Commit-Revision: 352489 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 17:18:10 -0000 Author: asomers Date: Wed Sep 18 17:18:09 2019 New Revision: 352489 URL: https://svnweb.freebsd.org/changeset/base/352489 Log: MFC r351192, r351203 r351192: periodic: fix anticongestion for scripts run after security Revision 316342, which introduced the anticongestion feature, failed to consider that the periodic scripts are executed by a recursive invocation of periodic. The recursive invocation wrongly cleaned up a temporary file that should've been cleaned up only by the original invocation. The result is that if the first script that requests an anticongestion sleep runs after the security scripts, the sleep won't happen. Fix this bug by delaying cleanup until the end of the original invocation. PR: 236564 Submitted by: Yasuhiro KIMURA Reviewed by: imp r351203: periodic: replace "tty" with "test -t 0" Apparently using tty for this purpose has been deprecated since 4.4 Lite. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D21318 Modified: stable/12/usr.sbin/periodic/periodic.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/periodic/periodic.sh ============================================================================== --- stable/12/usr.sbin/periodic/periodic.sh Wed Sep 18 16:15:05 2019 (r352488) +++ stable/12/usr.sbin/periodic/periodic.sh Wed Sep 18 17:18:09 2019 (r352489) @@ -78,8 +78,13 @@ arg=$1 if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX` + remove_periodic_anticongestion_file=yes +else + # We might be in a recursive invocation; let the top-level invocation + # remove the file. + remove_periodic_anticongestion_file=no fi -if tty > /dev/null 2>&1; then +if [ -t 0 ]; then export PERIODIC_IS_INTERACTIVE=1 fi tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` @@ -147,4 +152,6 @@ esac } | output_pipe $arg "$context" rm -f $tmp_output -rm -f $PERIODIC_ANTICONGESTION_FILE +if [ $remove_periodic_anticongestion_file = "yes" ] ; then + rm -f $PERIODIC_ANTICONGESTION_FILE +fi From owner-svn-src-all@freebsd.org Wed Sep 18 17:21: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 E2B6F1237C1; Wed, 18 Sep 2019 17:21:34 +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 46YRbf5dbPz4Z1W; Wed, 18 Sep 2019 17:21:34 +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 A5CDE347; Wed, 18 Sep 2019 17:21:34 +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 x8IHLYpg056004; Wed, 18 Sep 2019 17:21:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IHLYhe056003; Wed, 18 Sep 2019 17:21:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909181721.x8IHLYhe056003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 18 Sep 2019 17:21: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: r352490 - stable/11/usr.sbin/periodic X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/usr.sbin/periodic X-SVN-Commit-Revision: 352490 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 17:21:34 -0000 Author: asomers Date: Wed Sep 18 17:21:34 2019 New Revision: 352490 URL: https://svnweb.freebsd.org/changeset/base/352490 Log: MFC r351192, r351203 r351192: periodic: fix anticongestion for scripts run after security Revision 316342, which introduced the anticongestion feature, failed to consider that the periodic scripts are executed by a recursive invocation of periodic. The recursive invocation wrongly cleaned up a temporary file that should've been cleaned up only by the original invocation. The result is that if the first script that requests an anticongestion sleep runs after the security scripts, the sleep won't happen. Fix this bug by delaying cleanup until the end of the original invocation. PR: 236564 Submitted by: Yasuhiro KIMURA Reviewed by: imp r351203: periodic: replace "tty" with "test -t 0" Apparently using tty for this purpose has been deprecated since 4.4 Lite. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D21318 Modified: stable/11/usr.sbin/periodic/periodic.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/periodic/periodic.sh ============================================================================== --- stable/11/usr.sbin/periodic/periodic.sh Wed Sep 18 17:18:09 2019 (r352489) +++ stable/11/usr.sbin/periodic/periodic.sh Wed Sep 18 17:21:34 2019 (r352490) @@ -78,8 +78,13 @@ arg=$1 if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX` + remove_periodic_anticongestion_file=yes +else + # We might be in a recursive invocation; let the top-level invocation + # remove the file. + remove_periodic_anticongestion_file=no fi -if tty > /dev/null 2>&1; then +if [ -t 0 ]; then export PERIODIC_IS_INTERACTIVE=1 fi tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` @@ -147,4 +152,6 @@ esac } | output_pipe $arg "$context" rm -f $tmp_output -rm -f $PERIODIC_ANTICONGESTION_FILE +if [ $remove_periodic_anticongestion_file = "yes" ] ; then + rm -f $PERIODIC_ANTICONGESTION_FILE +fi From owner-svn-src-all@freebsd.org Wed Sep 18 19:21: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 E9575125227; Wed, 18 Sep 2019 19:21:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YVFr5qH1z4fJS; Wed, 18 Sep 2019 19:21:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB5711752; Wed, 18 Sep 2019 19:21:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IJLKI0026638; Wed, 18 Sep 2019 19:21:20 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IJLKSn026636; Wed, 18 Sep 2019 19:21:20 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201909181921.x8IJLKSn026636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 18 Sep 2019 19:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352491 - stable/12/usr.bin/procstat/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: stable/12/usr.bin/procstat/tests X-SVN-Commit-Revision: 352491 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 19:21:21 -0000 Author: jilles Date: Wed Sep 18 19:21:20 2019 New Revision: 352491 URL: https://svnweb.freebsd.org/changeset/base/352491 Log: MFC r351819: procstat/tests: Fix flakiness by waiting for program to start Some of the procstat tests start a program "while1" and examine the process using procstat, but did not wait properly for it to start (kill -0 will succeed immediately after the child process has been created). Instead, have "while1" write something when it starts, and use a fifo to wait for that. PR: 233587, 233588 Modified: stable/12/usr.bin/procstat/tests/procstat_test.sh stable/12/usr.bin/procstat/tests/while1.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/procstat/tests/procstat_test.sh ============================================================================== --- stable/12/usr.bin/procstat/tests/procstat_test.sh Wed Sep 18 17:21:34 2019 (r352490) +++ stable/12/usr.bin/procstat/tests/procstat_test.sh Wed Sep 18 19:21:20 2019 (r352491) @@ -25,7 +25,6 @@ # $FreeBSD$ # -MAX_TRIES=20 PROG_PID= PROG_PATH=$(atf_get_srcdir)/while1 @@ -37,16 +36,13 @@ start_program() PROG_COMM=while1 PROG_PATH=$(atf_get_srcdir)/$PROG_COMM - $PROG_PATH $* & + mkfifo wait_for_start || atf_fail "mkfifo" + $PROG_PATH $* >wait_for_start & PROG_PID=$! - try=0 - while [ $try -lt $MAX_TRIES ] && ! kill -0 $PROG_PID; do - sleep 0.5 - : $(( try += 1 )) - done - if [ $try -ge $MAX_TRIES ]; then - atf_fail "Polled for program start $MAX_TRIES tries and failed" + if ! read dummy Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C0141254C7; Wed, 18 Sep 2019 19:28:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YVPt2k8jz4frl; Wed, 18 Sep 2019 19:28:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DCC118D6; Wed, 18 Sep 2019 19:28:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IJSIju029667; Wed, 18 Sep 2019 19:28:18 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IJSHkB029665; Wed, 18 Sep 2019 19:28:17 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201909181928.x8IJSHkB029665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 18 Sep 2019 19:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352492 - stable/11/usr.bin/procstat/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: stable/11/usr.bin/procstat/tests X-SVN-Commit-Revision: 352492 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 19:28:18 -0000 Author: jilles Date: Wed Sep 18 19:28:17 2019 New Revision: 352492 URL: https://svnweb.freebsd.org/changeset/base/352492 Log: MFC r351819: procstat/tests: Fix flakiness by waiting for program to start Some of the procstat tests start a program "while1" and examine the process using procstat, but did not wait properly for it to start (kill -0 will succeed immediately after the child process has been created). Instead, have "while1" write something when it starts, and use a fifo to wait for that. PR: 233587, 233588 Modified: stable/11/usr.bin/procstat/tests/procstat_test.sh stable/11/usr.bin/procstat/tests/while1.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/procstat/tests/procstat_test.sh ============================================================================== --- stable/11/usr.bin/procstat/tests/procstat_test.sh Wed Sep 18 19:21:20 2019 (r352491) +++ stable/11/usr.bin/procstat/tests/procstat_test.sh Wed Sep 18 19:28:17 2019 (r352492) @@ -25,7 +25,6 @@ # $FreeBSD$ # -MAX_TRIES=20 PROG_PID= PROG_PATH=$(atf_get_srcdir)/while1 @@ -37,16 +36,13 @@ start_program() PROG_COMM=while1 PROG_PATH=$(atf_get_srcdir)/$PROG_COMM - $PROG_PATH $* & + mkfifo wait_for_start || atf_fail "mkfifo" + $PROG_PATH $* >wait_for_start & PROG_PID=$! - try=0 - while [ $try -lt $MAX_TRIES ] && ! kill -0 $PROG_PID; do - sleep 0.5 - : $(( try += 1 )) - done - if [ $try -ge $MAX_TRIES ]; then - atf_fail "Polled for program start $MAX_TRIES tries and failed" + if ! read dummy Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C220E125728; Wed, 18 Sep 2019 19:33:08 +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 46YVWS4kggz4gGw; Wed, 18 Sep 2019 19:33:08 +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 85DAE1AB7; Wed, 18 Sep 2019 19:33:08 +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 x8IJX8RR035302; Wed, 18 Sep 2019 19:33:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IJX8Bo035301; Wed, 18 Sep 2019 19:33:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909181933.x8IJX8Bo035301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 18 Sep 2019 19:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352493 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352493 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 19:33:08 -0000 Author: mav Date: Wed Sep 18 19:33:08 2019 New Revision: 352493 URL: https://svnweb.freebsd.org/changeset/base/352493 Log: Fix typo, setting hidden flag instead of reparse. Submitted by: Ryan Moeller MFC after: 3 days Sponsored by: iXsystems, Inc. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.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 Sep 18 19:28:17 2019 (r352492) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 18 19:33:08 2019 (r352493) @@ -5202,7 +5202,7 @@ zfs_freebsd_setattr(ap) FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN, xvap.xva_xoptattrs.xoa_hidden); FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE, - xvap.xva_xoptattrs.xoa_hidden); + xvap.xva_xoptattrs.xoa_reparse); FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE, xvap.xva_xoptattrs.xoa_offline); FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE, From owner-svn-src-all@freebsd.org Wed Sep 18 19:53: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 606BE125C76; Wed, 18 Sep 2019 19:53:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YVzW1j7Bz3CYd; Wed, 18 Sep 2019 19:53:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DC0C1E5C; Wed, 18 Sep 2019 19:53:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IJrxZi047119; Wed, 18 Sep 2019 19:53:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IJrwfv047118; Wed, 18 Sep 2019 19:53:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909181953.x8IJrwfv047118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 18 Sep 2019 19:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r352494 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: kib X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 352494 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 19:53:59 -0000 Author: kib Date: Wed Sep 18 19:53:58 2019 New Revision: 352494 URL: https://svnweb.freebsd.org/changeset/base/352494 Log: Release dougm. Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Wed Sep 18 19:33:08 2019 (r352493) +++ svnadmin/conf/mentors Wed Sep 18 19:53:58 2019 (r352494) @@ -16,7 +16,6 @@ bdragon jhibbits brd allanjude Co-mentor: bapt chs imp def pjd -dougm kib Co-mentor: markj gordon delphij Co-mentor: emaste jceel trasz jkh rwatson From owner-svn-src-all@freebsd.org Wed Sep 18 21:00: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 2AE0C126B16; Wed, 18 Sep 2019 21:00:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YXSK0Jw4z3Gb8; Wed, 18 Sep 2019 21:00:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E259E2904; Wed, 18 Sep 2019 21:00:32 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IL0W7U083146; Wed, 18 Sep 2019 21:00:32 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IL0WwD083145; Wed, 18 Sep 2019 21:00:32 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201909182100.x8IL0WwD083145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 18 Sep 2019 21:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352495 - head/tests/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/tests/sys/vm X-SVN-Commit-Revision: 352495 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 21:00:33 -0000 Author: jilles Date: Wed Sep 18 21:00:32 2019 New Revision: 352495 URL: https://svnweb.freebsd.org/changeset/base/352495 Log: Add some tests for page fault signals and codes It is useful to have some tests for page fault signals. More tests would be useful but creating the conditions (such as various kinds of running out of memory and I/O errors) is more complicated. The tests page_fault_signal__bus_objerr_1 and page_fault_signal__bus_objerr_2 depend on https://reviews.freebsd.org/D21566 before they can pass. PR: 211924 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D21624 Added: head/tests/sys/vm/page_fault_signal.c (contents, props changed) Modified: head/tests/sys/vm/Makefile Modified: head/tests/sys/vm/Makefile ============================================================================== --- head/tests/sys/vm/Makefile Wed Sep 18 19:53:58 2019 (r352494) +++ head/tests/sys/vm/Makefile Wed Sep 18 21:00:32 2019 (r352495) @@ -5,6 +5,7 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/vm ATF_TESTS_C+= mlock_test \ - mmap_test + mmap_test \ + page_fault_signal .include Added: head/tests/sys/vm/page_fault_signal.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/vm/page_fault_signal.c Wed Sep 18 21:00:32 2019 (r352495) @@ -0,0 +1,184 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Jilles Tjoelker + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include +#include + +static sigjmp_buf sig_env; +static volatile int last_sig, last_code; + +static void +sighandler(int sig, siginfo_t *info, void *context __unused) +{ + + last_sig = sig; + last_code = info->si_code; + siglongjmp(sig_env, 1); +} + +static void +setup_signals(void) +{ + struct sigaction sa; + int r; + + sa.sa_sigaction = sighandler; + sa.sa_flags = SA_RESTART | SA_RESETHAND | SA_SIGINFO; + r = sigfillset(&sa.sa_mask); + ATF_REQUIRE(r != -1); + r = sigaction(SIGILL, &sa, NULL); + ATF_REQUIRE(r != -1); + r = sigaction(SIGBUS, &sa, NULL); + ATF_REQUIRE(r != -1); + r = sigaction(SIGSEGV, &sa, NULL); + ATF_REQUIRE(r != -1); +} + +ATF_TC_WITHOUT_HEAD(page_fault_signal__segv_maperr_1); +ATF_TC_BODY(page_fault_signal__segv_maperr_1, tc) +{ + int *p; + int r; + int sz; + + sz = getpagesize(); + p = mmap(NULL, sz, PROT_READ, MAP_ANON, -1, 0); + ATF_REQUIRE(p != MAP_FAILED); + r = munmap(p, sz); + ATF_REQUIRE(r != -1); + if (sigsetjmp(sig_env, 1) == 0) { + setup_signals(); + *(volatile int *)p = 1; + } + ATF_CHECK_EQ(SIGSEGV, last_sig); + ATF_CHECK_EQ(SEGV_MAPERR, last_code); +} + +ATF_TC_WITHOUT_HEAD(page_fault_signal__segv_accerr_1); +ATF_TC_BODY(page_fault_signal__segv_accerr_1, tc) +{ + int *p; + int sz; + + sz = getpagesize(); + p = mmap(NULL, sz, PROT_READ, MAP_ANON, -1, 0); + ATF_REQUIRE(p != MAP_FAILED); + if (sigsetjmp(sig_env, 1) == 0) { + setup_signals(); + *(volatile int *)p = 1; + } + (void)munmap(p, sz); + ATF_CHECK_EQ(SIGSEGV, last_sig); + ATF_CHECK_EQ(SEGV_ACCERR, last_code); +} + +ATF_TC_WITHOUT_HEAD(page_fault_signal__segv_accerr_2); +ATF_TC_BODY(page_fault_signal__segv_accerr_2, tc) +{ + int *p; + volatile int dummy; + int sz; + + sz = getpagesize(); + p = mmap(NULL, sz, PROT_NONE, MAP_ANON, -1, 0); + ATF_REQUIRE(p != MAP_FAILED); + if (sigsetjmp(sig_env, 1) == 0) { + setup_signals(); + dummy = *p; + } + (void)munmap(p, sz); + ATF_CHECK_EQ(SIGSEGV, last_sig); + ATF_CHECK_EQ(SEGV_ACCERR, last_code); +} + +ATF_TC_WITHOUT_HEAD(page_fault_signal__bus_objerr_1); +ATF_TC_BODY(page_fault_signal__bus_objerr_1, tc) +{ + int *p; + int fd; + int sz; + + atf_tc_expect_fail("bug 211924"); + sz = getpagesize(); + fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); + ATF_REQUIRE(fd != -1); + p = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + ATF_REQUIRE(p != MAP_FAILED); + if (sigsetjmp(sig_env, 1) == 0) { + setup_signals(); + *(volatile int *)p = 1; + } + (void)munmap(p, sz); + (void)close(fd); + ATF_CHECK_EQ(SIGBUS, last_sig); + ATF_CHECK_EQ(BUS_OBJERR, last_code); +} + +ATF_TC_WITHOUT_HEAD(page_fault_signal__bus_objerr_2); +ATF_TC_BODY(page_fault_signal__bus_objerr_2, tc) +{ + int *p; + int fd; + int r; + int sz; + + atf_tc_expect_fail("bug 211924"); + sz = getpagesize(); + fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); + ATF_REQUIRE(fd != -1); + r = ftruncate(fd, sz); + ATF_REQUIRE(r != -1); + p = mmap(NULL, sz * 2, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + ATF_REQUIRE(p != MAP_FAILED); + if (sigsetjmp(sig_env, 1) == 0) { + setup_signals(); + ((volatile int *)p)[sz / sizeof(int)] = 1; + } + (void)munmap(p, sz * 2); + (void)close(fd); + ATF_CHECK_EQ(SIGBUS, last_sig); + ATF_CHECK_EQ(BUS_OBJERR, last_code); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, page_fault_signal__segv_maperr_1); + ATF_TP_ADD_TC(tp, page_fault_signal__segv_accerr_1); + ATF_TP_ADD_TC(tp, page_fault_signal__segv_accerr_2); + ATF_TP_ADD_TC(tp, page_fault_signal__bus_objerr_1); + ATF_TP_ADD_TC(tp, page_fault_signal__bus_objerr_2); + + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Wed Sep 18 22:45: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 83E7AE8B21; Wed, 18 Sep 2019 22:45:00 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YZmr3h7Bz3MS9; Wed, 18 Sep 2019 22:45:00 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D15C3F1A; Wed, 18 Sep 2019 22:45:00 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IMj0qj048024; Wed, 18 Sep 2019 22:45:00 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IMixcj048005; Wed, 18 Sep 2019 22:44:59 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182244.x8IMixcj048005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 22:44: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: r352496 - in stable/12/sys: conf dev/acpica x86/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in stable/12/sys: conf dev/acpica x86/acpica X-SVN-Commit-Revision: 352496 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 22:45:00 -0000 Author: jchandra Date: Wed Sep 18 22:44:59 2019 New Revision: 352496 URL: https://svnweb.freebsd.org/changeset/base/352496 Log: MFC r341741-r341742 r341741: x86/acpica/srat.c: Add API for parsing proximity tables The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on systems that use UEFI/ACPI firmware and support NUMA. To do this, we need to move most of the logic of x86/acpica/srat.c to dev/acpica and provide an API that architectures can use to parse and configure ACPI NUMA information. This commit adds the API in srat.c as a first step, without making any functional changes. We will move the common code to sys/dev/acpica as the next step. The functions added are: * int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and initialize data structures used * void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and memory proximity information * void acpi_pxm_set_mem_locality(void) - use the saved data to set memory locality * void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu locality * void acpi_pxm_free(void) - free data structures allocated by init On arm64, we do not have an cpu APIC id that can be used as index to store CPU data, we need to use the Processor Uid. To help with this, define internal functions cpu_add, cpu_find, cpu_get_info to store and get CPU proximity information. Reviewed by: markj, jhb (previous version) Differential Revision: https://reviews.freebsd.org/D17940 r341742: acpica : move SRAT/SLIT parsing to sys/dev/acpica This moves the architecture independent parts of sys/x86/acpica/srat.c to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function declarations are moved to sys/dev/acpica/acpivar.h We also need to update sys/conf/files.{i386,amd64} to use the new file. No functional changes. Reviewed by: markj, imp Differential Revision: https://reviews.freebsd.org/D17941 Added: stable/12/sys/dev/acpica/acpi_pxm.c - copied unchanged from r341742, head/sys/dev/acpica/acpi_pxm.c Modified: stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/dev/acpica/acpivar.h stable/12/sys/x86/acpica/srat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Wed Sep 18 21:00:32 2019 (r352495) +++ stable/12/sys/conf/files.amd64 Wed Sep 18 22:44:59 2019 (r352496) @@ -208,6 +208,7 @@ dev/acpica/acpi_pci_link.c optional acpi pci dev/acpica/acpi_pcib.c optional acpi pci dev/acpica/acpi_pcib_acpi.c optional acpi pci dev/acpica/acpi_pcib_pci.c optional acpi pci +dev/acpica/acpi_pxm.c optional acpi dev/acpica/acpi_timer.c optional acpi dev/acpi_support/acpi_wmi_if.m standard dev/agp/agp_amd64.c optional agp Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Wed Sep 18 21:00:32 2019 (r352495) +++ stable/12/sys/conf/files.i386 Wed Sep 18 22:44:59 2019 (r352496) @@ -342,6 +342,7 @@ dev/vmware/vmci/vmci_resource.c optional vmci dev/acpica/acpi_if.m standard dev/acpica/acpi_hpet.c optional acpi dev/acpica/acpi_timer.c optional acpi +dev/acpica/acpi_pxm.c optional acpi dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd dev/isci/isci.c optional isci Copied: stable/12/sys/dev/acpica/acpi_pxm.c (from r341742, head/sys/dev/acpica/acpi_pxm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/acpica/acpi_pxm.c Wed Sep 18 22:44:59 2019 (r352496, copy of r341742, head/sys/dev/acpica/acpi_pxm.c) @@ -0,0 +1,649 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2010 Hudson River Trading LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_vm.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#if MAXMEMDOM > 1 +static struct cpu_info { + int enabled:1; + int has_memory:1; + int domain; +} *cpus; + +static int max_cpus; +static int last_cpu; + +struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; +int num_mem; + +static ACPI_TABLE_SRAT *srat; +static vm_paddr_t srat_physaddr; + +static int domain_pxm[MAXMEMDOM]; +static int ndomain; +static vm_paddr_t maxphyaddr; + +static ACPI_TABLE_SLIT *slit; +static vm_paddr_t slit_physaddr; +static int vm_locality_table[MAXMEMDOM * MAXMEMDOM]; + +static void srat_walk_table(acpi_subtable_handler *handler, void *arg); + +/* + * SLIT parsing. + */ + +static void +slit_parse_table(ACPI_TABLE_SLIT *s) +{ + int i, j; + int i_domain, j_domain; + int offset = 0; + uint8_t e; + + /* + * This maps the SLIT data into the VM-domain centric view. + * There may be sparse entries in the PXM namespace, so + * remap them to a VM-domain ID and if it doesn't exist, + * skip it. + * + * It should result in a packed 2d array of VM-domain + * locality information entries. + */ + + if (bootverbose) + printf("SLIT.Localities: %d\n", (int) s->LocalityCount); + for (i = 0; i < s->LocalityCount; i++) { + i_domain = acpi_map_pxm_to_vm_domainid(i); + if (i_domain < 0) + continue; + + if (bootverbose) + printf("%d: ", i); + for (j = 0; j < s->LocalityCount; j++) { + j_domain = acpi_map_pxm_to_vm_domainid(j); + if (j_domain < 0) + continue; + e = s->Entry[i * s->LocalityCount + j]; + if (bootverbose) + printf("%d ", (int) e); + /* 255 == "no locality information" */ + if (e == 255) + vm_locality_table[offset] = -1; + else + vm_locality_table[offset] = e; + offset++; + } + if (bootverbose) + printf("\n"); + } +} + +/* + * Look for an ACPI System Locality Distance Information Table ("SLIT") + */ +static int +parse_slit(void) +{ + + if (resource_disabled("slit", 0)) { + return (-1); + } + + slit_physaddr = acpi_find_table(ACPI_SIG_SLIT); + if (slit_physaddr == 0) { + return (-1); + } + + /* + * Make a pass over the table to populate the cpus[] and + * mem_info[] tables. + */ + slit = acpi_map_table(slit_physaddr, ACPI_SIG_SLIT); + slit_parse_table(slit); + acpi_unmap_table(slit); + slit = NULL; + + return (0); +} + +/* + * SRAT parsing. + */ + +/* + * Returns true if a memory range overlaps with at least one range in + * phys_avail[]. + */ +static int +overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) +{ + int i; + + for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { + if (phys_avail[i + 1] <= start) + continue; + if (phys_avail[i] < end) + return (1); + break; + } + return (0); +} + +/* + * Find CPU by processor ID (APIC ID on x86). + */ +static struct cpu_info * +cpu_find(int cpuid) +{ + + if (cpuid <= last_cpu && cpus[cpuid].enabled) + return (&cpus[cpuid]); + return (NULL); +} + +/* + * Find CPU by pcpu pointer. + */ +static struct cpu_info * +cpu_get_info(struct pcpu *pc) +{ + struct cpu_info *cpup; + int id; + + id = pc->pc_apic_id; + cpup = cpu_find(id); + if (cpup == NULL) + panic("SRAT: CPU with APIC ID %u is not known", id); + return (cpup); +} + +/* + * Add proximity information for a new CPU. + */ +static struct cpu_info * +cpu_add(int cpuid, int domain) +{ + struct cpu_info *cpup; + + if (cpuid >= max_cpus) + return (NULL); + last_cpu = imax(last_cpu, cpuid); + cpup = &cpus[cpuid]; + cpup->domain = domain; + cpup->enabled = 1; + return (cpup); +} + +static void +srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_SRAT_CPU_AFFINITY *cpu; + ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; + ACPI_SRAT_MEM_AFFINITY *mem; + static struct cpu_info *cpup; + int domain, i, slot; + + switch (entry->Type) { + case ACPI_SRAT_TYPE_CPU_AFFINITY: + cpu = (ACPI_SRAT_CPU_AFFINITY *)entry; + domain = cpu->ProximityDomainLo | + cpu->ProximityDomainHi[0] << 8 | + cpu->ProximityDomainHi[1] << 16 | + cpu->ProximityDomainHi[2] << 24; + if (bootverbose) + printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", + cpu->ApicId, domain, + (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? + "enabled" : "disabled"); + if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) + break; + cpup = cpu_find(cpu->ApicId); + if (cpup != NULL) { + printf("SRAT: Duplicate local APIC ID %u\n", + cpu->ApicId); + *(int *)arg = ENXIO; + break; + } + cpup = cpu_add(cpu->ApicId, domain); + if (cpup == NULL) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + cpu->ApicId); + break; + case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: + x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; + if (bootverbose) + printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", + x2apic->ApicId, x2apic->ProximityDomain, + (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? + "enabled" : "disabled"); + if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) + break; + KASSERT(cpu_find(x2apic->ApicId) == NULL, + ("Duplicate local APIC ID %u", x2apic->ApicId)); + cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); + if (cpup == NULL) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + x2apic->ApicId); + break; + case ACPI_SRAT_TYPE_MEMORY_AFFINITY: + mem = (ACPI_SRAT_MEM_AFFINITY *)entry; + if (bootverbose) + printf( + "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", + mem->ProximityDomain, (uintmax_t)mem->BaseAddress, + (uintmax_t)mem->Length, + (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? + "enabled" : "disabled"); + if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) + break; + if (mem->BaseAddress >= maxphyaddr || + !overlaps_phys_avail(mem->BaseAddress, + mem->BaseAddress + mem->Length)) { + printf("SRAT: Ignoring memory at addr 0x%jx\n", + (uintmax_t)mem->BaseAddress); + break; + } + if (num_mem == VM_PHYSSEG_MAX) { + printf("SRAT: Too many memory regions\n"); + *(int *)arg = ENXIO; + break; + } + slot = num_mem; + for (i = 0; i < num_mem; i++) { + if (mem_info[i].end <= mem->BaseAddress) + continue; + if (mem_info[i].start < + (mem->BaseAddress + mem->Length)) { + printf("SRAT: Overlapping memory entries\n"); + *(int *)arg = ENXIO; + return; + } + slot = i; + } + for (i = num_mem; i > slot; i--) + mem_info[i] = mem_info[i - 1]; + mem_info[slot].start = mem->BaseAddress; + mem_info[slot].end = mem->BaseAddress + mem->Length; + mem_info[slot].domain = mem->ProximityDomain; + num_mem++; + break; + } +} + +/* + * Ensure each memory domain has at least one CPU and that each CPU + * has at least one memory domain. + */ +static int +check_domains(void) +{ + int found, i, j; + + for (i = 0; i < num_mem; i++) { + found = 0; + for (j = 0; j <= last_cpu; j++) + if (cpus[j].enabled && + cpus[j].domain == mem_info[i].domain) { + cpus[j].has_memory = 1; + found++; + } + if (!found) { + printf("SRAT: No CPU found for memory domain %d\n", + mem_info[i].domain); + return (ENXIO); + } + } + for (i = 0; i <= last_cpu; i++) + if (cpus[i].enabled && !cpus[i].has_memory) { + found = 0; + for (j = 0; j < num_mem && !found; j++) { + if (mem_info[j].domain == cpus[i].domain) + found = 1; + } + if (!found) { + if (bootverbose) + printf("SRAT: mem dom %d is empty\n", + cpus[i].domain); + mem_info[num_mem].start = 0; + mem_info[num_mem].end = 0; + mem_info[num_mem].domain = cpus[i].domain; + num_mem++; + } + } + return (0); +} + +/* + * Check that the SRAT memory regions cover all of the regions in + * phys_avail[]. + */ +static int +check_phys_avail(void) +{ + vm_paddr_t address; + int i, j; + + /* j is the current offset into phys_avail[]. */ + address = phys_avail[0]; + j = 0; + for (i = 0; i < num_mem; i++) { + /* + * Consume as many phys_avail[] entries as fit in this + * region. + */ + while (address >= mem_info[i].start && + address <= mem_info[i].end) { + /* + * If we cover the rest of this phys_avail[] entry, + * advance to the next entry. + */ + if (phys_avail[j + 1] <= mem_info[i].end) { + j += 2; + if (phys_avail[j] == 0 && + phys_avail[j + 1] == 0) { + return (0); + } + address = phys_avail[j]; + } else + address = mem_info[i].end + 1; + } + } + printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", + (uintmax_t)phys_avail[j], (uintmax_t)phys_avail[j + 1]); + return (ENXIO); +} + +/* + * Renumber the memory domains to be compact and zero-based if not + * already. Returns an error if there are too many domains. + */ +static int +renumber_domains(void) +{ + int i, j, slot; + + /* Enumerate all the domains. */ + ndomain = 0; + for (i = 0; i < num_mem; i++) { + /* See if this domain is already known. */ + for (j = 0; j < ndomain; j++) { + if (domain_pxm[j] >= mem_info[i].domain) + break; + } + if (j < ndomain && domain_pxm[j] == mem_info[i].domain) + continue; + + if (ndomain >= MAXMEMDOM) { + ndomain = 1; + printf("SRAT: Too many memory domains\n"); + return (EFBIG); + } + + /* Insert the new domain at slot 'j'. */ + slot = j; + for (j = ndomain; j > slot; j--) + domain_pxm[j] = domain_pxm[j - 1]; + domain_pxm[slot] = mem_info[i].domain; + ndomain++; + } + + /* Renumber each domain to its index in the sorted 'domain_pxm' list. */ + for (i = 0; i < ndomain; i++) { + /* + * If the domain is already the right value, no need + * to renumber. + */ + if (domain_pxm[i] == i) + continue; + + /* Walk the cpu[] and mem_info[] arrays to renumber. */ + for (j = 0; j < num_mem; j++) + if (mem_info[j].domain == domain_pxm[i]) + mem_info[j].domain = i; + for (j = 0; j <= last_cpu; j++) + if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) + cpus[j].domain = i; + } + + return (0); +} + +/* + * Look for an ACPI System Resource Affinity Table ("SRAT"), + * allocate space for cpu information, and initialize globals. + */ +int +acpi_pxm_init(int ncpus, vm_paddr_t maxphys) +{ + unsigned int idx, size; + vm_paddr_t addr; + + if (resource_disabled("srat", 0)) + return (-1); + + max_cpus = ncpus; + last_cpu = -1; + maxphyaddr = maxphys; + srat_physaddr = acpi_find_table(ACPI_SIG_SRAT); + if (srat_physaddr == 0) + return (-1); + + /* + * Allocate data structure: + * + * Find the last physical memory region and steal some memory from + * it. This is done because at this point in the boot process + * malloc is still not usable. + */ + for (idx = 0; phys_avail[idx + 1] != 0; idx += 2); + KASSERT(idx != 0, ("phys_avail is empty!")); + idx -= 2; + + size = sizeof(*cpus) * max_cpus; + addr = trunc_page(phys_avail[idx + 1] - size); + KASSERT(addr >= phys_avail[idx], + ("Not enough memory for SRAT table items")); + phys_avail[idx + 1] = addr - 1; + + /* + * We cannot rely on PHYS_TO_DMAP because this code is also used in + * i386, so use pmap_mapbios to map the memory, this will end up using + * the default memory attribute (WB), and the DMAP when available. + */ + cpus = (struct cpu_info *)pmap_mapbios(addr, size); + bzero(cpus, size); + return (0); +} + +static int +parse_srat(void) +{ + int error; + + /* + * Make a pass over the table to populate the cpus[] and + * mem_info[] tables. + */ + srat = acpi_map_table(srat_physaddr, ACPI_SIG_SRAT); + error = 0; + srat_walk_table(srat_parse_entry, &error); + acpi_unmap_table(srat); + srat = NULL; + if (error || check_domains() != 0 || check_phys_avail() != 0 || + renumber_domains() != 0) { + srat_physaddr = 0; + return (-1); + } + + return (0); +} + +static void +init_mem_locality(void) +{ + int i; + + /* + * For now, assume -1 == "no locality information for + * this pairing. + */ + for (i = 0; i < MAXMEMDOM * MAXMEMDOM; i++) + vm_locality_table[i] = -1; +} + +/* + * Parse SRAT and SLIT to save proximity info. Don't do + * anything if SRAT is not available. + */ +void +acpi_pxm_parse_tables(void) +{ + + if (srat_physaddr == 0) + return; + if (parse_srat() < 0) + return; + init_mem_locality(); + (void)parse_slit(); +} + +/* + * Use saved data from SRAT/SLIT to update memory locality. + */ +void +acpi_pxm_set_mem_locality(void) +{ + + if (srat_physaddr == 0) + return; + vm_phys_register_domains(ndomain, mem_info, vm_locality_table); +} + +static void +srat_walk_table(acpi_subtable_handler *handler, void *arg) +{ + + acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, + handler, arg); +} + +/* + * Setup per-CPU domain IDs from information saved in 'cpus'. + */ +void +acpi_pxm_set_cpu_locality(void) +{ + struct cpu_info *cpu; + struct pcpu *pc; + u_int i; + + if (srat_physaddr == 0) + return; + for (i = 0; i < MAXCPU; i++) { + if (CPU_ABSENT(i)) + continue; + pc = pcpu_find(i); + KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); + cpu = cpu_get_info(pc); + pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; + CPU_SET(i, &cpuset_domain[pc->pc_domain]); + if (bootverbose) + printf("SRAT: CPU %u has memory domain %d\n", i, + pc->pc_domain); + } +} + +/* + * Free data structures allocated during acpi_pxm_init. + */ +void +acpi_pxm_free(void) +{ + + if (srat_physaddr == 0) + return; + pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); + srat_physaddr = 0; + cpus = NULL; +} + +/* + * Map a _PXM value to a VM domain ID. + * + * Returns the domain ID, or -1 if no domain ID was found. + */ +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + int i; + + for (i = 0; i < ndomain; i++) { + if (domain_pxm[i] == pxm) + return (vm_ndomains > 1 ? i : 0); + } + + return (-1); +} + +#else /* MAXMEMDOM == 1 */ + +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + + return (-1); +} + +#endif /* MAXMEMDOM > 1 */ Modified: stable/12/sys/dev/acpica/acpivar.h ============================================================================== --- stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 21:00:32 2019 (r352495) +++ stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 22:44:59 2019 (r352496) @@ -522,6 +522,15 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDLE scope, ACPI_ SYSCTL_DECL(_debug_acpi); /* + * Parse and use proximity information in SRAT and SLIT. + */ +int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); +void acpi_pxm_parse_tables(void); +void acpi_pxm_set_mem_locality(void); +void acpi_pxm_set_cpu_locality(void); +void acpi_pxm_free(void); + +/* * Map a PXM to a VM domain. * * Returns the VM domain ID if found, or -1 if not found / invalid. Modified: stable/12/sys/x86/acpica/srat.c ============================================================================== --- stable/12/sys/x86/acpica/srat.c Wed Sep 18 21:00:32 2019 (r352495) +++ stable/12/sys/x86/acpica/srat.c Wed Sep 18 22:44:59 2019 (r352496) @@ -36,543 +36,33 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include #include -#include #include #if MAXMEMDOM > 1 -static struct cpu_info { - int enabled:1; - int has_memory:1; - int domain; -} *cpus; -struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; -int num_mem; - -static ACPI_TABLE_SRAT *srat; -static vm_paddr_t srat_physaddr; - -static int domain_pxm[MAXMEMDOM]; -static int ndomain; - -static ACPI_TABLE_SLIT *slit; -static vm_paddr_t slit_physaddr; -static int vm_locality_table[MAXMEMDOM * MAXMEMDOM]; - -static void srat_walk_table(acpi_subtable_handler *handler, void *arg); - -/* - * SLIT parsing. - */ - static void -slit_parse_table(ACPI_TABLE_SLIT *s) -{ - int i, j; - int i_domain, j_domain; - int offset = 0; - uint8_t e; - - /* - * This maps the SLIT data into the VM-domain centric view. - * There may be sparse entries in the PXM namespace, so - * remap them to a VM-domain ID and if it doesn't exist, - * skip it. - * - * It should result in a packed 2d array of VM-domain - * locality information entries. - */ - - if (bootverbose) - printf("SLIT.Localities: %d\n", (int) s->LocalityCount); - for (i = 0; i < s->LocalityCount; i++) { - i_domain = acpi_map_pxm_to_vm_domainid(i); - if (i_domain < 0) - continue; - - if (bootverbose) - printf("%d: ", i); - for (j = 0; j < s->LocalityCount; j++) { - j_domain = acpi_map_pxm_to_vm_domainid(j); - if (j_domain < 0) - continue; - e = s->Entry[i * s->LocalityCount + j]; - if (bootverbose) - printf("%d ", (int) e); - /* 255 == "no locality information" */ - if (e == 255) - vm_locality_table[offset] = -1; - else - vm_locality_table[offset] = e; - offset++; - } - if (bootverbose) - printf("\n"); - } -} - -/* - * Look for an ACPI System Locality Distance Information Table ("SLIT") - */ -static int -parse_slit(void) -{ - - if (resource_disabled("slit", 0)) { - return (-1); - } - - slit_physaddr = acpi_find_table(ACPI_SIG_SLIT); - if (slit_physaddr == 0) { - return (-1); - } - - /* - * Make a pass over the table to populate the cpus[] and - * mem_info[] tables. - */ - slit = acpi_map_table(slit_physaddr, ACPI_SIG_SLIT); - slit_parse_table(slit); - acpi_unmap_table(slit); - slit = NULL; - - return (0); -} - -/* - * SRAT parsing. - */ - -/* - * Returns true if a memory range overlaps with at least one range in - * phys_avail[]. - */ -static int -overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) -{ - int i; - - for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { - if (phys_avail[i + 1] <= start) - continue; - if (phys_avail[i] < end) - return (1); - break; - } - return (0); - -} - -static void -srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) -{ - ACPI_SRAT_CPU_AFFINITY *cpu; - ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; - ACPI_SRAT_MEM_AFFINITY *mem; - int domain, i, slot; - - switch (entry->Type) { - case ACPI_SRAT_TYPE_CPU_AFFINITY: - cpu = (ACPI_SRAT_CPU_AFFINITY *)entry; - domain = cpu->ProximityDomainLo | - cpu->ProximityDomainHi[0] << 8 | - cpu->ProximityDomainHi[1] << 16 | - cpu->ProximityDomainHi[2] << 24; - if (bootverbose) - printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", - cpu->ApicId, domain, - (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? - "enabled" : "disabled"); - if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) - break; - if (cpu->ApicId > max_apic_id) { - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - cpu->ApicId); - break; - } - - if (cpus[cpu->ApicId].enabled) { - printf("SRAT: Duplicate local APIC ID %u\n", - cpu->ApicId); - *(int *)arg = ENXIO; - break; - } - cpus[cpu->ApicId].domain = domain; - cpus[cpu->ApicId].enabled = 1; - break; - case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; - if (bootverbose) - printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", - x2apic->ApicId, x2apic->ProximityDomain, - (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? - "enabled" : "disabled"); - if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) - break; - if (x2apic->ApicId > max_apic_id) { - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - x2apic->ApicId); - break; - } - - KASSERT(!cpus[x2apic->ApicId].enabled, - ("Duplicate local APIC ID %u", x2apic->ApicId)); - cpus[x2apic->ApicId].domain = x2apic->ProximityDomain; - cpus[x2apic->ApicId].enabled = 1; - break; - case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - mem = (ACPI_SRAT_MEM_AFFINITY *)entry; - if (bootverbose) - printf( - "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", - mem->ProximityDomain, (uintmax_t)mem->BaseAddress, - (uintmax_t)mem->Length, - (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? - "enabled" : "disabled"); - if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) - break; - if (mem->BaseAddress >= cpu_getmaxphyaddr() || - !overlaps_phys_avail(mem->BaseAddress, - mem->BaseAddress + mem->Length)) { - printf("SRAT: Ignoring memory at addr 0x%jx\n", - (uintmax_t)mem->BaseAddress); - break; - } - if (num_mem == VM_PHYSSEG_MAX) { - printf("SRAT: Too many memory regions\n"); - *(int *)arg = ENXIO; - break; - } - slot = num_mem; - for (i = 0; i < num_mem; i++) { - if (mem_info[i].end <= mem->BaseAddress) - continue; - if (mem_info[i].start < - (mem->BaseAddress + mem->Length)) { - printf("SRAT: Overlapping memory entries\n"); - *(int *)arg = ENXIO; - return; - } - slot = i; - } - for (i = num_mem; i > slot; i--) - mem_info[i] = mem_info[i - 1]; - mem_info[slot].start = mem->BaseAddress; - mem_info[slot].end = mem->BaseAddress + mem->Length; - mem_info[slot].domain = mem->ProximityDomain; - num_mem++; - break; - } -} - -/* - * Ensure each memory domain has at least one CPU and that each CPU - * has at least one memory domain. - */ -static int -check_domains(void) -{ - int found, i, j; - - for (i = 0; i < num_mem; i++) { - found = 0; - for (j = 0; j <= max_apic_id; j++) - if (cpus[j].enabled && - cpus[j].domain == mem_info[i].domain) { - cpus[j].has_memory = 1; - found++; - } - if (!found) { - printf("SRAT: No CPU found for memory domain %d\n", - mem_info[i].domain); - return (ENXIO); - } - } - for (i = 0; i <= max_apic_id; i++) - if (cpus[i].enabled && !cpus[i].has_memory) { - found = 0; - for (j = 0; j < num_mem && !found; j++) { - if (mem_info[j].domain == cpus[i].domain) - found = 1; - } - if (!found) { - if (bootverbose) - printf("SRAT: mem dom %d is empty\n", - cpus[i].domain); - mem_info[num_mem].start = 0; - mem_info[num_mem].end = 0; - mem_info[num_mem].domain = cpus[i].domain; - num_mem++; - } - } - return (0); -} - -/* - * Check that the SRAT memory regions cover all of the regions in - * phys_avail[]. - */ -static int -check_phys_avail(void) -{ - vm_paddr_t address; - int i, j; - - /* j is the current offset into phys_avail[]. */ - address = phys_avail[0]; - j = 0; - for (i = 0; i < num_mem; i++) { - /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 18 22:55: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 86665E8FA4; Wed, 18 Sep 2019 22:55:26 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Yb0t30bfz3N3m; Wed, 18 Sep 2019 22:55:26 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C167414F; Wed, 18 Sep 2019 22:55:26 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IMtPZF054106; Wed, 18 Sep 2019 22:55:25 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IMtP0U054103; Wed, 18 Sep 2019 22:55:25 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182255.x8IMtP0U054103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 22:55: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: r352497 - in stable/12/sys: arm64/acpica arm64/arm64 conf dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in stable/12/sys: arm64/acpica arm64/arm64 conf dev/acpica X-SVN-Commit-Revision: 352497 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 22:55:26 -0000 Author: jchandra Date: Wed Sep 18 22:55:24 2019 New Revision: 352497 URL: https://svnweb.freebsd.org/changeset/base/352497 Log: MFC r341743-r341744 r341743: acpica: support parsing of arm64 affinity in acpi_pxm.c ACPI SRAT table on arm64 uses GICC entries to provide CPU locality information. These entries use an AcpiProcessorUid to identify the CPU (unlike on x86 where the entries have an APIC ID). Update acpi_pxm.c to extend the cpu_add/cpu_find/cpu_get_info functions to handle AcpiProcessorUid. Use the updated functions while parsing ACPI_SRAT_GICC_AFFINITY entry for arm64. Also update sys/conf/files.arm64 to build acpi_pxm.c when ACPI is enabled. Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D17942 r341744: arm64: add ACPI based NUMA support Use the newly defined SRAT/SLIT parsing APIs in arm64 to support ACPI based NUMA. Reviewed by: markj Modified: stable/12/sys/arm64/acpica/acpi_machdep.c stable/12/sys/arm64/arm64/mp_machdep.c stable/12/sys/conf/files.arm64 stable/12/sys/dev/acpica/acpi_pxm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/arm64/acpica/acpi_machdep.c Wed Sep 18 22:44:59 2019 (r352496) +++ stable/12/sys/arm64/acpica/acpi_machdep.c Wed Sep 18 22:55:24 2019 (r352497) @@ -233,3 +233,16 @@ acpi_map_addr(struct acpi_generic_address *addr, bus_s return (bus_space_map(*tag, phys, size, 0, handle)); } + +#if MAXMEMDOM > 1 +static void +parse_pxm_tables(void *dummy) +{ + + acpi_pxm_init(MAXCPU, (vm_paddr_t)1 << 40); + acpi_pxm_parse_tables(); + acpi_pxm_set_mem_locality(); +} +SYSINIT(parse_pxm_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_pxm_tables, + NULL); +#endif Modified: stable/12/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/mp_machdep.c Wed Sep 18 22:44:59 2019 (r352496) +++ stable/12/sys/arm64/arm64/mp_machdep.c Wed Sep 18 22:55:24 2019 (r352497) @@ -520,13 +520,15 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_MADT_GENERIC_INTERRUPT *intr; u_int *cpuid; + u_int id; switch(entry->Type) { case ACPI_MADT_TYPE_GENERIC_INTERRUPT: intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; cpuid = arg; - - start_cpu((*cpuid), intr->ArmMpidr); + id = *cpuid; + start_cpu(id, intr->ArmMpidr); + __pcpu[id].pc_acpi_id = intr->Uid; (*cpuid)++; break; default: @@ -556,6 +558,12 @@ cpu_init_acpi(void) madt_handler, &cpuid); acpi_unmap_table(madt); + +#if MAXMEMDOM > 1 + /* set proximity info */ + acpi_pxm_set_cpu_locality(); + acpi_pxm_free(); +#endif } #endif Modified: stable/12/sys/conf/files.arm64 ============================================================================== --- stable/12/sys/conf/files.arm64 Wed Sep 18 22:44:59 2019 (r352496) +++ stable/12/sys/conf/files.arm64 Wed Sep 18 22:55:24 2019 (r352497) @@ -203,6 +203,7 @@ dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi dev/acpica/acpi_pci_link.c optional acpi pci dev/acpica/acpi_pcib.c optional acpi pci +dev/acpica/acpi_pxm.c optional acpi dev/ahci/ahci_generic.c optional ahci dev/axgbe/if_axgbe.c optional axgbe dev/axgbe/xgbe-desc.c optional axgbe Modified: stable/12/sys/dev/acpica/acpi_pxm.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pxm.c Wed Sep 18 22:44:59 2019 (r352496) +++ stable/12/sys/dev/acpica/acpi_pxm.c Wed Sep 18 22:55:24 2019 (r352497) @@ -59,6 +59,7 @@ static struct cpu_info { int enabled:1; int has_memory:1; int domain; + int id; } *cpus; static int max_cpus; @@ -182,14 +183,33 @@ overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) } /* - * Find CPU by processor ID (APIC ID on x86). + * On x86 we can use the cpuid to index the cpus array, but on arm64 + * we have an ACPI Processor UID with a larger range. + * + * Use this variable to indicate if the cpus can be stored by index. */ +#ifdef __aarch64__ +static const int cpus_use_indexing = 0; +#else +static const int cpus_use_indexing = 1; +#endif + +/* + * Find CPU by processor ID (APIC ID on x86, Processor UID on arm64) + */ static struct cpu_info * cpu_find(int cpuid) { + int i; - if (cpuid <= last_cpu && cpus[cpuid].enabled) - return (&cpus[cpuid]); + if (cpus_use_indexing) { + if (cpuid <= last_cpu && cpus[cpuid].enabled) + return (&cpus[cpuid]); + } else { + for (i = 0; i <= last_cpu; i++) + if (cpus[i].id == cpuid) + return (&cpus[i]); + } return (NULL); } @@ -202,10 +222,14 @@ cpu_get_info(struct pcpu *pc) struct cpu_info *cpup; int id; +#ifdef __aarch64__ + id = pc->pc_acpi_id; +#else id = pc->pc_apic_id; +#endif cpup = cpu_find(id); if (cpup == NULL) - panic("SRAT: CPU with APIC ID %u is not known", id); + panic("SRAT: CPU with ID %u is not known", id); return (cpup); } @@ -217,11 +241,18 @@ cpu_add(int cpuid, int domain) { struct cpu_info *cpup; - if (cpuid >= max_cpus) - return (NULL); - last_cpu = imax(last_cpu, cpuid); - cpup = &cpus[cpuid]; + if (cpus_use_indexing) { + if (cpuid >= max_cpus) + return (NULL); + last_cpu = imax(last_cpu, cpuid); + cpup = &cpus[cpuid]; + } else { + if (last_cpu >= max_cpus - 1) + return (NULL); + cpup = &cpus[++last_cpu]; + } cpup->domain = domain; + cpup->id = cpuid; cpup->enabled = 1; return (cpup); } @@ -232,6 +263,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; ACPI_SRAT_MEM_AFFINITY *mem; + ACPI_SRAT_GICC_AFFINITY *gicc; static struct cpu_info *cpup; int domain, i, slot; @@ -276,6 +308,22 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar if (cpup == NULL) printf("SRAT: Ignoring local APIC ID %u (too high)\n", x2apic->ApicId); + break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + gicc = (ACPI_SRAT_GICC_AFFINITY *)entry; + if (bootverbose) + printf("SRAT: Found CPU UID %u domain %d: %s\n", + gicc->AcpiProcessorUid, gicc->ProximityDomain, + (gicc->Flags & ACPI_SRAT_GICC_ENABLED) ? + "enabled" : "disabled"); + if (!(gicc->Flags & ACPI_SRAT_GICC_ENABLED)) + break; + KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL, + ("Duplicate CPU UID %u", gicc->AcpiProcessorUid)); + cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain); + if (cpup == NULL) + printf("SRAT: Ignoring CPU UID %u (too high)\n", + gicc->AcpiProcessorUid); break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: mem = (ACPI_SRAT_MEM_AFFINITY *)entry; From owner-svn-src-all@freebsd.org Wed Sep 18 23:08: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 E9CBDE954B; Wed, 18 Sep 2019 23:08:52 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YbJN6hQvz3Nj2; Wed, 18 Sep 2019 23:08:52 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C49C04314; Wed, 18 Sep 2019 23:08:52 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8IN8q8B059935; Wed, 18 Sep 2019 23:08:52 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8IN8p96059928; Wed, 18 Sep 2019 23:08:51 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182308.x8IN8p96059928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352498 - in stable/12/sys: arm64/acpica arm64/arm64 conf dev/acpica dev/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in stable/12/sys: arm64/acpica arm64/arm64 conf dev/acpica dev/pci X-SVN-Commit-Revision: 352498 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:08:53 -0000 Author: jchandra Date: Wed Sep 18 23:08:51 2019 New Revision: 352498 URL: https://svnweb.freebsd.org/changeset/base/352498 Log: MFC r343853, r343856, r343860 r343853: arm64 acpi: Add support for IORT table Add new file arm64/acpica/acpi_iort.c to support the "IO Remapping Table" (IORT). The table is specified in ARM document "ARM DEN 0049D" titled "IO Remapping Table Platform Design Document". The IORT table has information on the associations between PCI root complexes, SMMU blocks and GIC ITS blocks in the system. The changes are to parse and save the information in the IORT table. The API to use this information is added to sys/dev/acpica/acpivar.h. The acpi_iort.c also has code to check the GIC ITS nodes seen in the IORT table with corresponding entries in MADT table (for validity) and with entries in SRAT table (for proximity information). Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D18002 r343856: arm64 gicv3: add IORT and NUMA support acpi_iort.c has added support to query GIC proximity and MSI XREF ID for GIC ITS blocks. Use this when GIC ITS blocks are initialized from ACPI. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D18003 r343860: pci_host_generic_acpi: use IORT data for MSI/MSI-X Use the information from IORT parsing to translate the PCI RID to GIC ITS device ID. And similarly, use the information to find the PIC XREF identifier to be used for PCI devices. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D18004 Added: stable/12/sys/arm64/acpica/acpi_iort.c - copied unchanged from r343853, head/sys/arm64/acpica/acpi_iort.c Modified: stable/12/sys/arm64/arm64/gic_v3_acpi.c stable/12/sys/arm64/arm64/gic_v3_var.h stable/12/sys/arm64/arm64/gicv3_its.c stable/12/sys/conf/files.arm64 stable/12/sys/dev/acpica/acpivar.h stable/12/sys/dev/pci/pci_host_generic_acpi.c Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/arm64/acpica/acpi_iort.c (from r343853, head/sys/arm64/acpica/acpi_iort.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/arm64/acpica/acpi_iort.c Wed Sep 18 23:08:51 2019 (r352498, copy of r343853, head/sys/arm64/acpica/acpi_iort.c) @@ -0,0 +1,502 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2018 Marvell International Ltd. + * + * Author: Jayachandran C Nair + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_acpi.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +/* + * Track next XREF available for ITS groups. + */ +static u_int acpi_its_xref = ACPI_MSI_XREF; + +/* + * Some types of IORT nodes have a set of mappings. Each of them map + * a range of device IDs [base..end] from the current node to another + * node. The corresponding device IDs on destination node starts at + * outbase. + */ +struct iort_map_entry { + u_int base; + u_int end; + u_int outbase; + u_int flags; + u_int out_node_offset; + struct iort_node *out_node; +}; + +/* + * The ITS group node does not have any outgoing mappings. It has a + * of a list of GIC ITS blocks which can handle the device ID. We + * will store the PIC XREF used by the block and the blocks proximity + * data here, so that it can be retrieved together. + */ +struct iort_its_entry { + u_int its_id; + u_int xref; + int pxm; +}; + +/* + * IORT node. Each node has some device specific data depending on the + * type of the node. The node can also have a set of mappings, OR in + * case of ITS group nodes a set of ITS entries. + * The nodes are kept in a TAILQ by type. + */ +struct iort_node { + TAILQ_ENTRY(iort_node) next; /* next entry with same type */ + enum AcpiIortNodeType type; /* ACPI type */ + u_int node_offset; /* offset in IORT - node ID */ + u_int nentries; /* items in array below */ + u_int usecount; /* for bookkeeping */ + union { + ACPI_IORT_ROOT_COMPLEX pci_rc; /* PCI root complex */ + ACPI_IORT_SMMU smmu; + ACPI_IORT_SMMU_V3 smmu_v3; + } data; + union { + struct iort_map_entry *mappings; /* node mappings */ + struct iort_its_entry *its; /* ITS IDs array */ + } entries; +}; + +/* Lists for each of the types. */ +static TAILQ_HEAD(, iort_node) pci_nodes = TAILQ_HEAD_INITIALIZER(pci_nodes); +static TAILQ_HEAD(, iort_node) smmu_nodes = TAILQ_HEAD_INITIALIZER(smmu_nodes); +static TAILQ_HEAD(, iort_node) its_groups = TAILQ_HEAD_INITIALIZER(its_groups); + +/* + * Lookup an ID in the mappings array. If successful, map the input ID + * to the output ID and return the output node found. + */ +static struct iort_node * +iort_entry_lookup(struct iort_node *node, u_int id, u_int *outid) +{ + struct iort_map_entry *entry; + int i; + + entry = node->entries.mappings; + for (i = 0; i < node->nentries; i++, entry++) { + if (entry->base <= id && id <= entry->end) + break; + } + if (i == node->nentries) + return (NULL); + if ((entry->flags & ACPI_IORT_ID_SINGLE_MAPPING) == 0) + *outid = entry->outbase + (id - entry->base); + else + *outid = entry->outbase; + return (entry->out_node); +} + +/* + * Map a PCI RID to a SMMU node or an ITS node, based on outtype. + */ +static struct iort_node * +iort_pci_rc_map(u_int seg, u_int rid, u_int outtype, u_int *outid) +{ + struct iort_node *node, *out_node; + u_int nxtid; + + out_node = NULL; + TAILQ_FOREACH(node, &pci_nodes, next) { + if (node->data.pci_rc.PciSegmentNumber != seg) + continue; + out_node = iort_entry_lookup(node, rid, &nxtid); + if (out_node != NULL) + break; + } + + /* Could not find a PCI RC node with segment and device ID. */ + if (out_node == NULL) + return (NULL); + + /* Node can be SMMU or ITS. If SMMU, we need another lookup. */ + if (outtype == ACPI_IORT_NODE_ITS_GROUP && + (out_node->type == ACPI_IORT_NODE_SMMU_V3 || + out_node->type == ACPI_IORT_NODE_SMMU)) { + out_node = iort_entry_lookup(out_node, nxtid, &nxtid); + if (out_node == NULL) + return (NULL); + } + + KASSERT(out_node->type == outtype, ("mapping fail")); + *outid = nxtid; + return (out_node); +} + +#ifdef notyet +/* + * Not implemented, map a PCIe device to the SMMU it is associated with. + */ +int +acpi_iort_map_smmu(u_int seg, u_int devid, void **smmu, u_int *sid) +{ + /* XXX: convert oref to SMMU device */ + return (ENXIO); +} +#endif + +/* + * Allocate memory for a node, initialize and copy mappings. 'start' + * argument provides the table start used to calculate the node offset. + */ +static void +iort_copy_data(struct iort_node *node, ACPI_IORT_NODE *node_entry) +{ + ACPI_IORT_ID_MAPPING *map_entry; + struct iort_map_entry *mapping; + int i; + + map_entry = ACPI_ADD_PTR(ACPI_IORT_ID_MAPPING, node_entry, + node_entry->MappingOffset); + node->nentries = node_entry->MappingCount; + node->usecount = 0; + mapping = malloc(sizeof(*mapping) * node->nentries, M_DEVBUF, + M_WAITOK | M_ZERO); + node->entries.mappings = mapping; + for (i = 0; i < node->nentries; i++, mapping++, map_entry++) { + mapping->base = map_entry->InputBase; + mapping->end = map_entry->InputBase + map_entry->IdCount - 1; + mapping->outbase = map_entry->OutputBase; + mapping->out_node_offset = map_entry->OutputReference; + mapping->flags = map_entry->Flags; + mapping->out_node = NULL; + } +} + +/* + * Allocate and copy an ITS group. + */ +static void +iort_copy_its(struct iort_node *node, ACPI_IORT_NODE *node_entry) +{ + struct iort_its_entry *its; + ACPI_IORT_ITS_GROUP *itsg_entry; + UINT32 *id; + int i; + + itsg_entry = (ACPI_IORT_ITS_GROUP *)node_entry->NodeData; + node->nentries = itsg_entry->ItsCount; + node->usecount = 0; + its = malloc(sizeof(*its) * node->nentries, M_DEVBUF, M_WAITOK | M_ZERO); + node->entries.its = its; + id = &itsg_entry->Identifiers[0]; + for (i = 0; i < node->nentries; i++, its++, id++) { + its->its_id = *id; + its->pxm = -1; + its->xref = 0; + } +} + +/* + * Walk the IORT table and add nodes to corresponding list. + */ +static void +iort_add_nodes(ACPI_IORT_NODE *node_entry, u_int node_offset) +{ + ACPI_IORT_ROOT_COMPLEX *pci_rc; + ACPI_IORT_SMMU *smmu; + ACPI_IORT_SMMU_V3 *smmu_v3; + struct iort_node *node; + + node = malloc(sizeof(*node), M_DEVBUF, M_WAITOK | M_ZERO); + node->type = node_entry->Type; + node->node_offset = node_offset; + + /* copy nodes depending on type */ + switch(node_entry->Type) { + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: + pci_rc = (ACPI_IORT_ROOT_COMPLEX *)node_entry->NodeData; + memcpy(&node->data.pci_rc, pci_rc, sizeof(*pci_rc)); + iort_copy_data(node, node_entry); + TAILQ_INSERT_TAIL(&pci_nodes, node, next); + break; + case ACPI_IORT_NODE_SMMU: + smmu = (ACPI_IORT_SMMU *)node_entry->NodeData; + memcpy(&node->data.smmu, smmu, sizeof(*smmu)); + iort_copy_data(node, node_entry); + TAILQ_INSERT_TAIL(&smmu_nodes, node, next); + break; + case ACPI_IORT_NODE_SMMU_V3: + smmu_v3 = (ACPI_IORT_SMMU_V3 *)node_entry->NodeData; + memcpy(&node->data.smmu_v3, smmu_v3, sizeof(*smmu_v3)); + iort_copy_data(node, node_entry); + TAILQ_INSERT_TAIL(&smmu_nodes, node, next); + break; + case ACPI_IORT_NODE_ITS_GROUP: + iort_copy_its(node, node_entry); + TAILQ_INSERT_TAIL(&its_groups, node, next); + break; + default: + printf("ACPI: IORT: Dropping unhandled type %u\n", + node_entry->Type); + free(node, M_DEVBUF); + break; + } +} + +/* + * For the mapping entry given, walk thru all the possible destination + * nodes and resolve the output reference. + */ +static void +iort_resolve_node(struct iort_map_entry *entry, int check_smmu) +{ + struct iort_node *node, *np; + + node = NULL; + if (check_smmu) { + TAILQ_FOREACH(np, &smmu_nodes, next) { + if (entry->out_node_offset == np->node_offset) { + node = np; + break; + } + } + } + if (node == NULL) { + TAILQ_FOREACH(np, &its_groups, next) { + if (entry->out_node_offset == np->node_offset) { + node = np; + break; + } + } + } + if (node != NULL) { + node->usecount++; + entry->out_node = node; + } else { + printf("ACPI: IORT: Firmware Bug: no mapping for node %u\n", + entry->out_node_offset); + } +} + +/* + * Resolve all output node references to node pointers. + */ +static void +iort_post_process_mappings(void) +{ + struct iort_node *node; + int i; + + TAILQ_FOREACH(node, &pci_nodes, next) + for (i = 0; i < node->nentries; i++) + iort_resolve_node(&node->entries.mappings[i], TRUE); + TAILQ_FOREACH(node, &smmu_nodes, next) + for (i = 0; i < node->nentries; i++) + iort_resolve_node(&node->entries.mappings[i], FALSE); + /* TODO: named nodes */ +} + +/* + * Walk MADT table, assign PIC xrefs to all ITS entries. + */ +static void +madt_resolve_its_xref(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_GENERIC_TRANSLATOR *gict; + struct iort_node *its_node; + struct iort_its_entry *its_entry; + u_int xref; + int i, matches; + + if (entry->Type != ACPI_MADT_TYPE_GENERIC_TRANSLATOR) + return; + + gict = (ACPI_MADT_GENERIC_TRANSLATOR *)entry; + matches = 0; + xref = acpi_its_xref++; + TAILQ_FOREACH(its_node, &its_groups, next) { + its_entry = its_node->entries.its; + for (i = 0; i < its_node->nentries; i++, its_entry++) { + if (its_entry->its_id == gict->TranslationId) { + its_entry->xref = xref; + matches++; + } + } + } + if (matches == 0) + printf("ACPI: IORT: Unused ITS block, ID %u\n", + gict->TranslationId); +} + +/* + * Walk SRAT, assign proximity to all ITS entries. + */ +static void +srat_resolve_its_pxm(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_SRAT_GIC_ITS_AFFINITY *gicits; + struct iort_node *its_node; + struct iort_its_entry *its_entry; + int i, matches; + + if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY) + return; + + matches = 0; + gicits = (ACPI_SRAT_GIC_ITS_AFFINITY *)entry; + TAILQ_FOREACH(its_node, &its_groups, next) { + its_entry = its_node->entries.its; + for (i = 0; i < its_node->nentries; i++, its_entry++) { + if (its_entry->its_id == gicits->ItsId) { + its_entry->pxm = acpi_map_pxm_to_vm_domainid( + gicits->ProximityDomain); + matches++; + } + } + } + if (matches == 0) + printf("ACPI: IORT: ITS block %u in SRAT not found in IORT!\n", + gicits->ItsId); +} + +/* + * Cross check the ITS Id with MADT and (if available) SRAT. + */ +static int +iort_post_process_its(void) +{ + ACPI_TABLE_MADT *madt; + ACPI_TABLE_SRAT *srat; + vm_paddr_t madt_pa, srat_pa; + + /* Check ITS block in MADT */ + madt_pa = acpi_find_table(ACPI_SIG_MADT); + KASSERT(madt_pa != 0, ("no MADT!")); + madt = acpi_map_table(madt_pa, ACPI_SIG_MADT); + KASSERT(madt != NULL, ("can't map MADT!")); + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + madt_resolve_its_xref, NULL); + acpi_unmap_table(madt); + + /* Get proximtiy if available */ + srat_pa = acpi_find_table(ACPI_SIG_SRAT); + if (srat_pa != 0) { + srat = acpi_map_table(srat_pa, ACPI_SIG_SRAT); + KASSERT(srat != NULL, ("can't map SRAT!")); + acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, + srat_resolve_its_pxm, NULL); + acpi_unmap_table(srat); + } + return (0); +} + +/* + * Find, parse, and save IO Remapping Table ("IORT"). + */ +static int +acpi_parse_iort(void *dummy __unused) +{ + ACPI_TABLE_IORT *iort; + ACPI_IORT_NODE *node_entry; + vm_paddr_t iort_pa; + u_int node_offset; + + iort_pa = acpi_find_table(ACPI_SIG_IORT); + if (iort_pa == 0) + return (ENXIO); + + iort = acpi_map_table(iort_pa, ACPI_SIG_IORT); + if (iort == NULL) { + printf("ACPI: Unable to map the IORT table!\n"); + return (ENXIO); + } + for (node_offset = iort->NodeOffset; + node_offset < iort->Header.Length; + node_offset += node_entry->Length) { + node_entry = ACPI_ADD_PTR(ACPI_IORT_NODE, iort, node_offset); + iort_add_nodes(node_entry, node_offset); + } + acpi_unmap_table(iort); + iort_post_process_mappings(); + iort_post_process_its(); + return (0); +} +SYSINIT(acpi_parse_iort, SI_SUB_DRIVERS, SI_ORDER_FIRST, acpi_parse_iort, NULL); + +/* + * Provide ITS ID to PIC xref mapping. + */ +int +acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm) +{ + struct iort_node *its_node; + struct iort_its_entry *its_entry; + int i; + + TAILQ_FOREACH(its_node, &its_groups, next) { + its_entry = its_node->entries.its; + for (i = 0; i < its_node->nentries; i++, its_entry++) { + if (its_entry->its_id == its_id) { + *xref = its_entry->xref; + *pxm = its_entry->pxm; + return (0); + } + } + } + return (ENOENT); +} + +/* + * Find mapping for a PCIe device given segment and device ID + * returns the XREF for MSI interrupt setup and the device ID to + * use for the interrupt setup + */ +int +acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid) +{ + struct iort_node *node; + + node = iort_pci_rc_map(seg, rid, ACPI_IORT_NODE_ITS_GROUP, devid); + if (node == NULL) + return (ENOENT); + + /* This should be an ITS node */ + KASSERT(node->type == ACPI_IORT_NODE_ITS_GROUP, ("bad group")); + + /* return first node, we don't handle more than that now. */ + *xref = node->entries.its[0].xref; + return (0); +} Modified: stable/12/sys/arm64/arm64/gic_v3_acpi.c ============================================================================== --- stable/12/sys/arm64/arm64/gic_v3_acpi.c Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/arm64/arm64/gic_v3_acpi.c Wed Sep 18 23:08:51 2019 (r352498) @@ -305,6 +305,8 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void struct gic_v3_acpi_devinfo *di; struct gic_v3_softc *sc; device_t child, dev; + u_int xref; + int err, pxm; if (entry->Type == ACPI_MADT_TYPE_GENERIC_TRANSLATOR) { /* We have an ITS, add it as a child */ @@ -321,7 +323,14 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void resource_list_add(&di->di_rl, SYS_RES_MEMORY, 0, gict->BaseAddress, gict->BaseAddress + 128 * 1024 - 1, 128 * 1024); - di->di_gic_dinfo.gic_domain = -1; + err = acpi_iort_its_lookup(gict->TranslationId, &xref, &pxm); + if (err == 0) { + di->di_gic_dinfo.gic_domain = pxm; + di->di_gic_dinfo.msi_xref = xref; + } else { + di->di_gic_dinfo.gic_domain = -1; + di->di_gic_dinfo.msi_xref = ACPI_MSI_XREF; + } sc->gic_nchildren++; device_set_ivars(child, di); } Modified: stable/12/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- stable/12/sys/arm64/arm64/gic_v3_var.h Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/arm64/arm64/gic_v3_var.h Wed Sep 18 23:08:51 2019 (r352498) @@ -87,6 +87,7 @@ struct gic_v3_softc { struct gic_v3_devinfo { int gic_domain; + int msi_xref; }; #define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc) Modified: stable/12/sys/arm64/arm64/gicv3_its.c ============================================================================== --- stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 23:08:51 2019 (r352498) @@ -1722,6 +1722,7 @@ static int gicv3_its_acpi_attach(device_t dev) { struct gicv3_its_softc *sc; + struct gic_v3_devinfo *di; int err; sc = device_get_softc(dev); @@ -1729,13 +1730,13 @@ gicv3_its_acpi_attach(device_t dev) if (err != 0) return (err); - sc->sc_pic = intr_pic_register(dev, - device_get_unit(dev) + ACPI_MSI_XREF); + di = device_get_ivars(dev); + sc->sc_pic = intr_pic_register(dev, di->msi_xref); intr_pic_add_handler(device_get_parent(dev), sc->sc_pic, gicv3_its_intr, sc, sc->sc_irq_base, sc->sc_irq_length); /* Register this device to handle MSI interrupts */ - intr_msi_register(dev, device_get_unit(dev) + ACPI_MSI_XREF); + intr_msi_register(dev, di->msi_xref); return (0); } Modified: stable/12/sys/conf/files.arm64 ============================================================================== --- stable/12/sys/conf/files.arm64 Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/conf/files.arm64 Wed Sep 18 23:08:51 2019 (r352498) @@ -105,6 +105,7 @@ arm/mv/mv_cp110_clock.c optional SOC_MARVELL_8K fdt arm/mv/mv_thermal.c optional SOC_MARVELL_8K mv_thermal fdt arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt arm/xilinx/uart_dev_cdnc.c optional uart soc_xilinx_zynq +arm64/acpica/acpi_iort.c optional acpi arm64/acpica/acpi_machdep.c optional acpi arm64/acpica/OsdEnvironment.c optional acpi arm64/acpica/acpi_wakeup.c optional acpi Modified: stable/12/sys/dev/acpica/acpivar.h ============================================================================== --- stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/dev/acpica/acpivar.h Wed Sep 18 23:08:51 2019 (r352498) @@ -540,5 +540,12 @@ int acpi_get_cpus(device_t dev, device_t child, enum size_t setsize, cpuset_t *cpuset); int acpi_get_domain(device_t dev, device_t child, int *domain); +#ifdef __aarch64__ +/* + * ARM specific ACPI interfaces, relating to IORT table. + */ +int acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid); +int acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm); +#endif #endif /* _KERNEL */ #endif /* !_ACPIVAR_H_ */ Modified: stable/12/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 22:55:24 2019 (r352497) +++ stable/12/sys/dev/pci/pci_host_generic_acpi.c Wed Sep 18 23:08:51 2019 (r352498) @@ -348,14 +348,52 @@ generic_pcie_acpi_route_interrupt(device_t bus, device return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt)); } +static u_int +generic_pcie_get_xref(device_t pci, device_t child) +{ + struct generic_pcie_acpi_softc *sc; + uintptr_t rid; + u_int xref, devid; + int err; + + sc = device_get_softc(pci); + err = pcib_get_id(pci, child, PCI_ID_RID, &rid); + if (err != 0) + return (ACPI_MSI_XREF); + err = acpi_iort_map_pci_msi(sc->base.ecam, rid, &xref, &devid); + if (err != 0) + return (ACPI_MSI_XREF); + return (xref); +} + +static u_int +generic_pcie_map_id(device_t pci, device_t child, uintptr_t *id) +{ + struct generic_pcie_acpi_softc *sc; + uintptr_t rid; + u_int xref, devid; + int err; + + sc = device_get_softc(pci); + err = pcib_get_id(pci, child, PCI_ID_RID, &rid); + if (err != 0) + return (err); + err = acpi_iort_map_pci_msi(sc->base.ecam, rid, &xref, &devid); + if (err == 0) + *id = devid; + else + *id = rid; /* RID not in IORT, likely FW bug, ignore */ + return (0); +} + static int generic_pcie_acpi_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) { #if defined(INTRNG) - return (intr_alloc_msi(pci, child, ACPI_MSI_XREF, count, maxcount, - irqs)); + return (intr_alloc_msi(pci, child, generic_pcie_get_xref(pci, child), + count, maxcount, irqs)); #else return (ENXIO); #endif @@ -367,7 +405,8 @@ generic_pcie_acpi_release_msi(device_t pci, device_t c { #if defined(INTRNG) - return (intr_release_msi(pci, child, ACPI_MSI_XREF, count, irqs)); + return (intr_release_msi(pci, child, generic_pcie_get_xref(pci, child), + count, irqs)); #else return (ENXIO); #endif @@ -379,7 +418,8 @@ generic_pcie_acpi_map_msi(device_t pci, device_t child { #if defined(INTRNG) - return (intr_map_msi(pci, child, ACPI_MSI_XREF, irq, addr, data)); + return (intr_map_msi(pci, child, generic_pcie_get_xref(pci, child), irq, + addr, data)); #else return (ENXIO); #endif @@ -390,7 +430,8 @@ generic_pcie_acpi_alloc_msix(device_t pci, device_t ch { #if defined(INTRNG) - return (intr_alloc_msix(pci, child, ACPI_MSI_XREF, irq)); + return (intr_alloc_msix(pci, child, generic_pcie_get_xref(pci, child), + irq)); #else return (ENXIO); #endif @@ -401,7 +442,8 @@ generic_pcie_acpi_release_msix(device_t pci, device_t { #if defined(INTRNG) - return (intr_release_msix(pci, child, ACPI_MSI_XREF, irq)); + return (intr_release_msix(pci, child, generic_pcie_get_xref(pci, child), + irq)); #else return (ENXIO); #endif @@ -412,14 +454,8 @@ generic_pcie_acpi_get_id(device_t pci, device_t child, uintptr_t *id) { - /* - * Use the PCI RID to find the MSI ID for now, we support only 1:1 - * mapping - * - * On aarch64, more complex mapping would come from IORT table - */ if (type == PCI_ID_MSI) - return (pcib_get_id(pci, child, PCI_ID_RID, id)); + return (generic_pcie_map_id(pci, child, id)); else return (pcib_get_id(pci, child, type, id)); } From owner-svn-src-all@freebsd.org Wed Sep 18 23:12: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 43C9BE975D; Wed, 18 Sep 2019 23:12:08 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YbN815JJz3NwJ; Wed, 18 Sep 2019 23:12:08 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08FA8449A; Wed, 18 Sep 2019 23:12:08 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8INC7EV065495; Wed, 18 Sep 2019 23:12:07 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8INC7OW065494; Wed, 18 Sep 2019 23:12:07 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182312.x8INC7OW065494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352499 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352499 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:12:08 -0000 Author: jchandra Date: Wed Sep 18 23:12:07 2019 New Revision: 352499 URL: https://svnweb.freebsd.org/changeset/base/352499 Log: MFC r348291: arm64 nexus: remove incorrect warning acpi_config_intr() will be called when an arm64 system booted with ACPI. We do the interrupt mapping for ACPI interrupts in nexus_acpi_map_intr() on arm64, so acpi_config_intr() has to just return success without printing this error message. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D19432 Modified: stable/12/sys/arm64/arm64/nexus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/nexus.c ============================================================================== --- stable/12/sys/arm64/arm64/nexus.c Wed Sep 18 23:08:51 2019 (r352498) +++ stable/12/sys/arm64/arm64/nexus.c Wed Sep 18 23:12:07 2019 (r352499) @@ -292,9 +292,11 @@ nexus_config_intr(device_t dev, int irq, enum intr_tri enum intr_polarity pol) { - /* TODO: This is wrong, it's needed for ACPI */ - device_printf(dev, "bus_config_intr is obsolete and not supported!\n"); - return (EOPNOTSUPP); + /* + * On arm64 (due to INTRNG), ACPI interrupt configuration is + * done in nexus_acpi_map_intr(). + */ + return (0); } static int From owner-svn-src-all@freebsd.org Wed Sep 18 23:18: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 31D55E9827; Wed, 18 Sep 2019 23:18:27 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YbWR0Wpfz3PD6; Wed, 18 Sep 2019 23:18:27 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E52BC44CB; Wed, 18 Sep 2019 23:18:26 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8INIQhk065879; Wed, 18 Sep 2019 23:18:26 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8INIQTE065878; Wed, 18 Sep 2019 23:18:26 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182318.x8INIQTE065878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:18: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: r352500 - stable/12/sys/arm64/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm64/acpica X-SVN-Commit-Revision: 352500 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:18:27 -0000 Author: jchandra Date: Wed Sep 18 23:18:26 2019 New Revision: 352500 URL: https://svnweb.freebsd.org/changeset/base/352500 Log: MFC r349348: arm64 acpi_iort: add some error handling Print warnings for some bad kernel configurations (like NUMA disabled with multiple domains). Check and report some firmware errors (like incorrect proximity domain entries). Differential Revision: https://reviews.freebsd.org/D20416 Modified: stable/12/sys/arm64/acpica/acpi_iort.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/acpica/acpi_iort.c ============================================================================== --- stable/12/sys/arm64/acpica/acpi_iort.c Wed Sep 18 23:12:07 2019 (r352499) +++ stable/12/sys/arm64/acpica/acpi_iort.c Wed Sep 18 23:18:26 2019 (r352500) @@ -370,19 +370,44 @@ srat_resolve_its_pxm(ACPI_SUBTABLE_HEADER *entry, void ACPI_SRAT_GIC_ITS_AFFINITY *gicits; struct iort_node *its_node; struct iort_its_entry *its_entry; - int i, matches; + int *map_counts; + int i, matches, dom; if (entry->Type != ACPI_SRAT_TYPE_GIC_ITS_AFFINITY) return; matches = 0; + map_counts = arg; gicits = (ACPI_SRAT_GIC_ITS_AFFINITY *)entry; + dom = acpi_map_pxm_to_vm_domainid(gicits->ProximityDomain); + + /* + * Catch firmware and config errors. map_counts keeps a + * count of ProximityDomain values mapping to a domain ID + */ +#if MAXMEMDOM > 1 + if (dom == -1) + printf("Firmware Error: Proximity Domain %d could not be" + " mapped for GIC ITS ID %d!\n", + gicits->ProximityDomain, gicits->ItsId); +#endif + /* use dom + 1 as index to handle the case where dom == -1 */ + i = ++map_counts[dom + 1]; + if (i > 1) { +#ifdef NUMA + if (dom != -1) + printf("ERROR: Multiple Proximity Domains map to the" + " same NUMA domain %d!\n", dom); +#else + printf("WARNING: multiple Proximity Domains in SRAT but NUMA" + " NOT enabled!\n"); +#endif + } TAILQ_FOREACH(its_node, &its_groups, next) { its_entry = its_node->entries.its; for (i = 0; i < its_node->nentries; i++, its_entry++) { if (its_entry->its_id == gicits->ItsId) { - its_entry->pxm = acpi_map_pxm_to_vm_domainid( - gicits->ProximityDomain); + its_entry->pxm = dom; matches++; } } @@ -401,6 +426,7 @@ iort_post_process_its(void) ACPI_TABLE_MADT *madt; ACPI_TABLE_SRAT *srat; vm_paddr_t madt_pa, srat_pa; + int map_counts[MAXMEMDOM + 1] = { 0 }; /* Check ITS block in MADT */ madt_pa = acpi_find_table(ACPI_SIG_MADT); @@ -417,7 +443,7 @@ iort_post_process_its(void) srat = acpi_map_table(srat_pa, ACPI_SIG_SRAT); KASSERT(srat != NULL, ("can't map SRAT!")); acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, - srat_resolve_its_pxm, NULL); + srat_resolve_its_pxm, map_counts); acpi_unmap_table(srat); } return (0); From owner-svn-src-all@freebsd.org Wed Sep 18 23:23: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 01311E9BB5; Wed, 18 Sep 2019 23:23:36 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YbdM6FRjz3Pgv; Wed, 18 Sep 2019 23:23:35 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA93D46B0; Wed, 18 Sep 2019 23:23:35 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8INNZvp071931; Wed, 18 Sep 2019 23:23:35 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8INNZdJ071928; Wed, 18 Sep 2019 23:23:35 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182323.x8INNZdJ071928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:23: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: r352501 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352501 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:23:36 -0000 Author: jchandra Date: Wed Sep 18 23:23:34 2019 New Revision: 352501 URL: https://svnweb.freebsd.org/changeset/base/352501 Log: MFC r348377-r348379, r349347 r348377: gic_v3: consolidate per-cpu redistributor information Update 'struct gic_redists' to consolidate all per-cpu redistributor information into a new 'struct redist_pcpu'. Provide a new interface (GICV3_IVAR_REDIST) for the GIC driver, which can be used to retrieve the per-cpu data. This per-cpu redistributor struct will be later used to improve the GIC ITS setup. While there, remove some unused fields in gic_v3_var.h interface. No functional changes. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D19842 r348378: gicv3_its: refactor LPI init into a new function Move the per-cpu LPI intialization to a separate function. This is in preparation for a commit that does LPI init only once for a CPU, even when there are multiple ITS blocks associated with the CPU. No functional changes in this commit. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D19843 r348379: gicv3_its: do LPI init only once per CPU The initialization required for LPIs (setting up pending tables etc.) has to be done just once per CPU, even in the case where there are multiple ITS blocks associated with the CPU. Add a flag lpi_enabled in the per-cpu distributor info for this and use it to ensure that we call its_init_cpu_lpi() just once. This enables us to support platforms where multiple GIC ITS blocks can generate LPIs to a CPU. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D19844 r349347: arm64 gicv3_its: enable all ITS blocks for a CPU We now support multiple ITS blocks raising interrupts to a CPU. Add all available CPUs to the ITS when no NUMA information is available. This reverts the check added in r340602, at that tim we did not suppport multiple ITS blocks for a CPU. Differential Revision: https://reviews.freebsd.org/D20417 Modified: stable/12/sys/arm64/arm64/gic_v3.c stable/12/sys/arm64/arm64/gic_v3_var.h stable/12/sys/arm64/arm64/gicv3_its.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/gic_v3.c ============================================================================== --- stable/12/sys/arm64/arm64/gic_v3.c Wed Sep 18 23:18:26 2019 (r352500) +++ stable/12/sys/arm64/arm64/gic_v3.c Wed Sep 18 23:23:34 2019 (r352501) @@ -183,36 +183,44 @@ uint32_t gic_r_read_4(device_t dev, bus_size_t offset) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - return (bus_read_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset)); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + return (bus_read_4(rdist, offset)); } uint64_t gic_r_read_8(device_t dev, bus_size_t offset) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - return (bus_read_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset)); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + return (bus_read_8(rdist, offset)); } void gic_r_write_4(device_t dev, bus_size_t offset, uint32_t val) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - bus_write_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + bus_write_4(rdist, offset, val); } void gic_r_write_8(device_t dev, bus_size_t offset, uint64_t val) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + bus_write_8(rdist, offset, val); } /* @@ -384,8 +392,11 @@ gic_v3_read_ivar(device_t dev, device_t child, int whi return (0); case GICV3_IVAR_REDIST_VADDR: *result = (uintptr_t)rman_get_virtual( - sc->gic_redists.pcpu[PCPU_GET(cpuid)]); + &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res); return (0); + case GICV3_IVAR_REDIST: + *result = (uintptr_t)sc->gic_redists.pcpu[PCPU_GET(cpuid)]; + return (0); case GIC_IVAR_HW_REV: KASSERT( GICR_PIDR2_ARCH(sc->gic_pidr2) == GICR_PIDR2_ARCH_GICv3 || @@ -979,7 +990,7 @@ gic_v3_wait_for_rwp(struct gic_v3_softc *sc, enum gic_ res = sc->gic_dist; break; case REDIST: - res = sc->gic_redists.pcpu[cpuid]; + res = &sc->gic_redists.pcpu[cpuid]->res; break; default: KASSERT(0, ("%s: Attempt to wait for unknown RWP", __func__)); @@ -1173,7 +1184,8 @@ gic_v3_redist_find(struct gic_v3_softc *sc) KASSERT(sc->gic_redists.pcpu[cpuid] != NULL, ("Invalid pointer to per-CPU redistributor")); /* Copy res contents to its final destination */ - *sc->gic_redists.pcpu[cpuid] = r_res; + sc->gic_redists.pcpu[cpuid]->res = r_res; + sc->gic_redists.pcpu[cpuid]->lpi_enabled = false; if (bootverbose) { device_printf(sc->dev, "CPU%u Re-Distributor has been found\n", Modified: stable/12/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- stable/12/sys/arm64/arm64/gic_v3_var.h Wed Sep 18 23:18:26 2019 (r352500) +++ stable/12/sys/arm64/arm64/gic_v3_var.h Wed Sep 18 23:23:34 2019 (r352501) @@ -40,10 +40,10 @@ DECLARE_CLASS(gic_v3_driver); struct gic_v3_irqsrc; -struct redist_lpis { - vm_offset_t conf_base; - vm_offset_t pend_base[MAXCPU]; - uint64_t flags; +struct redist_pcpu { + struct resource res; /* mem resource for redist */ + vm_offset_t pend_base; + bool lpi_enabled; /* redist LPI configured? */ }; struct gic_redists { @@ -55,10 +55,8 @@ struct gic_redists { struct resource ** regions; /* Number of Re-Distributor regions */ u_int nregions; - /* Per-CPU Re-Distributor handler */ - struct resource * pcpu[MAXCPU]; - /* LPIs data */ - struct redist_lpis lpis; + /* Per-CPU Re-Distributor data */ + struct redist_pcpu *pcpu[MAXCPU]; }; struct gic_v3_softc { @@ -97,9 +95,11 @@ MALLOC_DECLARE(M_GIC_V3); /* ivars */ #define GICV3_IVAR_NIRQS 1000 #define GICV3_IVAR_REDIST_VADDR 1001 +#define GICV3_IVAR_REDIST 1002 __BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int); __BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *); +__BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *); /* Device methods */ int gic_v3_attach(device_t dev); @@ -131,7 +131,7 @@ void gic_r_write_8(device_t, bus_size_t, uint64_t var) u_int cpu = PCPU_GET(cpuid); \ \ bus_read_##len( \ - sc->gic_redists.pcpu[cpu], \ + &sc->gic_redists.pcpu[cpu]->res, \ reg); \ }) @@ -140,7 +140,7 @@ void gic_r_write_8(device_t, bus_size_t, uint64_t var) u_int cpu = PCPU_GET(cpuid); \ \ bus_write_##len( \ - sc->gic_redists.pcpu[cpu], \ + &sc->gic_redists.pcpu[cpu]->res, \ reg, val); \ }) Modified: stable/12/sys/arm64/arm64/gicv3_its.c ============================================================================== --- stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 23:18:26 2019 (r352500) +++ stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 23:23:34 2019 (r352501) @@ -572,25 +572,17 @@ gicv3_its_pendtables_init(struct gicv3_its_softc *sc) } } -static int -its_init_cpu(device_t dev, struct gicv3_its_softc *sc) +static void +its_init_cpu_lpi(device_t dev, struct gicv3_its_softc *sc) { device_t gicv3; - vm_paddr_t target; uint64_t xbaser, tmp; uint32_t ctlr; u_int cpuid; gicv3 = device_get_parent(dev); cpuid = PCPU_GET(cpuid); - if (!CPU_ISSET(cpuid, &sc->sc_cpus)) - return (0); - /* Check if the ITS is enabled on this CPU */ - if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) { - return (ENXIO); - } - /* Disable LPIs */ ctlr = gic_r_read_4(gicv3, GICR_CTLR); ctlr &= ~GICR_CTLR_LPI_ENABLE; @@ -659,10 +651,36 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) /* Make sure the GIC has seen everything */ dsb(sy); +} +static int +its_init_cpu(device_t dev, struct gicv3_its_softc *sc) +{ + device_t gicv3; + vm_paddr_t target; + u_int cpuid; + struct redist_pcpu *rpcpu; + + gicv3 = device_get_parent(dev); + cpuid = PCPU_GET(cpuid); + if (!CPU_ISSET(cpuid, &sc->sc_cpus)) + return (0); + + /* Check if the ITS is enabled on this CPU */ + if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) + return (ENXIO); + + rpcpu = gicv3_get_redist(dev); + + /* Do per-cpu LPI init once */ + if (!rpcpu->lpi_enabled) { + its_init_cpu_lpi(dev, sc); + rpcpu->lpi_enabled = true; + } + if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) { /* This ITS wants the redistributor physical address */ - target = vtophys(gicv3_get_redist_vaddr(dev)); + target = vtophys(rman_get_virtual(&rpcpu->res)); } else { /* This ITS wants the unique processor number */ target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER)); @@ -727,9 +745,7 @@ gicv3_its_attach(device_t dev) if (domain < MAXMEMDOM) CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); } else { - /* XXX : cannot handle more than one ITS per cpu */ - if (device_get_unit(dev) == 0) - CPU_COPY(&all_cpus, &sc->sc_cpus); + CPU_COPY(&all_cpus, &sc->sc_cpus); } /* Allocate the command circular buffer */ From owner-svn-src-all@freebsd.org Wed Sep 18 23:30: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 6C5DAE9D41; Wed, 18 Sep 2019 23:30:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YbnJ2GrDz3Pqx; Wed, 18 Sep 2019 23:30:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32F0146B6; Wed, 18 Sep 2019 23:30:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8INURb8072364; Wed, 18 Sep 2019 23:30:27 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8INURbj072363; Wed, 18 Sep 2019 23:30:27 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182330.x8INURbj072363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:30:27 +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: r352502 - stable/12/sys/arm/arm X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm/arm X-SVN-Commit-Revision: 352502 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:30:28 -0000 Author: jchandra Date: Wed Sep 18 23:30:27 2019 New Revision: 352502 URL: https://svnweb.freebsd.org/changeset/base/352502 Log: MFC r339517: arm generic_timer: fix armv8 timer desc In the FDT based probe, check for "arm,armv8-timer" before "arm,armv7-timer". This gets the description right when the timer node has both entries in compatible list. Modified: stable/12/sys/arm/arm/generic_timer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/arm/generic_timer.c ============================================================================== --- stable/12/sys/arm/arm/generic_timer.c Wed Sep 18 23:23:34 2019 (r352501) +++ stable/12/sys/arm/arm/generic_timer.c Wed Sep 18 23:30:27 2019 (r352502) @@ -322,11 +322,11 @@ arm_tmr_fdt_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "arm,armv7-timer")) { - device_set_desc(dev, "ARMv7 Generic Timer"); - return (BUS_PROBE_DEFAULT); - } else if (ofw_bus_is_compatible(dev, "arm,armv8-timer")) { + if (ofw_bus_is_compatible(dev, "arm,armv8-timer")) { device_set_desc(dev, "ARMv8 Generic Timer"); + return (BUS_PROBE_DEFAULT); + } else if (ofw_bus_is_compatible(dev, "arm,armv7-timer")) { + device_set_desc(dev, "ARMv7 Generic Timer"); return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Wed Sep 18 23:33: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 B5E73E9F5D; Wed, 18 Sep 2019 23:33:39 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Ybrz4PVjz3QLT; Wed, 18 Sep 2019 23:33:39 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A25C4866; Wed, 18 Sep 2019 23:33:39 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8INXdS8077648; Wed, 18 Sep 2019 23:33:39 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8INXdFI077647; Wed, 18 Sep 2019 23:33:39 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201909182333.x8INXdFI077647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Wed, 18 Sep 2019 23:33:39 +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: r352503 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 352503 X-SVN-Commit-Repository: base MIME-Version: 1.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, 18 Sep 2019 23:33:39 -0000 Author: jchandra Date: Wed Sep 18 23:33:38 2019 New Revision: 352503 URL: https://svnweb.freebsd.org/changeset/base/352503 Log: MFC r348380: arm64 gicv3_its: Fix a typo Fix 'Cavium' spelling in errata description. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D20418 Modified: stable/12/sys/arm64/arm64/gicv3_its.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/gicv3_its.c ============================================================================== --- stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 23:30:27 2019 (r352502) +++ stable/12/sys/arm64/arm64/gicv3_its.c Wed Sep 18 23:33:38 2019 (r352503) @@ -272,7 +272,7 @@ static const struct { } its_quirks[] = { { /* Cavium ThunderX Pass 1.x */ - .desc = "Cavoum ThunderX errata: 22375, 24313", + .desc = "Cavium ThunderX errata: 22375, 24313", .iidr = GITS_IIDR_RAW(GITS_IIDR_IMPL_CAVIUM, GITS_IIDR_PROD_THUNDER, GITS_IIDR_VAR_THUNDER_1, 0), .iidr_mask = ~GITS_IIDR_REVISION_MASK, From owner-svn-src-all@freebsd.org Thu Sep 19 07:28: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 8C76AF9141; Thu, 19 Sep 2019 07:28:25 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46YpNn2rfHz4MPJ; Thu, 19 Sep 2019 07:28:25 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44EBA9EA0; Thu, 19 Sep 2019 07:28:25 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8J7SPwh056285; Thu, 19 Sep 2019 07:28:25 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8J7SPDr056284; Thu, 19 Sep 2019 07:28:25 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201909190728.x8J7SPDr056284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 19 Sep 2019 07:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352504 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352504 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 07:28:25 -0000 Author: allanjude Date: Thu Sep 19 07:28:24 2019 New Revision: 352504 URL: https://svnweb.freebsd.org/changeset/base/352504 Log: sys/vm/vm_glue.c: Incorrect function name in panic string Use __func__ to avoid this issue in the future. Submitted by: Wuyang Chung Reviewed by: markj, emaste Obtained from: https://github.com/freebsd/freebsd/pull/410 Modified: head/sys/vm/vm_glue.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Sep 18 23:33:38 2019 (r352503) +++ head/sys/vm/vm_glue.c Thu Sep 19 07:28:24 2019 (r352504) @@ -320,7 +320,7 @@ vm_thread_stack_create(struct domainset *ds, vm_object ks = kva_alloc((pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); #endif if (ks == 0) { - printf("vm_thread_new: kstack allocation failed\n"); + printf("%s: kstack allocation failed\n", __func__); vm_object_deallocate(ksobj); return (0); } @@ -362,7 +362,7 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t for (i = 0; i < pages; i++) { m = vm_page_lookup(ksobj, i); if (m == NULL) - panic("vm_thread_dispose: kstack already missing?"); + panic("%s: kstack already missing?", __func__); vm_page_unwire_noq(m); vm_page_free(m); } From owner-svn-src-all@freebsd.org Thu Sep 19 09:22: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 88C97FC299; Thu, 19 Sep 2019 09:22:46 +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 46Yrwk34Ktz4SdY; Thu, 19 Sep 2019 09:22:46 +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 4C997B44C; Thu, 19 Sep 2019 09:22:46 +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 x8J9MksG026968; Thu, 19 Sep 2019 09:22:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8J9Mk3Q026967; Thu, 19 Sep 2019 09:22:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909190922.x8J9Mk3Q026967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 19 Sep 2019 09:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352505 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 352505 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 09:22:46 -0000 Author: avg Date: Thu Sep 19 09:22:45 2019 New Revision: 352505 URL: https://svnweb.freebsd.org/changeset/base/352505 Log: vt: fix problems with trying to switch to a closed VT If there is an attempt to switch from a process-owned VT to a closed VT, then vt(4) first requests the process to release its VT and only then realizes that the target VT is closed and, so, the switch is not possible. So, the driver does not actually do any switch, but at the same time the owning process is not notified about that and it does not re-acquire the VT. This change adds an early check for the target VT state, so that the switch can be refused before the process coordination dance. On top of that, the code now checks for a failure of vt_window_switch() and calls vt_window_postswitch() for the current VT if it is in the process mode. Test Plan: - configure VT1 - VT8 (ttyv0 - ttyv7) to be text consoles (run getty) - configure VT9 (ttyv8) to rn X server - make sure that the X server configuration allows VT switching - leave VT10 - VT12 unconfigured - while in the X server press Ctrl+Alt+F10 - without the patch, observe strange screen content and problems with keyboard input - with the patch, observe that nothing happens The problem has been observed and the fix has been tested with an nVidia graphics card and the proprietary nvidia driver. Not sure if that matters. Reviewed by: ray MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21704 Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Sep 19 07:28:24 2019 (r352504) +++ head/sys/dev/vt/vt_core.c Thu Sep 19 09:22:45 2019 (r352505) @@ -335,7 +335,7 @@ static void vt_switch_timer(void *arg) { - vt_late_window_switch((struct vt_window *)arg); + (void)vt_late_window_switch((struct vt_window *)arg); } static int @@ -457,13 +457,22 @@ vt_window_postswitch(struct vt_window *vw) static int vt_late_window_switch(struct vt_window *vw) { + struct vt_window *curvw; int ret; callout_stop(&vw->vw_proc_dead_timer); ret = vt_window_switch(vw); - if (ret) + if (ret != 0) { + /* + * If the switch hasn't happened, then return the VT + * to the current owner, if any. + */ + curvw = vw->vw_device->vd_curwindow; + if (curvw->vw_smode.mode == VT_PROCESS) + (void)vt_window_postswitch(curvw); return (ret); + } /* Notify owner process about terminal availability. */ if (vw->vw_smode.mode == VT_PROCESS) { @@ -509,6 +518,19 @@ vt_proc_window_switch(struct vt_window *vw) return (0); /* success */ } + /* + * Early check for an attempt to switch to a non-functional VT. + * The same check is done in vt_window_switch(), but it's better + * to fail as early as possible to avoid needless pre-switch + * actions. + */ + VT_LOCK(vd); + if ((vw->vw_flags & (VWF_OPENED|VWF_CONSOLE)) == 0) { + VT_UNLOCK(vd); + return (EINVAL); + } + VT_UNLOCK(vd); + /* Ask current process permission to switch away. */ if (curvw->vw_smode.mode == VT_PROCESS) { DPRINTF(30, "%s: VT_PROCESS ", __func__); @@ -1792,7 +1814,7 @@ finish_vt_rel(struct vt_window *vw, int release, int * vw->vw_flags &= ~VWF_SWWAIT_REL; if (release) { callout_drain(&vw->vw_proc_dead_timer); - vt_late_window_switch(vw->vw_switch_to); + (void)vt_late_window_switch(vw->vw_switch_to); } return (0); } From owner-svn-src-all@freebsd.org Thu Sep 19 09:35: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 DA97CFC71B; Thu, 19 Sep 2019 09:35:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from springbank.echomania.com (springbank.echomania.com [IPv6:2a01:7c8:aab2:81::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "springbank.echomania.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46YsCq40WTz4TD6; Thu, 19 Sep 2019 09:35:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com Received: from [IPv6:2001:470:7a58:0:7545:d8b0:a999:1ee] (unknown [IPv6:2001:470:7a58:0:7545:d8b0:a999:1ee]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by springbank.echomania.com (Postfix) with ESMTPSA id 136F8580190; Thu, 19 Sep 2019 11:30:13 +0200 (CEST) Subject: Re: svn commit: r352304 - in head: . usr.sbin/ntp usr.sbin/ntp/ntpd To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201909132020.x8DKK62j025066@repo.freebsd.org> From: Dimitry Andric Message-ID: <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org> Date: Thu, 19 Sep 2019 11:30:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <201909132020.x8DKK62j025066@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46YsCq40WTz4TD6 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:20857, ipnet:2a01:7c8::/32, country:NL] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages 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, 19 Sep 2019 09:35:51 -0000 On 2019-09-13 22:20, Cy Schubert wrote: > Author: cy > Date: Fri Sep 13 20:20:05 2019 > New Revision: 352304 > URL: https://svnweb.freebsd.org/changeset/base/352304 > > Log: > No longer mlock() ntpd pages by default in memory thus allowing its > pages to page as necessary. > > To restore historic BSD behaviour add the following to ntp.conf: > rlimit memlock 32 Apparently this does not completely work, as I still see: ntpd[824]: ntpd 4.2.8p12-a (1): Starting ntpd[825]: Cannot set RLIMIT_MEMLOCK: Operation not permitted even while my ntp.conf is almost entirely vanilla (it only has a different "server" line). Even explicitly adding: rlimit memlock -1 does not work, it results in the same error. -Dimitry From owner-svn-src-all@freebsd.org Thu Sep 19 09:43: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 B0D22FCAEE; Thu, 19 Sep 2019 09:43:56 +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 46YsP84BQtz4TvM; Thu, 19 Sep 2019 09:43:56 +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 73170B7FE; Thu, 19 Sep 2019 09:43:56 +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 x8J9huFE039369; Thu, 19 Sep 2019 09:43:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8J9huLb039368; Thu, 19 Sep 2019 09:43:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909190943.x8J9huLb039368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 19 Sep 2019 09:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352506 - 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: 352506 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 09:43:56 -0000 Author: avg Date: Thu Sep 19 09:43:56 2019 New Revision: 352506 URL: https://svnweb.freebsd.org/changeset/base/352506 Log: fix dsl_scan_ds_clone_swapped logic It was incorrect with respect to swapping dataset IDs both in the on-disk ZAP object and the in-memory queue. In both cases, if only ds1 was already present, then it would be first replaced with ds2 and then ds2 would be replaced back with ds1. Also, both cases did not properly handle a situation where both ds1 and ds2 are already queued. A duplicate insertion would be attempted and its failure would result in a panic. This change has also been submitted to ZoL as zfsonlinux/zfs@dd262c9 PR: 239566 Reported by: pascal.guitierrez@gmail.com MFC after: 4 days Sponsored by: CyberSecure Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Sep 19 09:22:45 2019 (r352505) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Sep 19 09:43:56 2019 (r352506) @@ -2014,16 +2014,17 @@ ds_clone_swapped_bookmark(dsl_dataset_t *ds1, dsl_data } /* - * Called when a parent dataset and its clone are swapped. If we were + * Called when an origin dataset and its clone are swapped. If we were * currently traversing the dataset, we need to switch to traversing the - * newly promoted parent. + * newly promoted clone. */ void dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_dataset_t *ds2, dmu_tx_t *tx) { dsl_pool_t *dp = ds1->ds_dir->dd_pool; dsl_scan_t *scn = dp->dp_scan; - uint64_t mintxg; + uint64_t mintxg1, mintxg2; + boolean_t ds1_queued, ds2_queued; if (!dsl_scan_is_running(scn)) return; @@ -2031,44 +2032,81 @@ dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_data ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys.scn_bookmark); ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys_cached.scn_bookmark); - if (scan_ds_queue_contains(scn, ds1->ds_object, &mintxg)) { - scan_ds_queue_remove(scn, ds1->ds_object); - scan_ds_queue_insert(scn, ds2->ds_object, mintxg); + /* + * Handle the in-memory scan queue. + */ + ds1_queued = scan_ds_queue_contains(scn, ds1->ds_object, &mintxg1); + ds2_queued = scan_ds_queue_contains(scn, ds2->ds_object, &mintxg2); + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); } - if (scan_ds_queue_contains(scn, ds2->ds_object, &mintxg)) { + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * The swapping code below would not handle this case correctly, + * since we can't insert ds2 if it is already there. That's + * because scan_ds_queue_insert() prohibits a duplicate insert + * and panics. + */ + } else if (ds1_queued) { + scan_ds_queue_remove(scn, ds1->ds_object); + scan_ds_queue_insert(scn, ds2->ds_object, mintxg1); + } else if (ds2_queued) { scan_ds_queue_remove(scn, ds2->ds_object); - scan_ds_queue_insert(scn, ds1->ds_object, mintxg); + scan_ds_queue_insert(scn, ds1->ds_object, mintxg2); } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds1->ds_object, &mintxg) == 0) { - int err; - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + /* + * Handle the on-disk scan queue. + * The on-disk state is an out-of-date version of the in-memory state, + * so the in-memory and on-disk values for ds1_queued and ds2_queued may + * be different. Therefore we need to apply the swap logic to the + * on-disk state independently of the in-memory state. + */ + ds1_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, &mintxg1) == 0; + ds2_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, &mintxg2) == 0; + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * Alternatively, we could check for EEXIST from + * zap_add_int_key() and back out to the original state, but + * that would be more work than checking for this case upfront. + */ + } else if (ds1_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds1->ds_object, tx)); - err = zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg, tx); - VERIFY(err == 0 || err == EEXIST); - if (err == EEXIST) { - /* Both were there to begin with */ - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, - ds1->ds_object, mintxg, tx)); - } + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg1, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds1->ds_object, (u_longlong_t)ds2->ds_object); - } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds2->ds_object, &mintxg) == 0) { - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + } else if (ds2_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds2->ds_object, tx)); - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg, tx)); + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg2, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds2->ds_object, From owner-svn-src-all@freebsd.org Thu Sep 19 09:48: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 164E6FCD1C; Thu, 19 Sep 2019 09:48:02 +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 46YsTs6pf1z4V8G; Thu, 19 Sep 2019 09:48:01 +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 CD228B806; Thu, 19 Sep 2019 09:48:01 +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 x8J9m1JT039678; Thu, 19 Sep 2019 09:48:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8J9m1ue039677; Thu, 19 Sep 2019 09:48:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909190948.x8J9m1ue039677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 19 Sep 2019 09:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352507 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 352507 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 09:48:02 -0000 Author: avg Date: Thu Sep 19 09:48:01 2019 New Revision: 352507 URL: https://svnweb.freebsd.org/changeset/base/352507 Log: update zfs send usage help with r352447 MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Sep 19 09:43:56 2019 (r352506) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Sep 19 09:48:01 2019 (r352507) @@ -290,7 +290,7 @@ get_usage(zfs_help_t idx) case HELP_SEND: return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] " "\n" - "\tsend [-Le] [-i snapshot|bookmark] " + "\tsend [-LPcenv] [-i snapshot|bookmark] " "\n" "\tsend [-nvPe] -t \n")); case HELP_SET: From owner-svn-src-all@freebsd.org Thu Sep 19 09:59: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 D770FFD0D4; Thu, 19 Sep 2019 09:59:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46YslF5Mmgz4VlB; Thu, 19 Sep 2019 09:59:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C60AB9DB; Thu, 19 Sep 2019 09:59:37 +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 x8J9xbIC045565; Thu, 19 Sep 2019 09:59:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8J9xbYt045564; Thu, 19 Sep 2019 09:59:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909190959.x8J9xbYt045564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 19 Sep 2019 09:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352508 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352508 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 09:59:37 -0000 Author: tuexen Date: Thu Sep 19 09:59:37 2019 New Revision: 352508 URL: https://svnweb.freebsd.org/changeset/base/352508 Log: MFC r352386: Don't write to memory outside of the allocated array for SACK blocks. Obtained from: rrs@ Sponsored by: Netflix, Inc. Modified: stable/12/sys/netinet/tcp_sack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_sack.c ============================================================================== --- stable/12/sys/netinet/tcp_sack.c Thu Sep 19 09:48:01 2019 (r352507) +++ stable/12/sys/netinet/tcp_sack.c Thu Sep 19 09:59:37 2019 (r352508) @@ -235,7 +235,7 @@ tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_st saved_blks[n].start = mid_blk.start; saved_blks[n++].end = mid_blk.end; } - for (j = 0; (j < tp->rcv_numsacks) && (j < MAX_SACK_BLKS-1); j++) { + for (j = 0; (j < tp->rcv_numsacks) && (n < MAX_SACK_BLKS); j++) { if (((SEQ_LT(tp->sackblks[j].end, mid_blk.start) || SEQ_GT(tp->sackblks[j].start, mid_blk.end)) && (SEQ_GT(tp->sackblks[j].start, tp->rcv_nxt)))) From owner-svn-src-all@freebsd.org Thu Sep 19 10:01: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 06AD3FD172; Thu, 19 Sep 2019 10:01:20 +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 46YsnC6SRnz4Vwg; Thu, 19 Sep 2019 10:01:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C24A4BCEE; Thu, 19 Sep 2019 10:01:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JA1Jpk046570; Thu, 19 Sep 2019 10:01:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JA1J8k046569; Thu, 19 Sep 2019 10:01:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909191001.x8JA1J8k046569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 19 Sep 2019 10:01: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: r352509 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352509 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 10:01:20 -0000 Author: tuexen Date: Thu Sep 19 10:01:19 2019 New Revision: 352509 URL: https://svnweb.freebsd.org/changeset/base/352509 Log: MFC r352438: Only allow a SCTP-AUTH shared key to be updated by the application if it is not deactivated and not used. This avoids a use-after-free problem. Reported by: da_cheng_shao@yeah.net Modified: stable/12/sys/netinet/sctp_auth.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_auth.c ============================================================================== --- stable/12/sys/netinet/sctp_auth.c Thu Sep 19 09:59:37 2019 (r352508) +++ stable/12/sys/netinet/sctp_auth.c Thu Sep 19 10:01:19 2019 (r352509) @@ -523,7 +523,7 @@ sctp_insert_sharedkey(struct sctp_keyhead *shared_keys } else if (new_skey->keyid == skey->keyid) { /* replace the existing key */ /* verify this key *can* be replaced */ - if ((skey->deactivated) && (skey->refcount > 1)) { + if ((skey->deactivated) || (skey->refcount > 1)) { SCTPDBG(SCTP_DEBUG_AUTH1, "can't replace shared key id %u\n", new_skey->keyid); From owner-svn-src-all@freebsd.org Thu Sep 19 10: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 CCEF1FD3FE; Thu, 19 Sep 2019 10:06:18 +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 46Ysty53x7z4WRb; Thu, 19 Sep 2019 10:06:18 +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 90FEABD59; Thu, 19 Sep 2019 10:06:18 +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 x8JA6IKk051827; Thu, 19 Sep 2019 10:06:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JA6IYo051826; Thu, 19 Sep 2019 10:06:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909191006.x8JA6IYo051826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 19 Sep 2019 10:06:18 +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: r352510 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 352510 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 10:06:18 -0000 Author: tuexen Date: Thu Sep 19 10:06:18 2019 New Revision: 352510 URL: https://svnweb.freebsd.org/changeset/base/352510 Log: MFC r352438: Only allow a SCTP-AUTH shared key to be updated by the application if it is not deactivated and not used. This avoids a use-after-free problem. Reported by: da_cheng_shao@yeah.net Modified: stable/11/sys/netinet/sctp_auth.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_auth.c ============================================================================== --- stable/11/sys/netinet/sctp_auth.c Thu Sep 19 10:01:19 2019 (r352509) +++ stable/11/sys/netinet/sctp_auth.c Thu Sep 19 10:06:18 2019 (r352510) @@ -521,7 +521,7 @@ sctp_insert_sharedkey(struct sctp_keyhead *shared_keys } else if (new_skey->keyid == skey->keyid) { /* replace the existing key */ /* verify this key *can* be replaced */ - if ((skey->deactivated) && (skey->refcount > 1)) { + if ((skey->deactivated) || (skey->refcount > 1)) { SCTPDBG(SCTP_DEBUG_AUTH1, "can't replace shared key id %u\n", new_skey->keyid); From owner-svn-src-all@freebsd.org Thu Sep 19 10:22: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 DE86CFD8A8; Thu, 19 Sep 2019 10:22:29 +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 46YtFd5YmKz4X8x; Thu, 19 Sep 2019 10:22:29 +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 A2222C0CB; Thu, 19 Sep 2019 10:22:29 +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 x8JAMTEF063443; Thu, 19 Sep 2019 10:22:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JAMTIp063442; Thu, 19 Sep 2019 10:22:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909191022.x8JAMTIp063442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 19 Sep 2019 10:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352511 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 352511 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 10:22:29 -0000 Author: tuexen Date: Thu Sep 19 10:22:29 2019 New Revision: 352511 URL: https://svnweb.freebsd.org/changeset/base/352511 Log: When processing an incoming IPv6 packet over the loopback interface which contains Hop-by-Hop options, the mbuf chain is potentially changed in ip6_hopopts_input(), called by ip6_input_hbh(). This can happen, because of the the use of IP6_EXTHDR_CHECK, which might call m_pullup(). So provide the updated pointer back to the called of ip6_input_hbh() to avoid using a freed mbuf chain in`ip6_input()`. Reviewed by: markj@ MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D21664 Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Thu Sep 19 10:06:18 2019 (r352510) +++ head/sys/netinet6/ip6_input.c Thu Sep 19 10:22:29 2019 (r352511) @@ -403,20 +403,22 @@ VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_TH #endif static int -ip6_input_hbh(struct mbuf *m, uint32_t *plen, uint32_t *rtalert, int *off, +ip6_input_hbh(struct mbuf **mp, uint32_t *plen, uint32_t *rtalert, int *off, int *nxt, int *ours) { + struct mbuf *m; struct ip6_hdr *ip6; struct ip6_hbh *hbh; - if (ip6_hopopts_input(plen, rtalert, &m, off)) { + if (ip6_hopopts_input(plen, rtalert, mp, off)) { #if 0 /*touches NULL pointer*/ - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); + in6_ifstat_inc((*mp)->m_pkthdr.rcvif, ifs6_in_discard); #endif goto out; /* m have already been freed */ } /* adjust pointer */ + m = *mp; ip6 = mtod(m, struct ip6_hdr *); /* @@ -854,7 +856,7 @@ passin: */ plen = (u_int32_t)ntohs(ip6->ip6_plen); if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { - if (ip6_input_hbh(m, &plen, &rtalert, &off, &nxt, &ours) != 0) + if (ip6_input_hbh(&m, &plen, &rtalert, &off, &nxt, &ours) != 0) return; } else nxt = ip6->ip6_nxt; From owner-svn-src-all@freebsd.org Thu Sep 19 10:27: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 7E53EFDA77; Thu, 19 Sep 2019 10:27: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 46YtMm2pk0z4XSZ; Thu, 19 Sep 2019 10:27: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 2A28FC0E4; Thu, 19 Sep 2019 10:27: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 x8JARl7G063854; Thu, 19 Sep 2019 10:27:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JARljp063853; Thu, 19 Sep 2019 10:27:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909191027.x8JARljp063853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 19 Sep 2019 10:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352512 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 352512 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 10:27:48 -0000 Author: tuexen Date: Thu Sep 19 10:27:47 2019 New Revision: 352512 URL: https://svnweb.freebsd.org/changeset/base/352512 Log: When the RACK stack computes the space for user data in a TCP segment, it wasn't taking the IP level options into account. This patch fixes this. In addition, it also corrects a KASSERT and adds protection code to assure that the IP header chain and the TCP head fit in the first fragment as required by RFC 7112. Reviewed by: rrs@ MFC after: 3 days Sponsored by: Nertflix, Inc. Differential Revision: https://reviews.freebsd.org/D21666 Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Sep 19 10:22:29 2019 (r352511) +++ head/sys/netinet/tcp_stacks/rack.c Thu Sep 19 10:27:47 2019 (r352512) @@ -7840,7 +7840,16 @@ send: hdrlen += sizeof(struct udphdr); } #endif - ipoptlen = 0; +#ifdef INET6 + if (isipv6) + ipoptlen = ip6_optlen(tp->t_inpcb); + else +#endif + if (tp->t_inpcb->inp_options) + ipoptlen = tp->t_inpcb->inp_options->m_len - + offsetof(struct ipoption, ipopt_list); + else + ipoptlen = 0; #if defined(IPSEC) || defined(IPSEC_SUPPORT) ipoptlen += ipsec_optlen; #endif @@ -7913,6 +7922,18 @@ send: sendalot = 1; } else { + if (optlen + ipoptlen > tp->t_maxseg) { + /* + * Since we don't have enough space to put + * the IP header chain and the TCP header in + * one packet as required by RFC 7112, don't + * send it. + */ + SOCKBUF_UNLOCK(&so->so_snd); + error = EMSGSIZE; + sack_rxmit = 0; + goto out; + } len = tp->t_maxseg - optlen - ipoptlen; sendalot = 1; } @@ -8414,15 +8435,9 @@ send: m->m_pkthdr.csum_flags |= CSUM_TSO; m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen; } -#if defined(IPSEC) || defined(IPSEC_SUPPORT) - KASSERT(len + hdrlen + ipoptlen - ipsec_optlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u - %u != %u", - __func__, len, hdrlen, ipoptlen, ipsec_optlen, m_length(m, NULL))); -#else - KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u != %u", - __func__, len, hdrlen, ipoptlen, m_length(m, NULL))); -#endif + KASSERT(len + hdrlen == m_length(m, NULL), + ("%s: mbuf chain different than expected: %d + %u != %u", + __func__, len, hdrlen, m_length(m, NULL))); #ifdef TCP_HHOOK /* Run HHOOK_TCP_ESTABLISHED_OUT helper hooks. */ From owner-svn-src-all@freebsd.org Thu Sep 19 11:34: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 EF2A5FEE49; Thu, 19 Sep 2019 11:34:35 +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 46Yvrq64b7z4b85; Thu, 19 Sep 2019 11:34:35 +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 B115ACD73; Thu, 19 Sep 2019 11:34:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JBYZ6L004855; Thu, 19 Sep 2019 11:34:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JBYZMv004854; Thu, 19 Sep 2019 11:34:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909191134.x8JBYZMv004854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 19 Sep 2019 11:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352513 - head/usr.sbin/freebsd-update X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352513 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 11:34:36 -0000 Author: emaste Date: Thu Sep 19 11:34:35 2019 New Revision: 352513 URL: https://svnweb.freebsd.org/changeset/base/352513 Log: freebsd-update.8: appease igor igor follows American style guides in the belief that abbreviations i.e. and e.g. are always followed by a comma. Make that change now so that future updates to freebsd-update.8 do not complain about this. Submitted by: grembo Event: EuroBSDCon Norway FreeBSD DevSummit Modified: head/usr.sbin/freebsd-update/freebsd-update.8 Modified: head/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 19 10:27:47 2019 (r352512) +++ head/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 19 11:34:35 2019 (r352513) @@ -95,7 +95,7 @@ Trust an RSA key with SHA256 of .Ar KEY . (default: read value from configuration file.) .It Fl r Ar newrelease -Specify the new release (e.g. 11.2-RELEASE) to which +Specify the new release (e.g., 11.2-RELEASE) to which .Nm should upgrade (upgrade command only). .It Fl s Ar server From owner-svn-src-all@freebsd.org Thu Sep 19 11:46: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 2D9B5FF2D8; Thu, 19 Sep 2019 11:46:44 +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 46Yw6r0T10z4bp1; Thu, 19 Sep 2019 11:46:44 +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 E8691CF5E; Thu, 19 Sep 2019 11:46:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JBkhB1010565; Thu, 19 Sep 2019 11:46:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JBkhgL010564; Thu, 19 Sep 2019 11:46:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909191146.x8JBkhgL010564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 19 Sep 2019 11:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352514 - head/usr.sbin/freebsd-update X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352514 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 11:46:44 -0000 Author: emaste Date: Thu Sep 19 11:46:43 2019 New Revision: 352514 URL: https://svnweb.freebsd.org/changeset/base/352514 Log: freebsd-update: make usage output consistent Drop trailing . which appeared only on description of IDS. Submitted by: grembo Event: EuroBSDCon Norway FreeBSD DevSummit Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 19 11:34:35 2019 (r352513) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 19 11:46:43 2019 (r352514) @@ -64,7 +64,7 @@ Commands: upgrade -- Fetch upgrades to FreeBSD version specified via -r option install -- Install downloaded updates or upgrades rollback -- Uninstall most recently installed updates - IDS -- Compare the system against an index of "known good" files. + IDS -- Compare the system against an index of "known good" files EOF exit 0 } From owner-svn-src-all@freebsd.org Thu Sep 19 12:46: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 D160A122428; Thu, 19 Sep 2019 12:46:46 +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 46YxS53M34z3CC7; Thu, 19 Sep 2019 12:46:45 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id AvpYil7hDUIS2Avpaiznxv; Thu, 19 Sep 2019 06:46:43 -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=J70Eh1EUuV4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=M9TVV_1QxNmupA89uy4A:9 a=CjuIK1q_8ugA:10 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 88B4DFA; Thu, 19 Sep 2019 05:46:40 -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 x8JCke0o003919; Thu, 19 Sep 2019 05:46:40 -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 x8JCke4Y003916; Thu, 19 Sep 2019 05:46:40 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201909191246.x8JCke4Y003916@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: Dimitry Andric cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r352304 - in head: . usr.sbin/ntp usr.sbin/ntp/ntpd In-reply-to: <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org> References: <201909132020.x8DKK62j025066@repo.freebsd.org> <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org> Comments: In-reply-to Dimitry Andric message dated "Thu, 19 Sep 2019 11:30:12 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 19 Sep 2019 05:46:40 -0700 X-CMAE-Envelope: MS4wfLhdgsmdiNKbT0mddolIEthE+HI9pWYlc9No05zpzFnvtU7dSpI+o9oxiFA/xd0LXWmjIB0vsAcfThmi/IFeRWNeLyGvzwi2YGrUcDBXdQhqDmDWUzvO 41gkbrpWRkYk+ipO4UKOKgCGOXHVCuaGq1VpNOy+9LUTgi06ZjdacK29LGsd99miaJn6XsX7dqkJo3J1FtFESDi+RVwQOBEzyH0+He4+1S7qc/3OWVso5Jd8 BWBJBGpWMckFyl9inBQoslJUGRFMIkaULCKL5G4FelLBArHFgxyr/N/zUfITuMUMLyqivURgw7VU26u679+7AA== X-Rspamd-Queue-Id: 46YxS53M34z3CC7 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 [-4.03 / 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)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.43)[ip: (-6.59), ipnet: 64.59.128.0/20(-3.08), asn: 6327(-2.39), country: CA(-0.09)]; RCVD_IN_DNSWL_NONE(0.00)[13.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]; 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: Thu, 19 Sep 2019 12:46:46 -0000 In message <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org>, Dimitry Andric w rites: > On 2019-09-13 22:20, Cy Schubert wrote: > > Author: cy > > Date: Fri Sep 13 20:20:05 2019 > > New Revision: 352304 > > URL: https://svnweb.freebsd.org/changeset/base/352304 > > > > Log: > > No longer mlock() ntpd pages by default in memory thus allowing its > > pages to page as necessary. > > > > To restore historic BSD behaviour add the following to ntp.conf: > > rlimit memlock 32 > > Apparently this does not completely work, as I still see: > > ntpd[824]: ntpd 4.2.8p12-a (1): Starting > ntpd[825]: Cannot set RLIMIT_MEMLOCK: Operation not permitted > > even while my ntp.conf is almost entirely vanilla (it only has a > different "server" line). > > Even explicitly adding: > > rlimit memlock -1 > > does not work, it results in the same error. > > -Dimitry Can you try this please? diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c index 2b14431dc7b..bcfca27a535 100644 --- a/contrib/ntp/ntpd/ntpd.c +++ b/contrib/ntp/ntpd/ntpd.c @@ -999,7 +999,7 @@ ntpdmain( # if defined(HAVE_MLOCKALL) # ifdef HAVE_SETRLIMIT ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); -# ifdef RLIMIT_MEMLOCK +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && DFLT_RLIMIT_MEMLOCK != -1 /* * The default RLIMIT_MEMLOCK is very low on Linux systems. * Unless we increase this limit malloc calls are likely to -- 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 Thu Sep 19 13: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 3B632123731; Thu, 19 Sep 2019 13:23:26 +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 46YyGQ0qtpz3FG1; Thu, 19 Sep 2019 13:23:26 +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 0103CE159; Thu, 19 Sep 2019 13:23:26 +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 x8JDNPVb070218; Thu, 19 Sep 2019 13:23:25 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JDNP43070217; Thu, 19 Sep 2019 13:23:25 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909191323.x8JDNP43070217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 19 Sep 2019 13:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352515 - head/lib/libarchive/tests X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/lib/libarchive/tests X-SVN-Commit-Revision: 352515 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 13:23:26 -0000 Author: lwhsu Date: Thu Sep 19 13:23:25 2019 New Revision: 352515 URL: https://svnweb.freebsd.org/changeset/base/352515 Log: Temporarily add test_write_filter_zstd BROKEN_TESTS as it always fails in CI There is no trivial way to mark single libarchive test skip currently so just add it to BROKEN_TESTS for now. PR: 240683 Sponsored by: The FreeBSD Foundation Modified: head/lib/libarchive/tests/Makefile Modified: head/lib/libarchive/tests/Makefile ============================================================================== --- head/lib/libarchive/tests/Makefile Thu Sep 19 11:46:43 2019 (r352514) +++ head/lib/libarchive/tests/Makefile Thu Sep 19 13:23:25 2019 (r352515) @@ -305,6 +305,9 @@ BROKEN_TESTS+= test_read_disk_directory_traversals # (Times out?) [and] crashes BROKEN_TESTS+= test_fuzz_rar +# https://bugs.freebsd.org/240683 +BROKEN_TESTS+= test_write_filter_zstd + # Build the test program. SRCS.libarchive_test= \ ${TESTS_SRCS} \ From owner-svn-src-all@freebsd.org Thu Sep 19 13:25: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 57228123844; Thu, 19 Sep 2019 13:25:20 +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 46YyJc1ZMwz3FRb; Thu, 19 Sep 2019 13:25:20 +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 F3662E160; Thu, 19 Sep 2019 13:25:19 +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 x8JDPJub070367; Thu, 19 Sep 2019 13:25:19 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JDPJaO070366; Thu, 19 Sep 2019 13:25:19 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909191325.x8JDPJaO070366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 19 Sep 2019 13:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352516 - head/lib/libarchive/tests X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/lib/libarchive/tests X-SVN-Commit-Revision: 352516 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 13:25:20 -0000 Author: lwhsu Date: Thu Sep 19 13:25:19 2019 New Revision: 352516 URL: https://svnweb.freebsd.org/changeset/base/352516 Log: Whitespace cleanup, no functional change Sponsored by: The FreeBSD Foundation Modified: head/lib/libarchive/tests/Makefile Modified: head/lib/libarchive/tests/Makefile ============================================================================== --- head/lib/libarchive/tests/Makefile Thu Sep 19 13:23:25 2019 (r352515) +++ head/lib/libarchive/tests/Makefile Thu Sep 19 13:25:19 2019 (r352516) @@ -520,12 +520,12 @@ ${PACKAGE}FILES+= test_read_format_rar5_blake2.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_compressed.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_different_window_size.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_distance_overflow.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_extra_field_version.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_extra_field_version.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_fileattr.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_hardlink.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_invalid_dict_reference.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_leftshift1.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_leftshift2.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_hardlink.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_invalid_dict_reference.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_leftshift1.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_leftshift2.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_multiarchive.part01.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_multiarchive.part02.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_multiarchive.part03.rar.uu @@ -541,13 +541,13 @@ ${PACKAGE}FILES+= test_read_format_rar5_multiarchive_s ${PACKAGE}FILES+= test_read_format_rar5_multiple_files.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_multiple_files_solid.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_nonempty_dir_stream.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_owner.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_readtables_overflow.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_owner.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_readtables_overflow.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_solid.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_stored.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_stored_manyfiles.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_symlink.rar.uu -${PACKAGE}FILES+= test_read_format_rar5_truncated_huff.rar.uu +${PACKAGE}FILES+= test_read_format_rar5_truncated_huff.rar.uu ${PACKAGE}FILES+= test_read_format_rar5_win32.rar.uu ${PACKAGE}FILES+= test_read_format_raw.bufr.uu ${PACKAGE}FILES+= test_read_format_raw.data.Z.uu From owner-svn-src-all@freebsd.org Thu Sep 19 14:36: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 B01691250C2; Thu, 19 Sep 2019 14:36:31 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Yztl3PZtz3KBd; Thu, 19 Sep 2019 14:36:31 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ADEFEE2B; Thu, 19 Sep 2019 14:36:31 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JEaV6m011819; Thu, 19 Sep 2019 14:36:31 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JEaU8O011817; Thu, 19 Sep 2019 14:36:30 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909191436.x8JEaU8O011817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 19 Sep 2019 14:36: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: r352517 - in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 352517 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 14:36:31 -0000 Author: alc Date: Thu Sep 19 14:36:30 2019 New Revision: 352517 URL: https://svnweb.freebsd.org/changeset/base/352517 Log: MFC r349526: When we protect PTEs (as opposed to PDEs), we only call vm_page_dirty() when, in fact, we are write protecting the page and the PTE has PG_M set. However, pmap_protect_pde() was always calling vm_page_dirty() when the PDE has PG_M set. So, adding PG_NX to a writeable PDE could result in unnecessary (but harmless) calls to vm_page_dirty(). Simplify the loop calling vm_page_dirty() in pmap_protect_pde(). Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/i386/i386/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 13:25:19 2019 (r352516) +++ stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 14:36:30 2019 (r352517) @@ -5214,8 +5214,7 @@ static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) { pd_entry_t newpde, oldpde; - vm_offset_t eva, va; - vm_page_t m; + vm_page_t m, mt; boolean_t anychanged; pt_entry_t PG_G, PG_M, PG_RW; @@ -5229,15 +5228,15 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offs anychanged = FALSE; retry: oldpde = newpde = *pde; - if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == - (PG_MANAGED | PG_M | PG_RW)) { - eva = sva + NBPDR; - for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); - va < eva; va += PAGE_SIZE, m++) - vm_page_dirty(m); - } - if ((prot & VM_PROT_WRITE) == 0) + if ((prot & VM_PROT_WRITE) == 0) { + if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { + m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_dirty(mt); + } newpde &= ~(PG_RW | PG_M); + } if ((prot & VM_PROT_EXECUTE) == 0) newpde |= pg_nx; if (newpde != oldpde) { Modified: stable/12/sys/i386/i386/pmap.c ============================================================================== --- stable/12/sys/i386/i386/pmap.c Thu Sep 19 13:25:19 2019 (r352516) +++ stable/12/sys/i386/i386/pmap.c Thu Sep 19 14:36:30 2019 (r352517) @@ -3332,8 +3332,7 @@ static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) { pd_entry_t newpde, oldpde; - vm_offset_t eva, va; - vm_page_t m; + vm_page_t m, mt; boolean_t anychanged; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -3342,15 +3341,15 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offs anychanged = FALSE; retry: oldpde = newpde = *pde; - if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == - (PG_MANAGED | PG_M | PG_RW)) { - eva = sva + NBPDR; - for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); - va < eva; va += PAGE_SIZE, m++) - vm_page_dirty(m); - } - if ((prot & VM_PROT_WRITE) == 0) + if ((prot & VM_PROT_WRITE) == 0) { + if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) == + (PG_MANAGED | PG_M | PG_RW)) { + m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME); + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_dirty(mt); + } newpde &= ~(PG_RW | PG_M); + } #if defined(PAE) || defined(PAE_TABLES) if ((prot & VM_PROT_EXECUTE) == 0) newpde |= pg_nx; From owner-svn-src-all@freebsd.org Thu Sep 19 14:45: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 56CBD125445; Thu, 19 Sep 2019 14:45:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z04d1ccJz3Kr9; Thu, 19 Sep 2019 14:45:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BC43F001; Thu, 19 Sep 2019 14:45:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JEj4QK017530; Thu, 19 Sep 2019 14:45:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JEj4RS017529; Thu, 19 Sep 2019 14:45:04 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909191445.x8JEj4RS017529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 19 Sep 2019 14:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352518 - head/usr.sbin/ntp/libntp X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/usr.sbin/ntp/libntp X-SVN-Commit-Revision: 352518 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 14:45:05 -0000 Author: cy Date: Thu Sep 19 14:45:04 2019 New Revision: 352518 URL: https://svnweb.freebsd.org/changeset/base/352518 Log: Reduce calls to close(2) at startup through the use of closefrom(2). Submitted by: pawel.biernacki@gmail.com Reviewed by: mjg, cy MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D21715 Modified: head/usr.sbin/ntp/libntp/Makefile Modified: head/usr.sbin/ntp/libntp/Makefile ============================================================================== --- head/usr.sbin/ntp/libntp/Makefile Thu Sep 19 14:36:30 2019 (r352517) +++ head/usr.sbin/ntp/libntp/Makefile Thu Sep 19 14:45:04 2019 (r352518) @@ -83,7 +83,7 @@ CFLAGS+= -I${SRCTOP}/contrib/ntp/include \ -I${.CURDIR:H} \ -I${.CURDIR}/ -CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H +CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H -DHAVE_CLOSEFROM CLEANFILES+= .version version.c From owner-svn-src-all@freebsd.org Thu Sep 19 15:12: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 917BD126046; Thu, 19 Sep 2019 15:12:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z0hK3PgXz3Mk0; Thu, 19 Sep 2019 15:12:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57F4DF582; Thu, 19 Sep 2019 15:12:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JFCX7B035581; Thu, 19 Sep 2019 15:12:33 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JFCW3H035578; Thu, 19 Sep 2019 15:12:32 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909191512.x8JFCW3H035578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 19 Sep 2019 15:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352519 - in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv X-SVN-Commit-Revision: 352519 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 15:12:33 -0000 Author: alc Date: Thu Sep 19 15:12:32 2019 New Revision: 352519 URL: https://svnweb.freebsd.org/changeset/base/352519 Log: MFC r350335: Simplify the handling of superpages in pmap_clear_modify(). Specifically, if a demotion succeeds, then all of the 4KB page mappings within the superpage-sized region must be valid, so there is no point in testing the validity of the 4KB page mapping that is going to be write protected. Deindent the nearby code. Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/arm64/arm64/pmap.c stable/12/sys/i386/i386/pmap.c stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 14:45:04 2019 (r352518) +++ stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 15:12:32 2019 (r352519) @@ -7599,7 +7599,7 @@ pmap_clear_modify(vm_page_t m) pmap_t pmap; pv_entry_t next_pv, pv; pd_entry_t oldpde, *pde; - pt_entry_t oldpte, *pte, PG_M, PG_RW, PG_V; + pt_entry_t *pte, PG_M, PG_RW; struct rwlock *lock; vm_offset_t va; int md_gen, pvh_gen; @@ -7635,33 +7635,23 @@ restart: } } PG_M = pmap_modified_bit(pmap); - PG_V = pmap_valid_bit(pmap); PG_RW = pmap_rw_bit(pmap); va = pv->pv_va; pde = pmap_pde(pmap, va); oldpde = *pde; - if ((oldpde & PG_RW) != 0) { - if (pmap_demote_pde_locked(pmap, pde, va, &lock)) { - if ((oldpde & PG_W) == 0) { - /* - * Write protect the mapping to a - * single page so that a subsequent - * write access may repromote. - */ - va += VM_PAGE_TO_PHYS(m) - (oldpde & - PG_PS_FRAME); - pte = pmap_pde_to_pte(pde, va); - oldpte = *pte; - if ((oldpte & PG_V) != 0) { - while (!atomic_cmpset_long(pte, - oldpte, - oldpte & ~(PG_M | PG_RW))) - oldpte = *pte; - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - } - } - } + /* If oldpde has PG_RW set, then it also has PG_M set. */ + if ((oldpde & PG_RW) != 0 && + pmap_demote_pde_locked(pmap, pde, va, &lock) && + (oldpde & PG_W) == 0) { + /* + * Write protect the mapping to a single page so that + * a subsequent write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - (oldpde & PG_PS_FRAME); + pte = pmap_pde_to_pte(pde, va); + atomic_clear_long(pte, PG_M | PG_RW); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); } PMAP_UNLOCK(pmap); } Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Thu Sep 19 14:45:04 2019 (r352518) +++ stable/12/sys/arm64/arm64/pmap.c Thu Sep 19 15:12:32 2019 (r352519) @@ -5008,28 +5008,22 @@ restart: va = pv->pv_va; l2 = pmap_l2(pmap, va); oldl2 = pmap_load(l2); - if ((oldl2 & ATTR_SW_DBM) != 0) { - if (pmap_demote_l2_locked(pmap, l2, va, &lock)) { - if ((oldl2 & ATTR_SW_WIRED) == 0) { - /* - * Write protect the mapping to a - * single page so that a subsequent - * write access may repromote. - */ - va += VM_PAGE_TO_PHYS(m) - - (oldl2 & ~ATTR_MASK); - l3 = pmap_l2_to_l3(l2, va); - oldl3 = pmap_load(l3); - if (pmap_l3_valid(oldl3)) { - while (!atomic_fcmpset_long(l3, - &oldl3, (oldl3 & ~ATTR_SW_DBM) | - ATTR_AP(ATTR_AP_RO))) - cpu_spinwait(); - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - } - } - } + /* If oldl2 has ATTR_SW_DBM set, then it is also dirty. */ + if ((oldl2 & ATTR_SW_DBM) != 0 && + pmap_demote_l2_locked(pmap, l2, va, &lock) && + (oldl2 & ATTR_SW_WIRED) == 0) { + /* + * Write protect the mapping to a single page so that + * a subsequent write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - (oldl2 & ~ATTR_MASK); + l3 = pmap_l2_to_l3(l2, va); + oldl3 = pmap_load(l3); + while (!atomic_fcmpset_long(l3, &oldl3, + (oldl3 & ~ATTR_SW_DBM) | ATTR_AP(ATTR_AP_RO))) + cpu_spinwait(); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); } PMAP_UNLOCK(pmap); } Modified: stable/12/sys/i386/i386/pmap.c ============================================================================== --- stable/12/sys/i386/i386/pmap.c Thu Sep 19 14:45:04 2019 (r352518) +++ stable/12/sys/i386/i386/pmap.c Thu Sep 19 15:12:32 2019 (r352519) @@ -5366,7 +5366,7 @@ pmap_clear_modify(vm_page_t m) pv_entry_t next_pv, pv; pmap_t pmap; pd_entry_t oldpde, *pde; - pt_entry_t oldpte, *pte; + pt_entry_t *pte; vm_offset_t va; KASSERT((m->oflags & VPO_UNMANAGED) == 0, @@ -5393,33 +5393,24 @@ pmap_clear_modify(vm_page_t m) PMAP_LOCK(pmap); pde = pmap_pde(pmap, va); oldpde = *pde; - if ((oldpde & PG_RW) != 0) { - if (pmap_demote_pde(pmap, pde, va)) { - if ((oldpde & PG_W) == 0) { - /* - * Write protect the mapping to a - * single page so that a subsequent - * write access may repromote. - */ - va += VM_PAGE_TO_PHYS(m) - (oldpde & - PG_PS_FRAME); - pte = pmap_pte_quick(pmap, va); - oldpte = *pte; - if ((oldpte & PG_V) != 0) { - /* - * Regardless of whether a pte is 32 or 64 bits - * in size, PG_RW and PG_M are among the least - * significant 32 bits. - */ - while (!atomic_cmpset_int((u_int *)pte, - oldpte, - oldpte & ~(PG_M | PG_RW))) - oldpte = *pte; - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - } - } - } + /* If oldpde has PG_RW set, then it also has PG_M set. */ + if ((oldpde & PG_RW) != 0 && + pmap_demote_pde(pmap, pde, va) && + (oldpde & PG_W) == 0) { + /* + * Write protect the mapping to a single page so that + * a subsequent write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - (oldpde & PG_PS_FRAME); + pte = pmap_pte_quick(pmap, va); + /* + * Regardless of whether a pte is 32 or 64 bits + * in size, PG_RW and PG_M are among the least + * significant 32 bits. + */ + atomic_clear_int((u_int *)pte, PG_M | PG_RW); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); } PMAP_UNLOCK(pmap); } Modified: stable/12/sys/riscv/riscv/pmap.c ============================================================================== --- stable/12/sys/riscv/riscv/pmap.c Thu Sep 19 14:45:04 2019 (r352518) +++ stable/12/sys/riscv/riscv/pmap.c Thu Sep 19 15:12:32 2019 (r352519) @@ -4104,7 +4104,7 @@ pmap_clear_modify(vm_page_t m) pmap_t pmap; pv_entry_t next_pv, pv; pd_entry_t *l2, oldl2; - pt_entry_t *l3, oldl3; + pt_entry_t *l3; vm_offset_t va; int md_gen, pvh_gen; @@ -4142,28 +4142,19 @@ restart: va = pv->pv_va; l2 = pmap_l2(pmap, va); oldl2 = pmap_load(l2); - if ((oldl2 & PTE_W) != 0) { - if (pmap_demote_l2_locked(pmap, l2, va, &lock)) { - if ((oldl2 & PTE_SW_WIRED) == 0) { - /* - * Write protect the mapping to a - * single page so that a subsequent - * write access may repromote. - */ - va += VM_PAGE_TO_PHYS(m) - - PTE_TO_PHYS(oldl2); - l3 = pmap_l2_to_l3(l2, va); - oldl3 = pmap_load(l3); - if ((oldl3 & PTE_V) != 0) { - while (!atomic_fcmpset_long(l3, - &oldl3, oldl3 & ~(PTE_D | - PTE_W))) - cpu_spinwait(); - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - } - } - } + /* If oldl2 has PTE_W set, then it also has PTE_D set. */ + if ((oldl2 & PTE_W) != 0 && + pmap_demote_l2_locked(pmap, l2, va, &lock) && + (oldl2 & PTE_SW_WIRED) == 0) { + /* + * Write protect the mapping to a single page so that + * a subsequent write access may repromote. + */ + va += VM_PAGE_TO_PHYS(m) - PTE_TO_PHYS(oldl2); + l3 = pmap_l2_to_l3(l2, va); + pmap_clear_bits(l3, PTE_D | PTE_W); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); } PMAP_UNLOCK(pmap); } From owner-svn-src-all@freebsd.org Thu Sep 19 15:24: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 45E02126649 for ; Thu, 19 Sep 2019 15:24:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (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 46Z0yd6GVnz3Nd8 for ; Thu, 19 Sep 2019 15:24:57 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1568906696; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=MfS86Qi4vjXUGCeF7elXAEwDTin+FYW98BM+o8rUUBNWjMY+YBQD1moDx2e0EkXysaXEfaFkx96/u 4BsKHFkviZOlFs3uaFO7ONKLKOTm6XJKLoAXlWAYIvCDXsj3fb9QjeWu8juBvOsieMIuwI9btvCten jxRvr+o0RZygz5N6lIpB7dPNC3QOaGIvkd7OpYrnTfa5pOzRnpWcfwo6IETM5Nui3wTGmZ2Lt1CCMy oz6/E7X79JPGm/8EzYcffp4QGdjZvPT2E2vepXK6nY/ThnHOKGSz4v/B0fvf095WNgHnvQPgh8NOip PBzJgOAVBfP1vqvg+Ks0BfXmH9V2EKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=S7fxOxi31KmQAldQpXFQcEeugPXJ8gL/HEYxItfH1xQ=; b=CdakdsrsLCPOYU+tu/UE9R4DwlMy0K2cCgOpeMTA+/F6s57RDl+kGgEe+eq1uRiaSnI7VPQoUItXk pQcZHsSXNKANW89+QtP03n/w74jXKyWnhaS97JnZSl81EdXryKJeizPlCQqbQQl7JOXwvmieBXdXfe 3k13lyALh/pxeOM0BInG+GpBcrqOB4ADKRvJhT8khetBMQM9NZfORSts5mzc8HgikAYgpFiCDrzEIU bh5hmBfIq/VSrooGRmzMo1FYXk5pAVU0eaxxN8Io9MLeO0kUqlwuT1pcyJBV32lqE7B0HIIPRrdTzx yKJL/TdtbeNjAi/XJwK44gxx14vzGIQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=S7fxOxi31KmQAldQpXFQcEeugPXJ8gL/HEYxItfH1xQ=; b=j8KKDF+b3FKtcp82xqfo8B2cduN8v06F9lFjMoyqwWXpLClEnMe/40Cbfoq2gwCiwdgzfr/igrqHf M2fGBNcsAbCuRM2cazz6zgj1XeMvx37hnuDMhBCuTRqLPsuh8QYjgXhF7ejo2qX5UFRjKaMVJB5/AP WkLYWhwWpAuyL3+8WrsXr1X+DxWLAKAnapS3j7X8V3f9cU6tlTOnk2FLcJeJu7RcJ2CJdf4NDllsJm 9N8OfTp6PmrVRNh0wxSCvcXkqJuVvK96fNrw9qdHMtDRfI3o+3ul2JBPqJUn6+9MNlc0JqvsLLyNiJ giNcdRnHZMBJyNvFpIRxUNu/cejwLuA== X-MHO-RoutePath: aGlwcGll X-MHO-User: a13cba16-daf1-11e9-b67d-cdd75d6ce7a8 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id a13cba16-daf1-11e9-b67d-cdd75d6ce7a8; Thu, 19 Sep 2019 15:24:54 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x8JFOrhP007234; Thu, 19 Sep 2019 09:24:53 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r352513 - head/usr.sbin/freebsd-update From: Ian Lepore To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 19 Sep 2019 09:24:53 -0600 In-Reply-To: <201909191134.x8JBYZMv004854@repo.freebsd.org> References: <201909191134.x8JBYZMv004854@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: 46Z0yd6GVnz3Nd8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.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: Thu, 19 Sep 2019 15:24:58 -0000 On Thu, 2019-09-19 at 11:34 +0000, Ed Maste wrote: > Author: emaste > Date: Thu Sep 19 11:34:35 2019 > New Revision: 352513 > URL: https://svnweb.freebsd.org/changeset/base/352513 > > Log: > freebsd-update.8: appease igor > > igor follows American style guides in the belief that abbreviations i.e. > and e.g. are always followed by a comma. Make that change now so that > future updates to freebsd-update.8 do not complain about this. > > Grammatically, English requires a comma after 'i.e.' because it is an adverbial phrase functioning as a conjunctive adverb. If you translate 'e.g.' idiomatically as "for example", then it is also a conjunctive adverbial phrase requiring a comma. -- Ian From owner-svn-src-all@freebsd.org Thu Sep 19 16:43: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 E02F512837D; Thu, 19 Sep 2019 16:43:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z2hw5cXXz3ydg; Thu, 19 Sep 2019 16:43:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4A1018589; Thu, 19 Sep 2019 16:43:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JGhCKl089739; Thu, 19 Sep 2019 16:43:12 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JGhCJu089738; Thu, 19 Sep 2019 16:43:12 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201909191643.x8JGhCJu089738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 19 Sep 2019 16:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352520 - head/usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/usr.sbin/pkg X-SVN-Commit-Revision: 352520 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 16:43:12 -0000 Author: gjb Date: Thu Sep 19 16:43:12 2019 New Revision: 352520 URL: https://svnweb.freebsd.org/changeset/base/352520 Log: Apply r346792 (cperciva) from stable/12 to head. The original commit message: On non-x86 systems, use "quarterly" packages. x86 architectures have "latest" package builds on stable/*, so keep using those (they'll get switched over to "quarterly" during releases). The original commit was a direct commit to stable/12, as at the time it was presumed it would not be necessary for head. However, when it is time to create a releng branch or switch from PRERELEASE/STABLE to BETA/RC, the pkg(7) Makefile needs further adjusting. This commit includes those further adjustments, evaluating the BRANCH variable from release/Makefile to determine the pkg(7) repository to use. MFC after: immediate (if possible) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/usr.sbin/pkg/Makefile Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Thu Sep 19 15:12:32 2019 (r352519) +++ head/usr.sbin/pkg/Makefile Thu Sep 19 16:43:12 2019 (r352520) @@ -1,6 +1,16 @@ # $FreeBSD$ +.if ${MACHINE} != "amd64" && ${MACHINE} != "i386" +PKGCONFBRANCH?= quarterly +.else +_BRANCH!= ${MAKE} -C ${SRCTOP}/release -V BRANCH +BRANCH?= ${_BRANCH} +. if ${BRANCH:MBETA*} || ${BRANCH:MRC*} || ${BRANCH:MRELEASE*} +PKGCONFBRANCH?= quarterly +. else PKGCONFBRANCH?= latest +. endif +.endif CONFS= FreeBSD.conf.${PKGCONFBRANCH} CONFSNAME= FreeBSD.conf CONFSDIR= /etc/pkg From owner-svn-src-all@freebsd.org Thu Sep 19 16:54: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 3C26E128816; Thu, 19 Sep 2019 16:54:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z2y30hcHz40Tj; Thu, 19 Sep 2019 16:54:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBB891874B; Thu, 19 Sep 2019 16:54:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JGsYb6095595; Thu, 19 Sep 2019 16:54:34 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JGsYtd095594; Thu, 19 Sep 2019 16:54:34 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201909191654.x8JGsYtd095594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 19 Sep 2019 16:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r352521 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 352521 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 16:54:35 -0000 Author: gjb Date: Thu Sep 19 16:54:34 2019 New Revision: 352521 URL: https://svnweb.freebsd.org/changeset/base/352521 Log: Add releng/12.1 to svnadmin/conf/approvers. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Thu Sep 19 16:43:12 2019 (r352520) +++ svnadmin/conf/approvers Thu Sep 19 16:54:34 2019 (r352521) @@ -20,6 +20,7 @@ #^stable/12/ re #^stable/11/ re ^release/ re +^releng/12.1/ re ^releng/12.0/ (security-officer|so) ^releng/11.[0-3]/ (security-officer|so) ^releng/10.[0-4]/ (security-officer|so) From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 2643312922A; Thu, 19 Sep 2019 17:17:31 +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 46Z3SW09Hvz41tj; Thu, 19 Sep 2019 17:17:31 +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 D977E18AC0; Thu, 19 Sep 2019 17:17:30 +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 x8JHHUsm007466; Thu, 19 Sep 2019 17:17:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHTFv007462; Thu, 19 Sep 2019 17:17:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHTFv007462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352522 - in vendor/llvm/dist-release_90: include/llvm/IR lib/CodeGen lib/IR lib/Target/X86 lib/Transforms/Utils X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_90: include/llvm/IR lib/CodeGen lib/IR lib/Target/X86 lib/Transforms/Utils X-SVN-Commit-Revision: 352522 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:31 -0000 Author: dim Date: Thu Sep 19 17:17:29 2019 New Revision: 352522 URL: https://svnweb.freebsd.org/changeset/base/352522 Log: Vendor import of llvm 9.0.0 release r372316: https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_900/final@372316 Modified: vendor/llvm/dist-release_90/include/llvm/IR/Instructions.h vendor/llvm/dist-release_90/lib/CodeGen/IfConversion.cpp vendor/llvm/dist-release_90/lib/IR/Instructions.cpp vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist-release_90/lib/Transforms/Utils/SimplifyLibCalls.cpp Modified: vendor/llvm/dist-release_90/include/llvm/IR/Instructions.h ============================================================================== --- vendor/llvm/dist-release_90/include/llvm/IR/Instructions.h Thu Sep 19 16:54:34 2019 (r352521) +++ vendor/llvm/dist-release_90/include/llvm/IR/Instructions.h Thu Sep 19 17:17:29 2019 (r352522) @@ -3938,6 +3938,9 @@ class CallBrInst : public CallBase { ArrayRef IndirectDests, ArrayRef Args, ArrayRef Bundles, const Twine &NameStr); + /// Should the Indirect Destinations change, scan + update the Arg list. + void updateArgBlockAddresses(unsigned i, BasicBlock *B); + /// Compute the number of operands to allocate. static int ComputeNumOperands(int NumArgs, int NumIndirectDests, int NumBundleInputs = 0) { @@ -4075,7 +4078,7 @@ class CallBrInst : public CallBase { return cast(*(&Op<-1>() - getNumIndirectDests() - 1)); } BasicBlock *getIndirectDest(unsigned i) const { - return cast(*(&Op<-1>() - getNumIndirectDests() + i)); + return cast_or_null(*(&Op<-1>() - getNumIndirectDests() + i)); } SmallVector getIndirectDests() const { SmallVector IndirectDests; @@ -4087,6 +4090,7 @@ class CallBrInst : public CallBase { *(&Op<-1>() - getNumIndirectDests() - 1) = reinterpret_cast(B); } void setIndirectDest(unsigned i, BasicBlock *B) { + updateArgBlockAddresses(i, B); *(&Op<-1>() - getNumIndirectDests() + i) = reinterpret_cast(B); } @@ -4096,11 +4100,10 @@ class CallBrInst : public CallBase { return i == 0 ? getDefaultDest() : getIndirectDest(i - 1); } - void setSuccessor(unsigned idx, BasicBlock *NewSucc) { - assert(idx < getNumIndirectDests() + 1 && + void setSuccessor(unsigned i, BasicBlock *NewSucc) { + assert(i < getNumIndirectDests() + 1 && "Successor # out of range for callbr!"); - *(&Op<-1>() - getNumIndirectDests() -1 + idx) = - reinterpret_cast(NewSucc); + return i == 0 ? setDefaultDest(NewSucc) : setIndirectDest(i - 1, NewSucc); } unsigned getNumSuccessors() const { return getNumIndirectDests() + 1; } Modified: vendor/llvm/dist-release_90/lib/CodeGen/IfConversion.cpp ============================================================================== --- vendor/llvm/dist-release_90/lib/CodeGen/IfConversion.cpp Thu Sep 19 16:54:34 2019 (r352521) +++ vendor/llvm/dist-release_90/lib/CodeGen/IfConversion.cpp Thu Sep 19 17:17:29 2019 (r352522) @@ -912,6 +912,12 @@ void IfConverter::AnalyzeBranches(BBInfo &BBI) { BBI.BrCond.clear(); BBI.IsBrAnalyzable = !TII->analyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); + if (!BBI.IsBrAnalyzable) { + BBI.TrueBB = nullptr; + BBI.FalseBB = nullptr; + BBI.BrCond.clear(); + } + SmallVector RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); BBI.IsBrReversible = (RevCond.size() == 0) || !TII->reverseBranchCondition(RevCond); @@ -1758,9 +1764,15 @@ bool IfConverter::IfConvertDiamondCommon( if (!BBI1->IsBrAnalyzable) verifySameBranchInstructions(&MBB1, &MBB2); #endif - BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB); - // Remove duplicated instructions. + // Remove duplicated instructions from the tail of MBB1: any branch + // instructions, and the common instructions counted by NumDups2. DI1 = MBB1.end(); + while (DI1 != MBB1.begin()) { + MachineBasicBlock::iterator Prev = std::prev(DI1); + if (!Prev->isBranch() && !Prev->isDebugInstr()) + break; + DI1 = Prev; + } for (unsigned i = 0; i != NumDups2; ) { // NumDups2 only counted non-dbg_value instructions, so this won't // run off the head of the list. Modified: vendor/llvm/dist-release_90/lib/IR/Instructions.cpp ============================================================================== --- vendor/llvm/dist-release_90/lib/IR/Instructions.cpp Thu Sep 19 16:54:34 2019 (r352521) +++ vendor/llvm/dist-release_90/lib/IR/Instructions.cpp Thu Sep 19 17:17:29 2019 (r352522) @@ -822,6 +822,17 @@ void CallBrInst::init(FunctionType *FTy, Value *Fn, Ba setName(NameStr); } +void CallBrInst::updateArgBlockAddresses(unsigned i, BasicBlock *B) { + assert(getNumIndirectDests() > i && "IndirectDest # out of range for callbr"); + if (BasicBlock *OldBB = getIndirectDest(i)) { + BlockAddress *Old = BlockAddress::get(OldBB); + BlockAddress *New = BlockAddress::get(B); + for (unsigned ArgNo = 0, e = getNumArgOperands(); ArgNo != e; ++ArgNo) + if (dyn_cast(getArgOperand(ArgNo)) == Old) + setArgOperand(ArgNo, New); + } +} + CallBrInst::CallBrInst(const CallBrInst &CBI) : CallBase(CBI.Attrs, CBI.FTy, CBI.getType(), Instruction::CallBr, OperandTraits::op_end(this) - CBI.getNumOperands(), Modified: vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.cpp Thu Sep 19 16:54:34 2019 (r352521) +++ vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.cpp Thu Sep 19 17:17:29 2019 (r352522) @@ -7650,17 +7650,22 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayR // IsConsecutiveLoadWithZeros - we need to create a shuffle of the loaded // vector and a zero vector to clear out the zero elements. if (!isAfterLegalize && VT.isVector()) { - SmallVector ClearMask(NumElems, -1); - for (unsigned i = 0; i < NumElems; ++i) { - if (ZeroMask[i]) - ClearMask[i] = i + NumElems; - else if (LoadMask[i]) - ClearMask[i] = i; + unsigned NumMaskElts = VT.getVectorNumElements(); + if ((NumMaskElts % NumElems) == 0) { + unsigned Scale = NumMaskElts / NumElems; + SmallVector ClearMask(NumMaskElts, -1); + for (unsigned i = 0; i < NumElems; ++i) { + if (UndefMask[i]) + continue; + int Offset = ZeroMask[i] ? NumMaskElts : 0; + for (unsigned j = 0; j != Scale; ++j) + ClearMask[(i * Scale) + j] = (i * Scale) + j + Offset; + } + SDValue V = CreateLoad(VT, LDBase); + SDValue Z = VT.isInteger() ? DAG.getConstant(0, DL, VT) + : DAG.getConstantFP(0.0, DL, VT); + return DAG.getVectorShuffle(VT, DL, V, Z, ClearMask); } - SDValue V = CreateLoad(VT, LDBase); - SDValue Z = VT.isInteger() ? DAG.getConstant(0, DL, VT) - : DAG.getConstantFP(0.0, DL, VT); - return DAG.getVectorShuffle(VT, DL, V, Z, ClearMask); } } @@ -31664,8 +31669,8 @@ static bool matchUnaryPermuteShuffle(MVT MaskVT, Array if (!ContainsZeros && AllowIntDomain && MaskScalarSizeInBits == 16) { SmallVector RepeatedMask; if (is128BitLaneRepeatedShuffleMask(MaskEltVT, Mask, RepeatedMask)) { - ArrayRef LoMask(Mask.data() + 0, 4); - ArrayRef HiMask(Mask.data() + 4, 4); + ArrayRef LoMask(RepeatedMask.data() + 0, 4); + ArrayRef HiMask(RepeatedMask.data() + 4, 4); // PSHUFLW: permute lower 4 elements only. if (isUndefOrInRange(LoMask, 0, 4) && Modified: vendor/llvm/dist-release_90/lib/Transforms/Utils/SimplifyLibCalls.cpp ============================================================================== --- vendor/llvm/dist-release_90/lib/Transforms/Utils/SimplifyLibCalls.cpp Thu Sep 19 16:54:34 2019 (r352521) +++ vendor/llvm/dist-release_90/lib/Transforms/Utils/SimplifyLibCalls.cpp Thu Sep 19 17:17:29 2019 (r352522) @@ -1480,8 +1480,8 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, I if (match(Expo, m_SpecificFP(-1.0))) return B.CreateFDiv(ConstantFP::get(Ty, 1.0), Base, "reciprocal"); - // pow(x, 0.0) -> 1.0 - if (match(Expo, m_SpecificFP(0.0))) + // pow(x, +/-0.0) -> 1.0 + if (match(Expo, m_AnyZeroFP())) return ConstantFP::get(Ty, 1.0); // pow(x, 1.0) -> x From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 F2E1112924B; Thu, 19 Sep 2019 17:17:33 +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 46Z3SY6CgCz41vX; Thu, 19 Sep 2019 17:17:33 +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 A12E218AC1; Thu, 19 Sep 2019 17:17:33 +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 x8JHHXNb007515; Thu, 19 Sep 2019 17:17:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHXOn007514; Thu, 19 Sep 2019 17:17:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHXOn007514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352523 - vendor/llvm/llvm-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_900-r372316 X-SVN-Commit-Revision: 352523 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:34 -0000 Author: dim Date: Thu Sep 19 17:17:33 2019 New Revision: 352523 URL: https://svnweb.freebsd.org/changeset/base/352523 Log: Tag llvm 9.0.0 release r372316. Added: vendor/llvm/llvm-release_900-r372316/ - copied from r352522, vendor/llvm/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 CDC7A129279; Thu, 19 Sep 2019 17:17:37 +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 46Z3Sd4bqDz422J; Thu, 19 Sep 2019 17:17:37 +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 343AE18AC2; Thu, 19 Sep 2019 17:17:37 +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 x8JHHbnl007567; Thu, 19 Sep 2019 17:17:37 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHaI4007563; Thu, 19 Sep 2019 17:17:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHaI4007563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352524 - in vendor/clang/dist-release_90: include/clang/Basic lib/AST lib/Basic lib/CodeGen X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_90: include/clang/Basic lib/AST lib/Basic lib/CodeGen X-SVN-Commit-Revision: 352524 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:37 -0000 Author: dim Date: Thu Sep 19 17:17:36 2019 New Revision: 352524 URL: https://svnweb.freebsd.org/changeset/base/352524 Log: Vendor import of clang 9.0.0 release r372316: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_900/final@372316 Modified: vendor/clang/dist-release_90/include/clang/Basic/Builtins.def vendor/clang/dist-release_90/lib/AST/Decl.cpp vendor/clang/dist-release_90/lib/Basic/Version.cpp vendor/clang/dist-release_90/lib/CodeGen/CodeGenModule.cpp Modified: vendor/clang/dist-release_90/include/clang/Basic/Builtins.def ============================================================================== --- vendor/clang/dist-release_90/include/clang/Basic/Builtins.def Thu Sep 19 17:17:33 2019 (r352523) +++ vendor/clang/dist-release_90/include/clang/Basic/Builtins.def Thu Sep 19 17:17:36 2019 (r352524) @@ -440,7 +440,7 @@ BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "nc") BUILTIN(__builtin_rotateright8, "UcUcUc", "nc") BUILTIN(__builtin_rotateright16, "UsUsUs", "nc") BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc") -BUILTIN(__builtin_rotateright64, "UWiUWiWi", "nc") +BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "nc") // Random GCC builtins BUILTIN(__builtin_constant_p, "i.", "nctu") Modified: vendor/clang/dist-release_90/lib/AST/Decl.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/AST/Decl.cpp Thu Sep 19 17:17:33 2019 (r352523) +++ vendor/clang/dist-release_90/lib/AST/Decl.cpp Thu Sep 19 17:17:36 2019 (r352524) @@ -3332,7 +3332,8 @@ SourceRange FunctionDecl::getExceptionSpecSourceRange( /// an externally visible symbol, but "extern inline" will not create an /// externally visible symbol. bool FunctionDecl::isInlineDefinitionExternallyVisible() const { - assert((doesThisDeclarationHaveABody() || willHaveBody()) && + assert((doesThisDeclarationHaveABody() || willHaveBody() || + hasAttr()) && "Must be a function definition"); assert(isInlined() && "Function must be inline"); ASTContext &Context = getASTContext(); Modified: vendor/clang/dist-release_90/lib/Basic/Version.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/Basic/Version.cpp Thu Sep 19 17:17:33 2019 (r352523) +++ vendor/clang/dist-release_90/lib/Basic/Version.cpp Thu Sep 19 17:17:36 2019 (r352524) @@ -35,7 +35,7 @@ std::string getClangRepositoryPath() { // If the CLANG_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_90/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_900/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: vendor/clang/dist-release_90/lib/CodeGen/CodeGenModule.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/CodeGen/CodeGenModule.cpp Thu Sep 19 17:17:33 2019 (r352523) +++ vendor/clang/dist-release_90/lib/CodeGen/CodeGenModule.cpp Thu Sep 19 17:17:36 2019 (r352524) @@ -4355,17 +4355,22 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) // Create a reference to the named value. This ensures that it is emitted // if a deferred decl. llvm::Constant *Aliasee; - if (isa(DeclTy)) + llvm::GlobalValue::LinkageTypes LT; + if (isa(DeclTy)) { Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GD, /*ForVTable=*/false); - else + LT = getFunctionLinkage(GD); + } else { Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(), llvm::PointerType::getUnqual(DeclTy), /*D=*/nullptr); + LT = getLLVMLinkageVarDefinition(cast(GD.getDecl()), + D->getType().isConstQualified()); + } // Create the new alias itself, but don't set a name yet. - auto *GA = llvm::GlobalAlias::create( - DeclTy, 0, llvm::Function::ExternalLinkage, "", Aliasee, &getModule()); + auto *GA = + llvm::GlobalAlias::create(DeclTy, 0, LT, "", Aliasee, &getModule()); if (Entry) { if (GA->getAliasee() == Entry) { From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 6AD6C1292A4; Thu, 19 Sep 2019 17:17:40 +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 46Z3Sh1kgzz426m; Thu, 19 Sep 2019 17:17:40 +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 E52DE18AC3; Thu, 19 Sep 2019 17:17:39 +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 x8JHHdxP007613; Thu, 19 Sep 2019 17:17:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHdXZ007612; Thu, 19 Sep 2019 17:17:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHdXZ007612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352525 - vendor/clang/clang-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_900-r372316 X-SVN-Commit-Revision: 352525 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:40 -0000 Author: dim Date: Thu Sep 19 17:17:39 2019 New Revision: 352525 URL: https://svnweb.freebsd.org/changeset/base/352525 Log: Tag clang 9.0.0 release r372316. Added: vendor/clang/clang-release_900-r372316/ - copied from r352524, vendor/clang/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 E1C9D1292DD; Thu, 19 Sep 2019 17:17:43 +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 46Z3Sl4VLpz42Fd; Thu, 19 Sep 2019 17:17:43 +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 1162318AC4; Thu, 19 Sep 2019 17:17:43 +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 x8JHHg2P007662; Thu, 19 Sep 2019 17:17:42 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHgs5007661; Thu, 19 Sep 2019 17:17:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHgs5007661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352526 - vendor/compiler-rt/compiler-rt-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_900-r372316 X-SVN-Commit-Revision: 352526 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:44 -0000 Author: dim Date: Thu Sep 19 17:17:42 2019 New Revision: 352526 URL: https://svnweb.freebsd.org/changeset/base/352526 Log: Tag compiler-rt 9.0.0 release r372316. Added: vendor/compiler-rt/compiler-rt-release_900-r372316/ - copied from r352525, vendor/compiler-rt/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 5E4C0129311; Thu, 19 Sep 2019 17:17:46 +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 46Z3Sp12BBz42K8; Thu, 19 Sep 2019 17:17:46 +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 DCD7018AC5; Thu, 19 Sep 2019 17:17:45 +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 x8JHHj9u007708; Thu, 19 Sep 2019 17:17:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHjV7007707; Thu, 19 Sep 2019 17:17:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHjV7007707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352527 - vendor/libc++/libc++-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_900-r372316 X-SVN-Commit-Revision: 352527 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:46 -0000 Author: dim Date: Thu Sep 19 17:17:45 2019 New Revision: 352527 URL: https://svnweb.freebsd.org/changeset/base/352527 Log: Tag libc++ 9.0.0 release r372316. Added: vendor/libc++/libc++-release_900-r372316/ - copied from r352526, vendor/libc++/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17: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 875CB129358; Thu, 19 Sep 2019 17:17: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 46Z3Ss27ZZz42T3; Thu, 19 Sep 2019 17:17: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 B9CC518AC6; Thu, 19 Sep 2019 17:17: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 x8JHHm0e007757; Thu, 19 Sep 2019 17:17:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHm9u007756; Thu, 19 Sep 2019 17:17:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHm9u007756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352528 - vendor/llvm-libunwind/libunwind-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-libunwind/libunwind-release_900-r372316 X-SVN-Commit-Revision: 352528 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:49 -0000 Author: dim Date: Thu Sep 19 17:17:48 2019 New Revision: 352528 URL: https://svnweb.freebsd.org/changeset/base/352528 Log: Tag LLVM libunwind 9.0.0 release r372316. Added: vendor/llvm-libunwind/libunwind-release_900-r372316/ - copied from r352527, vendor/llvm-libunwind/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 D38FF129389; Thu, 19 Sep 2019 17:17: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 46Z3Sv5K0Nz42Xy; Thu, 19 Sep 2019 17:17: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 75D7618AC7; Thu, 19 Sep 2019 17:17: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 x8JHHpAm007803; Thu, 19 Sep 2019 17:17:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHpul007802; Thu, 19 Sep 2019 17:17:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHpul007802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352529 - vendor/lld/lld-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_900-r372316 X-SVN-Commit-Revision: 352529 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:51 -0000 Author: dim Date: Thu Sep 19 17:17:51 2019 New Revision: 352529 URL: https://svnweb.freebsd.org/changeset/base/352529 Log: Tag lld 9.0.0 release r372316. Added: vendor/lld/lld-release_900-r372316/ - copied from r352528, vendor/lld/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:17: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 D466D1293BC; Thu, 19 Sep 2019 17:17:54 +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 46Z3Sy5Dkhz42f8; Thu, 19 Sep 2019 17:17:54 +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 9775918AC8; Thu, 19 Sep 2019 17:17:54 +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 x8JHHsgB007855; Thu, 19 Sep 2019 17:17:54 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHs9j007853; Thu, 19 Sep 2019 17:17:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHs9j007853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352530 - in vendor/lldb/dist-release_90/utils: . TableGen X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lldb/dist-release_90/utils: . TableGen X-SVN-Commit-Revision: 352530 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:54 -0000 Author: dim Date: Thu Sep 19 17:17:53 2019 New Revision: 352530 URL: https://svnweb.freebsd.org/changeset/base/352530 Log: Vendor import of lldb 9.0.0 release r372316: https://llvm.org/svn/llvm-project/lldb/tags/RELEASE_900/final@372316 Added: vendor/lldb/dist-release_90/utils/ vendor/lldb/dist-release_90/utils/TableGen/ vendor/lldb/dist-release_90/utils/TableGen/LLDBOptionDefEmitter.cpp vendor/lldb/dist-release_90/utils/TableGen/LLDBTableGen.cpp vendor/lldb/dist-release_90/utils/TableGen/LLDBTableGenBackends.h Added: vendor/lldb/dist-release_90/utils/TableGen/LLDBOptionDefEmitter.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist-release_90/utils/TableGen/LLDBOptionDefEmitter.cpp Thu Sep 19 17:17:53 2019 (r352530) @@ -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-release_90/utils/TableGen/LLDBTableGen.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist-release_90/utils/TableGen/LLDBTableGen.cpp Thu Sep 19 17:17:53 2019 (r352530) @@ -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-release_90/utils/TableGen/LLDBTableGenBackends.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist-release_90/utils/TableGen/LLDBTableGenBackends.h Thu Sep 19 17:17:53 2019 (r352530) @@ -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 Thu Sep 19 17:17: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 767BB129406; Thu, 19 Sep 2019 17:17:58 +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 46Z3T21bjPz42lb; Thu, 19 Sep 2019 17:17:58 +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 6E09218AC9; Thu, 19 Sep 2019 17:17: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 x8JHHv8F007903; Thu, 19 Sep 2019 17:17:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHHvkW007902; Thu, 19 Sep 2019 17:17:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191717.x8JHHvkW007902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352531 - vendor/lldb/lldb-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_900-r372316 X-SVN-Commit-Revision: 352531 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:17:58 -0000 Author: dim Date: Thu Sep 19 17:17:56 2019 New Revision: 352531 URL: https://svnweb.freebsd.org/changeset/base/352531 Log: Tag lldb 9.0.0 release r372316. Added: vendor/lldb/lldb-release_900-r372316/ - copied from r352530, vendor/lldb/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:18: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 18FA9129440; Thu, 19 Sep 2019 17:18:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46Z3T45x6Cz42rW; Thu, 19 Sep 2019 17:18:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 354F218ACA; Thu, 19 Sep 2019 17:18:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JHI0t5007953; Thu, 19 Sep 2019 17:18:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHI05M007951; Thu, 19 Sep 2019 17:18:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909191718.x8JHI05M007951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 19 Sep 2019 17:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r352532 - vendor/llvm-openmp/openmp-release_900-r372316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-openmp/openmp-release_900-r372316 X-SVN-Commit-Revision: 352532 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:18:01 -0000 Author: dim Date: Thu Sep 19 17:17:59 2019 New Revision: 352532 URL: https://svnweb.freebsd.org/changeset/base/352532 Log: Tag LLVM openmp 9.0.0 release r372316. Added: vendor/llvm-openmp/openmp-release_900-r372316/ - copied from r352531, vendor/llvm-openmp/dist-release_90/ From owner-svn-src-all@freebsd.org Thu Sep 19 17:38: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 068F0129B24; Thu, 19 Sep 2019 17:38:45 +0000 (UTC) (envelope-from dim@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 46Z3x06Mx3z43qq; Thu, 19 Sep 2019 17:38:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id A2386D1C5; Thu, 19 Sep 2019 17:38:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::d05d:2f14:a99b:7df2] (unknown [IPv6:2001:470:7a58:0:d05d:2f14:a99b:7df2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 0F73B6C02F; Thu, 19 Sep 2019 19:38:43 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_7D33F55E-C322-41B9-AABE-9757195E930D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r352304 - in head: . usr.sbin/ntp usr.sbin/ntp/ntpd Date: Thu, 19 Sep 2019 19:38:37 +0200 In-Reply-To: <201909191246.x8JCke4Y003916@slippy.cwsent.com> Cc: src-committers , svn-src-all , svn-src-head@freebsd.org To: Cy Schubert References: <201909132020.x8DKK62j025066@repo.freebsd.org> <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org> <201909191246.x8JCke4Y003916@slippy.cwsent.com> X-Mailer: Apple Mail (2.3445.104.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: Thu, 19 Sep 2019 17:38:45 -0000 --Apple-Mail=_7D33F55E-C322-41B9-AABE-9757195E930D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 19 Sep 2019, at 14:46, Cy Schubert wrote: >=20 > In message <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org>, Dimitry = Andric writes: >> On 2019-09-13 22:20, Cy Schubert wrote: >>> Author: cy >>> Date: Fri Sep 13 20:20:05 2019 >>> New Revision: 352304 >>> URL: https://svnweb.freebsd.org/changeset/base/352304 >>>=20 >>> Log: >>> No longer mlock() ntpd pages by default in memory thus allowing = its >>> pages to page as necessary. >>>=20 >>> To restore historic BSD behaviour add the following to ntp.conf: >>> rlimit memlock 32 >>=20 >> Apparently this does not completely work, as I still see: >>=20 >> ntpd[824]: ntpd 4.2.8p12-a (1): Starting >> ntpd[825]: Cannot set RLIMIT_MEMLOCK: Operation not permitted >>=20 >> even while my ntp.conf is almost entirely vanilla (it only has a >> different "server" line). >>=20 >> Even explicitly adding: >>=20 >> rlimit memlock -1 >>=20 >> does not work, it results in the same error. >>=20 >> -Dimitry >=20 > Can you try this please? >=20 > diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c > index 2b14431dc7b..bcfca27a535 100644 > --- a/contrib/ntp/ntpd/ntpd.c > +++ b/contrib/ntp/ntpd/ntpd.c > @@ -999,7 +999,7 @@ ntpdmain( > # if defined(HAVE_MLOCKALL) > # ifdef HAVE_SETRLIMIT > ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); > -# ifdef RLIMIT_MEMLOCK > +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && > DFLT_RLIMIT_MEMLOCK !=3D -1 > /* > * The default RLIMIT_MEMLOCK is very low on Linux systems. > * Unless we increase this limit malloc calls are likely to Yes, I already had something similar edited in (though I tested DLT_RLIMIT_MEMLOCK > 0), and that works for me. -Dimitry --Apple-Mail=_7D33F55E-C322-41B9-AABE-9757195E930D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXYO9HQAKCRCwXqMKLiCW o+bKAJ4yObZeTSfli2jwIpS48AeeeeRkAgCgwI2gFdOJWghEdvhTS0n9Ucn8ACI= =qFIb -----END PGP SIGNATURE----- --Apple-Mail=_7D33F55E-C322-41B9-AABE-9757195E930D-- From owner-svn-src-all@freebsd.org Thu Sep 19 17:42: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 36172129E62; Thu, 19 Sep 2019 17:42:18 +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 46Z4160hnPz44MJ; Thu, 19 Sep 2019 17:42:18 +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 EF4F418FF0; Thu, 19 Sep 2019 17:42:17 +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 x8JHgHc2022297; Thu, 19 Sep 2019 17:42:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JHgHlh022296; Thu, 19 Sep 2019 17:42:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909191742.x8JHgHlh022296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 19 Sep 2019 17:42:17 +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: r352534 - stable/12/sys/fs/fuse X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sys/fs/fuse X-SVN-Commit-Revision: 352534 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 17:42:18 -0000 Author: asomers Date: Thu Sep 19 17:42:17 2019 New Revision: 352534 URL: https://svnweb.freebsd.org/changeset/base/352534 Log: MFC r352417: Fix an off-by-one error from r351961 That revision addressed a Coverity CID that could lead to a buffer overflow, but it had an off-by-one error in the buffer size check. Reported by: Coverity Coverity CID: 1405530 MFC-With: 351961 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/fs/fuse/fuse_internal.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/fuse/fuse_internal.c ============================================================================== --- stable/12/sys/fs/fuse/fuse_internal.c Thu Sep 19 17:42:02 2019 (r352533) +++ stable/12/sys/fs/fuse/fuse_internal.c Thu Sep 19 17:42:17 2019 (r352534) @@ -390,7 +390,7 @@ fuse_internal_invalidate_entry(struct mount *mp, struc if ((err = uiomove(&fnieo, sizeof(fnieo), uio)) != 0) return (err); - if (fnieo.namelen > sizeof(name)) + if (fnieo.namelen >= sizeof(name)) return (EINVAL); if ((err = uiomove(name, fnieo.namelen, uio)) != 0) From owner-svn-src-all@freebsd.org Thu Sep 19 18:50: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 47CC312B68C; Thu, 19 Sep 2019 18:50:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z5X310lwz47sy; Thu, 19 Sep 2019 18:50:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0607419AEB; Thu, 19 Sep 2019 18:50:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JIog1P062441; Thu, 19 Sep 2019 18:50:42 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JIogvM062440; Thu, 19 Sep 2019 18:50:42 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201909191850.x8JIogvM062440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 19 Sep 2019 18:50: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: r352535 - stable/12/usr.sbin/pkg X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/12/usr.sbin/pkg X-SVN-Commit-Revision: 352535 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 18:50:43 -0000 Author: gjb Date: Thu Sep 19 18:50:42 2019 New Revision: 352535 URL: https://svnweb.freebsd.org/changeset/base/352535 Log: MFC r352520 (partial): The original commit was a direct commit to stable/12, as at the time it was presumed it would not be necessary for head. However, when it is time to create a releng branch or switch from PRERELEASE/STABLE to BETA/RC, the pkg(7) Makefile needs further adjusting. This commit includes those further adjustments, evaluating the BRANCH variable from release/Makefile to determine the pkg(7) repository to use. Approved by: re (kib, insta-MFC) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/12/usr.sbin/pkg/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/pkg/Makefile ============================================================================== --- stable/12/usr.sbin/pkg/Makefile Thu Sep 19 17:42:17 2019 (r352534) +++ stable/12/usr.sbin/pkg/Makefile Thu Sep 19 18:50:42 2019 (r352535) @@ -2,8 +2,15 @@ .if ${MACHINE} != "amd64" && ${MACHINE} != "i386" PKGCONFBRANCH?= quarterly -.endif +.else +_BRANCH!= ${MAKE} -C ${SRCTOP}/release -V BRANCH +BRANCH?= ${_BRANCH} +. if ${BRANCH:MBETA*} || ${BRANCH:MRC*} || ${BRANCH:MRELEASE*} +PKGCONFBRANCH?= quarterly +. else PKGCONFBRANCH?= latest +. endif +.endif CONFS= FreeBSD.conf.${PKGCONFBRANCH} CONFSNAME= FreeBSD.conf CONFSDIR= /etc/pkg From owner-svn-src-all@freebsd.org Thu Sep 19 19:38: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 7361712C8B1; Thu, 19 Sep 2019 19:38:22 +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 46Z6b20YX4z4BSP; Thu, 19 Sep 2019 19:38:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id B2FtiYasRsAGkB2Fui1mt6; Thu, 19 Sep 2019 13:38:19 -0600 X-Authority-Analysis: v=2.3 cv=WeVylHpX c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=J70Eh1EUuV4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=A-G1zzc3P0URKbUEIbsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 58E024E8; Thu, 19 Sep 2019 12:38:16 -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 x8JJcFSr064445; Thu, 19 Sep 2019 12:38:15 -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 x8JJcFSb064442; Thu, 19 Sep 2019 12:38:15 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201909191938.x8JJcFSb064442@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: Dimitry Andric cc: Cy Schubert , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r352304 - in head: . usr.sbin/ntp usr.sbin/ntp/ntpd In-reply-to: References: <201909132020.x8DKK62j025066@repo.freebsd.org> <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org> <201909191246.x8JCke4Y003916@slippy.cwsent.com> Comments: In-reply-to Dimitry Andric message dated "Thu, 19 Sep 2019 19:38:37 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 19 Sep 2019 12:38:15 -0700 X-CMAE-Envelope: MS4wfP8XZIx2JXZTW0FqfbX5HFiZky6dCCBehg2mZqKSHC/ZvqZIYaiWy4ugwsc2mwDdSnngyM0SWQKqsji9Sg0r+c/2I07rJNLJ1Heb0oTJ675en8hiskfQ 7GbfLF/tDlGRntpFxnbItEU4N1YvJc0N8msGnqr+OjfFE/K751uuVmzt0veicUMcmcq1HhjoHSB4jYJezYACjQ/HkzzMti0RL0GikCFfLDYQ8nJX01buP/6a 29kbzhCqeuMCe+6qHxaAQEkNcwxuff8e2Vb3XipwNxQUNRy1YG3xFnHdxdhHMaRP X-Rspamd-Queue-Id: 46Z6b20YX4z4BSP X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,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: Thu, 19 Sep 2019 19:38:22 -0000 In message , Dimitry Andric w rites: > > On 19 Sep 2019, at 14:46, Cy Schubert wrote: > >=20 > > In message <4ccdcc18-6412-e606-4a74-314033a5f9c1@FreeBSD.org>, Dimitry = > Andric writes: > >> On 2019-09-13 22:20, Cy Schubert wrote: > >>> Author: cy > >>> Date: Fri Sep 13 20:20:05 2019 > >>> New Revision: 352304 > >>> URL: https://svnweb.freebsd.org/changeset/base/352304 > >>>=20 > >>> Log: > >>> No longer mlock() ntpd pages by default in memory thus allowing = > its > >>> pages to page as necessary. > >>>=20 > >>> To restore historic BSD behaviour add the following to ntp.conf: > >>> rlimit memlock 32 > >>=20 > >> Apparently this does not completely work, as I still see: > >>=20 > >> ntpd[824]: ntpd 4.2.8p12-a (1): Starting > >> ntpd[825]: Cannot set RLIMIT_MEMLOCK: Operation not permitted > >>=20 > >> even while my ntp.conf is almost entirely vanilla (it only has a > >> different "server" line). > >>=20 > >> Even explicitly adding: > >>=20 > >> rlimit memlock -1 > >>=20 > >> does not work, it results in the same error. > >>=20 > >> -Dimitry > >=20 > > Can you try this please? > >=20 > > diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c > > index 2b14431dc7b..bcfca27a535 100644 > > --- a/contrib/ntp/ntpd/ntpd.c > > +++ b/contrib/ntp/ntpd/ntpd.c > > @@ -999,7 +999,7 @@ ntpdmain( > > # if defined(HAVE_MLOCKALL) > > # ifdef HAVE_SETRLIMIT > > ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); > > -# ifdef RLIMIT_MEMLOCK > > +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && > > DFLT_RLIMIT_MEMLOCK !=3D -1 > > /* > > * The default RLIMIT_MEMLOCK is very low on Linux systems. > > * Unless we increase this limit malloc calls are likely to > > Yes, I already had something similar edited in (though I tested > DLT_RLIMIT_MEMLOCK > 0), and that works for me. That would work too, as it sets defaults before it reads the config file, which overrides the defaults. I'll commit the fix and put a corresponding fix into both ports as well and let our upstrem know. -- 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 Thu Sep 19 20:16: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 927E512D967; Thu, 19 Sep 2019 20:16:52 +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 46Z7RS3Mgxz4F1K; Thu, 19 Sep 2019 20:16:52 +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 56F6B1AAC1; Thu, 19 Sep 2019 20:16:52 +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 x8JKGqOC014331; Thu, 19 Sep 2019 20:16:52 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JKGqjH014330; Thu, 19 Sep 2019 20:16:52 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909192016.x8JKGqjH014330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 19 Sep 2019 20:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352540 - head/contrib/ntp/ntpd X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ntp/ntpd X-SVN-Commit-Revision: 352540 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 20:16:52 -0000 Author: cy Date: Thu Sep 19 20:16:51 2019 New Revision: 352540 URL: https://svnweb.freebsd.org/changeset/base/352540 Log: Follow up on r352304 which disabled default mlockall() at startup. Unfortunately though the original tarball supports this in ./configure (for Linux), to fully support disabling of mlockall() by default requires a little extra help otherwise the following is logged in syslog: Cannot set RLIMIT_MEMLOCK: Operation not permitted MFC after: 2 weeks X-MFC with: r352304 Modified: head/contrib/ntp/ntpd/ntpd.c Modified: head/contrib/ntp/ntpd/ntpd.c ============================================================================== --- head/contrib/ntp/ntpd/ntpd.c Thu Sep 19 19:42:59 2019 (r352539) +++ head/contrib/ntp/ntpd/ntpd.c Thu Sep 19 20:16:51 2019 (r352540) @@ -999,7 +999,7 @@ ntpdmain( # if defined(HAVE_MLOCKALL) # ifdef HAVE_SETRLIMIT ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); -# ifdef RLIMIT_MEMLOCK +# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && DFLT_RLIMIT_MEMLOCK != -1 /* * The default RLIMIT_MEMLOCK is very low on Linux systems. * Unless we increase this limit malloc calls are likely to From owner-svn-src-all@freebsd.org Thu Sep 19 20:45: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 5AB6A12E0D6; Thu, 19 Sep 2019 20:45:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46Z84N1bcDz4GKd; Thu, 19 Sep 2019 20:45:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16D711AFFB; Thu, 19 Sep 2019 20:45:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JKjNjh032037; Thu, 19 Sep 2019 20:45:23 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JKjNCa032036; Thu, 19 Sep 2019 20:45:23 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909192045.x8JKjNCa032036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 19 Sep 2019 20:45: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: r352541 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 352541 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 20:45:24 -0000 Author: alc Date: Thu Sep 19 20:45:23 2019 New Revision: 352541 URL: https://svnweb.freebsd.org/changeset/base/352541 Log: MF r349585 Tidy up pmap_copy(). Notably, deindent the innermost loop by making a simple change to the control flow. Replace an unnecessary test by a KASSERT. Add a comment explaining an obscure test. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 20:16:51 2019 (r352540) +++ stable/12/sys/amd64/amd64/pmap.c Thu Sep 19 20:45:23 2019 (r352541) @@ -6355,18 +6355,18 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t * * This routine is only advisory and need not do anything. */ - void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { struct rwlock *lock; struct spglist free; - vm_offset_t addr; - vm_offset_t end_addr = src_addr + len; - vm_offset_t va_next; + pml4_entry_t *pml4e; + pdp_entry_t *pdpe; + pd_entry_t *pde, srcptepaddr; + pt_entry_t *dst_pte, PG_A, PG_M, PG_V, ptetemp, *src_pte; + vm_offset_t addr, end_addr, va_next; vm_page_t dst_pdpg, dstmpte, srcmpte; - pt_entry_t PG_A, PG_M, PG_V; if (dst_addr != src_addr) return; @@ -6385,6 +6385,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ if (pmap_emulate_ad_bits(dst_pmap)) return; + end_addr = src_addr + len; lock = NULL; if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); @@ -6399,11 +6400,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ PG_V = pmap_valid_bit(dst_pmap); for (addr = src_addr; addr < end_addr; addr = va_next) { - pt_entry_t *src_pte, *dst_pte; - pml4_entry_t *pml4e; - pdp_entry_t *pdpe; - pd_entry_t srcptepaddr, *pde; - KASSERT(addr < UPT_MIN_ADDRESS, ("pmap_copy: invalid to pmap_copy page tables")); @@ -6445,7 +6441,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { *pde = srcptepaddr & ~PG_W; - pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_inc(dst_pmap, NBPDR / + PAGE_SIZE); atomic_add_long(&pmap_pde_mappings, 1); } else dst_pdpg->wire_count--; @@ -6463,58 +6460,54 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ src_pte = (pt_entry_t *)PHYS_TO_DMAP(srcptepaddr); src_pte = &src_pte[pmap_pte_index(addr)]; dstmpte = NULL; - while (addr < va_next) { - pt_entry_t ptetemp; + for (; addr < va_next; addr += PAGE_SIZE, src_pte++) { ptetemp = *src_pte; + /* - * we only virtual copy managed pages + * We only virtual copy managed pages. */ - if ((ptetemp & PG_MANAGED) != 0) { - if (dstmpte != NULL && - dstmpte->pindex == pmap_pde_pindex(addr)) - dstmpte->wire_count++; - else if ((dstmpte = pmap_allocpte(dst_pmap, - addr, NULL)) == NULL) - goto out; - dst_pte = (pt_entry_t *) - PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); - dst_pte = &dst_pte[pmap_pte_index(addr)]; - if (*dst_pte == 0 && - pmap_try_insert_pv_entry(dst_pmap, addr, - PHYS_TO_VM_PAGE(ptetemp & PG_FRAME), - &lock)) { + if ((ptetemp & PG_MANAGED) == 0) + continue; + + if (dstmpte != NULL) { + KASSERT(dstmpte->pindex == + pmap_pde_pindex(addr), + ("dstmpte pindex/addr mismatch")); + dstmpte->wire_count++; + } else if ((dstmpte = pmap_allocpte(dst_pmap, addr, + NULL)) == NULL) + goto out; + dst_pte = (pt_entry_t *) + PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); + dst_pte = &dst_pte[pmap_pte_index(addr)]; + if (*dst_pte == 0 && + pmap_try_insert_pv_entry(dst_pmap, addr, + PHYS_TO_VM_PAGE(ptetemp & PG_FRAME), &lock)) { + /* + * Clear the wired, modified, and accessed + * (referenced) bits during the copy. + */ + *dst_pte = ptetemp & ~(PG_W | PG_M | PG_A); + pmap_resident_count_inc(dst_pmap, 1); + } else { + SLIST_INIT(&free); + if (pmap_unwire_ptp(dst_pmap, addr, dstmpte, + &free)) { /* - * Clear the wired, modified, and - * accessed (referenced) bits - * during the copy. + * Although "addr" is not mapped, + * paging-structure caches could + * nonetheless have entries that refer + * to the freed page table pages. + * Invalidate those entries. */ - *dst_pte = ptetemp & ~(PG_W | PG_M | - PG_A); - pmap_resident_count_inc(dst_pmap, 1); - } else { - SLIST_INIT(&free); - if (pmap_unwire_ptp(dst_pmap, addr, - dstmpte, &free)) { - /* - * Although "addr" is not - * mapped, paging-structure - * caches could nonetheless - * have entries that refer to - * the freed page table pages. - * Invalidate those entries. - */ - pmap_invalidate_page(dst_pmap, - addr); - vm_page_free_pages_toq(&free, - true); - } - goto out; + pmap_invalidate_page(dst_pmap, addr); + vm_page_free_pages_toq(&free, true); } - if (dstmpte->wire_count >= srcmpte->wire_count) - break; + goto out; } - addr += PAGE_SIZE; - src_pte++; + /* Have we copied all of the valid mappings? */ + if (dstmpte->wire_count >= srcmpte->wire_count) + break; } } out: From owner-svn-src-all@freebsd.org Thu Sep 19 21:13: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 E3D8112EAE9; Thu, 19 Sep 2019 21:13:51 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Z8jC5mDpz4HrK; Thu, 19 Sep 2019 21:13:51 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8E511B54F; Thu, 19 Sep 2019 21:13:51 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JLDpH3049800; Thu, 19 Sep 2019 21:13:51 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JLDpih049799; Thu, 19 Sep 2019 21:13:51 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909192113.x8JLDpih049799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 19 Sep 2019 21:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352542 - head/usr.sbin/freebsd-update X-SVN-Group: head X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: head/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352542 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 21:13:52 -0000 Author: grembo (ports committer) Date: Thu Sep 19 21:13:51 2019 New Revision: 352542 URL: https://svnweb.freebsd.org/changeset/base/352542 Log: Fix src component detection Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D21579 Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 19 20:45:23 2019 (r352541) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 19 21:13:51 2019 (r352542) @@ -221,6 +221,14 @@ config_KeepModifiedMetadata () { # Add to the list of components which should be kept updated. config_Components () { for C in $@; do + COMPONENTS="${COMPONENTS} ${C}" + done +} + +# Remove src component from list if it isn't installed +finalize_components_config () { + COMPONENTS="" + for C in $@; do if [ "$C" = "src" ]; then if [ -e "${BASEDIR}/usr/src/COPYRIGHT" ]; then COMPONENTS="${COMPONENTS} ${C}" @@ -3284,6 +3292,7 @@ get_params () { parse_cmdline $@ parse_conffile default_params + finalize_components_config ${COMPONENTS} } # Fetch command. Make sure that we're being called From owner-svn-src-all@freebsd.org Thu Sep 19 21:23: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 5E17512EF56; Thu, 19 Sep 2019 21:23:15 +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 46Z8w31sqqz4JWb; Thu, 19 Sep 2019 21:23:15 +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 238191B71B; Thu, 19 Sep 2019 21:23:15 +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 x8JLNFs8055613; Thu, 19 Sep 2019 21:23:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JLNETp055611; Thu, 19 Sep 2019 21:23:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909192123.x8JLNETp055611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 19 Sep 2019 21:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352543 - 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: 352543 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 21:23:15 -0000 Author: mjg Date: Thu Sep 19 21:23:14 2019 New Revision: 352543 URL: https://svnweb.freebsd.org/changeset/base/352543 Log: vfs: group fields used for per-cpu ops in one cacheline Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Sep 19 21:13:51 2019 (r352542) +++ head/sys/kern/vfs_mount.c Thu Sep 19 21:23:14 2019 (r352543) @@ -157,7 +157,7 @@ vfs_mount_init(void *dummy __unused) { mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount), NULL, - NULL, mount_init, mount_fini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, mount_init, mount_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE); } SYSINIT(vfs_mount, SI_SUB_VFS, SI_ORDER_ANY, vfs_mount_init, NULL); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Thu Sep 19 21:13:51 2019 (r352542) +++ head/sys/sys/mount.h Thu Sep 19 21:23:14 2019 (r352543) @@ -226,7 +226,7 @@ struct mount { struct lock mnt_explock; /* vfs_export walkers lock */ TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ - int mnt_vfs_ops; /* (i) pending vfs ops */ + int __aligned(CACHE_LINE_SIZE) mnt_vfs_ops;/* (i) pending vfs ops */ int *mnt_thread_in_ops_pcpu; int *mnt_ref_pcpu; int *mnt_lockref_pcpu; From owner-svn-src-all@freebsd.org Thu Sep 19 22:15: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 8523112FF2E; Thu, 19 Sep 2019 22:15: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 46ZB4t2qyKz4MBl; Thu, 19 Sep 2019 22:15: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 409B91C071; Thu, 19 Sep 2019 22:15: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 x8JMFwuD085360; Thu, 19 Sep 2019 22:15:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JMFv8j085358; Thu, 19 Sep 2019 22:15:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909192215.x8JMFv8j085358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 19 Sep 2019 22:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352544 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 352544 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 22:15:58 -0000 Author: mav Date: Thu Sep 19 22:15:57 2019 New Revision: 352544 URL: https://svnweb.freebsd.org/changeset/base/352544 Log: Improve ioat(4) NUMA-awareness. Allocate ioat->ring memory from the device domain. Schedule ioat->poll_timer to the first CPU of the device domain. According to pcm-numa tool from intel-pcm port, this reduces number of remote DRAM accesses while copying data by 75%. And unless it is a noise, I've noticed some speed improvement when copying data to other domain. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Thu Sep 19 21:23:14 2019 (r352543) +++ head/sys/dev/ioat/ioat.c Thu Sep 19 22:15:57 2019 (r352544) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -266,6 +268,11 @@ ioat_attach(device_t device) ioat = DEVICE2SOFTC(device); ioat->device = device; + if (bus_get_domain(device, &ioat->domain) != 0) + ioat->domain = 0; + ioat->cpu = CPU_FFS(&cpuset_domain[ioat->domain]) - 1; + if (ioat->cpu < 0) + ioat->cpu = CPU_FIRST(); error = ioat_map_pci_bar(ioat); if (error != 0) @@ -600,8 +607,8 @@ ioat3_attach(device_t device) __func__, error); return (error); } - ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT, - M_ZERO | M_WAITOK); + ioat->ring = malloc_domainset(num_descriptors * sizeof(*ring), M_IOAT, + DOMAINSET_PREF(ioat->domain), M_ZERO | M_WAITOK); ring = ioat->ring; for (i = 0; i < num_descriptors; i++) { @@ -1107,8 +1114,8 @@ ioat_release(bus_dmaengine_t dmaengine) (uint16_t)ioat->head); if (!callout_pending(&ioat->poll_timer)) { - callout_reset(&ioat->poll_timer, 1, - ioat_poll_timer_callback, ioat); + callout_reset_on(&ioat->poll_timer, 1, + ioat_poll_timer_callback, ioat, ioat->cpu); } } mtx_unlock(&ioat->submit_lock); @@ -1644,7 +1651,7 @@ ioat_free_ring(struct ioat_softc *ioat, uint32_t size, struct ioat_descriptor *ring) { - free(ring, M_IOAT); + free_domain(ring, M_IOAT); } static struct ioat_descriptor * Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Thu Sep 19 21:23:14 2019 (r352543) +++ head/sys/dev/ioat/ioat_internal.h Thu Sep 19 22:15:57 2019 (r352544) @@ -442,6 +442,8 @@ struct ioat_softc { }) device_t device; + int domain; + int cpu; int version; unsigned chan_idx; From owner-svn-src-all@freebsd.org Thu Sep 19 22:39: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 60A2EE8A79; Thu, 19 Sep 2019 22:39:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ZBbl0ZzHz4NsQ; Thu, 19 Sep 2019 22:39:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6D751C3E7; Thu, 19 Sep 2019 22:39:14 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8JMdE89097001; Thu, 19 Sep 2019 22:39:14 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8JMdEwk096998; Thu, 19 Sep 2019 22:39:14 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201909192239.x8JMdEwk096998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 19 Sep 2019 22:39: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: r352545 - in stable/12: share/man/man4 sys/dev/rtwn/usb sys/dev/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/rtwn/usb sys/dev/usb X-SVN-Commit-Revision: 352545 X-SVN-Commit-Repository: base MIME-Version: 1.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, 19 Sep 2019 22:39:15 -0000 Author: jkim Date: Thu Sep 19 22:39:13 2019 New Revision: 352545 URL: https://svnweb.freebsd.org/changeset/base/352545 Log: MFC: r351653 Add support for TP-Link Archer T2U Nano. Modified: stable/12/share/man/man4/rtwn_usb.4 stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/rtwn_usb.4 ============================================================================== --- stable/12/share/man/man4/rtwn_usb.4 Thu Sep 19 22:15:57 2019 (r352544) +++ stable/12/share/man/man4/rtwn_usb.4 Thu Sep 19 22:39:13 2019 (r352545) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd February 2, 2019 +.Dd September 1, 2019 .Dt RTWN_USB 4 .Os .Sh NAME @@ -94,6 +94,7 @@ based USB wireless network adapters, including: .It "Realtek RTL8192CU" Ta RTL8192CU Ta USB 2.0 .It "Realtek RTL8188CUS" Ta RTL8188CUS Ta USB 2.0 .It "Sitecom WLA-7100" Ta RTL8812AU Ta USB 3.0 +.It "TP-Link Archer T2U Nano" Ta RTL8821AU Ta USB 2.0 .It "TP-Link Archer T4U" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T4U v2" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T4UH v1" Ta RTL8812AU Ta USB 3.0 Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h ============================================================================== --- stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Thu Sep 19 22:15:57 2019 (r352544) +++ stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Thu Sep 19 22:39:13 2019 (r352545) @@ -158,7 +158,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8821AU_DEV(MELCO, WIU2433DM), RTWN_RTL8821AU_DEV(NETGEAR, A6100), RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_1), - RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2) + RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2), + RTWN_RTL8821AU_DEV(TPLINK, T2UNANO) #undef RTWN_RTL8821AU_DEV }; Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Thu Sep 19 22:15:57 2019 (r352544) +++ stable/12/sys/dev/usb/usbdevs Thu Sep 19 22:39:13 2019 (r352545) @@ -4661,6 +4661,7 @@ product TPLINK WN722NV2 0x010c TL-WN722N v2 product TPLINK T4UV2 0x010d Archer T4U ver 2 product TPLINK T4UHV1 0x0103 Archer T4UH ver 1 product TPLINK T4UHV2 0x010e Archer T4UH ver 2 +product TPLINK T2UNANO 0x011e Archer T2U Nano product TPLINK RTL8153 0x0601 RTL8153 USB 10/100/1000 LAN /* Trek Technology products */ From owner-svn-src-all@freebsd.org Fri Sep 20 00:05: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 05608EA718; Fri, 20 Sep 2019 00:05:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46ZDVz6RXGz4SNQ; Fri, 20 Sep 2019 00:05:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A36181D3BB; Fri, 20 Sep 2019 00:05:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8K05FRP051628; Fri, 20 Sep 2019 00:05:15 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K05E8D051625; Fri, 20 Sep 2019 00:05:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201909200005.x8K05E8D051625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 20 Sep 2019 00:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r352546 - in releng/12.1: release/pkg_repos sys/conf sys/sys usr.sbin/pkg X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/12.1: release/pkg_repos sys/conf sys/sys usr.sbin/pkg X-SVN-Commit-Revision: 352546 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 00:05:16 -0000 Author: gjb Date: Fri Sep 20 00:05:14 2019 New Revision: 352546 URL: https://svnweb.freebsd.org/changeset/base/352546 Log: - Copy stable/12@r352480 to releng/12.1 as part of the 12.1 release cycle. - Update from PRERELEASE to BETA1. - Set the default pkg(7) repository to 'quarterly'. - Bump __FreeBSD_version. - Prune svn:mergeinfo from the new branch. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Added: - copied from r352480, stable/12/ Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/release/pkg_repos/release-dvd.conf releng/12.1/sys/conf/newvers.sh releng/12.1/sys/sys/param.h releng/12.1/usr.sbin/pkg/Makefile Modified: releng/12.1/release/pkg_repos/release-dvd.conf ============================================================================== --- stable/12/release/pkg_repos/release-dvd.conf Wed Sep 18 07:31:31 2019 (r352480) +++ releng/12.1/release/pkg_repos/release-dvd.conf Fri Sep 20 00:05:14 2019 (r352546) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: releng/12.1/sys/conf/newvers.sh ============================================================================== --- stable/12/sys/conf/newvers.sh Wed Sep 18 07:31:31 2019 (r352480) +++ releng/12.1/sys/conf/newvers.sh Fri Sep 20 00:05:14 2019 (r352546) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.1" -BRANCH="PRERELEASE" +BRANCH="BETA1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/12.1/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Wed Sep 18 07:31:31 2019 (r352480) +++ releng/12.1/sys/sys/param.h Fri Sep 20 00:05:14 2019 (r352546) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200519 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: releng/12.1/usr.sbin/pkg/Makefile ============================================================================== --- stable/12/usr.sbin/pkg/Makefile Wed Sep 18 07:31:31 2019 (r352480) +++ releng/12.1/usr.sbin/pkg/Makefile Fri Sep 20 00:05:14 2019 (r352546) @@ -2,8 +2,15 @@ .if ${MACHINE} != "amd64" && ${MACHINE} != "i386" PKGCONFBRANCH?= quarterly -.endif +.else +_BRANCH!= ${MAKE} -C ${SRCTOP}/release -V BRANCH +BRANCH?= ${_BRANCH} +. if ${BRANCH:MBETA*} || ${BRANCH:MRC*} || ${BRANCH:MRELEASE*} +PKGCONFBRANCH?= quarterly +. else PKGCONFBRANCH?= latest +. endif +.endif CONFS= FreeBSD.conf.${PKGCONFBRANCH} CONFSNAME= FreeBSD.conf CONFSDIR= /etc/pkg From owner-svn-src-all@freebsd.org Fri Sep 20 00:07: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 14A2DEA804; Fri, 20 Sep 2019 00:07:49 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46ZDYw6pjnz4SXq; Fri, 20 Sep 2019 00:07:48 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE05B1D3BE; Fri, 20 Sep 2019 00:07:48 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8K07mZH051789; Fri, 20 Sep 2019 00:07:48 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K07mdq051787; Fri, 20 Sep 2019 00:07:48 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201909200007.x8K07mdq051787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 20 Sep 2019 00:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352547 - in stable/12/sys: conf sys X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable/12/sys: conf sys X-SVN-Commit-Revision: 352547 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 00:07:49 -0000 Author: gjb Date: Fri Sep 20 00:07:48 2019 New Revision: 352547 URL: https://svnweb.freebsd.org/changeset/base/352547 Log: - Set stable/12 back to 'STABLE', now that all work on the 12.1 release cycle will take place in the releng/12.1 branch. - Bump __FreeBSD_version. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/12/sys/conf/newvers.sh stable/12/sys/sys/param.h Modified: stable/12/sys/conf/newvers.sh ============================================================================== --- stable/12/sys/conf/newvers.sh Fri Sep 20 00:05:14 2019 (r352546) +++ stable/12/sys/conf/newvers.sh Fri Sep 20 00:07:48 2019 (r352547) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.1" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Fri Sep 20 00:05:14 2019 (r352546) +++ stable/12/sys/sys/param.h Fri Sep 20 00:07:48 2019 (r352547) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200519 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201500 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Sep 20 05:22: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 D2B52F2A10; Fri, 20 Sep 2019 05:22:34 +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 46ZMY65Gj4z3FGW; Fri, 20 Sep 2019 05:22:34 +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 9850420CDA; Fri, 20 Sep 2019 05:22:34 +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 x8K5MYqT039077; Fri, 20 Sep 2019 05:22:34 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K5MYMX039076; Fri, 20 Sep 2019 05:22:34 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909200522.x8K5MYMX039076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 20 Sep 2019 05:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352548 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 352548 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 05:22:34 -0000 Author: tsoome Date: Fri Sep 20 05:22:34 2019 New Revision: 352548 URL: https://svnweb.freebsd.org/changeset/base/352548 Log: loader: fix typo in zalloc. Modified: head/stand/libsa/zalloc.c Modified: head/stand/libsa/zalloc.c ============================================================================== --- head/stand/libsa/zalloc.c Fri Sep 20 00:07:48 2019 (r352547) +++ head/stand/libsa/zalloc.c Fri Sep 20 05:22:34 2019 (r352548) @@ -125,7 +125,8 @@ znalloc(MemPool *mp, uintptr_t bytes, size_t align) continue; /* - * Cut extra from head and create new memory node from reminder. + * Cut extra from head and create new memory node from + * remainder. */ if (extra != 0) { From owner-svn-src-all@freebsd.org Fri Sep 20 07:24: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 C178AF5106; Fri, 20 Sep 2019 07:24: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 46ZQFb4f7sz3LLg; Fri, 20 Sep 2019 07:24: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 8346522259; Fri, 20 Sep 2019 07:24: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 x8K7OJrp009808; Fri, 20 Sep 2019 07:24:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K7OJnw009807; Fri, 20 Sep 2019 07:24:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909200724.x8K7OJnw009807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 20 Sep 2019 07:24: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: r352549 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 352549 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 07:24:19 -0000 Author: kib Date: Fri Sep 20 07:24:18 2019 New Revision: 352549 URL: https://svnweb.freebsd.org/changeset/base/352549 Log: MFC r352303: riscv trap_pfault: remove unneeded hold of the process around vm_fault() call. Modified: stable/12/sys/riscv/riscv/trap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/trap.c ============================================================================== --- stable/12/sys/riscv/riscv/trap.c Fri Sep 20 05:22:34 2019 (r352548) +++ stable/12/sys/riscv/riscv/trap.c Fri Sep 20 07:24:18 2019 (r352549) @@ -219,29 +219,7 @@ data_abort(struct trapframe *frame, int usermode) if (pmap_fault_fixup(map->pmap, va, ftype)) goto done; - if (map != kernel_map) { - /* - * Keep swapout from messing with us during this - * critical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process locking or stacks in the - * kernel. - */ - error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } - + error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); if (error != KERN_SUCCESS) { if (usermode) { sig = SIGSEGV; From owner-svn-src-all@freebsd.org Fri Sep 20 08:20: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 44774F6A26; Fri, 20 Sep 2019 08:20:21 +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 46ZRVF16Vbz3NK1; Fri, 20 Sep 2019 08:20:21 +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 094A222B49; Fri, 20 Sep 2019 08:20:21 +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 x8K8KKW1039493; Fri, 20 Sep 2019 08:20:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K8KKwP039492; Fri, 20 Sep 2019 08:20:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909200820.x8K8KKwP039492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 20 Sep 2019 08:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352550 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 352550 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 08:20:21 -0000 Author: tuexen Date: Fri Sep 20 08:20:20 2019 New Revision: 352550 URL: https://svnweb.freebsd.org/changeset/base/352550 Log: Fix the handling of invalid parameters in ASCONF chunks. Thanks to Mark Wodrich from Google for reproting the issue in https://github.com/sctplab/usrsctp/issues/376 for the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Fri Sep 20 07:24:18 2019 (r352549) +++ head/sys/netinet/sctp_asconf.c Fri Sep 20 08:20:20 2019 (r352550) @@ -703,6 +703,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset if (param_length <= sizeof(struct sctp_paramhdr)) { SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: param length (%u) too short\n", param_length); sctp_m_freem(m_ack); + return; } /* get the entire parameter */ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf); From owner-svn-src-all@freebsd.org Fri Sep 20 09:04: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 C01D9F802B; Fri, 20 Sep 2019 09:04:52 +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 46ZSTc4YLNz3Qq0; Fri, 20 Sep 2019 09:04:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 805D52350A; Fri, 20 Sep 2019 09:04:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8K94qOM068776; Fri, 20 Sep 2019 09:04:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K94qs0068775; Fri, 20 Sep 2019 09:04:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909200904.x8K94qs0068775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 20 Sep 2019 09:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352551 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 352551 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 09:04:52 -0000 Author: emaste Date: Fri Sep 20 09:04:52 2019 New Revision: 352551 URL: https://svnweb.freebsd.org/changeset/base/352551 Log: elf_common: add ELF note names r348628 added a definition of NT_GNU_BUILD_ID. Some software (Valgrind) also expects a #define for the note name (ELF_NOTE_GNU) in the case that NT_GNU_BUILD_ID is defined. PR: 239669 Reported by: Yuichiro NAITO Sponsored by: The FreeBSD Foundation Event: EuroBSDCon FreeBSD DevSummit 2019 Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Sep 20 08:20:20 2019 (r352550) +++ head/sys/sys/elf_common.h Fri Sep 20 09:04:52 2019 (r352551) @@ -769,6 +769,12 @@ typedef struct { #define LL_DELAY_LOAD 0x10 #define LL_DELTA 0x20 +/* Note section names */ +#define ELF_NOTE_FREEBSD "FreeBSD" +#define ELF_NOTE_NETBSD "NetBSD" +#define ELF_NOTE_SOLARIS "SUNW Solaris" +#define ELF_NOTE_GNU "GNU" + /* Values for n_type used in executables. */ #define NT_FREEBSD_ABI_TAG 1 #define NT_FREEBSD_NOINIT_TAG 2 From owner-svn-src-all@freebsd.org Fri Sep 20 09:36: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 6E89CF8879; Fri, 20 Sep 2019 09:36:08 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ZT9h2HWqz3xSg; Fri, 20 Sep 2019 09:36:08 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D58623A6C; Fri, 20 Sep 2019 09:36:08 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8K9a8iC086789; Fri, 20 Sep 2019 09:36:08 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K9a8m3086788; Fri, 20 Sep 2019 09:36:08 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201909200936.x8K9a8m3086788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Fri, 20 Sep 2019 09:36:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352552 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352552 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 09:36:08 -0000 Author: gallatin Date: Fri Sep 20 09:36:07 2019 New Revision: 352552 URL: https://svnweb.freebsd.org/changeset/base/352552 Log: remove redundant "ktls" in KTLS thr name This reducesthe string width of the ktls thread name and improves "ps" output. Glanced at by: jhb Event: EuroBSDCon hackathon Sponsored by: Netflix Modified: head/sys/kern/uipc_ktls.c Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Fri Sep 20 09:04:52 2019 (r352551) +++ head/sys/kern/uipc_ktls.c Fri Sep 20 09:36:07 2019 (r352552) @@ -349,7 +349,7 @@ ktls_init(void *dummy __unused) 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); + &ktls_proc, &td, 0, 0, "KTLS", "thr_%d", i); if (error) panic("Can't add KTLS thread %d error %d", i, error); From owner-svn-src-all@freebsd.org Fri Sep 20 09:45: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 4E5F1F8CB3; Fri, 20 Sep 2019 09:45:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46ZTNg1Hv5z3yBm; Fri, 20 Sep 2019 09:45:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B30823C40; Fri, 20 Sep 2019 09:45:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8K9jcwe092705; Fri, 20 Sep 2019 09:45:38 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8K9jcC0092704; Fri, 20 Sep 2019 09:45:38 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909200945.x8K9jcC0092704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 20 Sep 2019 09:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352553 - head X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 352553 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 09:45:39 -0000 Author: bapt Date: Fri Sep 20 09:45:38 2019 New Revision: 352553 URL: https://svnweb.freebsd.org/changeset/base/352553 Log: Ensure libthr is always built before libprivatezstd when building the startup libs Reported by: "Galazka, Krzysztof" Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Sep 20 09:36:07 2019 (r352552) +++ head/Makefile.inc1 Fri Sep 20 09:45:38 2019 (r352553) @@ -2832,6 +2832,7 @@ _lib_casper= lib/libcasper lib/libpjdlog__L: lib/libutil__L lib/libcasper__L: lib/libnv__L lib/liblzma__L: lib/libthr__L +lib/libzstd__L: lib/libthr__L _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib .if ${MK_IPFILTER} != "no" From owner-svn-src-all@freebsd.org Fri Sep 20 10:56: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 59FC4F9EB2; Fri, 20 Sep 2019 10:56:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46ZVy61fZPz428R; Fri, 20 Sep 2019 10:56:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18B7F24881; Fri, 20 Sep 2019 10:56:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KAuDQo034202; Fri, 20 Sep 2019 10:56:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KAuD3k034201; Fri, 20 Sep 2019 10:56:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909201056.x8KAuD3k034201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 20 Sep 2019 10:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352554 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 352554 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 10:56:14 -0000 Author: hselasky Date: Fri Sep 20 10:56:13 2019 New Revision: 352554 URL: https://svnweb.freebsd.org/changeset/base/352554 Log: The maximum TD size is 31 and not 15. Found at: EuroBSDcon 2019 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Sep 20 09:45:38 2019 (r352553) +++ head/sys/dev/usb/controller/xhci.c Fri Sep 20 10:56:13 2019 (r352554) @@ -2003,7 +2003,7 @@ restart: /* clear TD SIZE to zero, hence this is the last TRB */ /* remove chain bit because this is the last data TRB in the chain */ - td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); + td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(31)); td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); /* remove CHAIN-BIT from last LINK TRB */ td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); From owner-svn-src-all@freebsd.org Fri Sep 20 11:00: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 860E6F9FA9; Fri, 20 Sep 2019 11:00:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46ZW2W31kMz42Lg; Fri, 20 Sep 2019 11:00:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B1A82488D; Fri, 20 Sep 2019 11:00:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KB032h034489; Fri, 20 Sep 2019 11:00:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KB03er034488; Fri, 20 Sep 2019 11:00:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909201100.x8KB03er034488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 20 Sep 2019 11:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352555 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 352555 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 11:00:03 -0000 Author: hselasky Date: Fri Sep 20 11:00:02 2019 New Revision: 352555 URL: https://svnweb.freebsd.org/changeset/base/352555 Log: Increase the maximum user-space buffer size from 256kBytes to 32MBytes for libusb. This is useful for speeding up large data transfers while reducing the interrupt rate. Found at: EuroBSDcon 2019 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_ioctl.h Modified: head/sys/dev/usb/usb_ioctl.h ============================================================================== --- head/sys/dev/usb/usb_ioctl.h Fri Sep 20 10:56:13 2019 (r352554) +++ head/sys/dev/usb/usb_ioctl.h Fri Sep 20 11:00:02 2019 (r352555) @@ -224,7 +224,7 @@ struct usb_fs_uninit { } USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_open { -#define USB_FS_MAX_BUFSIZE (1 << 18) +#define USB_FS_MAX_BUFSIZE (1 << 25) /* 32 MBytes */ uint32_t max_bufsize; #define USB_FS_MAX_FRAMES (1U << 12) #define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */ From owner-svn-src-all@freebsd.org Fri Sep 20 11:28: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 5D068FA87E; Fri, 20 Sep 2019 11:28:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 46ZWgf1qWpz43jZ; Fri, 20 Sep 2019 11:28:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C2C24E12; Fri, 20 Sep 2019 11:28:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KBSkw5051838; Fri, 20 Sep 2019 11:28:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KBSjjR051835; Fri, 20 Sep 2019 11:28:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909201128.x8KBSjjR051835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 20 Sep 2019 11:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352556 - in head/sys/dev/usb: . controller X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/usb: . controller X-SVN-Commit-Revision: 352556 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 11:28:46 -0000 Author: hselasky Date: Fri Sep 20 11:28:45 2019 New Revision: 352556 URL: https://svnweb.freebsd.org/changeset/base/352556 Log: Add quirk for XHCI(4) controllers to support USB control transfers above 1Kbyte. It might look like some XHCI(4) controllers do not support when the USB control transfer is split using a link TRB. The next NORMAL TRB after the link TRB is simply failing with XHCI error code 4. The quirk ensures we allocate a 64Kbyte buffer so that the data stage TRB is not broken with a link TRB. Found at: EuroBSDcon 2019 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Sep 20 11:00:02 2019 (r352555) +++ head/sys/dev/usb/controller/xhci.c Fri Sep 20 11:28:45 2019 (r352556) @@ -601,6 +601,9 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_ device_printf(self, "%d bytes context size, %d-bit DMA\n", sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); + /* enable 64Kbyte control endpoint quirk */ + sc->sc_bus.control_ep_quirk = 1; + temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); /* get number of device slots */ Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Fri Sep 20 11:00:02 2019 (r352555) +++ head/sys/dev/usb/usb_bus.h Fri Sep 20 11:28:45 2019 (r352556) @@ -131,6 +131,7 @@ struct usb_bus { uint8_t do_probe; /* set if USB should be re-probed */ uint8_t no_explore; /* don't explore USB ports */ uint8_t dma_bits; /* number of DMA address lines */ + uint8_t control_ep_quirk; /* need 64kByte buffer for data stage */ }; #endif /* _USB_BUS_H_ */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Fri Sep 20 11:00:02 2019 (r352555) +++ head/sys/dev/usb/usb_transfer.c Fri Sep 20 11:28:45 2019 (r352556) @@ -106,6 +106,33 @@ static const struct usb_config usb_control_ep_cfg[USB_ }, }; +static const struct usb_config usb_control_ep_quirk_cfg[USB_CTRL_XFER_MAX] = { + + /* This transfer is used for generic control endpoint transfers */ + + [0] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control endpoint */ + .direction = UE_DIR_ANY, + .bufsize = 65535, /* bytes */ + .callback = &usb_request_callback, + .usb_mode = USB_MODE_DUAL, /* both modes */ + }, + + /* This transfer is used for generic clear stall only */ + + [1] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control pipe */ + .direction = UE_DIR_ANY, + .bufsize = sizeof(struct usb_device_request), + .callback = &usb_do_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ + .usb_mode = USB_MODE_HOST, + }, +}; + /* function prototypes */ static void usbd_update_max_frame_size(struct usb_xfer *); @@ -1021,7 +1048,8 @@ usbd_transfer_setup(struct usb_device *udev, * context, else there is a chance of * deadlock! */ - if (setup_start == usb_control_ep_cfg) + if (setup_start == usb_control_ep_cfg || + setup_start == usb_control_ep_quirk_cfg) info->done_p = USB_BUS_CONTROL_XFER_PROC(udev->bus); else if (xfer_mtx == &Giant) @@ -3149,7 +3177,8 @@ repeat: */ iface_index = 0; if (usbd_transfer_setup(udev, &iface_index, - udev->ctrl_xfer, usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL, + udev->ctrl_xfer, udev->bus->control_ep_quirk ? + usb_control_ep_quirk_cfg : usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL, &udev->device_mtx)) { DPRINTFN(0, "could not setup default " "USB transfer\n"); From owner-svn-src-all@freebsd.org Fri Sep 20 12:14: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 8486CFBB16; Fri, 20 Sep 2019 12:14:44 +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 46ZXhg2FhKz45yt; Fri, 20 Sep 2019 12:14:42 +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 D38A736182F; Fri, 20 Sep 2019 22:14:40 +1000 (AEST) Date: Fri, 20 Sep 2019 22:14:39 +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: r351700 - head/lib/libc/string In-Reply-To: <201909021356.x82Dui6v077765@repo.freebsd.org> Message-ID: <20190920212702.N1017@besplex.bde.org> References: <201909021356.x82Dui6v077765@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=cn9ZTVXxRq8eMFPCvVIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 46ZXhg2FhKz45yt 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 [-2.30 / 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]; RWL_MAILSPIKE_POSSIBLE(0.00)[249.132.29.211.rep.mailspike.net : 127.0.0.17]; IP_SCORE(0.00)[ip: (-5.26), ipnet: 211.28.0.0/14(-3.26), asn: 4804(-2.40), country: AU(0.01)]; IP_SCORE_FREEMAIL(0.00)[]; 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, 20 Sep 2019 12:14:44 -0000 On Mon, 2 Sep 2019, Ed Maste wrote: > Author: emaste > Date: Mon Sep 2 13:56:44 2019 > New Revision: 351700 > URL: https://svnweb.freebsd.org/changeset/base/351700 > > Log: > libc: Use musl's optimized memchr > > Parentheses added to HASZERO macro to avoid a GCC warning. > > Reviewed by: kib, mjg > Obtained from: musl (snapshot at commit 4d0a82170a) > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D17631 > > Modified: > head/lib/libc/string/memchr.c > > Modified: head/lib/libc/string/memchr.c > ============================================================================== > --- head/lib/libc/string/memchr.c Mon Sep 2 13:55:31 2019 (r351699) > +++ head/lib/libc/string/memchr.c Mon Sep 2 13:56:44 2019 (r351700) > @@ -1,55 +1,54 @@ > /*- > - * SPDX-License-Identifier: BSD-3-Clause > + * SPDX-License-Identifier: MIT > * > - * Copyright (c) 1990, 1993 > - * The Regents of the University of California. All rights reserved. > + * Copyright (c) 2005-2014 Rich Felker, et al. > * > - * This code is derived from software contributed to Berkeley by > - * Chris Torek. I prefer Torek's version. Optimizing this function is especially unimportant, and this version has mounds of style bugs. > -void * > -memchr(const void *s, int c, size_t n) > -{ > - if (n != 0) { > - const unsigned char *p = s; > +#define SS (sizeof(size_t)) > +#define ALIGN (sizeof(size_t)-1) > +#define ONES ((size_t)-1/UCHAR_MAX) > +#define HIGHS (ONES * (UCHAR_MAX/2+1)) > +#define HASZERO(x) (((x)-ONES) & ~(x) & HIGHS) > > - do { > - if (*p++ == (unsigned char)c) > - return ((void *)(p - 1)); > - } while (--n != 0); Old KNF code. In the !__GNUC__ #else clausew , this is replaced by equivalent code with a style that is very far from KNF. If compilers understood this function, then they could reasonably optimize the old code in very AMD ways, e.g., use AVX512. This is not so reasonable for the new code. clang does such optimizations to a fault, but knows that it doesn't understand this code or even strlen(), so it does a naive translation. > +void *memchr(const void *src, int c, size_t n) > +{ > + const unsigned char *s = src; > + c = (unsigned char)c; > +#ifdef __GNUC__ > + for (; ((uintptr_t)s & ALIGN) && n && *s != c; s++, n--); > + if (n && *s != c) { > + typedef size_t __attribute__((__may_alias__)) word; This seems to have no dependencies on __GNUC__ except the use of anti-aliasing, and that dependendency is broken (very old versions of gcc don't even have __attribute__(()), and old versions don't have __may_alias). > + const word *w; > + size_t k = ONES * c; > + for (w = (const void *)s; n>=SS && !HASZERO(*w^k); w++, n-=SS); > + s = (const void *)w; > } This is cryptic as well as non-KNF. libc/string/strlen.c uses the same dubious optimization method, but it is at least clearly written and it is even in KNF. > - return (NULL); > +#endif > + for (; n && *s != c; s++, n--); > + return n ? (void *)s : 0; > } I checked that this optimization actually works. For long strings, it is almost sizeof(size_t) times faster, by accessing memory with a size sizeof(size_t). size_t is a not very good way of hard-coding the word size. Related silly optimizations: - i386 has memchr() in asm. This uses scasb, which was last optimal on the 8088, or perhaps the original i386. On freefall, it is several times slower than the naive translation of the naive C code. - i386 pessimizes several old string functions using scasb. amd64 mostly doesn't copy this mistake. Similarly for wide char string functions. Optimizing these is even more unimportant and just writing them in asm is quite complicated. They are perhaps not fully pessimized in asm on i386. amd64 doesn't have any of them in asm. - i386 also does dubious alignment optimizations - amd64 pessimizes strcpy() by implementing it as a C wrapper for stpcpy(). The wrapper code is MI, but is only used for amd64. - amd64 stpcpy(), strcat() and strcmp() uses the fancy optimization using the 0x0101... and 0x8080... tricks (as in this version of memchr() except not so cryptically since the constants are literal instead of constructed using macros from the word type). Optimizing strcat() some of these functions is unimportant. Worth doing at most once, in the C version. - the generic strlen() (but no other generic string function) is optimized using the 0x0101... and 0x8080... tricks. This optimization is dubious since it is a pessimization for short strings. Compilers often inline string functions, especially strlen() anyway. I think x86 compilers used to routinely inline strlen(), but now they know that they don't understand it, so they just call the library strlen() for most strings that are not known at compile time. This results in the fancy optimization actually being used. Sometimes this optimization improves the speed of a large program by as much as 0.001%. Bruce From owner-svn-src-all@freebsd.org Fri Sep 20 13:35: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 104D3FD3E3; Fri, 20 Sep 2019 13:35:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46ZZTr6hzRz4BjS; Fri, 20 Sep 2019 13:35:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C93DC265CE; Fri, 20 Sep 2019 13:35:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KDZS4i031095; Fri, 20 Sep 2019 13:35:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KDZSuP031094; Fri, 20 Sep 2019 13:35:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201909201335.x8KDZSuP031094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 20 Sep 2019 13:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352557 - head/stand/powerpc/uboot X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/stand/powerpc/uboot X-SVN-Commit-Revision: 352557 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 13:35:29 -0000 Author: jhibbits Date: Fri Sep 20 13:35:28 2019 New Revision: 352557 URL: https://svnweb.freebsd.org/changeset/base/352557 Log: powerpc/loader: Install ubldr without stripping Summary: Install's strip capability, by way of strip(1), doesn't seem to work correctly on msdosfs, and instead ends up truncating the resulting binary to 0-length. As a workaround, don't strip ubldr(8). This fixes installworld on Book-E ubldr-based platforms, which prior to this would need to manually install ubldr separately after installworld, in order to have a functional ubldr. The same thing could be done on PowerNV platforms that use msdosfs /boot volumes, since loader and loader.kboot, etc, all get truncated to 0 on install. However, PowerNV does not use loader, instead loading from petitboot, so it's not really necessary at this time. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D21725 Modified: head/stand/powerpc/uboot/Makefile Modified: head/stand/powerpc/uboot/Makefile ============================================================================== --- head/stand/powerpc/uboot/Makefile Fri Sep 20 11:28:45 2019 (r352556) +++ head/stand/powerpc/uboot/Makefile Fri Sep 20 13:35:28 2019 (r352557) @@ -13,6 +13,7 @@ LOADER_BZIP2_SUPPORT?= no BINDIR= /boot/uboot PROG= ubldr +STRIP= NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} INSTALLFLAGS= -b From owner-svn-src-all@freebsd.org Fri Sep 20 17:37: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 E7E9A123117; Fri, 20 Sep 2019 17:37:24 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Zgs05q3zz4Qmd; Fri, 20 Sep 2019 17:37:24 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAF111276; Fri, 20 Sep 2019 17:37:24 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KHbOtP071878; Fri, 20 Sep 2019 17:37:24 GMT (envelope-from daichi@FreeBSD.org) Received: (from daichi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KHbNhf071874; Fri, 20 Sep 2019 17:37:23 GMT (envelope-from daichi@FreeBSD.org) Message-Id: <201909201737.x8KHbNhf071874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: daichi set sender to daichi@FreeBSD.org using -f From: Daichi GOTO Date: Fri, 20 Sep 2019 17:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352558 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: daichi X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 352558 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 17:37:25 -0000 Author: daichi Date: Fri Sep 20 17:37:23 2019 New Revision: 352558 URL: https://svnweb.freebsd.org/changeset/base/352558 Log: top(1): support multibyte characters in command names (ARGV array) depending on locale. - add setlocale() - remove printable() function - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display non-printable characters that do not use C-style backslash sequences in three digit octal sequence, or remove it This change allows multibyte characters to be displayed according to locale. If it is recognized as a non-display character according to the locale, it is displayed in three digit octal sequence. Reference: https://www.mail-archive.com/svn-src-all@freebsd.org/msg165751.html https://www.mail-archive.com/svn-src-all@freebsd.org/msg165766.html https://www.mail-archive.com/svn-src-all@freebsd.org/msg165833.html https://www.mail-archive.com/svn-src-all@freebsd.org/msg165846.html https://www.mail-archive.com/svn-src-all@freebsd.org/msg165891.html Submitted by: hrs Differential Revision: https://reviews.freebsd.org/D16204 Modified: head/usr.bin/top/display.c head/usr.bin/top/display.h head/usr.bin/top/machine.c head/usr.bin/top/top.1 head/usr.bin/top/top.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Fri Sep 20 13:35:28 2019 (r352557) +++ head/usr.bin/top/display.c Fri Sep 20 17:37:23 2019 (r352558) @@ -1291,31 +1291,6 @@ line_update(char *old, char *new, int start, int line) } } -/* - * printable(str) - make the string pointed to by "str" into one that is - * printable (i.e.: all ascii), by converting all non-printable - * characters into '?'. Replacements are done in place and a pointer - * to the original buffer is returned. - */ - -char * -printable(char str[]) -{ - char *ptr; - char ch; - - ptr = str; - while ((ch = *ptr) != '\0') - { - if (!isprint(ch)) - { - *ptr = '?'; - } - ptr++; - } - return(str); -} - void i_uptime(struct timeval *bt, time_t *tod) { Modified: head/usr.bin/top/display.h ============================================================================== --- head/usr.bin/top/display.h Fri Sep 20 13:35:28 2019 (r352557) +++ head/usr.bin/top/display.h Fri Sep 20 17:37:23 2019 (r352558) @@ -11,7 +11,6 @@ int display_updatecpus(struct statics *statics); void clear_message(void); int display_resize(void); void i_header(const char *text); -char *printable(char *string); void display_header(int t); int display_init(struct statics *statics); void i_arc(int *stats); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Fri Sep 20 13:35:28 2019 (r352557) +++ head/usr.bin/top/machine.c Fri Sep 20 17:37:23 2019 (r352558) @@ -1003,7 +1003,7 @@ format_next_process(struct handle * xhandle, char *(*g len = (argbuflen - (dst - argbuf) - 1) / 4; strvisx(dst, src, MIN(strlen(src), len), - VIS_NL | VIS_CSTYLE); + VIS_NL | VIS_CSTYLE | VIS_OCTAL | VIS_SAFE); while (*dst != '\0') dst++; if ((argbuflen - (dst - argbuf) - 1) / 4 > 0) @@ -1102,7 +1102,7 @@ format_next_process(struct handle * xhandle, char *(*g sbuf_printf(procbuf, "%6s ", format_time(cputime)); sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * weighted_cpu(PCTCPU(pp), pp) : 100.0 * PCTCPU(pp)); } - sbuf_printf(procbuf, "%s", printable(cmdbuf)); + sbuf_printf(procbuf, "%s", cmdbuf); free(cmdbuf); return (sbuf_data(procbuf)); } Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Fri Sep 20 13:35:28 2019 (r352557) +++ head/usr.bin/top/top.1 Fri Sep 20 17:37:23 2019 (r352558) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd October 2, 2018 +.Dd September 20, 2019 .Dt TOP 1 .Os .Sh NAME @@ -192,6 +192,10 @@ or \*(lqall\*(rq. Boolean flags are toggles. A second specification of any of these options will negate the first. +.Pp +The display of command names changes according to the locale. +If command names displayed in the locale settings are recognized as +non-display characters, they are displayed in three digit octal sequence. .Sh "INTERACTIVE MODE" When .Nm Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Fri Sep 20 13:35:28 2019 (r352557) +++ head/usr.bin/top/top.c Fri Sep 20 17:37:23 2019 (r352558) @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -264,6 +265,11 @@ main(int argc, const char *argv[]) #else setbuffer(stdout, stdoutbuf, Buffersize); #endif + + if (setlocale(LC_ALL, "") == NULL) { + fprintf(stderr, "invalid locale.\n"); + exit(1); + } mypid = getpid(); From owner-svn-src-all@freebsd.org Fri Sep 20 19:43: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 DE57212560E; Fri, 20 Sep 2019 19:43:41 +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 46Zkfj57xMz4XYc; Fri, 20 Sep 2019 19:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 836B729C8; Fri, 20 Sep 2019 19:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KJhfYW048951; Fri, 20 Sep 2019 19:43:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJhegB048949; Fri, 20 Sep 2019 19:43:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909201943.x8KJhegB048949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 20 Sep 2019 19:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352559 - in head/stand: forth lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/stand: forth lua X-SVN-Commit-Revision: 352559 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 19:43:41 -0000 Author: kevans Date: Fri Sep 20 19:43:40 2019 New Revision: 352559 URL: https://svnweb.freebsd.org/changeset/base/352559 Log: loader: Respect loader_color=YES for serial consoles It's not uncommon these days for the terminals attached to serial consoles to support ANSI escape sequences. However, we assume escape sequences may break some serial consoles and default to not using them when boot_serial or boot_multicons (or if console contains "comconsole" in the forth loader) for broader compatibility. We also have loader_color which can be explicitly set to "NO" to disable the use of ANSI escape sequences. The problem is that loader_color=YES gets ignored when boot_serial=YES or boot_multicons=YES (or when console contains "comconsole" in the forth loader). To fix, the existing default behavior remains unchanged when loader_color is unset, loader_color=NO explicitly disables the use of ANSI escape sequences still, and the change is that loader_color=YES can now be used to explicitly allow ANSI escapes when a serial console is enabled. Submitted by: Ryan Moeller Reviewed by: tsoome (forth), kevans (lua) MFC after: 1 week Sponsored by: iXsystems, Inc. (Ryan) Differential Revision: https://reviews.freebsd.org/D21732 Modified: head/stand/forth/color.4th head/stand/lua/color.lua Modified: head/stand/forth/color.4th ============================================================================== --- head/stand/forth/color.4th Fri Sep 20 17:37:23 2019 (r352558) +++ head/stand/forth/color.4th Fri Sep 20 19:43:40 2019 (r352559) @@ -27,12 +27,14 @@ marker task-color.4th \ This function returns FALSE if the `loader_color' environment variable is set -\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial). +\ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value. +\ If `loader_color' is unset, TRUE is returned (unless booting serial). \ -: loader_color? ( -- N ) +: loader_color? ( -- t ) s" loader_color" getenv dup -1 <> if - + \ `loader_color' is set. + \ Check if it is explicitly disabled. 2dup s" NO" compare-insensitive 0= if 2drop FALSE exit @@ -42,8 +44,12 @@ marker task-color.4th FALSE exit then drop + \ It is enabled. + TRUE + else + \ `loader_color' is unset. + \ Default to using color unless serial boot is active. + drop + boot_serial? 0= then - drop - - boot_serial? if FALSE else TRUE then ; Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Fri Sep 20 17:37:23 2019 (r352558) +++ head/stand/lua/color.lua Fri Sep 20 19:43:40 2019 (r352559) @@ -49,9 +49,7 @@ color.DIM = 2 function color.isEnabled() local c = loader.getenv("loader_color") if c ~= nil then - if c:lower() == "no" or c == "0" then - return false - end + return c:lower() ~= "no" and c ~= "0" end return not core.isSerialBoot() end From owner-svn-src-all@freebsd.org Fri Sep 20 19:45: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 29E5512569C; Fri, 20 Sep 2019 19:45:39 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Zkhy6DQ7z4Xhw; Fri, 20 Sep 2019 19:45:38 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9C7129CF; Fri, 20 Sep 2019 19:45:38 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KJjcBV049118; Fri, 20 Sep 2019 19:45:38 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJjcqr049115; Fri, 20 Sep 2019 19:45:38 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201909201945.x8KJjcqr049115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 20 Sep 2019 19:45: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: r352560 - in stable/12: etc/mtree usr.sbin/jail usr.sbin/jail/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: in stable/12: etc/mtree usr.sbin/jail usr.sbin/jail/tests X-SVN-Commit-Revision: 352560 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 19:45:39 -0000 Author: mizhka Date: Fri Sep 20 19:45:37 2019 New Revision: 352560 URL: https://svnweb.freebsd.org/changeset/base/352560 Log: MFC r352263: [jail] removal by jid doesn't trigger pre/post stop scripts This commit fixes bug: command "jail -r" didn't trigger pre/post stop commands (and others) defined in config file if jid is specified insted of name. Also it adds basic tests for usr.sbin/jail to avoid regression. Reviewed by: jamie, kevans, ray Differential Revision: https://reviews.freebsd.org/D21328 Added: stable/12/usr.sbin/jail/tests/ - copied from r352263, head/usr.sbin/jail/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.sbin/jail/Makefile stable/12/usr.sbin/jail/state.c Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Fri Sep 20 19:43:40 2019 (r352559) +++ stable/12/etc/mtree/BSD.tests.dist Fri Sep 20 19:45:37 2019 (r352560) @@ -1070,6 +1070,8 @@ .. fstyp .. + jail + .. makefs .. newsyslog Modified: stable/12/usr.sbin/jail/Makefile ============================================================================== --- stable/12/usr.sbin/jail/Makefile Fri Sep 20 19:43:40 2019 (r352559) +++ stable/12/usr.sbin/jail/Makefile Fri Sep 20 19:45:37 2019 (r352560) @@ -24,4 +24,7 @@ CFLAGS+= -DINET CLEANFILES= y.output +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Modified: stable/12/usr.sbin/jail/state.c ============================================================================== --- stable/12/usr.sbin/jail/state.c Fri Sep 20 19:43:40 2019 (r352559) +++ stable/12/usr.sbin/jail/state.c Fri Sep 20 19:45:37 2019 (r352560) @@ -44,7 +44,7 @@ static void dep_add(struct cfjail *from, struct cfjail static int cmp_jailptr(const void *a, const void *b); static int cmp_jailptr_name(const void *a, const void *b); static struct cfjail *find_jail(const char *name); -static int running_jid(const char *name, int flags); +static struct cfjail *running_jail(const char *name, int flags); static struct cfjail **jails_byname; static size_t njails; @@ -72,7 +72,7 @@ dep_setup(int docf) if ((j = TAILQ_FIRST(&cfjails)) && (p = j->intparams[IP_DEPEND])) { TAILQ_FOREACH(s, &p->val, tq) { - if (running_jid(s->s, 0) < 0) { + if (running_jail(s->s, 0) == NULL) { warnx("depends on nonexistent jail " "\"%s\"", s->s); j->flags |= JF_FAILED; @@ -369,11 +369,7 @@ start_state(const char *target, int docf, unsigned sta j = find_jail(target); if (j == NULL && state == JF_STOP) { /* Allow -[rR] to specify a currently running jail. */ - if ((jid = running_jid(target, JAIL_DYING)) > 0) { - j = add_jail(); - j->name = estrdup(target); - j->jid = jid; - } + j = running_jail(target, JAIL_DYING); } if (j == NULL) { warnx("\"%s\" not found", target); @@ -446,6 +442,9 @@ static struct cfjail * find_jail(const char *name) { struct cfjail **jp; + + if (jails_byname == NULL) + return NULL; jp = bsearch(name, jails_byname, njails, sizeof(struct cfjail *), cmp_jailptr_name); @@ -453,26 +452,43 @@ find_jail(const char *name) } /* - * Return the named jail's jid if it is running, and -1 if it isn't. + * Return jail if it is running, and NULL if it isn't. */ -static int -running_jid(const char *name, int flags) +static struct cfjail * +running_jail(const char *name, int flags) { - struct iovec jiov[2]; + struct iovec jiov[4]; + struct cfjail *jail; char *ep; - int jid; - + char jailname[MAXHOSTNAMELEN]; + int jid, ret, len; + if ((jid = strtol(name, &ep, 10)) && !*ep) { - jiov[0].iov_base = __DECONST(char *, "jid"); - jiov[0].iov_len = sizeof("jid"); - jiov[1].iov_base = &jid; - jiov[1].iov_len = sizeof(jid); + memset(jailname,0,sizeof(jailname)); + len = sizeof(jailname); } else { - jiov[0].iov_base = __DECONST(char *, "name"); - jiov[0].iov_len = sizeof("name"); - jiov[1].iov_len = strlen(name) + 1; - jiov[1].iov_base = alloca(jiov[1].iov_len); - strcpy(jiov[1].iov_base, name); + strncpy(jailname, name,sizeof(jailname)); + len = strlen(name) + 1; + jid = 0; } - return jail_get(jiov, 2, flags); + + jiov[0].iov_base = __DECONST(char *, "jid"); + jiov[0].iov_len = sizeof("jid"); + jiov[1].iov_base = &jid; + jiov[1].iov_len = sizeof(jid); + jiov[2].iov_base = __DECONST(char *, "name"); + jiov[2].iov_len = sizeof("name"); + jiov[3].iov_base = &jailname; + jiov[3].iov_len = len; + + if ((ret = jail_get(jiov, 4, flags)) < 0) + return (NULL); + + if ((jail = find_jail(jailname)) == NULL) { + jail = add_jail(); + jail->name = estrdup(jailname); + jail->jid = ret; + } + + return (jail); } From owner-svn-src-all@freebsd.org Fri Sep 20 19: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 4E9771257FC; Fri, 20 Sep 2019 19:50:45 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Zkps1Ks6z4Y92; Fri, 20 Sep 2019 19:50:45 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 124DD2A04; Fri, 20 Sep 2019 19:50:45 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KJoicU050503; Fri, 20 Sep 2019 19:50:44 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJoilj050501; Fri, 20 Sep 2019 19:50:44 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201909201950.x8KJoilj050501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 20 Sep 2019 19:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352561 - in stable/11: etc/mtree usr.sbin/jail usr.sbin/jail/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: in stable/11: etc/mtree usr.sbin/jail usr.sbin/jail/tests X-SVN-Commit-Revision: 352561 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 19:50:45 -0000 Author: mizhka Date: Fri Sep 20 19:50:44 2019 New Revision: 352561 URL: https://svnweb.freebsd.org/changeset/base/352561 Log: MFC r352263: [jail] removal by jid doesn't trigger pre/post stop scripts This commit fixes bug: command "jail -r" didn't trigger pre/post stop commands (and others) defined in config file if jid is specified insted of name. Also it adds basic tests for usr.sbin/jail to avoid regression. Reviewed by: jamie, kevans, ray Differential Revision: https://reviews.freebsd.org/D21328 Added: stable/11/usr.sbin/jail/tests/ - copied from r352263, head/usr.sbin/jail/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.sbin/jail/Makefile stable/11/usr.sbin/jail/state.c Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Fri Sep 20 19:45:37 2019 (r352560) +++ stable/11/etc/mtree/BSD.tests.dist Fri Sep 20 19:50:44 2019 (r352561) @@ -750,6 +750,8 @@ .. fstyp .. + jail + .. makefs .. newsyslog Modified: stable/11/usr.sbin/jail/Makefile ============================================================================== --- stable/11/usr.sbin/jail/Makefile Fri Sep 20 19:45:37 2019 (r352560) +++ stable/11/usr.sbin/jail/Makefile Fri Sep 20 19:50:44 2019 (r352561) @@ -24,4 +24,7 @@ CFLAGS+= -DINET CLEANFILES= y.output +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include Modified: stable/11/usr.sbin/jail/state.c ============================================================================== --- stable/11/usr.sbin/jail/state.c Fri Sep 20 19:45:37 2019 (r352560) +++ stable/11/usr.sbin/jail/state.c Fri Sep 20 19:50:44 2019 (r352561) @@ -44,7 +44,7 @@ static void dep_add(struct cfjail *from, struct cfjail static int cmp_jailptr(const void *a, const void *b); static int cmp_jailptr_name(const void *a, const void *b); static struct cfjail *find_jail(const char *name); -static int running_jid(const char *name, int flags); +static struct cfjail *running_jail(const char *name, int flags); static struct cfjail **jails_byname; static size_t njails; @@ -72,7 +72,7 @@ dep_setup(int docf) if ((j = TAILQ_FIRST(&cfjails)) && (p = j->intparams[IP_DEPEND])) { TAILQ_FOREACH(s, &p->val, tq) { - if (running_jid(s->s, 0) < 0) { + if (running_jail(s->s, 0) == NULL) { warnx("depends on nonexistent jail " "\"%s\"", s->s); j->flags |= JF_FAILED; @@ -369,11 +369,7 @@ start_state(const char *target, int docf, unsigned sta j = find_jail(target); if (j == NULL && state == JF_STOP) { /* Allow -[rR] to specify a currently running jail. */ - if ((jid = running_jid(target, JAIL_DYING)) > 0) { - j = add_jail(); - j->name = estrdup(target); - j->jid = jid; - } + j = running_jail(target, JAIL_DYING); } if (j == NULL) { warnx("\"%s\" not found", target); @@ -446,6 +442,9 @@ static struct cfjail * find_jail(const char *name) { struct cfjail **jp; + + if (jails_byname == NULL) + return NULL; jp = bsearch(name, jails_byname, njails, sizeof(struct cfjail *), cmp_jailptr_name); @@ -453,26 +452,43 @@ find_jail(const char *name) } /* - * Return the named jail's jid if it is running, and -1 if it isn't. + * Return jail if it is running, and NULL if it isn't. */ -static int -running_jid(const char *name, int flags) +static struct cfjail * +running_jail(const char *name, int flags) { - struct iovec jiov[2]; + struct iovec jiov[4]; + struct cfjail *jail; char *ep; - int jid; - + char jailname[MAXHOSTNAMELEN]; + int jid, ret, len; + if ((jid = strtol(name, &ep, 10)) && !*ep) { - jiov[0].iov_base = __DECONST(char *, "jid"); - jiov[0].iov_len = sizeof("jid"); - jiov[1].iov_base = &jid; - jiov[1].iov_len = sizeof(jid); + memset(jailname,0,sizeof(jailname)); + len = sizeof(jailname); } else { - jiov[0].iov_base = __DECONST(char *, "name"); - jiov[0].iov_len = sizeof("name"); - jiov[1].iov_len = strlen(name) + 1; - jiov[1].iov_base = alloca(jiov[1].iov_len); - strcpy(jiov[1].iov_base, name); + strncpy(jailname, name,sizeof(jailname)); + len = strlen(name) + 1; + jid = 0; } - return jail_get(jiov, 2, flags); + + jiov[0].iov_base = __DECONST(char *, "jid"); + jiov[0].iov_len = sizeof("jid"); + jiov[1].iov_base = &jid; + jiov[1].iov_len = sizeof(jid); + jiov[2].iov_base = __DECONST(char *, "name"); + jiov[2].iov_len = sizeof("name"); + jiov[3].iov_base = &jailname; + jiov[3].iov_len = len; + + if ((ret = jail_get(jiov, 4, flags)) < 0) + return (NULL); + + if ((jail = find_jail(jailname)) == NULL) { + jail = add_jail(); + jail->name = estrdup(jailname); + jail->jid = ret; + } + + return (jail); } From owner-svn-src-all@freebsd.org Fri Sep 20 19:56: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 127C7125A29; Fri, 20 Sep 2019 19:56:31 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ZkxV6jnhz4YZ6; Fri, 20 Sep 2019 19:56:30 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9B792BA6; Fri, 20 Sep 2019 19:56:30 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KJuUU4055217; Fri, 20 Sep 2019 19:56:30 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJuUUt055216; Fri, 20 Sep 2019 19:56:30 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201909201956.x8KJuUUt055216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 20 Sep 2019 19:56: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: r352562 - stable/12/sys/dev/ral X-SVN-Group: stable-12 X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: stable/12/sys/dev/ral X-SVN-Commit-Revision: 352562 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 19:56:31 -0000 Author: mizhka Date: Fri Sep 20 19:56:30 2019 New Revision: 352562 URL: https://svnweb.freebsd.org/changeset/base/352562 Log: MFC r352260: [Bug 240473] add support of Ralink RT5390R Wireless Card This commit adds PCI ID of Ralink RT5390R into ids table of driver ral. Tests show stability of card during day. Network speed is reasonable ( around several megabytes per second). PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240473 Reported by: zetrotrack000@gmail.com Reviewed by: ray Approved by: ray Differential Revision: https://reviews.freebsd.org/D21604 Modified: stable/12/sys/dev/ral/if_ral_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ral/if_ral_pci.c ============================================================================== --- stable/12/sys/dev/ral/if_ral_pci.c Fri Sep 20 19:50:44 2019 (r352561) +++ stable/12/sys/dev/ral/if_ral_pci.c Fri Sep 20 19:56:30 2019 (r352562) @@ -100,6 +100,7 @@ static const struct ral_pci_ident ral_pci_ids[] = { { 0x1814, 0x5390, "Ralink Technology RT5390" }, { 0x1814, 0x5392, "Ralink Technology RT5392" }, { 0x1814, 0x539a, "Ralink Technology RT5390" }, + { 0x1814, 0x539b, "Ralink Technology RT5390" }, { 0x1814, 0x539f, "Ralink Technology RT5390" }, { 0x1a3b, 0x1059, "AWT RT2890" }, { 0, 0, NULL } From owner-svn-src-all@freebsd.org Fri Sep 20 19:56: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 56A6E125A84; Fri, 20 Sep 2019 19:56:56 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Zky01cQlz4Yhg; Fri, 20 Sep 2019 19:56:56 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B62C2BAB; Fri, 20 Sep 2019 19:56:56 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KJutdD055289; Fri, 20 Sep 2019 19:56:55 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KJutkU055288; Fri, 20 Sep 2019 19:56:55 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201909201956.x8KJutkU055288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 20 Sep 2019 19:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352563 - stable/11/sys/dev/ral X-SVN-Group: stable-11 X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: stable/11/sys/dev/ral X-SVN-Commit-Revision: 352563 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 19:56:56 -0000 Author: mizhka Date: Fri Sep 20 19:56:55 2019 New Revision: 352563 URL: https://svnweb.freebsd.org/changeset/base/352563 Log: MFC r352260: [Bug 240473] add support of Ralink RT5390R Wireless Card This commit adds PCI ID of Ralink RT5390R into ids table of driver ral. Tests show stability of card during day. Network speed is reasonable ( around several megabytes per second). PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240473 Reported by: zetrotrack000@gmail.com Reviewed by: ray Approved by: ray Differential Revision: https://reviews.freebsd.org/D21604 Modified: stable/11/sys/dev/ral/if_ral_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ral/if_ral_pci.c ============================================================================== --- stable/11/sys/dev/ral/if_ral_pci.c Fri Sep 20 19:56:30 2019 (r352562) +++ stable/11/sys/dev/ral/if_ral_pci.c Fri Sep 20 19:56:55 2019 (r352563) @@ -99,6 +99,7 @@ static const struct ral_pci_ident ral_pci_ids[] = { { 0x1814, 0x5390, "Ralink Technology RT5390" }, { 0x1814, 0x5392, "Ralink Technology RT5392" }, { 0x1814, 0x539a, "Ralink Technology RT5390" }, + { 0x1814, 0x539b, "Ralink Technology RT5390" }, { 0x1814, 0x539f, "Ralink Technology RT5390" }, { 0x1a3b, 0x1059, "AWT RT2890" }, { 0, 0, NULL } From owner-svn-src-all@freebsd.org Fri Sep 20 20:47: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 6A2BE126BF6; Fri, 20 Sep 2019 20:47:11 +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 46Zm3z284Zz4cR7; Fri, 20 Sep 2019 20:47:11 +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 282C134D2; Fri, 20 Sep 2019 20:47:11 +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 x8KKlBGV086361; Fri, 20 Sep 2019 20:47:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KKlAX2086360; Fri, 20 Sep 2019 20:47:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909202047.x8KKlAX2086360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 20 Sep 2019 20:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352564 - head/sys/fs/msdosfs X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/fs/msdosfs X-SVN-Commit-Revision: 352564 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 20:47:11 -0000 Author: kevans Date: Fri Sep 20 20:47:10 2019 New Revision: 352564 URL: https://svnweb.freebsd.org/changeset/base/352564 Log: msdosfs: do not deget unlinked denodes When a file is unlinked, the denode is not reclaimed until the last reference is dropped, but the directory entry is immediately up for reuse. This is a problem later when createde goes to grab a denode for the newly created entry -- we search the hash and find a dead denode, then return that without even bumping the reference count and the data later gets truncated when the the last reference to the unlinked file is dropped. This manifested itself as a broken in-place strip(1) on msdosfs. elfcopy will do a sequence incredibly roughly like this: open("/mnt/foo", ...) => fd 3 mmap() unlink("/mnt/foo") open("/mnt/foo", ...) => fd 4 write(4, ...) close(4) close(3) and the resulting file would be truncated, but the write succeeded, as long as a reference to the unlinked file had not been closed. Some archaeology indicates that this bug has likely existed since msdosfs was converted to use vfs_hash instead of a home rolled hash implementation in r143570. Prior to that point, the hashget implementation would do a refcnt check while searching and explicitly only return a denode with de_refcnt != 0. vfs_hash did not yet have the callback that it does today, so this slipped away and did not come back when it later grew that functionality. The comment indicating that we want to skip these denodes has been updated to reflect where this is actually done. My repo-diving session seems to indicate that the refcnt check was likely never actually below the comment, to be pedantic, but instead a detail wrapped up in the hashget implementation since the beginning of its inclusion into FreeBSD. This bug was the cause behind the issue addressed in r352557. Reported by: jhibbits Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21731 Modified: head/sys/fs/msdosfs/msdosfs_denode.c Modified: head/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_denode.c Fri Sep 20 19:56:55 2019 (r352563) +++ head/sys/fs/msdosfs/msdosfs_denode.c Fri Sep 20 20:47:10 2019 (r352564) @@ -79,7 +79,7 @@ de_vncmpf(struct vnode *vp, void *arg) a = arg; de = VTODE(vp); - return (de->de_inode != *a); + return (de->de_inode != *a) || (de->de_refcnt <= 0); } /* @@ -124,8 +124,9 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon * address of "." entry. For root dir (if not FAT32) use cluster * MSDOSFSROOT, offset MSDOSFSROOT_OFS * - * NOTE: The check for de_refcnt > 0 below insures the denode being - * examined does not represent an unlinked but still open file. + * NOTE: de_vncmpf will explicitly skip any denodes that do not have + * a de_refcnt > 0. This insures that that we do not attempt to use + * a denode that represents an unlinked but still open file. * These files are not to be accessible even when the directory * entry that represented the file happens to be reused while the * deleted file is still open. From owner-svn-src-all@freebsd.org Fri Sep 20 21:27: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 B2757E813B; Fri, 20 Sep 2019 21:27:42 +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 46Zmyk3dHbz4ftZ; Fri, 20 Sep 2019 21:27:42 +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 5B8753E3D; Fri, 20 Sep 2019 21:27:42 +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 x8KLRgKf010283; Fri, 20 Sep 2019 21:27:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KLRgkc010282; Fri, 20 Sep 2019 21:27:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909202127.x8KLRgkc010282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 20 Sep 2019 21:27: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: r352565 - in stable: 11/sys/net 12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/net 12/sys/net X-SVN-Commit-Revision: 352565 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 21:27:42 -0000 Author: kevans Date: Fri Sep 20 21:27:41 2019 New Revision: 352565 URL: https://svnweb.freebsd.org/changeset/base/352565 Log: MFC r352246: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Modified: stable/12/sys/net/if.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/net/if.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/net/if.c ============================================================================== --- stable/12/sys/net/if.c Fri Sep 20 20:47:10 2019 (r352564) +++ stable/12/sys/net/if.c Fri Sep 20 21:27:41 2019 (r352565) @@ -2750,6 +2750,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, if (strlen(new_name) == IFNAMSIZ-1) return (EINVAL); } + if (strcmp(new_name, ifp->if_xname) == 0) + break; if (ifunit(new_name) != NULL) return (EEXIST); From owner-svn-src-all@freebsd.org Fri Sep 20 21:27: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 72049E8135; Fri, 20 Sep 2019 21:27:42 +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 46Zmyk1nsPz4ftY; Fri, 20 Sep 2019 21:27:42 +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 20CFC3E3C; Fri, 20 Sep 2019 21:27:42 +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 x8KLRfx1010277; Fri, 20 Sep 2019 21:27:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KLRfqv010276; Fri, 20 Sep 2019 21:27:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909202127.x8KLRfqv010276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 20 Sep 2019 21:27:41 +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: r352565 - in stable: 11/sys/net 12/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/net 12/sys/net X-SVN-Commit-Revision: 352565 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 21:27:42 -0000 Author: kevans Date: Fri Sep 20 21:27:41 2019 New Revision: 352565 URL: https://svnweb.freebsd.org/changeset/base/352565 Log: MFC r352246: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Modified: stable/11/sys/net/if.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/net/if.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/net/if.c ============================================================================== --- stable/11/sys/net/if.c Fri Sep 20 20:47:10 2019 (r352564) +++ stable/11/sys/net/if.c Fri Sep 20 21:27:41 2019 (r352565) @@ -2672,6 +2672,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, if (strlen(new_name) == IFNAMSIZ-1) return (EINVAL); } + if (strcmp(new_name, ifp->if_xname) == 0) + break; if (ifunit(new_name) != NULL) return (EEXIST); From owner-svn-src-all@freebsd.org Fri Sep 20 22:08: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 DC2B4E9507; Fri, 20 Sep 2019 22:08:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ZnsK5XJtz3DKQ; Fri, 20 Sep 2019 22:08:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C3DF45A8; Fri, 20 Sep 2019 22:08:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8KM85LJ033694; Fri, 20 Sep 2019 22:08:05 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8KM80Et033668; Fri, 20 Sep 2019 22:08:00 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201909202208.x8KM80Et033668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 20 Sep 2019 22:08: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: r352566 - in stable/12: sys/amd64/acpica sys/arm64/acpica sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger... X-SVN-Group: stable-12 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/12: sys/amd64/acpica sys/arm64/acpica sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/c... X-SVN-Commit-Revision: 352566 X-SVN-Commit-Repository: base MIME-Version: 1.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, 20 Sep 2019 22:08:05 -0000 Author: jkim Date: Fri Sep 20 22:07:59 2019 New Revision: 352566 URL: https://svnweb.freebsd.org/changeset/base/352566 Log: MFC: r342869, r344398, r344446, r344448, r345713, r345980, r347415, r349863, r350510, r351095 Merge ACPICA up to 20190703. Modified: stable/12/sys/amd64/acpica/acpi_machdep.c stable/12/sys/arm64/acpica/acpi_machdep.c stable/12/sys/contrib/dev/acpica/changes.txt stable/12/sys/contrib/dev/acpica/common/acfileio.c stable/12/sys/contrib/dev/acpica/common/acgetline.c stable/12/sys/contrib/dev/acpica/common/adfile.c stable/12/sys/contrib/dev/acpica/common/adisasm.c stable/12/sys/contrib/dev/acpica/common/adwalk.c stable/12/sys/contrib/dev/acpica/common/ahids.c stable/12/sys/contrib/dev/acpica/common/ahpredef.c stable/12/sys/contrib/dev/acpica/common/ahtable.c stable/12/sys/contrib/dev/acpica/common/ahuuids.c stable/12/sys/contrib/dev/acpica/common/cmfsize.c stable/12/sys/contrib/dev/acpica/common/dmextern.c stable/12/sys/contrib/dev/acpica/common/dmrestag.c stable/12/sys/contrib/dev/acpica/common/dmswitch.c stable/12/sys/contrib/dev/acpica/common/dmtable.c stable/12/sys/contrib/dev/acpica/common/dmtables.c stable/12/sys/contrib/dev/acpica/common/dmtbdump.c stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c stable/12/sys/contrib/dev/acpica/common/dmtbinfo.c stable/12/sys/contrib/dev/acpica/common/dmtbinfo1.c stable/12/sys/contrib/dev/acpica/common/dmtbinfo2.c stable/12/sys/contrib/dev/acpica/common/dmtbinfo3.c stable/12/sys/contrib/dev/acpica/common/getopt.c stable/12/sys/contrib/dev/acpica/compiler/aslallocate.c stable/12/sys/contrib/dev/acpica/compiler/aslanalyze.c stable/12/sys/contrib/dev/acpica/compiler/aslascii.c stable/12/sys/contrib/dev/acpica/compiler/aslbtypes.c stable/12/sys/contrib/dev/acpica/compiler/aslcache.c stable/12/sys/contrib/dev/acpica/compiler/aslcodegen.c stable/12/sys/contrib/dev/acpica/compiler/aslcompile.c stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.h stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.l stable/12/sys/contrib/dev/acpica/compiler/aslcstyle.y stable/12/sys/contrib/dev/acpica/compiler/asldebug.c stable/12/sys/contrib/dev/acpica/compiler/asldefine.h stable/12/sys/contrib/dev/acpica/compiler/aslerror.c stable/12/sys/contrib/dev/acpica/compiler/aslexternal.c stable/12/sys/contrib/dev/acpica/compiler/aslfileio.c stable/12/sys/contrib/dev/acpica/compiler/aslfiles.c stable/12/sys/contrib/dev/acpica/compiler/aslfold.c stable/12/sys/contrib/dev/acpica/compiler/aslglobal.h stable/12/sys/contrib/dev/acpica/compiler/aslhelp.c stable/12/sys/contrib/dev/acpica/compiler/aslhelpers.y stable/12/sys/contrib/dev/acpica/compiler/aslhex.c stable/12/sys/contrib/dev/acpica/compiler/aslkeywords.y stable/12/sys/contrib/dev/acpica/compiler/asllength.c stable/12/sys/contrib/dev/acpica/compiler/asllisting.c stable/12/sys/contrib/dev/acpica/compiler/asllistsup.c stable/12/sys/contrib/dev/acpica/compiler/aslload.c stable/12/sys/contrib/dev/acpica/compiler/asllookup.c stable/12/sys/contrib/dev/acpica/compiler/aslmain.c stable/12/sys/contrib/dev/acpica/compiler/aslmap.c stable/12/sys/contrib/dev/acpica/compiler/aslmapenter.c stable/12/sys/contrib/dev/acpica/compiler/aslmapoutput.c stable/12/sys/contrib/dev/acpica/compiler/aslmaputils.c stable/12/sys/contrib/dev/acpica/compiler/aslmessages.c stable/12/sys/contrib/dev/acpica/compiler/aslmessages.h stable/12/sys/contrib/dev/acpica/compiler/aslmethod.c stable/12/sys/contrib/dev/acpica/compiler/aslnamesp.c stable/12/sys/contrib/dev/acpica/compiler/asloffset.c stable/12/sys/contrib/dev/acpica/compiler/aslopcodes.c stable/12/sys/contrib/dev/acpica/compiler/asloperands.c stable/12/sys/contrib/dev/acpica/compiler/aslopt.c stable/12/sys/contrib/dev/acpica/compiler/asloptions.c stable/12/sys/contrib/dev/acpica/compiler/aslparseop.c stable/12/sys/contrib/dev/acpica/compiler/aslparser.y stable/12/sys/contrib/dev/acpica/compiler/aslpld.c stable/12/sys/contrib/dev/acpica/compiler/aslpredef.c stable/12/sys/contrib/dev/acpica/compiler/aslprepkg.c stable/12/sys/contrib/dev/acpica/compiler/aslprimaries.y stable/12/sys/contrib/dev/acpica/compiler/aslprintf.c stable/12/sys/contrib/dev/acpica/compiler/aslprune.c stable/12/sys/contrib/dev/acpica/compiler/aslresource.c stable/12/sys/contrib/dev/acpica/compiler/aslresources.y stable/12/sys/contrib/dev/acpica/compiler/aslrestype1.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype1i.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2d.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2e.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2q.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2s.c stable/12/sys/contrib/dev/acpica/compiler/aslrestype2w.c stable/12/sys/contrib/dev/acpica/compiler/aslrules.y stable/12/sys/contrib/dev/acpica/compiler/aslstartup.c stable/12/sys/contrib/dev/acpica/compiler/aslstubs.c stable/12/sys/contrib/dev/acpica/compiler/aslsupport.l stable/12/sys/contrib/dev/acpica/compiler/aslsupport.y stable/12/sys/contrib/dev/acpica/compiler/asltokens.y stable/12/sys/contrib/dev/acpica/compiler/asltransform.c stable/12/sys/contrib/dev/acpica/compiler/asltree.c stable/12/sys/contrib/dev/acpica/compiler/asltypes.h stable/12/sys/contrib/dev/acpica/compiler/asltypes.y stable/12/sys/contrib/dev/acpica/compiler/aslutils.c stable/12/sys/contrib/dev/acpica/compiler/asluuid.c stable/12/sys/contrib/dev/acpica/compiler/aslwalks.c stable/12/sys/contrib/dev/acpica/compiler/aslxref.c stable/12/sys/contrib/dev/acpica/compiler/aslxrefout.c stable/12/sys/contrib/dev/acpica/compiler/cvcompiler.c stable/12/sys/contrib/dev/acpica/compiler/cvdisasm.c stable/12/sys/contrib/dev/acpica/compiler/cvparser.c stable/12/sys/contrib/dev/acpica/compiler/dtcompile.c stable/12/sys/contrib/dev/acpica/compiler/dtcompiler.h stable/12/sys/contrib/dev/acpica/compiler/dtexpress.c stable/12/sys/contrib/dev/acpica/compiler/dtfield.c stable/12/sys/contrib/dev/acpica/compiler/dtio.c stable/12/sys/contrib/dev/acpica/compiler/dtparser.l stable/12/sys/contrib/dev/acpica/compiler/dtparser.y stable/12/sys/contrib/dev/acpica/compiler/dtsubtable.c stable/12/sys/contrib/dev/acpica/compiler/dttable.c stable/12/sys/contrib/dev/acpica/compiler/dttable1.c stable/12/sys/contrib/dev/acpica/compiler/dttable2.c stable/12/sys/contrib/dev/acpica/compiler/dttemplate.c stable/12/sys/contrib/dev/acpica/compiler/dttemplate.h stable/12/sys/contrib/dev/acpica/compiler/dtutils.c stable/12/sys/contrib/dev/acpica/compiler/preprocess.h stable/12/sys/contrib/dev/acpica/compiler/prexpress.c stable/12/sys/contrib/dev/acpica/compiler/prmacros.c stable/12/sys/contrib/dev/acpica/compiler/prparser.l stable/12/sys/contrib/dev/acpica/compiler/prparser.y stable/12/sys/contrib/dev/acpica/compiler/prscan.c stable/12/sys/contrib/dev/acpica/compiler/prutils.c stable/12/sys/contrib/dev/acpica/components/debugger/dbcmds.c stable/12/sys/contrib/dev/acpica/components/debugger/dbconvert.c stable/12/sys/contrib/dev/acpica/components/debugger/dbdisply.c stable/12/sys/contrib/dev/acpica/components/debugger/dbexec.c stable/12/sys/contrib/dev/acpica/components/debugger/dbfileio.c stable/12/sys/contrib/dev/acpica/components/debugger/dbhistry.c stable/12/sys/contrib/dev/acpica/components/debugger/dbinput.c stable/12/sys/contrib/dev/acpica/components/debugger/dbmethod.c stable/12/sys/contrib/dev/acpica/components/debugger/dbnames.c stable/12/sys/contrib/dev/acpica/components/debugger/dbobject.c stable/12/sys/contrib/dev/acpica/components/debugger/dbstats.c stable/12/sys/contrib/dev/acpica/components/debugger/dbtest.c stable/12/sys/contrib/dev/acpica/components/debugger/dbutils.c stable/12/sys/contrib/dev/acpica/components/debugger/dbxface.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmnames.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmopcode.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmresrc.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmutils.c stable/12/sys/contrib/dev/acpica/components/disassembler/dmwalk.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsargs.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsfield.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsinit.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsobject.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dsutils.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dswexec.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dswload.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dswload2.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dswscope.c stable/12/sys/contrib/dev/acpica/components/dispatcher/dswstate.c stable/12/sys/contrib/dev/acpica/components/events/evevent.c stable/12/sys/contrib/dev/acpica/components/events/evglock.c stable/12/sys/contrib/dev/acpica/components/events/evgpe.c stable/12/sys/contrib/dev/acpica/components/events/evgpeblk.c stable/12/sys/contrib/dev/acpica/components/events/evgpeinit.c stable/12/sys/contrib/dev/acpica/components/events/evgpeutil.c stable/12/sys/contrib/dev/acpica/components/events/evhandler.c stable/12/sys/contrib/dev/acpica/components/events/evmisc.c stable/12/sys/contrib/dev/acpica/components/events/evregion.c stable/12/sys/contrib/dev/acpica/components/events/evrgnini.c stable/12/sys/contrib/dev/acpica/components/events/evsci.c stable/12/sys/contrib/dev/acpica/components/events/evxface.c stable/12/sys/contrib/dev/acpica/components/events/evxfevnt.c stable/12/sys/contrib/dev/acpica/components/events/evxfgpe.c stable/12/sys/contrib/dev/acpica/components/events/evxfregn.c stable/12/sys/contrib/dev/acpica/components/executer/exconcat.c stable/12/sys/contrib/dev/acpica/components/executer/exconfig.c stable/12/sys/contrib/dev/acpica/components/executer/exconvrt.c stable/12/sys/contrib/dev/acpica/components/executer/excreate.c stable/12/sys/contrib/dev/acpica/components/executer/exdebug.c stable/12/sys/contrib/dev/acpica/components/executer/exdump.c stable/12/sys/contrib/dev/acpica/components/executer/exfield.c stable/12/sys/contrib/dev/acpica/components/executer/exfldio.c stable/12/sys/contrib/dev/acpica/components/executer/exmisc.c stable/12/sys/contrib/dev/acpica/components/executer/exmutex.c stable/12/sys/contrib/dev/acpica/components/executer/exnames.c stable/12/sys/contrib/dev/acpica/components/executer/exoparg1.c stable/12/sys/contrib/dev/acpica/components/executer/exoparg2.c stable/12/sys/contrib/dev/acpica/components/executer/exoparg3.c stable/12/sys/contrib/dev/acpica/components/executer/exoparg6.c stable/12/sys/contrib/dev/acpica/components/executer/exprep.c stable/12/sys/contrib/dev/acpica/components/executer/exregion.c stable/12/sys/contrib/dev/acpica/components/executer/exresnte.c stable/12/sys/contrib/dev/acpica/components/executer/exresolv.c stable/12/sys/contrib/dev/acpica/components/executer/exresop.c stable/12/sys/contrib/dev/acpica/components/executer/exserial.c stable/12/sys/contrib/dev/acpica/components/executer/exstore.c stable/12/sys/contrib/dev/acpica/components/executer/exstoren.c stable/12/sys/contrib/dev/acpica/components/executer/exstorob.c stable/12/sys/contrib/dev/acpica/components/executer/exsystem.c stable/12/sys/contrib/dev/acpica/components/executer/extrace.c stable/12/sys/contrib/dev/acpica/components/executer/exutils.c stable/12/sys/contrib/dev/acpica/components/hardware/hwacpi.c stable/12/sys/contrib/dev/acpica/components/hardware/hwesleep.c stable/12/sys/contrib/dev/acpica/components/hardware/hwgpe.c stable/12/sys/contrib/dev/acpica/components/hardware/hwpci.c stable/12/sys/contrib/dev/acpica/components/hardware/hwregs.c stable/12/sys/contrib/dev/acpica/components/hardware/hwsleep.c stable/12/sys/contrib/dev/acpica/components/hardware/hwtimer.c stable/12/sys/contrib/dev/acpica/components/hardware/hwvalid.c stable/12/sys/contrib/dev/acpica/components/hardware/hwxface.c stable/12/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c stable/12/sys/contrib/dev/acpica/components/namespace/nsaccess.c stable/12/sys/contrib/dev/acpica/components/namespace/nsalloc.c stable/12/sys/contrib/dev/acpica/components/namespace/nsarguments.c stable/12/sys/contrib/dev/acpica/components/namespace/nsconvert.c stable/12/sys/contrib/dev/acpica/components/namespace/nsdump.c stable/12/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c stable/12/sys/contrib/dev/acpica/components/namespace/nseval.c stable/12/sys/contrib/dev/acpica/components/namespace/nsinit.c stable/12/sys/contrib/dev/acpica/components/namespace/nsload.c stable/12/sys/contrib/dev/acpica/components/namespace/nsnames.c stable/12/sys/contrib/dev/acpica/components/namespace/nsobject.c stable/12/sys/contrib/dev/acpica/components/namespace/nsparse.c stable/12/sys/contrib/dev/acpica/components/namespace/nspredef.c stable/12/sys/contrib/dev/acpica/components/namespace/nsprepkg.c stable/12/sys/contrib/dev/acpica/components/namespace/nsrepair.c stable/12/sys/contrib/dev/acpica/components/namespace/nsrepair2.c stable/12/sys/contrib/dev/acpica/components/namespace/nssearch.c stable/12/sys/contrib/dev/acpica/components/namespace/nsutils.c stable/12/sys/contrib/dev/acpica/components/namespace/nswalk.c stable/12/sys/contrib/dev/acpica/components/namespace/nsxfeval.c stable/12/sys/contrib/dev/acpica/components/namespace/nsxfname.c stable/12/sys/contrib/dev/acpica/components/namespace/nsxfobj.c stable/12/sys/contrib/dev/acpica/components/parser/psargs.c stable/12/sys/contrib/dev/acpica/components/parser/psloop.c stable/12/sys/contrib/dev/acpica/components/parser/psobject.c stable/12/sys/contrib/dev/acpica/components/parser/psopcode.c stable/12/sys/contrib/dev/acpica/components/parser/psopinfo.c stable/12/sys/contrib/dev/acpica/components/parser/psparse.c stable/12/sys/contrib/dev/acpica/components/parser/psscope.c stable/12/sys/contrib/dev/acpica/components/parser/pstree.c stable/12/sys/contrib/dev/acpica/components/parser/psutils.c stable/12/sys/contrib/dev/acpica/components/parser/pswalk.c stable/12/sys/contrib/dev/acpica/components/parser/psxface.c stable/12/sys/contrib/dev/acpica/components/resources/rsaddr.c stable/12/sys/contrib/dev/acpica/components/resources/rscalc.c stable/12/sys/contrib/dev/acpica/components/resources/rscreate.c stable/12/sys/contrib/dev/acpica/components/resources/rsdump.c stable/12/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c stable/12/sys/contrib/dev/acpica/components/resources/rsinfo.c stable/12/sys/contrib/dev/acpica/components/resources/rsio.c stable/12/sys/contrib/dev/acpica/components/resources/rsirq.c stable/12/sys/contrib/dev/acpica/components/resources/rslist.c stable/12/sys/contrib/dev/acpica/components/resources/rsmemory.c stable/12/sys/contrib/dev/acpica/components/resources/rsmisc.c stable/12/sys/contrib/dev/acpica/components/resources/rsserial.c stable/12/sys/contrib/dev/acpica/components/resources/rsutils.c stable/12/sys/contrib/dev/acpica/components/resources/rsxface.c stable/12/sys/contrib/dev/acpica/components/tables/tbdata.c stable/12/sys/contrib/dev/acpica/components/tables/tbfadt.c stable/12/sys/contrib/dev/acpica/components/tables/tbfind.c stable/12/sys/contrib/dev/acpica/components/tables/tbinstal.c stable/12/sys/contrib/dev/acpica/components/tables/tbprint.c stable/12/sys/contrib/dev/acpica/components/tables/tbutils.c stable/12/sys/contrib/dev/acpica/components/tables/tbxface.c stable/12/sys/contrib/dev/acpica/components/tables/tbxfload.c stable/12/sys/contrib/dev/acpica/components/tables/tbxfroot.c stable/12/sys/contrib/dev/acpica/components/utilities/utaddress.c stable/12/sys/contrib/dev/acpica/components/utilities/utalloc.c stable/12/sys/contrib/dev/acpica/components/utilities/utascii.c stable/12/sys/contrib/dev/acpica/components/utilities/utbuffer.c stable/12/sys/contrib/dev/acpica/components/utilities/utcache.c stable/12/sys/contrib/dev/acpica/components/utilities/utcopy.c stable/12/sys/contrib/dev/acpica/components/utilities/utdebug.c stable/12/sys/contrib/dev/acpica/components/utilities/utdecode.c stable/12/sys/contrib/dev/acpica/components/utilities/utdelete.c stable/12/sys/contrib/dev/acpica/components/utilities/uterror.c stable/12/sys/contrib/dev/acpica/components/utilities/uteval.c stable/12/sys/contrib/dev/acpica/components/utilities/utexcep.c stable/12/sys/contrib/dev/acpica/components/utilities/utglobal.c stable/12/sys/contrib/dev/acpica/components/utilities/uthex.c stable/12/sys/contrib/dev/acpica/components/utilities/utids.c stable/12/sys/contrib/dev/acpica/components/utilities/utinit.c stable/12/sys/contrib/dev/acpica/components/utilities/utlock.c stable/12/sys/contrib/dev/acpica/components/utilities/utmath.c stable/12/sys/contrib/dev/acpica/components/utilities/utmisc.c stable/12/sys/contrib/dev/acpica/components/utilities/utmutex.c stable/12/sys/contrib/dev/acpica/components/utilities/utnonansi.c stable/12/sys/contrib/dev/acpica/components/utilities/utobject.c stable/12/sys/contrib/dev/acpica/components/utilities/utosi.c stable/12/sys/contrib/dev/acpica/components/utilities/utownerid.c stable/12/sys/contrib/dev/acpica/components/utilities/utpredef.c stable/12/sys/contrib/dev/acpica/components/utilities/utresdecode.c stable/12/sys/contrib/dev/acpica/components/utilities/utresrc.c stable/12/sys/contrib/dev/acpica/components/utilities/utstate.c stable/12/sys/contrib/dev/acpica/components/utilities/utstring.c stable/12/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c stable/12/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c stable/12/sys/contrib/dev/acpica/components/utilities/uttrack.c stable/12/sys/contrib/dev/acpica/components/utilities/utuuid.c stable/12/sys/contrib/dev/acpica/components/utilities/utxface.c stable/12/sys/contrib/dev/acpica/components/utilities/utxferror.c stable/12/sys/contrib/dev/acpica/components/utilities/utxfinit.c stable/12/sys/contrib/dev/acpica/components/utilities/utxfmutex.c stable/12/sys/contrib/dev/acpica/include/acapps.h stable/12/sys/contrib/dev/acpica/include/acbuffer.h stable/12/sys/contrib/dev/acpica/include/acclib.h stable/12/sys/contrib/dev/acpica/include/accommon.h stable/12/sys/contrib/dev/acpica/include/acconfig.h stable/12/sys/contrib/dev/acpica/include/acconvert.h stable/12/sys/contrib/dev/acpica/include/acdebug.h stable/12/sys/contrib/dev/acpica/include/acdisasm.h stable/12/sys/contrib/dev/acpica/include/acdispat.h stable/12/sys/contrib/dev/acpica/include/acevents.h stable/12/sys/contrib/dev/acpica/include/acexcep.h stable/12/sys/contrib/dev/acpica/include/acglobal.h stable/12/sys/contrib/dev/acpica/include/achware.h stable/12/sys/contrib/dev/acpica/include/acinterp.h stable/12/sys/contrib/dev/acpica/include/aclocal.h stable/12/sys/contrib/dev/acpica/include/acmacros.h stable/12/sys/contrib/dev/acpica/include/acnames.h stable/12/sys/contrib/dev/acpica/include/acnamesp.h stable/12/sys/contrib/dev/acpica/include/acobject.h stable/12/sys/contrib/dev/acpica/include/acopcode.h stable/12/sys/contrib/dev/acpica/include/acoutput.h stable/12/sys/contrib/dev/acpica/include/acparser.h stable/12/sys/contrib/dev/acpica/include/acpi.h stable/12/sys/contrib/dev/acpica/include/acpiosxf.h stable/12/sys/contrib/dev/acpica/include/acpixf.h stable/12/sys/contrib/dev/acpica/include/acpredef.h stable/12/sys/contrib/dev/acpica/include/acresrc.h stable/12/sys/contrib/dev/acpica/include/acrestyp.h stable/12/sys/contrib/dev/acpica/include/acstruct.h stable/12/sys/contrib/dev/acpica/include/actables.h stable/12/sys/contrib/dev/acpica/include/actbinfo.h stable/12/sys/contrib/dev/acpica/include/actbl.h stable/12/sys/contrib/dev/acpica/include/actbl1.h stable/12/sys/contrib/dev/acpica/include/actbl2.h stable/12/sys/contrib/dev/acpica/include/actbl3.h stable/12/sys/contrib/dev/acpica/include/actypes.h stable/12/sys/contrib/dev/acpica/include/acutils.h stable/12/sys/contrib/dev/acpica/include/acuuid.h stable/12/sys/contrib/dev/acpica/include/amlcode.h stable/12/sys/contrib/dev/acpica/include/amlresrc.h stable/12/sys/contrib/dev/acpica/include/platform/acenv.h stable/12/sys/contrib/dev/acpica/include/platform/acenvex.h stable/12/sys/contrib/dev/acpica/include/platform/acfreebsd.h stable/12/sys/contrib/dev/acpica/include/platform/acgcc.h stable/12/sys/contrib/dev/acpica/include/platform/acgccex.h stable/12/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c stable/12/sys/dev/acpica/Osd/OsdTable.c stable/12/sys/dev/acpica/acpi_quirk.c stable/12/sys/i386/acpica/acpi_machdep.c stable/12/usr.sbin/acpi/acpidump/acpi.c stable/12/usr.sbin/bhyve/acpi.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/amd64/acpica/acpi_machdep.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/amd64/acpica/acpi_machdep.c Fri Sep 20 22:07:59 2019 (r352566) @@ -164,7 +164,7 @@ map_table(vm_paddr_t pa, int offset, const char *sig) void *table; header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER)); - if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) { + if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { table_unmap(header, sizeof(ACPI_TABLE_HEADER)); return (NULL); } @@ -202,7 +202,7 @@ probe_table(vm_paddr_t address, const char *sig) printf("Table '%.4s' at 0x%jx\n", table->Signature, (uintmax_t)address); - if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) { + if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { table_unmap(table, sizeof(ACPI_TABLE_HEADER)); return (0); } Modified: stable/12/sys/arm64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/arm64/acpica/acpi_machdep.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/arm64/acpica/acpi_machdep.c Fri Sep 20 22:07:59 2019 (r352566) @@ -68,7 +68,7 @@ map_table(vm_paddr_t pa, int offset, const char *sig) void *table; header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER)); - if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) { + if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER)); return (NULL); } @@ -107,7 +107,7 @@ probe_table(vm_paddr_t address, const char *sig) printf("Table '%.4s' at 0x%jx\n", table->Signature, (uintmax_t)address); - if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) { + if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); return (0); } Modified: stable/12/sys/contrib/dev/acpica/changes.txt ============================================================================== --- stable/12/sys/contrib/dev/acpica/changes.txt Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/changes.txt Fri Sep 20 22:07:59 2019 (r352566) @@ -1,4 +1,356 @@ ---------------------------------------- +03 July 2019. Summary of changes for version 20190703: + + +1) ACPICA kernel-resident subsystem: + +Remove legacy module-level support code. There were still some remnants +of the legacy module-level code executions. Since we no longer support +this option, this is essentially dead code and has been removed from the +ACPICA source. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System. + +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC +one) can be enabled in two situations. First, the GPEs with existing _Lxx +and _Exx methods are enabled implicitly by ACPICA during system +initialization. Second, the GPEs without these methods (like GPEs listed +by _PRW objects for wakeup devices) need to be enabled directly by the +code that is going to use them (e.g. ACPI power management or device +drivers). + +In the former case, if the status of a given GPE is set to start with, +its handler method (either _Lxx or _Exx) needs to be invoked to take care +of the events (possibly) signaled before the GPE was enabled. In the +latter case, however, the first caller of AcpiEnableGpe() for a given GPE +should not be expected to care about any events that might be signaled +through it earlier. In that case, it is better to clear the status of +the GPE before enabling it, to prevent stale events from triggering +unwanted actions (like spurious system resume, for example). + +For this reason, modify AcpiEvAddGpeReference() to take an additional +boolean argument indicating whether or not the GPE status needs to be +cleared when its reference counter changes from zero to one and make +AcpiEnableGpe() pass TRUE to it through that new argument. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +The tool generation process has been migrated to MSVC 2017, and all +project files have been upgraded. The new project files appear in the +directory \acpica\generate\msvc2017. This change effectively deprecates +the older project files in \acpica\generate\msvc9. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System + +---------------------------------------- +09 May 2019. Summary of changes for version 20190509: + + +1) ACPICA kernel-resident subsystem: + +Revert commit 6c43e1a ("ACPICA: Clear status of GPEs before enabling +them") that causes problems with Thunderbolt controllers to occur if a +dock device is connected at init time (the xhci_hcd and thunderbolt +modules crash which prevents peripherals connected through them from +working). Commit 6c43e1a effectively causes commit ecc1165b8b74 ("ACPICA: +Dispatch active GPEs at init time") to get undone, so the problem +addressed by commit ecc1165b8b74 appears again as a result of it. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +Reverted iASL: Additional forward reference detection. This change +reverts forward reference detection for field declarations. The feature +unintentionally emitted AML bytecode with incorrect package lengths for +some ASL code related to Fields and OperationRegions. This malformed AML +can cause systems to crash +during boot. The malformed AML bytecode is emitted in iASL version +20190329 and 20190405. + +iASL: improve forward reference detection. This change improves forward +reference detection for named objects inside of scopes. If a parse object +has the OP_NOT_FOUND_DURING_LOAD set, it means that Op is a reference to +a named object that is declared later in the AML bytecode. This is +allowed if the reference is inside of a method and the declaration is +outside of a method like so: + +DefinitionBlock(...) +{ + Method (TEST) + { + Return (NUM0) + } + Name (NUM0,0) +} + +However, if the declaration and reference are both in the same method or +outside any methods, this is a forward reference and should be marked as +an error because it would result in runtime errors. + +DefinitionBlock(...) +{ + Name (BUFF, Buffer (NUM0) {}) // Forward reference + Name (NUM0, 0x0) + + Method (TEST) + { + Local0 = NUM1 + Name (NUM1, 0x1) // Forward reference + return (Local0) + } +} + +iASL: Implemented additional buffer overflow analysis for BufferField +declarations. Check if a buffer index argument to a create buffer field +operation is beyond the end of the target buffer. + +This affects these AML operators: + + AML_CREATE_FIELD_OP + AML_CREATE_BIT_FIELD_OP + AML_CREATE_BYTE_FIELD_OP + AML_CREATE_WORD_FIELD_OP + AML_CREATE_DWORD_FIELD_OP + AML_CREATE_QWORD_FIELD_OP + + There are three conditions that must be satisfied in order to allow this +validation at compile time: + + 1) The length of the target buffer must be an integer constant + 2) The index specified in the create* must be an integer constant + 3) For CreateField, the bit length argument must be non-zero. + +Example: + Name (BUF1, Buffer() {1,2}) + CreateField (BUF1, 7, 9, CF03) // 3: ERR + +dsdt.asl 14: CreateField (BUF1, 7, 9, CF03) // 3: ERR +Error 6165 - ^ Buffer index beyond end of +target buffer + + +---------------------------------------- +05 April 2019. Summary of changes for version 20190405: + + +1) ACPICA kernel-resident subsystem: + +Event Manager: History: Commit 18996f2db918 ("ACPICA: Events: Stop +unconditionally clearing ACPI IRQs during suspend/resume") was added +earlier to stop clearing of event status bits unconditionally on suspend +and resume paths. Though this change fixed an issue on suspend path, it +introduced regressions on several resume paths. In the case of S0ix, +events are enabled as part of device suspend path. If status bits for the +events are set when they are enabled, it could result in premature wake +from S0ix. If status is cleared for any event that is being enabled so +that any stale events are cleared out. In case of S0ix, events are +enabled as part of device suspend path. If status bits for the events are +set when they are enabled, it could result in premature wake from S0ix. + +This change ensures that status is cleared for any event that is being +enabled so that any stale events are cleared out. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Implemented an enhanced multiple file compilation that combines +named objects from all input files to a single namespace. With this +feature, any unresolved external declarations as well as duplicate named +object declarations can be detected during compilation rather than +generating errors much later at runtime. The following commands are +examples that utilize this feature: + iasl dsdt.asl ssdt.asl + iasl dsdt.asl ssdt1.asl ssdt2.asl + iasl dsdt.asl ssdt*.asl + +---------------------------------------- +29 March 2019. Summary of changes for version 20190329: + + +1) ACPICA kernel-resident subsystem: + +Namespace support: Remove the address nodes from global list after method +termination. The global address list contains pointers to namespace nodes +that represent Operation Regions. This change properly removes Operation +Region namespace nodes that are declared dynamically during method +execution. + +Linux: Use a different debug default than ACPICA. There was a divergence +between Linux and the ACPICA codebases. In order to resolve this +divergence, Linux now declares its own debug default in aclinux.h + +Renamed some internal macros to improve code understanding and +maintenance. The macros below all operate on single 4-character ACPI +NameSegs, not generic strings (old -> new): + ACPI_NAME_SIZE -> ACPI_NAMESEG_SIZE + ACPI_COMPARE_NAME -> ACPI_COMPARE_NAMESEG + ACPI_MOVE_NAME -> ACPI_COPY_NAMESEG + +Fix for missing comma in array declaration for the AcpiGbl_GenericNotify +table. + +Test suite: Update makefiles, add PCC operation region support + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented additional illegal forward reference detection. Now +detect and emit an error upon detection of a forward reference from a +Field to an Operation Region. This will fail at runtime if allowed to +pass the compiler. + +AcpiExec: Add an address list check for dynamic Operation Regions. This +feature performs a sanity test for each node the global address list. +This is done in order to ensure that all dynamic operation regions are +properly removed from the global address list and no dangling pointers +are left behind. + +Disassembler: Improved generation of resource pathnames. This change +improves the code that generates resource descriptor and resource tag +pathnames. The original code used a bunch of str* C library functions +that caused warnings on some compilers. + +iASL: Removed some uses of strncpy and replaced with memmove. The strncpy +function can overwrite buffers if the calling code is not very careful. +In the case of generating a module/table header, use of memmove is a +better implementation. + + +3) Status of new features that have not been completed at this time: + +iASL: Implementing an enhanced multiple file compilation into a single +namespace feature (Status): This feature will be released soon, and +allows multiple ASL files to be compiled into the same single namespace. +By doing so, any unresolved external declarations as well as duplicate +named object declarations can be detected during compilation (rather than +later during runtime). The following commands are examples that utilize +this feature: + iasl dsdt.asl ssdt.asl + iasl dsdt.asl ssdt1.asl ssdt2.asl + iasl dsdt.asl ssdt*.asl + +ASL tutorial status: Feedback is being gathered internally and the +current plan is to publish this tutorial on the ACPICA website after a +final review by a tech writer. + +---------------------------------------- +15 February 2019. Summary of changes for version 20190215: + + +0) Support for ACPI specification version 6.3: + +Add PCC operation region support for the AML interpreter. This adds PCC +operation region support in the AML interpreter and a default handler for +acpiexec. The change also renames the PCC region address space keyword to +PlatformCommChannel. + +Support for new predefined methods _NBS, _NCH, _NIC, _NIH, and _NIG. +These methods provide OSPM with health information and device boot +status. + +PDTT: Add TriggerOrder to the PCC Identifier structure. The field value +defines if the trigger needs to be invoked by OSPM before or at the end +of kernel crash dump processing/handling operation. + +SRAT: Add Generic Affinity Structure subtable. This subtable in the SRAT +is used for describing devices such as heterogeneous processors, +accelerators, GPUs, and IO devices with integrated compute or DMA +engines. + +MADT: Add support for statistical profiling in GICC. Statistical +profiling extension (SPE) is an architecture-specific feature for ARM. + +MADT: Add online capable flag. If this bit is set, system hardware +supports enabling this processor during OS runtime. + +New Error Disconnect Recover Notification value. There are a number of +scenarios where system Firmware in collaboration with hardware may +disconnect one or more devices from the rest of the system for purposes +of error containment. Firmware can use this new notification value to +alert OSPM of such a removal. + +PPTT: New additional fields in Processor Structure Flags. These flags +provide more information about processor topology. + +NFIT/Disassembler: Change a field name from "Address Range" to "Region +Type". + +HMAT updates: make several existing fields to be reserved as well as +rename subtable 0 to "memory proximity domain attributes". + +GTDT: Add support for new GTDT Revision 3. This revision adds information +for the EL2 timer. + +iASL: Update the HMAT example template for new fields. + +iASL: Add support for the new revision of the GTDT (Rev 3). + + +1) ACPICA kernel-resident subsystem: + +AML Parser: fix the main AML parse loop to correctly skip erroneous +extended opcodes. AML opcodes come in two lengths: 1-byte opcodes and 2- +byte extended opcodes. If an error occurs during an AML table load, the +AML parser will continue loading the table by skipping the offending +opcode. This implements a "load table at any cost" philosophy. + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Add checks for illegal object references, such as a reference +outside of method to an object within a method. Such an object is only +temporary. + +iASL: Emit error for creation of a zero-length operation region. Such a +region is rather pointless. If encountered, a runtime error is also +implemented in the interpeter. + +Debugger: Fix a possible fault with the "test objects" command. + +iASL: Makefile: support parent directory filenames containing embedded +spaces. + +iASL: Update the TPM2 template to revision 4. + +iASL: Add the ability to report specific warnings or remarks as errors. + +Disassembler: Disassemble OEMx tables as actual AML byte code. +Previously, these tables were treated as "unknown table". + +iASL: Add definition and disassembly for TPM2 revision 3. + +iASL: Add support for TPM2 rev 3 compilation. + + +---------------------------------------- +08 January 2019. Summary of changes for version 20190108: + + +1) ACPICA kernel-resident subsystem: + +Updated all copyrights to 2019. This affects all source code modules. + + +2) iASL Compiler/Disassembler and Tools: + +ASL test suite (ASLTS): Updated all copyrights to 2019. + +Tools: Updated all signon copyrights to 2019. + +AcpiExec: Added a new option to dump extra information concerning any +memory leaks detected by the internal object/cache tracking mechanism. - +va + +iASL: Updated the table template for the TPM2 table to the newest version +of the table (Revision 4) + + +---------------------------------------- 13 December 2018. Summary of changes for version 20181213: @@ -1193,7 +1545,7 @@ internal cache) is detected and ignored via object poi Debugger: Fixed an AML interpreter mutex issue during the single stepping of control methods. If certain debugger commands are executed during -stepping, a mutex aquire/release error could occur. Lv Zheng. +stepping, a mutex acquire/release error could occur. Lv Zheng. Fixed some issues generating ACPICA with the Intel C compiler by restoring the original behavior and compiler-specific include file in @@ -6735,7 +7087,7 @@ keyword is not standard across compilers, and this typ be configured on a per-compiler basis. Lin Ming. -Made the system global AcpiGbl_SystemAwakeAndRunning publically +Made the system global AcpiGbl_SystemAwakeAndRunning publicly available. Added an extern for this boolean in acpixf.h. Some hosts utilize this value @@ -11402,9 +11754,9 @@ Helgaas. Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) -any implicit conversion of a Buffer to a String, 2) a String object +any implicit conversion of a Buffer to a String, 2) a String object result -of the ASL Concatentate operator, 3) the String object result of the ASL +of the ASL Concatenate operator, 3) the String object result of the ASL ToString operator. Fixed a problem in the Windows OS interface layer (OSL) where a @@ -13560,7 +13912,7 @@ next access width boundary (a common coding error.) Renamed OSD_HANDLER to ACPI_OSD_HANDLER, and OSD_EXECUTION_CALLBACK to ACPI_OSD_EXEC_CALLBACK for consistency with other ACPI symbols. Also, these -symbols are lowercased by the latest version of the AcpiSrc tool. +symbols are lowercase by the latest version of the AcpiSrc tool. The prototypes for the PCI interfaces in acpiosxf.h have been updated to rename "Register" to simply "Reg" to prevent certain compilers from @@ -14932,8 +15284,8 @@ with the Linux coding style. Removed the non-Linux SourceSafe module revision number from each module header. -Completed major overhaul of symbols to be lowercased for linux. -Doubled the number of symbols that are lowercased. +Completed major overhaul of symbols to be lowercase for linux. +Doubled the number of symbols that are lowercase. Fixed a problem where identifiers within procedure headers and within quotes were not fully lower cased (they were left with a @@ -16429,7 +16781,7 @@ Summary of changes for this label: 02_14_02 Implemented support in AcpiLoadTable to allow loading of FACS and FADT tables. -Suport for the now-obsolete interim 0.71 64-bit ACPI tables has +Support for the now-obsolete interim 0.71 64-bit ACPI tables has been removed. All 64-bit platforms should be migrated to the ACPI 2.0 tables. The actbl71.h header has been removed from the source tree. @@ -16779,7 +17131,7 @@ Updated all files to apply cleanly against 2.4.16. Added basic PCI Interrupt Routing Table (PRT) support for IA32 (acpi_pci.c), and unified the PRT code for IA32 and IA64. This -version supports both static and dyanmic PRT entries, but dynamic +version supports both static and dynamic PRT entries, but dynamic entries are treated as if they were static (not yet reconfigurable). Architecture- specific code to use this data is absent on IA32 but should be available shortly. @@ -16868,7 +17220,7 @@ power-down, and thermal passive cooling issues (coming Added additional typechecking for Fields within restricted access Operation Regions. All fields within EC and CMOS regions must be -declared with ByteAcc. All fields withing SMBus regions must be +declared with ByteAcc. All fields within SMBus regions must be declared with the BufferAcc access type. Fixed a problem where the listing file output of control methods @@ -17041,7 +17393,7 @@ objects to not be deleted during subsystem termination Fixed a problem with the external AcpiEvaluateObject interface where the subsystem would fault if the named object to be -evaluated refered to a constant such as Zero, Ones, etc. +evaluated referred to a constant such as Zero, Ones, etc. Fixed a problem with IndexFields and BankFields where the subsystem would fault if the index, data, or bank registers were @@ -17108,7 +17460,7 @@ sleeps.) The AcpiEnterSleepState and AcpiLeaveSleepState interfaces now support wake-enabled GPEs. This means that upon entering the sleep state, all GPEs that are not wake-enabled are disabled. -When leaving the sleep state, these GPEs are reenabled. +When leaving the sleep state, these GPEs are re-enabled. A local double-precision divide/modulo module has been added to enhance portability to OS kernels where a 64-bit math library is Modified: stable/12/sys/contrib/dev/acpica/common/acfileio.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/acfileio.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/acfileio.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -585,7 +585,7 @@ AcValidateTableHeader ( * These fields must be ASCII: OemId, OemTableId, AslCompilerId. * We allow a NULL terminator in OemId and OemTableId. */ - for (i = 0; i < ACPI_NAME_SIZE; i++) + for (i = 0; i < ACPI_NAMESEG_SIZE; i++) { if (!ACPI_IS_ASCII ((UINT8) TableHeader.AslCompilerId[i])) { Modified: stable/12/sys/contrib/dev/acpica/common/acgetline.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/acgetline.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/acgetline.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/adfile.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/adfile.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/adfile.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/adisasm.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/adisasm.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -459,7 +459,7 @@ AdDisassembleOneTable ( */ if (AcpiGbl_CaptureComments) { - strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAME_SIZE); + strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAMESEG_SIZE); } #endif @@ -579,7 +579,7 @@ AdDisassembleOneTable ( if (AslGbl_MapfileFlag) { fprintf (stderr, "%14s %s - %u bytes\n", - AslGbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, + AslGbl_FileDescs[ASL_FILE_MAP_OUTPUT].ShortDescription, AslGbl_Files[ASL_FILE_MAP_OUTPUT].Filename, FlGetFileSize (ASL_FILE_MAP_OUTPUT)); } Modified: stable/12/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/adwalk.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/adwalk.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -814,7 +814,7 @@ AcpiDmLoadDescendingOp ( while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name) { - if (ACPI_COMPARE_NAME (Node->Name.Ascii, + if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, AcpiGbl_PreDefinedNames[PreDefineIndex].Name)) { PreDefined = TRUE; Modified: stable/12/sys/contrib/dev/acpica/common/ahids.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/ahids.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/ahids.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/ahpredef.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/ahpredef.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/ahpredef.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -305,6 +305,11 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), AH_PREDEF ("_MTL", "Minimum Throttle Limit", "Returns the minimum throttle limit for a thermal zone"), AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), + AH_PREDEF ("_NBS", "NVDIMM Boot Status", "Returns information about NVDIMM device’s status at boot time"), + AH_PREDEF ("_NCH", "NVDIMM Current Health Information", "Returns current health information of the NVDIMM device"), + AH_PREDEF ("_NIC", "NVDIMM Health Error Injection Capabilities", "Returns health error injection capabilities that are supported by the platform"), + AH_PREDEF ("_NIG", "NVDIMM Inject Health Error Status","Returns currently active health errors and their error attributes that are injected by _NIH"), + AH_PREDEF ("_NIH", "NVDIMM Inject/Clear Health Errors", "Returns the status of injecting or clearing Health Errors"), AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), AH_PREDEF ("_ON_", "Power On", "Sets a power resource to the on state"), @@ -393,7 +398,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_SDD", "Set Device Data", "Sets data for a SATA device"), AH_PREDEF ("_SEG", "PCI Segment", "Returns a device's PCI Segment Group number"), AH_PREDEF ("_SHL", "Set Hardware Limit", "Sets the hardware limit enforced by the Power Meter"), - AH_PREDEF ("_SHR", "Sharable", "Interrupt share status, Resource Descriptor field"), + AH_PREDEF ("_SHR", "Shareable", "Interrupt share status, Resource Descriptor field"), AH_PREDEF ("_SI_", "System Indicators", "Predefined scope"), AH_PREDEF ("_SIZ", "Size", "DMA transfer size, Resource Descriptor field"), AH_PREDEF ("_SLI", "System Locality Information", "Returns a list of NUMA system localities"), @@ -485,7 +490,7 @@ AcpiAhMatchPredefinedName ( for (Info = AslPredefinedInfo; Info->Name; Info++) { - if (ACPI_COMPARE_NAME (Nameseg, Info->Name)) + if (ACPI_COMPARE_NAMESEG (Nameseg, Info->Name)) { return (Info); } Modified: stable/12/sys/contrib/dev/acpica/common/ahtable.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/ahtable.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/ahtable.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -183,7 +183,7 @@ AcpiAhGetTableInfo ( for (Info = AcpiGbl_SupportedTables; Info->Signature; Info++) { - if (ACPI_COMPARE_NAME (Signature, Info->Signature)) + if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature)) { return (Info); } Modified: stable/12/sys/contrib/dev/acpica/common/ahuuids.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/ahuuids.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/ahuuids.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -226,7 +226,7 @@ AcpiAhMatchUuid ( for (Info = Gbl_AcpiUuids; Info->Description; Info++) { - /* Null string means desciption is a UUID class */ + /* Null string means description is a UUID class */ if (!Info->String) { Modified: stable/12/sys/contrib/dev/acpica/common/cmfsize.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/cmfsize.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/cmfsize.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmextern.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmextern.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -1216,7 +1216,7 @@ AcpiDmCreateSubobjectForExternal ( * * DESCRIPTION: Add one external to the namespace by resolvign the external * (by performing a namespace lookup) and annotating the resulting - * namespace node with the approperiate information if the type + * namespace node with the appropriate information if the type * is ACPI_TYPE_REGION or ACPI_TYPE_METHOD. * ******************************************************************************/ Modified: stable/12/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmrestag.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmrestag.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -747,6 +747,7 @@ AcpiGetTagPathname ( UINT8 ResourceTableIndex; ACPI_SIZE RequiredSize; char *Pathname; + char *PathnameEnd; AML_RESOURCE *Aml; ACPI_PARSE_OBJECT *Op; char *InternalPath; @@ -809,20 +810,27 @@ AcpiGetTagPathname ( RequiredSize, FALSE); /* - * Create the full path to the resource and tag by: remove the buffer name, - * append the resource descriptor name, append a dot, append the tag name. + * Create the full path to the resource and tag by: + * 1) Remove the buffer nameseg from the end of the pathname + * 2) Append the resource descriptor nameseg + * 3) Append a dot + * 4) Append the field tag nameseg * - * TBD: Always using the full path is a bit brute force, the path can be + * Always using the full path is a bit brute force, the path can be * often be optimized with carats (if the original buffer namepath is a * single nameseg). This doesn't really matter, because these paths do not * end up in the final compiled AML, it's just an appearance issue for the * disassembled code. */ - Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0; - strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE); - strcat (Pathname, "."); - strncat (Pathname, Tag, ACPI_NAME_SIZE); + PathnameEnd = Pathname + (RequiredSize - ACPI_NAMESEG_SIZE - 1); + ACPI_COPY_NAMESEG (PathnameEnd, ResourceNode->Name.Ascii); + PathnameEnd += ACPI_NAMESEG_SIZE; + *PathnameEnd = '.'; + + PathnameEnd++; + ACPI_COPY_NAMESEG (PathnameEnd, Tag); + /* Internalize the namepath to AML format */ AcpiNsInternalizeName (Pathname, &InternalPath); @@ -863,7 +871,7 @@ static void AcpiDmUpdateResourceName ( ACPI_NAMESPACE_NODE *ResourceNode) { - char Name[ACPI_NAME_SIZE]; + char Name[ACPI_NAMESEG_SIZE]; /* Ignore if a unique name has already been assigned */ @@ -906,7 +914,7 @@ AcpiDmUpdateResourceName ( * * PARAMETERS: BitIndex - Index into the resource descriptor * Resource - Pointer to the raw resource data - * ResourceIndex - Index correspoinding to the resource type + * ResourceIndex - Index corresponding to the resource type * * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match. * Modified: stable/12/sys/contrib/dev/acpica/common/dmswitch.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmswitch.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmswitch.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtable.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtable.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -320,7 +320,7 @@ static const char *AcpiDmHestNotifySubnames[ static const char *AcpiDmHmatSubnames[] = { - "Memory Subystem Address Range", + "Memory Proximity Domain Attributes", "System Locality Latency and Bandwidth Information", "Memory Side Cache Information", "Unknown Structure Type" /* Reserved */ @@ -400,6 +400,7 @@ static const char *AcpiDmSratSubnames[] = "Processor Local x2APIC Affinity", "GICC Affinity", "GIC ITS Affinity", /* Acpi 6.2 */ + "Generic Initiator Affinity", /* Acpi 6.3 */ "Unknown Subtable Type" /* Reserved */ }; @@ -601,7 +602,7 @@ AcpiDmGetTableData ( for (Info = AcpiDmTableData; Info->Signature; Info++) { - if (ACPI_COMPARE_NAME (Signature, Info->Signature)) + if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature)) { return (Info); } @@ -656,7 +657,7 @@ AcpiDmDumpDataTable ( * Handle tables that don't use the common ACPI table header structure. * Currently, these are the FACS, RSDP, and S3PT. */ - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) + if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS)) { Length = Table->Length; Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); @@ -669,7 +670,7 @@ AcpiDmDumpDataTable ( { Length = AcpiDmDumpRsdp (Table); } - else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT)) + else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT)) { Length = AcpiDmDumpS3pt (Table); } Modified: stable/12/sys/contrib/dev/acpica/common/dmtables.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtables.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtables.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -281,7 +281,7 @@ AdCreateTableHeader ( /* Revision of DSDT controls the ACPI integer width */ - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) + if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) { AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); } Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbdump.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbdump.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -1106,9 +1106,26 @@ AcpiDmDumpGtdt ( return; } - /* Subtables */ + /* Rev 3 fields */ Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + + if (Table->Revision > 2) + { + SubtableLength = sizeof (ACPI_GTDT_EL2); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + SubtableLength, AcpiDmTableInfoGtdtEl2); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += SubtableLength; + } + + Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + + /* Subtables */ + while (Offset < Table->Length) { /* Common subtable header */ @@ -1406,7 +1423,7 @@ AcpiDmDumpHmat ( case ACPI_HMAT_TYPE_ADDRESS_RANGE: InfoTable = AcpiDmTableInfoHmat0; - Length = sizeof (ACPI_HMAT_ADDRESS_RANGE); + Length = sizeof (ACPI_HMAT_PROXIMITY_DOMAIN); break; case ACPI_HMAT_TYPE_LOCALITY: Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -331,6 +331,11 @@ AcpiDmDumpSrat ( case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY: InfoTable = AcpiDmTableInfoSrat4; + break; + + case ACPI_SRAT_TYPE_GENERIC_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat5; break; default: Modified: stable/12/sys/contrib/dev/acpica/common/dmtbinfo.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbinfo.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbinfo.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License Modified: stable/12/sys/contrib/dev/acpica/common/dmtbinfo1.c ============================================================================== --- stable/12/sys/contrib/dev/acpica/common/dmtbinfo1.c Fri Sep 20 21:27:41 2019 (r352565) +++ stable/12/sys/contrib/dev/acpica/common/dmtbinfo1.c Fri Sep 20 22:07:59 2019 (r352566) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp. * All rights reserved. * * 2. License @@ -814,6 +814,15 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[] = ACPI_DMT_TERMINATOR }; +/* GDTD EL2 timer info. This table is appended to AcpiDmTableInfoGtdt for rev 3 and later */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtEl2[] = +{ + {ACPI_DMT_UINT32, ACPI_GTDT_EL2_OFFSET (VirtualEL2TimerGsiv), "Virtual EL2 Timer GSIV", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_EL2_OFFSET (VirtualEL2TimerFlags), "Virtual EL2 Timer Flags", 0}, + ACPI_DMT_TERMINATOR +}; + /* GTDT Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtHdr[] = @@ -1105,20 +1114,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHmatHdr[] = /* HMAT subtables */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Sep 21 00:17: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 C8CCBEC2E3; Sat, 21 Sep 2019 00:17:40 +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 46Zrkr4x2bz3KQ0; Sat, 21 Sep 2019 00:17:40 +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 8CBD15C86; Sat, 21 Sep 2019 00:17:40 +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 x8L0HerE008981; Sat, 21 Sep 2019 00:17:40 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8L0HeQ8008980; Sat, 21 Sep 2019 00:17:40 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909210017.x8L0HeQ8008980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 00:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352567 - head/usr.bin/quota X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/usr.bin/quota X-SVN-Commit-Revision: 352567 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 00:17:40 -0000 Author: hrs Date: Sat Sep 21 00:17:40 2019 New Revision: 352567 URL: https://svnweb.freebsd.org/changeset/base/352567 Log: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: head/usr.bin/quota/quota.c Modified: head/usr.bin/quota/quota.c ============================================================================== --- head/usr.bin/quota/quota.c Fri Sep 20 22:07:59 2019 (r352566) +++ head/usr.bin/quota/quota.c Sat Sep 21 00:17:40 2019 (r352567) @@ -606,7 +606,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args, (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; From owner-svn-src-all@freebsd.org Sat Sep 21 00:44: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 8E158ECE0E; Sat, 21 Sep 2019 00:44:38 +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 46ZsKy35b0z3M3K; Sat, 21 Sep 2019 00:44:38 +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 4EBAF61DD; Sat, 21 Sep 2019 00:44:38 +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 x8L0ic35027188; Sat, 21 Sep 2019 00:44:38 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8L0icEp027187; Sat, 21 Sep 2019 00:44:38 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909210044.x8L0icEp027187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 00:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352568 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 352568 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 00:44:38 -0000 Author: hrs Date: Sat Sep 21 00:44:37 2019 New Revision: 352568 URL: https://svnweb.freebsd.org/changeset/base/352568 Log: Impove wording and move descriptions about locale to LC_CTYPE in the ENVIRONMENT section. Modified: head/usr.bin/top/top.1 Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Sat Sep 21 00:17:40 2019 (r352567) +++ head/usr.bin/top/top.1 Sat Sep 21 00:44:37 2019 (r352568) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd September 20, 2019 +.Dd September 21, 2019 .Dt TOP 1 .Os .Sh NAME @@ -66,6 +66,9 @@ It it useful when you want to watch applications, that puts their status information there. If the real name differs from argv[0], it will be displayed in parenthesis. +Non-printable characters in the command line are +encoded in C-style backslash sequences or +a three digit octal sequences. .It Fl b Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is @@ -192,10 +195,6 @@ or \*(lqall\*(rq. Boolean flags are toggles. A second specification of any of these options will negate the first. -.Pp -The display of command names changes according to the locale. -If command names displayed in the locale settings are recognized as -non-display characters, they are displayed in three digit octal sequence. .Sh "INTERACTIVE MODE" When .Nm @@ -426,6 +425,12 @@ bytes paged out to swap devices (last interval) .It Ev TOP Default set of arguments to .Nm . +.It Ev LC_CTYPE +The locale to use when displaying the +.Va argv +vector when +.Fl a +flag is specified. .El .Sh SEE ALSO .Xr kill 1 , From owner-svn-src-all@freebsd.org Sat Sep 21 01:30: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 80BC2EF500; Sat, 21 Sep 2019 01:30:00 +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 46ZtLJ2Dy5z3PRt; Sat, 21 Sep 2019 01:30:00 +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 3184B6997; Sat, 21 Sep 2019 01:30:00 +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 x8L1U0Cv050868; Sat, 21 Sep 2019 01:30:00 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8L1Txev050828; Sat, 21 Sep 2019 01:29:59 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909210129.x8L1Txev050828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 01:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352570 - head/usr.sbin/rpc.statd X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/usr.sbin/rpc.statd X-SVN-Commit-Revision: 352570 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 01:30:00 -0000 Author: hrs Date: Sat Sep 21 01:29:59 2019 New Revision: 352570 URL: https://svnweb.freebsd.org/changeset/base/352570 Log: Fix build errors of test.c, which had been broken for a long time. This is a temporary fix and should be converted to a complete test scenarios by using this tool. Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/test.c Modified: head/usr.sbin/rpc.statd/Makefile ============================================================================== --- head/usr.sbin/rpc.statd/Makefile Sat Sep 21 01:23:08 2019 (r352569) +++ head/usr.sbin/rpc.statd/Makefile Sat Sep 21 01:29:59 2019 (r352570) @@ -20,7 +20,8 @@ sm_inter_svc.c: ${RPCSRC} sm_inter.h: ${RPCSRC} ${RPCGEN} -h -o ${.TARGET} ${.ALLSRC} -test: test.c - cc -o test test.c -lrpcsvc +test: test.o + ${CC} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LIBADD:S/^/-l/} +CLEANFILES+= test test.o .include Modified: head/usr.sbin/rpc.statd/test.c ============================================================================== --- head/usr.sbin/rpc.statd/test.c Sat Sep 21 01:23:08 2019 (r352569) +++ head/usr.sbin/rpc.statd/test.c Sat Sep 21 01:29:59 2019 (r352570) @@ -1,14 +1,14 @@ - #ifndef lint static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ #include +#include +#include #include #include - /* Default timeout can be changed using clnt_control() */ static struct timeval TIMEOUT = { 25, 0 }; @@ -20,7 +20,8 @@ sm_stat_1(argp, clnt) static struct sm_stat_res res; bzero((char *)&res, sizeof(res)); - if (clnt_call(clnt, SM_STAT, xdr_sm_name, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp, + (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&res); @@ -35,7 +36,8 @@ sm_mon_1(argp, clnt) static struct sm_stat_res res; bzero((char *)&res, sizeof(res)); - if (clnt_call(clnt, SM_MON, xdr_mon, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp, + (xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&res); @@ -50,7 +52,8 @@ sm_unmon_1(argp, clnt) static struct sm_stat res; bzero((char *)&res, sizeof(res)); - if (clnt_call(clnt, SM_UNMON, xdr_mon_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp, + (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&res); @@ -65,7 +68,8 @@ sm_unmon_all_1(argp, clnt) static struct sm_stat res; bzero((char *)&res, sizeof(res)); - if (clnt_call(clnt, SM_UNMON_ALL, xdr_my_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp, + (xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (&res); @@ -80,7 +84,8 @@ sm_simu_crash_1(argp, clnt) static char res; bzero((char *)&res, sizeof(res)); - if (clnt_call(clnt, SM_SIMU_CRASH, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp, + (xdrproc_t)xdr_void, &res, TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)&res); @@ -119,25 +124,20 @@ int main(int argc, char **argv) { /* Hostname given */ struct sm_stat_res *res; - if (res = sm_mon_1(&mon, cli)) - { + + res = sm_mon_1(&mon, cli); + if (res) printf("Success!\n"); - } else - { printf("Fail\n"); - } } else { - if (out = sm_simu_crash_1(&dummy, cli)) - { + out = sm_simu_crash_1(&dummy, cli); + if (out) printf("Success!\n"); - } else - { printf("Fail\n"); - } } return 0; From owner-svn-src-all@freebsd.org Sat Sep 21 01:39: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 8A093F02CC; Sat, 21 Sep 2019 01:39:50 +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 46ZtYf36gTz3QC5; Sat, 21 Sep 2019 01:39:50 +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 4E57A6B9A; Sat, 21 Sep 2019 01:39:50 +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 x8L1do9m056846; Sat, 21 Sep 2019 01:39:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8L1doM2056845; Sat, 21 Sep 2019 01:39:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909210139.x8L1doM2056845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 21 Sep 2019 01:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r352571 - releng/12.1/sys/net X-SVN-Group: releng X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: releng/12.1/sys/net X-SVN-Commit-Revision: 352571 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 01:39:50 -0000 Author: kevans Date: Sat Sep 21 01:39:49 2019 New Revision: 352571 URL: https://svnweb.freebsd.org/changeset/base/352571 Log: MFS r352565: SIOCSIFNAME: Do nothing if we're not actually changing Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Approved by: re (gjb) Modified: releng/12.1/sys/net/if.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/net/if.c ============================================================================== --- releng/12.1/sys/net/if.c Sat Sep 21 01:29:59 2019 (r352570) +++ releng/12.1/sys/net/if.c Sat Sep 21 01:39:49 2019 (r352571) @@ -2750,6 +2750,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, if (strlen(new_name) == IFNAMSIZ-1) return (EINVAL); } + if (strcmp(new_name, ifp->if_xname) == 0) + break; if (ifunit(new_name) != NULL) return (EEXIST); From owner-svn-src-all@freebsd.org Sat Sep 21 12:33: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 7D1E21229AF; Sat, 21 Sep 2019 12:33:42 +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 46b9462cyPz4SSl; Sat, 21 Sep 2019 12:33:42 +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 3D2D7E426; Sat, 21 Sep 2019 12:33:42 +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 x8LCXghd050009; Sat, 21 Sep 2019 12:33:42 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LCXfIp050007; Sat, 21 Sep 2019 12:33:41 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909211233.x8LCXfIp050007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 12:33:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352572 - head/usr.sbin/rpc.statd X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/usr.sbin/rpc.statd X-SVN-Commit-Revision: 352572 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 12:33:42 -0000 Author: hrs Date: Sat Sep 21 12:33:41 2019 New Revision: 352572 URL: https://svnweb.freebsd.org/changeset/base/352572 Log: Fix warnings and set WARNS=6. Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/file.c head/usr.sbin/rpc.statd/statd.c Modified: head/usr.sbin/rpc.statd/Makefile ============================================================================== --- head/usr.sbin/rpc.statd/Makefile Sat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/Makefile Sat Sep 21 12:33:41 2019 (r352572) @@ -4,9 +4,7 @@ PROG= rpc.statd MAN= rpc.statd.8 SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c -CFLAGS+= -I. -WARNS?= 2 - +CFLAGS+= -I${.OBJDIR} LIBADD= rpcsvc CLEANFILES= sm_inter_svc.c sm_inter.h Modified: head/usr.sbin/rpc.statd/file.c ============================================================================== --- head/usr.sbin/rpc.statd/file.c Sat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/file.c Sat Sep 21 12:33:41 2019 (r352572) @@ -201,8 +201,8 @@ void init_file(const char *filename) /* defective, re-create from scratch. */ if (!new_file) { - if ((status_file_len < HEADER_LEN) || (status_file_len - < (HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) + if ((status_file_len < (off_t)HEADER_LEN) || (status_file_len + < (off_t)(HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) { warnx("status file is corrupt"); new_file = TRUE; Modified: head/usr.sbin/rpc.statd/statd.c ============================================================================== --- head/usr.sbin/rpc.statd/statd.c Sat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/statd.c Sat Sep 21 12:33:41 2019 (r352572) @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); int debug = 0; /* Controls syslog() calls for debug messages */ -char **hosts, *svcport_str = NULL; -int nhosts = 0; -int xcreated = 0; +static char **hosts, *svcport_str = NULL; +static int nhosts = 0; +static int xcreated = 0; static int mallocd_svcport = 0; static int *sock_fd; static int sock_fdcnt; @@ -86,7 +86,8 @@ main(int argc, char **argv) void *nc_handle; in_port_t svcport; int ch, i, s; - char *endptr, **hosts_bak; + char *endptr; + char **hosts_bak; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; @@ -156,7 +157,7 @@ main(int argc, char **argv) if (hosts == NULL) out_of_mem(); - hosts[0] = "*"; + hosts[0] = strdup("*"); nhosts = 1; } else { hosts_bak = hosts; @@ -172,7 +173,7 @@ main(int argc, char **argv) hosts = hosts_bak; nhosts += 2; - hosts[nhosts - 2] = "::1"; + hosts[nhosts - 2] = strdup("::1"); } else { hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); if (hosts_bak == NULL) { @@ -186,7 +187,7 @@ main(int argc, char **argv) hosts = hosts_bak; } } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = strdup("127.0.0.1"); } attempt_cnt = 1; From owner-svn-src-all@freebsd.org Sat Sep 21 13:00: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 CB2E8123232; Sat, 21 Sep 2019 13:00: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 46b9gB4rscz4TLm; Sat, 21 Sep 2019 13:00:38 +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 89EA0E7C9; Sat, 21 Sep 2019 13:00:38 +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 x8LD0coR063406; Sat, 21 Sep 2019 13:00:38 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LD0cnx063405; Sat, 21 Sep 2019 13:00:38 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909211300.x8LD0cnx063405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 21 Sep 2019 13:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r352573 - releng/12.1/sys/fs/fuse X-SVN-Group: releng X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: releng/12.1/sys/fs/fuse X-SVN-Commit-Revision: 352573 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 13:00:38 -0000 Author: asomers Date: Sat Sep 21 13:00:38 2019 New Revision: 352573 URL: https://svnweb.freebsd.org/changeset/base/352573 Log: MF stable/12 r352534: Fix an off-by-one error from r351961 That revision addressed a Coverity CID that could lead to a buffer overflow, but it had an off-by-one error in the buffer size check. Approved by: re (kib) Reported by: Coverity Coverity CID: 1405530 MFC-With: 351961 Sponsored by: The FreeBSD Foundation Modified: releng/12.1/sys/fs/fuse/fuse_internal.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/fs/fuse/fuse_internal.c ============================================================================== --- releng/12.1/sys/fs/fuse/fuse_internal.c Sat Sep 21 12:33:41 2019 (r352572) +++ releng/12.1/sys/fs/fuse/fuse_internal.c Sat Sep 21 13:00:38 2019 (r352573) @@ -390,7 +390,7 @@ fuse_internal_invalidate_entry(struct mount *mp, struc if ((err = uiomove(&fnieo, sizeof(fnieo), uio)) != 0) return (err); - if (fnieo.namelen > sizeof(name)) + if (fnieo.namelen >= sizeof(name)) return (EINVAL); if ((err = uiomove(name, fnieo.namelen, uio)) != 0) From owner-svn-src-all@freebsd.org Sat Sep 21 13:34: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 4BA37123B96; Sat, 21 Sep 2019 13:34:07 +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 46bBPq1H8lz4VfB; Sat, 21 Sep 2019 13:34:07 +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 0F473EEEE; Sat, 21 Sep 2019 13:34:07 +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 x8LDY6E1085804; Sat, 21 Sep 2019 13:34:06 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LDY63O085803; Sat, 21 Sep 2019 13:34:06 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909211334.x8LDY63O085803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 13:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352574 - head/usr.sbin/rpc.statd X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/usr.sbin/rpc.statd X-SVN-Commit-Revision: 352574 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 13:34:07 -0000 Author: hrs Date: Sat Sep 21 13:34:06 2019 New Revision: 352574 URL: https://svnweb.freebsd.org/changeset/base/352574 Log: - Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void(). - Add prototype of from_addr(). Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/procs.c Modified: head/usr.sbin/rpc.statd/Makefile ============================================================================== --- head/usr.sbin/rpc.statd/Makefile Sat Sep 21 13:00:38 2019 (r352573) +++ head/usr.sbin/rpc.statd/Makefile Sat Sep 21 13:34:06 2019 (r352574) @@ -7,6 +7,9 @@ SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c CFLAGS+= -I${.OBJDIR} LIBADD= rpcsvc +# XXX: mismatch between (xdrproc_t) and xdr_void(). +WARNS?= 2 + CLEANFILES= sm_inter_svc.c sm_inter.h RPCSRC= ${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc/sm_inter.x Modified: head/usr.sbin/rpc.statd/procs.c ============================================================================== --- head/usr.sbin/rpc.statd/procs.c Sat Sep 21 13:00:38 2019 (r352573) +++ head/usr.sbin/rpc.statd/procs.c Sat Sep 21 13:34:06 2019 (r352574) @@ -52,9 +52,10 @@ __FBSDID("$FreeBSD$"); #include "statd.h" +static const char *from_addr(struct sockaddr *); + static const char * -from_addr(saddr) - struct sockaddr *saddr; +from_addr(struct sockaddr *saddr) { static char inet_buf[INET6_ADDRSTRLEN]; From owner-svn-src-all@freebsd.org Sat Sep 21 14: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 D2CD7124BB9; Sat, 21 Sep 2019 14:03:41 +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 46bC3x5D6Zz4XCs; Sat, 21 Sep 2019 14:03:41 +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 97BFCF47A; Sat, 21 Sep 2019 14:03:41 +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 x8LE3fMt003952; Sat, 21 Sep 2019 14:03:41 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LE3f9h003951; Sat, 21 Sep 2019 14:03:41 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909211403.x8LE3f9h003951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 14:03: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: r352575 - stable/12/usr.bin/quota X-SVN-Group: stable-12 X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: stable/12/usr.bin/quota X-SVN-Commit-Revision: 352575 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 14:03:41 -0000 Author: hrs Date: Sat Sep 21 14:03:41 2019 New Revision: 352575 URL: https://svnweb.freebsd.org/changeset/base/352575 Log: MFC r352567: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: stable/12/usr.bin/quota/quota.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/quota/quota.c ============================================================================== --- stable/12/usr.bin/quota/quota.c Sat Sep 21 13:34:06 2019 (r352574) +++ stable/12/usr.bin/quota/quota.c Sat Sep 21 14:03:41 2019 (r352575) @@ -606,7 +606,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args, (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; From owner-svn-src-all@freebsd.org Sat Sep 21 14:06: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 79213124CE9; Sat, 21 Sep 2019 14:06:17 +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 46bC6x2HzWz4XR6; Sat, 21 Sep 2019 14:06:17 +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 336DAF484; Sat, 21 Sep 2019 14:06:17 +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 x8LE6HCn004238; Sat, 21 Sep 2019 14:06:17 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LE6H6V004237; Sat, 21 Sep 2019 14:06:17 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201909211406.x8LE6H6V004237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 21 Sep 2019 14:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352576 - stable/11/usr.bin/quota X-SVN-Group: stable-11 X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: stable/11/usr.bin/quota X-SVN-Commit-Revision: 352576 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 14:06:17 -0000 Author: hrs Date: Sat Sep 21 14:06:16 2019 New Revision: 352576 URL: https://svnweb.freebsd.org/changeset/base/352576 Log: MFC r352567: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: stable/11/usr.bin/quota/quota.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/quota/quota.c ============================================================================== --- stable/11/usr.bin/quota/quota.c Sat Sep 21 14:03:41 2019 (r352575) +++ stable/11/usr.bin/quota/quota.c Sat Sep 21 14:06:16 2019 (r352576) @@ -604,7 +604,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args, (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; From owner-svn-src-all@freebsd.org Sat Sep 21 14: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 3B184125137; Sat, 21 Sep 2019 14:16:38 +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 46bCLt0qpqz4Xyt; Sat, 21 Sep 2019 14:16:38 +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 F0FEDF659; Sat, 21 Sep 2019 14:16:37 +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 x8LEGbfK009999; Sat, 21 Sep 2019 14:16:37 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LEGbKd009998; Sat, 21 Sep 2019 14:16:37 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <201909211416.x8LEGbKd009998@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: Sat, 21 Sep 2019 14:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352577 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 352577 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 14:16:38 -0000 Author: 0mp (ports committer) Date: Sat Sep 21 14:16:37 2019 New Revision: 352577 URL: https://svnweb.freebsd.org/changeset/base/352577 Log: ascii(7): Add STANDARDS section and update HISTORY section PR: 240727 Submitted by: Gordon Bergling Approved by: src (imp) Event: EuroBSDcon 2019 Modified: head/share/man/man7/ascii.7 Modified: head/share/man/man7/ascii.7 ============================================================================== --- head/share/man/man7/ascii.7 Sat Sep 21 14:06:16 2019 (r352576) +++ head/share/man/man7/ascii.7 Sat Sep 21 14:16:37 2019 (r352577) @@ -28,7 +28,7 @@ .\" @(#)ascii.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 30, 2017 +.Dd September 21, 2019 .Dt ASCII 7 .Os .Sh NAME @@ -146,8 +146,15 @@ ESC ; [ { 11011 .Bl -tag -width /usr/share/misc/ascii -compact .It Pa /usr/share/misc/ascii .El +.Sh STANDARDS +.Rs +.%T Information Systems - Coded Character Sets - 7-Bit American National\ + Standard Code for Information Interchange (7-Bit ASCII) +.%R INCITS 4-1986[R2017] +.%Q InterNational Committee for Information Technology Standards +.Re .Sh HISTORY An .Nm manual page appeared in -.At v7 . +.At v2 . From owner-svn-src-all@freebsd.org Sat Sep 21 15:01: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 A2AC2126AC0; Sat, 21 Sep 2019 15:01:12 +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 46bDLJ1Hh0z4bvD; Sat, 21 Sep 2019 15:01:12 +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 0FC86FE25; Sat, 21 Sep 2019 15:01:12 +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 x8LF1Bf4038298; Sat, 21 Sep 2019 15:01:11 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LF1BvL038297; Sat, 21 Sep 2019 15:01:11 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <201909211501.x8LF1BvL038297@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: Sat, 21 Sep 2019 15:01:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352578 - head/usr.bin/jot X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/jot X-SVN-Commit-Revision: 352578 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 15:01:12 -0000 Author: 0mp (ports committer) Date: Sat Sep 21 15:01:11 2019 New Revision: 352578 URL: https://svnweb.freebsd.org/changeset/base/352578 Log: jot.1: Explain default argument values more precisely The way jot(1) defaults missing arguments doesn't match the behaviour described in the manpage, which states that with fewer than 3 arguments missing values are supplied from left to right. In fact, with one or two arguments, the last (s which is step size or seed) defaults to 1 (or -1 if begin and end specify a descending range), and then omitted arguments are set to default starting with the leftmost until three arguments are available. This is why `jot 2 1000` prints 1000 and 1001 instead of 1000 and 100. PR: 135475 Submitted by: Jonathan McKeown Approved by: doc (bcr) Differential Revision: https://reviews.freebsd.org/D21736 Event: EuroBSDcon 2019 Modified: head/usr.bin/jot/jot.1 Modified: head/usr.bin/jot/jot.1 ============================================================================== --- head/usr.bin/jot/jot.1 Sat Sep 21 14:16:37 2019 (r352577) +++ head/usr.bin/jot/jot.1 Sat Sep 21 15:01:11 2019 (r352578) @@ -28,7 +28,7 @@ .\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd April 7, 2015 +.Dd September 21, 2019 .Dt JOT 1 .Os .Sh NAME @@ -108,14 +108,16 @@ Any three of these arguments determines the fourth. If four are specified and the given and computed values of .Ar reps conflict, the lower value is used. -If fewer than three are specified, defaults are assigned -left to right, except for +If one or two are specified, defaults are assigned +starting with .Ar s , -which assumes a default of 1 or -1 if both +which assumes a default of 1 (or -1 if .Ar begin and .Ar end -are given. +specify a descending range). +Then the default values are assigned to the leftmost omitted arguments until +three arguments are set. .Pp Defaults for the four arguments are, respectively, 100, 1, 100, and 1, except that when random data are requested, From owner-svn-src-all@freebsd.org Sat Sep 21 15:38: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 0FFE0127A9B; Sat, 21 Sep 2019 15:38:09 +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 46bF8w6gkPz4fqD; Sat, 21 Sep 2019 15:38:08 +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 C841E18574; Sat, 21 Sep 2019 15:38:08 +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 x8LFc8jg059767; Sat, 21 Sep 2019 15:38:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LFc82r059766; Sat, 21 Sep 2019 15:38:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909211538.x8LFc82r059766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 21 Sep 2019 15:38:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352579 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352579 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 15:38:09 -0000 Author: mav Date: Sat Sep 21 15:38:08 2019 New Revision: 352579 URL: https://svnweb.freebsd.org/changeset/base/352579 Log: Allocate callout wheel from the respective memory domain. MFC after: 1 week Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sat Sep 21 15:01:11 2019 (r352578) +++ head/sys/kern/kern_timeout.c Sat Sep 21 15:38:08 2019 (r352579) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -325,8 +326,9 @@ callout_cpu_init(struct callout_cpu *cc, int cpu) mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); cc->cc_inited = 1; - cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, - M_CALLOUT, M_WAITOK); + cc->cc_callwheel = malloc_domainset(sizeof(struct callout_list) * + callwheelsize, M_CALLOUT, + DOMAINSET_PREF(pcpu_find(cpu)->pc_domain), M_WAITOK); for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); TAILQ_INIT(&cc->cc_expireq); From owner-svn-src-all@freebsd.org Sat Sep 21 17:54: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 1838412B0B0; Sat, 21 Sep 2019 17:54:43 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46bJBV6hW7z3K9G; Sat, 21 Sep 2019 17:54:42 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5DE019E8C; Sat, 21 Sep 2019 17:54:42 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8LHsgZS042670; Sat, 21 Sep 2019 17:54:42 GMT (envelope-from sef@FreeBSD.org) Received: (from sef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LHsgpV042669; Sat, 21 Sep 2019 17:54:42 GMT (envelope-from sef@FreeBSD.org) Message-Id: <201909211754.x8LHsgpV042669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sef set sender to sef@FreeBSD.org using -f From: Sean Eric Fagan Date: Sat, 21 Sep 2019 17:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352580 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: sef X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 352580 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 17:54:43 -0000 Author: sef Date: Sat Sep 21 17:54:42 2019 New Revision: 352580 URL: https://svnweb.freebsd.org/changeset/base/352580 Log: Fix a regression introduced in r344601, and work properly with the -v and -n options. PR: 240640 Reported by: Andriy Gapon Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21709 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 21 15:38:08 2019 (r352579) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 21 17:54:42 2019 (r352580) @@ -1289,13 +1289,11 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) fromorigin = sdd->prevsnap[0] == '\0' && (sdd->fromorigin || sdd->replicate); - if (sdd->progress && sdd->dryrun) { + if (sdd->verbose || sdd->progress) { (void) estimate_ioctl(zhp, sdd->prevsnap_obj, fromorigin, flags, &size); sdd->size += size; - } - if (sdd->verbose) { send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, size, sdd->parsable); @@ -1663,7 +1661,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla fromname = name; } - if (flags->progress) { + if (flags->progress || flags->verbose) { error = lzc_send_space(zhp->zfs_name, fromname, lzc_flags, &size); if (error == 0) @@ -1933,7 +1931,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons sdd.cleanup_fd = -1; sdd.snapholds = NULL; } - if (flags->progress || sdd.snapholds != NULL) { + if (flags->progress || flags->verbose || sdd.snapholds != NULL) { /* * Do a verbose no-op dry run to get all the verbose output * or to gather snapshot hold's before generating any data, From owner-svn-src-all@freebsd.org Sat Sep 21 17:59: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 7903312B390; Sat, 21 Sep 2019 17:59: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 46bJHm2bfXz3KYT; Sat, 21 Sep 2019 17:59: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 3D1CE19EA0; Sat, 21 Sep 2019 17:59: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 x8LHxGmD043117; Sat, 21 Sep 2019 17:59:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LHxGtd043116; Sat, 21 Sep 2019 17:59:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909211759.x8LHxGtd043116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 21 Sep 2019 17:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352581 - 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: 352581 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 17:59:16 -0000 Author: kib Date: Sat Sep 21 17:59:15 2019 New Revision: 352581 URL: https://svnweb.freebsd.org/changeset/base/352581 Log: amd64 pmap: Fix formats for 64bit addresses in ddb and sysctl output. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21737 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Sep 21 17:54:42 2019 (r352580) +++ head/sys/amd64/amd64/pmap.c Sat Sep 21 17:59:15 2019 (r352581) @@ -10030,13 +10030,13 @@ sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_ mode = "WC"; break; default: - printf("%s: unknown PAT mode %#x for range %#016lx-%#016lx\n", + printf("%s: unknown PAT mode %#x for range 0x%016lx-0x%016lx\n", __func__, i, range->sva, eva); mode = "??"; break; } - sbuf_printf(sb, "%#016lx-%#016lx r%c%c%c%c %s %d %d %d\n", + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c%c %s %d %d %d\n", range->sva, eva, (range->attrs & X86_PG_RW) != 0 ? 'w' : '-', (range->attrs & pg_nx) != 0 ? '-' : 'x', @@ -10271,25 +10271,25 @@ DB_SHOW_COMMAND(pte, pmap_print_pte) PG_V = pmap_valid_bit(pmap); pml4 = pmap_pml4e(pmap, va); - db_printf("VA %#016lx pml4e %#016lx", va, *pml4); + db_printf("VA 0x%016lx pml4e 0x%016lx", va, *pml4); if ((*pml4 & PG_V) == 0) { db_printf("\n"); return; } pdp = pmap_pml4e_to_pdpe(pml4, va); - db_printf(" pdpe %#016lx", *pdp); + db_printf(" pdpe 0x%016lx", *pdp); if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) { db_printf("\n"); return; } pde = pmap_pdpe_to_pde(pdp, va); - db_printf(" pde %#016lx", *pde); + db_printf(" pde 0x%016lx", *pde); if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) { db_printf("\n"); return; } pte = pmap_pde_to_pte(pde, va); - db_printf(" pte %#016lx\n", *pte); + db_printf(" pte 0x%016lx\n", *pte); } DB_SHOW_COMMAND(phys2dmap, pmap_phys2dmap) From owner-svn-src-all@freebsd.org Sat Sep 21 18:00: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 CCC4912B455; Sat, 21 Sep 2019 18:00:23 +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 46bJK34zPdz3KjG; Sat, 21 Sep 2019 18:00:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E2DB19EAD; Sat, 21 Sep 2019 18:00:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8LI0NaI043287; Sat, 21 Sep 2019 18:00:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LI0Np1043286; Sat, 21 Sep 2019 18:00:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909211800.x8LI0Np1043286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 21 Sep 2019 18:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352582 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352582 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 18:00:23 -0000 Author: kib Date: Sat Sep 21 18:00:23 2019 New Revision: 352582 URL: https://svnweb.freebsd.org/changeset/base/352582 Log: Make non-ASLR pie base tunable. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Sep 21 17:59:15 2019 (r352581) +++ head/sys/kern/imgact_elf.c Sat Sep 21 18:00:23 2019 (r352582) @@ -135,6 +135,11 @@ SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_R "enable execution from readable segments"); #endif +static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR; +SYSCTL_ULONG(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, pie_base, + CTLFLAG_RWTUN, &__elfN(pie_base), 0, + "PIE load base without randomization"); + SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr, CTLFLAG_RW, 0, ""); #define ASLR_NODE_OID __CONCAT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), _aslr) @@ -1146,13 +1151,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i if (baddr == 0) { if ((sv->sv_flags & SV_ASLR) == 0 || (fctl0 & NT_FREEBSD_FCTL_ASLR_DISABLE) != 0) - et_dyn_addr = ET_DYN_LOAD_ADDR; + et_dyn_addr = __elfN(pie_base); else if ((__elfN(pie_aslr_enabled) && (imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) || (imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0) et_dyn_addr = ET_DYN_ADDR_RAND; else - et_dyn_addr = ET_DYN_LOAD_ADDR; + et_dyn_addr = __elfN(pie_base); } } From owner-svn-src-all@freebsd.org Sat Sep 21 19:05: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 E768C12CC41; Sat, 21 Sep 2019 19:05:38 +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 46bKmL5nw4z3PJ9; Sat, 21 Sep 2019 19:05:38 +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 AA0121AB9F; Sat, 21 Sep 2019 19:05:38 +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 x8LJ5cm8086094; Sat, 21 Sep 2019 19:05:38 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LJ5ceX086093; Sat, 21 Sep 2019 19:05:38 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201909211905.x8LJ5ceX086093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 21 Sep 2019 19:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352583 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352583 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 19:05:39 -0000 Author: mjg Date: Sat Sep 21 19:05:38 2019 New Revision: 352583 URL: https://svnweb.freebsd.org/changeset/base/352583 Log: lockprof: use CPUFOREACH and drop always false lp_cpu NULL checks Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_lock.c Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Sat Sep 21 18:00:23 2019 (r352582) +++ head/sys/kern/subr_lock.c Sat Sep 21 19:05:38 2019 (r352583) @@ -287,7 +287,7 @@ lock_prof_init(void *arg) { int cpu; - for (cpu = 0; cpu <= mp_maxid; cpu++) { + CPU_FOREACH(cpu) { lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF, M_WAITOK | M_ZERO); lock_prof_init_type(&lp_cpu[cpu]->lpc_types[0]); @@ -330,14 +330,14 @@ lock_prof_reset(void) * before we zero the structures. Some items may still be linked * into per-thread lists as well. */ - for (cpu = 0; cpu <= mp_maxid; cpu++) { + CPU_FOREACH(cpu) { lpc = lp_cpu[cpu]; for (i = 0; i < LPROF_CACHE_SIZE; i++) { LIST_REMOVE(&lpc->lpc_types[0].lpt_objs[i], lpo_link); LIST_REMOVE(&lpc->lpc_types[1].lpt_objs[i], lpo_link); } } - for (cpu = 0; cpu <= mp_maxid; cpu++) { + CPU_FOREACH(cpu) { lpc = lp_cpu[cpu]; bzero(lpc, sizeof(*lpc)); lock_prof_init_type(&lpc->lpc_types[0]); @@ -378,9 +378,7 @@ lock_prof_sum(struct lock_prof *match, struct lock_pro dst->class = match->class; dst->name = match->name; - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (lp_cpu[cpu] == NULL) - continue; + CPU_FOREACH(cpu) { type = &lp_cpu[cpu]->lpc_types[spin]; SLIST_FOREACH(l, &type->lpt_hash[hash], link) { if (l->ticks == t) @@ -399,7 +397,6 @@ lock_prof_sum(struct lock_prof *match, struct lock_pro dst->cnt_contest_locking += l->cnt_contest_locking; } } - } static void @@ -438,9 +435,7 @@ dump_lock_prof_stats(SYSCTL_HANDLER_ARGS) lock_prof_enable = 0; quiesce_all_cpus("profstat", 0); t = ticks; - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (lp_cpu[cpu] == NULL) - continue; + CPU_FOREACH(cpu) { lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[0], sb, 0, t); lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[1], sb, 1, t); } From owner-svn-src-all@freebsd.org Sat Sep 21 19:51: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 724A512DDA1; Sat, 21 Sep 2019 19:51:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 46bLnp2WTZz3wYk; Sat, 21 Sep 2019 19:51:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AA011B432; Sat, 21 Sep 2019 19:51:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8LJpwhp012347; Sat, 21 Sep 2019 19:51:58 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LJpwDd012346; Sat, 21 Sep 2019 19:51:58 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201909211951.x8LJpwDd012346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 21 Sep 2019 19:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352584 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 352584 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 19:51:58 -0000 Author: alc Date: Sat Sep 21 19:51:57 2019 New Revision: 352584 URL: https://svnweb.freebsd.org/changeset/base/352584 Log: In case a translation fault on the kernel address space occurs from within a critical section, we must perform a lock-free check on the faulting address. Reported by: andrew Reviewed by: andrew, markj X-MFC with: r350579 Differential Revision: https://reviews.freebsd.org/D21685 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Sep 21 19:05:38 2019 (r352583) +++ head/sys/arm64/arm64/pmap.c Sat Sep 21 19:51:57 2019 (r352584) @@ -5810,23 +5810,33 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) case ISS_DATA_DFSC_TF_L1: case ISS_DATA_DFSC_TF_L2: case ISS_DATA_DFSC_TF_L3: - PMAP_LOCK(pmap); - /* Ask the MMU to check the address */ - intr = intr_disable(); - if (pmap == kernel_pmap) - par = arm64_address_translate_s1e1r(far); - else - par = arm64_address_translate_s1e0r(far); - intr_restore(intr); - PMAP_UNLOCK(pmap); - /* - * If the translation was successful the address was invalid - * due to a break-before-make sequence. We can unlock and - * return success to the trap handler. + * Retry the translation. A break-before-make sequence can + * produce a transient fault. */ - if (PAR_SUCCESS(par)) - rv = KERN_SUCCESS; + if (pmap == kernel_pmap) { + /* + * The translation fault may have occurred within a + * critical section. Therefore, we must check the + * address without acquiring the kernel pmap's lock. + */ + if (pmap_kextract(far) != 0) + rv = KERN_SUCCESS; + } else { + PMAP_LOCK(pmap); + /* Ask the MMU to check the address. */ + intr = intr_disable(); + par = arm64_address_translate_s1e0r(far); + intr_restore(intr); + PMAP_UNLOCK(pmap); + + /* + * If the translation was successful, then we can + * return success to the trap handler. + */ + if (PAR_SUCCESS(par)) + rv = KERN_SUCCESS; + } break; } From owner-svn-src-all@freebsd.org Sat Sep 21 20:03: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 0862C12E1BA; Sat, 21 Sep 2019 20:03:18 +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 46bM2s6Smnz3x7S; Sat, 21 Sep 2019 20:03:17 +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 C267E1B657; Sat, 21 Sep 2019 20:03:17 +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 x8LK3Hq7021502; Sat, 21 Sep 2019 20:03:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8LK3HFK021501; Sat, 21 Sep 2019 20:03:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909212003.x8LK3HFK021501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 21 Sep 2019 20:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352585 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 352585 X-SVN-Commit-Repository: base MIME-Version: 1.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, 21 Sep 2019 20:03:18 -0000 Author: kib Date: Sat Sep 21 20:03:17 2019 New Revision: 352585 URL: https://svnweb.freebsd.org/changeset/base/352585 Log: kern.elf{32,64}.pie_base sysctl: enforce page alignment. Requested by: rstone Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Sep 21 19:51:57 2019 (r352584) +++ head/sys/kern/imgact_elf.c Sat Sep 21 20:03:17 2019 (r352585) @@ -136,8 +136,24 @@ SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_R #endif static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR; -SYSCTL_ULONG(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, pie_base, - CTLFLAG_RWTUN, &__elfN(pie_base), 0, +static int +sysctl_pie_base(SYSCTL_HANDLER_ARGS) +{ + u_long val; + int error; + + val = __elfN(pie_base); + error = sysctl_handle_long(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if ((val & PAGE_MASK) != 0) + return (EINVAL); + __elfN(pie_base) = val; + return (0); +} +SYSCTL_PROC(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, pie_base, + CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, + sysctl_pie_base, "LU", "PIE load base without randomization"); SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr, CTLFLAG_RW, 0,