From owner-svn-src-stable-11@freebsd.org Sun Nov 5 22:33:43 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 013F1E53ED1; Sun, 5 Nov 2017 22:33:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C43EB6F796; Sun, 5 Nov 2017 22:33:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA5MXg71011128; Sun, 5 Nov 2017 22:33:42 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA5MXg4t011127; Sun, 5 Nov 2017 22:33:42 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201711052233.vA5MXg4t011127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 5 Nov 2017 22:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325459 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 325459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 22:33:43 -0000 Author: ngie Date: Sun Nov 5 22:33:41 2017 New Revision: 325459 URL: https://svnweb.freebsd.org/changeset/base/325459 Log: MFC r324862: Clean up trailing whitespace in kdb_thr_ctx(..) Modified: stable/11/sys/kern/subr_kdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_kdb.c ============================================================================== --- stable/11/sys/kern/subr_kdb.c Sun Nov 5 22:29:45 2017 (r325458) +++ stable/11/sys/kern/subr_kdb.c Sun Nov 5 22:33:41 2017 (r325459) @@ -513,12 +513,12 @@ kdb_reenter(void) struct pcb * kdb_thr_ctx(struct thread *thr) -{ +{ #if defined(SMP) && defined(KDB_STOPPEDPCB) struct pcpu *pc; #endif - - if (thr == curthread) + + if (thr == curthread) return (&kdb_pcb); #if defined(SMP) && defined(KDB_STOPPEDPCB) From owner-svn-src-stable-11@freebsd.org Sun Nov 5 22:36:03 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A181E53FD0; Sun, 5 Nov 2017 22:36:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51ABF6FA14; Sun, 5 Nov 2017 22:36:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA5Ma2wG011396; Sun, 5 Nov 2017 22:36:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA5Ma25D011394; Sun, 5 Nov 2017 22:36:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201711052236.vA5Ma25D011394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 5 Nov 2017 22:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325461 - stable/11/lib/libugidfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/lib/libugidfw X-SVN-Commit-Revision: 325461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 22:36:03 -0000 Author: ngie Date: Sun Nov 5 22:36:02 2017 New Revision: 325461 URL: https://svnweb.freebsd.org/changeset/base/325461 Log: MFC r324928,r324929: r324928: Remove dead stores The return value of various snprintf calls was stored in `len` and not used in many functions. r324929: Clean up trailing whitespace Modified: stable/11/lib/libugidfw/Makefile stable/11/lib/libugidfw/ugidfw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libugidfw/Makefile ============================================================================== --- stable/11/lib/libugidfw/Makefile Sun Nov 5 22:34:27 2017 (r325460) +++ stable/11/lib/libugidfw/Makefile Sun Nov 5 22:36:02 2017 (r325461) @@ -2,7 +2,7 @@ PACKAGE=lib${LIB} LIB= ugidfw -SHLIB_MAJOR= 5 +SHLIB_MAJOR= 5 SRCS= ugidfw.c INCS= ugidfw.h Modified: stable/11/lib/libugidfw/ugidfw.c ============================================================================== --- stable/11/lib/libugidfw/ugidfw.c Sun Nov 5 22:34:27 2017 (r325460) +++ stable/11/lib/libugidfw/ugidfw.c Sun Nov 5 22:36:02 2017 (r325461) @@ -194,7 +194,7 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule, cur += len; } if (rule->mbr_subject.mbs_flags & MBS_PRISON_DEFINED) { - len = snprintf(cur, left, "jailid %d ", + len = snprintf(cur, left, "jailid %d ", rule->mbr_subject.mbs_prison); if (len < 0 || len > left) goto truncated; @@ -334,7 +334,7 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule, &(mntbuf[i].f_fsid), sizeof(mntbuf[i].f_fsid)) == 0) break; - len = snprintf(cur, left, "filesys %s ", + len = snprintf(cur, left, "filesys %s ", i == numfs ? "???" : mntbuf[i].f_mntonname); if (len < 0 || len > left) goto truncated; @@ -512,7 +512,6 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max uid_t uid1, uid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -523,8 +522,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec1); + snprintf(errstr, buflen, "invalid uid: '%s'", spec1); return (-1); } uid1 = value; @@ -541,8 +539,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec2); + snprintf(errstr, buflen, "invalid uid: '%s'", spec2); return (-1); } uid2 = value; @@ -561,7 +558,6 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max gid_t gid1, gid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -572,8 +568,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec1); + snprintf(errstr, buflen, "invalid gid: '%s'", spec1); return (-1); } gid1 = value; @@ -590,8 +585,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec2); + snprintf(errstr, buflen, "invalid gid: '%s'", spec2); return (-1); } gid2 = value; @@ -613,7 +607,6 @@ bsde_parse_subject(int argc, char *argv[], uid_t uid_min, uid_max; gid_t gid_min, gid_max; int jid = 0; - size_t len; long value; current = 0; @@ -630,11 +623,11 @@ bsde_parse_subject(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBS_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -648,11 +641,11 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBS_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -666,17 +659,17 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "jailid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "prison short"); + snprintf(errstr, buflen, "prison short"); return (-1); } if (flags & MBS_PRISON_DEFINED) { - len = snprintf(errstr, buflen, "one jail only"); + snprintf(errstr, buflen, "one jail only"); return (-1); } value = strtol(argv[current+1], &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid jid: '%s'", argv[current+1]); + snprintf(errstr, buflen, "invalid jid: '%s'", + argv[current+1]); return (-1); } jid = value; @@ -688,14 +681,13 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, - "double negative"); + snprintf(errstr, buflen, "double negative"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -723,7 +715,6 @@ bsde_parse_subject(int argc, char *argv[], static int bsde_parse_type(char *spec, int *type, size_t buflen, char *errstr) { - size_t len; int i; *type = 0; @@ -755,10 +746,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, *type |= MBO_ALL_TYPE; break; default: - len = snprintf(errstr, buflen, "Unknown type code: %c", + snprintf(errstr, buflen, "Unknown type code: %c", spec[i]); return (-1); - } + } } return (0); @@ -767,11 +758,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, static int bsde_parse_fsid(char *spec, struct fsid *fsid, size_t buflen, char *errstr) { - size_t len; struct statfs buf; if (statfs(spec, &buf) < 0) { - len = snprintf(errstr, buflen, "Unable to get id for %s: %s", + snprintf(errstr, buflen, "Unable to get id for %s: %s", spec, strerror(errno)); return (-1); } @@ -791,7 +781,6 @@ bsde_parse_object(int argc, char *argv[], uid_t uid_min, uid_max; gid_t gid_min, gid_max; struct fsid fsid; - size_t len; current = 0; flags = 0; @@ -808,11 +797,11 @@ bsde_parse_object(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBO_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -826,11 +815,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBO_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -844,11 +833,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "filesys") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "filesys short"); + snprintf(errstr, buflen, "filesys short"); return (-1); } if (flags & MBO_FSID_DEFINED) { - len = snprintf(errstr, buflen, "one fsid only"); + snprintf(errstr, buflen, "one fsid only"); return (-1); } if (bsde_parse_fsid(argv[current+1], &fsid, @@ -890,11 +879,11 @@ bsde_parse_object(int argc, char *argv[], current += 1; } else if (strcmp(argv[current], "type") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "type short"); + snprintf(errstr, buflen, "type short"); return (-1); } if (flags & MBO_TYPE_DEFINED) { - len = snprintf(errstr, buflen, "one type only"); + snprintf(errstr, buflen, "one type only"); return (-1); } if (bsde_parse_type(argv[current+1], &type, @@ -908,14 +897,14 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, + snprintf(errstr, buflen, "double negative'"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -946,16 +935,15 @@ int bsde_parse_mode(int argc, char *argv[], mode_t *mode, size_t buflen, char *errstr) { - size_t len; int i; if (argc == 0) { - len = snprintf(errstr, buflen, "mode expects mode value"); + snprintf(errstr, buflen, "mode expects mode value"); return (-1); } if (argc != 1) { - len = snprintf(errstr, buflen, "'%s' unexpected", argv[1]); + snprintf(errstr, buflen, "'%s' unexpected", argv[1]); return (-1); } @@ -981,10 +969,10 @@ bsde_parse_mode(int argc, char *argv[], mode_t *mode, /* ignore */ break; default: - len = snprintf(errstr, buflen, "Unknown mode letter: %c", + snprintf(errstr, buflen, "Unknown mode letter: %c", argv[0][i]); return (-1); - } + } } return (0); @@ -998,17 +986,16 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd int object, object_elements, object_elements_length; int mode, mode_elements, mode_elements_length; int error, i; - size_t len; bzero(rule, sizeof(*rule)); if (argc < 1) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } if (strcmp(argv[0], "subject") != 0) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } subject = 0; @@ -1022,7 +1009,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd object = i; if (object == -1) { - len = snprintf(errstr, buflen, "Rule must contain an object"); + snprintf(errstr, buflen, "Rule must contain an object"); return (-1); } @@ -1033,7 +1020,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd mode = i; if (mode == -1) { - len = snprintf(errstr, buflen, "Rule must contain mode"); + snprintf(errstr, buflen, "Rule must contain mode"); return (-1); } @@ -1112,12 +1099,12 @@ bsde_check_version(size_t buflen, char *errstr) len = sizeof(version); error = sysctlbyname(MIB ".rule_version", &version, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "version check failed: %s", + snprintf(errstr, buflen, "version check failed: %s", strerror(errno)); return (-1); } if (version != MB_VERSION) { - len = snprintf(errstr, buflen, "module v%d != library v%d", + snprintf(errstr, buflen, "module v%d != library v%d", version, MB_VERSION); return (-1); } @@ -1134,11 +1121,11 @@ bsde_get_rule_count(size_t buflen, char *errstr) len = sizeof(rule_count); error = sysctlbyname(MIB ".rule_count", &rule_count, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_count)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_count", + snprintf(errstr, buflen, "Data error in %s.rule_count", MIB); return (-1); } @@ -1156,12 +1143,11 @@ bsde_get_rule_slots(size_t buflen, char *errstr) len = sizeof(rule_slots); error = sysctlbyname(MIB ".rule_slots", &rule_slots, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_slots)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_slots", - MIB); + snprintf(errstr, buflen, "Data error in %s.rule_slots", MIB); return (-1); } @@ -1187,7 +1173,7 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, errlen, "%s: %s", MIB ".rules", + snprintf(errstr, errlen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1199,11 +1185,11 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule if (error == -1 && errno == ENOENT) return (-2); if (error) { - len = snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } else if (size != sizeof(*rule)) { - len = snprintf(errstr, errlen, "Data error in %s.%d: %s", + snprintf(errstr, errlen, "Data error in %s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1225,7 +1211,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1235,7 +1221,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err error = sysctl(name, len, NULL, NULL, &rule, 0); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1257,7 +1243,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1267,7 +1253,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule)); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1290,14 +1276,14 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } rule_slots = bsde_get_rule_slots(BUFSIZ, charstr); if (rule_slots == -1) { - len = snprintf(errstr, buflen, "unable to get rule slots: %s", + snprintf(errstr, buflen, "unable to get rule slots: %s", strerror(errno)); return (-1); } @@ -1307,7 +1293,7 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule)); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rule_slots, strerror(errno)); return (-1); } From owner-svn-src-stable-11@freebsd.org Mon Nov 6 11:10:44 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCE7FE59F2F; Mon, 6 Nov 2017 11:10:44 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8306A1C4; Mon, 6 Nov 2017 11:10:44 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6BAh2M026975; Mon, 6 Nov 2017 11:10:43 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6BAhfw026974; Mon, 6 Nov 2017 11:10:43 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061110.vA6BAhfw026974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 11:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325471 - stable/11/libexec/ftpd X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/libexec/ftpd X-SVN-Commit-Revision: 325471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 11:10:44 -0000 Author: eugen (ports committer) Date: Mon Nov 6 11:10:43 2017 New Revision: 325471 URL: https://svnweb.freebsd.org/changeset/base/325471 Log: MFC r324364: ftpd(8): fix user context handling Apply authenticated user context after update of wtmp(5) at start of session, so that ftpd process is not killed by kernel with SIGXFSZ when user has "filesize" limit lower than size of system wtmp file. Same applies to session finalization: revert to super-user context before update of wtmp. If ftpd hits limit while writing a file at user request, do not get killed with SIGXFSZ instantly but apparently ignore the signal, process error and report it to the user, and continue with the session. PR: 143570 Approved by: mav (mentor) Modified: stable/11/libexec/ftpd/ftpd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/ftpd/ftpd.c ============================================================================== --- stable/11/libexec/ftpd/ftpd.c Mon Nov 6 06:05:54 2017 (r325470) +++ stable/11/libexec/ftpd/ftpd.c Mon Nov 6 11:10:43 2017 (r325471) @@ -430,6 +430,10 @@ main(int argc, char *argv[], char **envp) } } + /* handle filesize limit gracefully */ + sa.sa_handler = SIG_IGN; + (void)sigaction(SIGXFSZ, &sa, NULL); + if (daemon_mode) { int *ctl_sock, fd, maxfd = -1, nfds, i; fd_set defreadfds, readfds; @@ -1196,14 +1200,14 @@ end_login(void) #endif (void) seteuid(0); - if (logged_in && dowtmp) - ftpd_logwtmp(wtmpid, NULL, NULL); - pw = NULL; #ifdef LOGIN_CAP setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | LOGIN_SETENV)); #endif + if (logged_in && dowtmp) + ftpd_logwtmp(wtmpid, NULL, NULL); + pw = NULL; #ifdef USE_PAM if (pamh) { if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS) @@ -1478,7 +1482,7 @@ skip: } } setusercontext(lc, pw, 0, LOGIN_SETALL & - ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); + ~(LOGIN_SETRESOURCES | LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); #else setlogin(pw->pw_name); (void) initgroups(pw->pw_name, pw->pw_gid); @@ -1520,6 +1524,10 @@ skip: (struct sockaddr *)&his_addr); logged_in = 1; +#ifdef LOGIN_CAP + setusercontext(lc, pw, 0, LOGIN_SETRESOURCES); +#endif + if (guest && stats && statfd < 0) #ifdef VIRTUAL_HOSTING statfd = open(thishost->statfile, O_WRONLY|O_APPEND); @@ -2770,6 +2778,11 @@ dologout(int status) if (logged_in && dowtmp) { (void) seteuid(0); +#ifdef LOGIN_CAP + setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | + LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | + LOGIN_SETENV)); +#endif ftpd_logwtmp(wtmpid, NULL, NULL); } /* beware of flushing buffers after a SIGPIPE */ From owner-svn-src-stable-11@freebsd.org Mon Nov 6 12:44:28 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5790EE5D11C; Mon, 6 Nov 2017 12:44:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8126DA15; Mon, 6 Nov 2017 12:44:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6CiRDS068494; Mon, 6 Nov 2017 12:44:27 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6CiRmk068492; Mon, 6 Nov 2017 12:44:27 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061244.vA6CiRmk068492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 12:44:27 +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: r325473 - stable/11/usr.bin/rsh X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/usr.bin/rsh X-SVN-Commit-Revision: 325473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 12:44:28 -0000 Author: eugen (ports committer) Date: Mon Nov 6 12:44:26 2017 New Revision: 325473 URL: https://svnweb.freebsd.org/changeset/base/325473 Log: MFC r324212: rsh: introduce new option -N disabling shutdown of socket sending path. PR: 205144 Approved by: mav (mentor) Modified: stable/11/usr.bin/rsh/rsh.1 stable/11/usr.bin/rsh/rsh.c Modified: stable/11/usr.bin/rsh/rsh.1 ============================================================================== --- stable/11/usr.bin/rsh/rsh.1 Mon Nov 6 11:11:44 2017 (r325472) +++ stable/11/usr.bin/rsh/rsh.1 Mon Nov 6 12:44:26 2017 (r325473) @@ -36,7 +36,7 @@ .Nd remote shell .Sh SYNOPSIS .Nm -.Op Fl 46dn +.Op Fl 46dnN .Op Fl l Ar username .Op Fl t Ar timeout .Ar host @@ -87,12 +87,22 @@ By default, the remote username is the same as the loc Authorization is determined as in .Xr rlogin 1 . +.It Fl N +Opposite to +.Fl n +option: do not send the "end of file" (EOF) indication for input stream +to the remote host. This option makes the +.Nm +utility compatible with protocol implementations confused by receiving +EOF, like some Cisco IOS versions. Disables +.Fl n . .It Fl n Redirect input from the special device .Pa /dev/null (see the .Sx BUGS -section of this manual page). +section of this manual page). Disables +.Fl N . .It Fl t Ar timeout Allow a .Ar timeout Modified: stable/11/usr.bin/rsh/rsh.c ============================================================================== --- stable/11/usr.bin/rsh/rsh.c Mon Nov 6 11:11:44 2017 (r325472) +++ stable/11/usr.bin/rsh/rsh.c Mon Nov 6 12:44:26 2017 (r325473) @@ -85,7 +85,7 @@ static char rlogin[] = "rlogin"; void connect_timeout(int); char *copyargs(char * const *); void sendsig(int); -void talk(int, long, pid_t, int, int); +void talk(int, int, long, pid_t, int, int); void usage(void); int @@ -94,13 +94,13 @@ main(int argc, char *argv[]) struct passwd const *pw; struct servent const *sp; long omask; - int argoff, asrsh, ch, dflag, nflag, one, rem; + int argoff, asrsh, ch, dflag, nflag, Nflag, one, rem; pid_t pid = 0; uid_t uid; char *args, *host, *p, *user; int timeout = 0; - argoff = asrsh = dflag = nflag = 0; + argoff = asrsh = dflag = nflag = Nflag = 0; one = 1; host = user = NULL; @@ -120,7 +120,7 @@ main(int argc, char *argv[]) argoff = 1; } -#define OPTIONS "468Lde:l:nt:w" +#define OPTIONS "468LNde:l:nt:w" while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1) switch(ch) { case '4': @@ -131,6 +131,10 @@ main(int argc, char *argv[]) family = PF_INET6; break; + case 'N': + Nflag = 1; + nflag = 0; + break; case 'L': /* -8Lew are ignored to allow rlogin aliases */ case 'e': case 'w': @@ -144,6 +148,7 @@ main(int argc, char *argv[]) break; case 'n': nflag = 1; + Nflag = 0; break; case 't': timeout = atoi(optarg); @@ -227,7 +232,7 @@ main(int argc, char *argv[]) (void)ioctl(rfd2, FIONBIO, &one); (void)ioctl(rem, FIONBIO, &one); - talk(nflag, omask, pid, rem, timeout); + talk(nflag, Nflag, omask, pid, rem, timeout); if (!nflag) (void)kill(pid, SIGKILL); @@ -235,7 +240,7 @@ main(int argc, char *argv[]) } void -talk(int nflag, long omask, pid_t pid, int rem, int timeout) +talk(int nflag, int Nflag, long omask, pid_t pid, int rem, int timeout) { int cc, wc; fd_set readfrom, ready, rembits; @@ -276,8 +281,8 @@ rewrite: if (cc == 0) goto reread; goto rewrite; -done: - (void)shutdown(rem, SHUT_WR); +done: if (!Nflag) + (void)shutdown(rem, SHUT_WR); exit(0); } @@ -371,6 +376,6 @@ usage(void) { (void)fprintf(stderr, - "usage: rsh [-46dn] [-l username] [-t timeout] host [command]\n"); + "usage: rsh [-46Ndn] [-l username] [-t timeout] host [command]\n"); exit(1); } From owner-svn-src-stable-11@freebsd.org Mon Nov 6 13:56:04 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60CDCE5EC8F; Mon, 6 Nov 2017 13:56:04 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E24A70032; Mon, 6 Nov 2017 13:56:04 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6Du3Ze097938; Mon, 6 Nov 2017 13:56:03 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6Du3Pa097937; Mon, 6 Nov 2017 13:56:03 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061356.vA6Du3Pa097937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 13:56: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: r325475 - stable/11/usr.sbin/ppp X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/usr.sbin/ppp X-SVN-Commit-Revision: 325475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 13:56:04 -0000 Author: eugen (ports committer) Date: Mon Nov 6 13:56:03 2017 New Revision: 325475 URL: https://svnweb.freebsd.org/changeset/base/325475 Log: MFC r325157,325158: Fix ppp(8) to add RTF_HOST flag to created host route. Reported by: Mike Tancsa Approved by: mav (mentor) Modified: stable/11/usr.sbin/ppp/route.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ppp/route.c ============================================================================== --- stable/11/usr.sbin/ppp/route.c Mon Nov 6 12:45:51 2017 (r325474) +++ stable/11/usr.sbin/ppp/route.c Mon Nov 6 13:56:03 2017 (r325475) @@ -801,7 +801,8 @@ rt_Set(struct bundle *bundle, int cmd, const struct nc if (!ncprange_ishost(dst)) { cp += memcpy_roundup(cp, &samask, samask.ss_len); rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; - } + } else + rtmes.m_rtm.rtm_flags |= RTF_HOST; nb = cp - (char *)&rtmes; rtmes.m_rtm.rtm_msglen = nb; @@ -905,7 +906,8 @@ rt_Update(struct bundle *bundle, const struct sockaddr if (mask) { rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; p += memcpy_roundup(p, mask, mask->sa_len); - } + } else + rtmes.m_rtm.rtm_flags |= RTF_HOST; if (ifa && ifp && ifp->sa_family == AF_LINK) { rtmes.m_rtm.rtm_addrs |= RTA_IFP; From owner-svn-src-stable-11@freebsd.org Mon Nov 6 14:15:12 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BD47E5F2DC; Mon, 6 Nov 2017 14:15:12 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 110C070A3A; Mon, 6 Nov 2017 14:15:11 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6EFBAp006665; Mon, 6 Nov 2017 14:15:11 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6EFBG4006664; Mon, 6 Nov 2017 14:15:11 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061415.vA6EFBG4006664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 14:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325476 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 325476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 14:15:12 -0000 Author: eugen (ports committer) Date: Mon Nov 6 14:15:10 2017 New Revision: 325476 URL: https://svnweb.freebsd.org/changeset/base/325476 Log: r325473 (MFC r324212) missed mergeinfo for unknown reason. Fix it. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Mon Nov 6 17:27:51 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8208E632F7; Mon, 6 Nov 2017 17:27:51 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 965837780A; Mon, 6 Nov 2017 17:27:51 +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 vA6HRotS088115; Mon, 6 Nov 2017 17:27:50 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6HRo0n088114; Mon, 6 Nov 2017 17:27:50 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711061727.vA6HRo0n088114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 6 Nov 2017 17:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325489 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 325489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 17:27:51 -0000 Author: gjb Date: Mon Nov 6 17:27:50 2017 New Revision: 325489 URL: https://svnweb.freebsd.org/changeset/base/325489 Log: Document issuing 'vagrant up' a second time will boot properly if the virtual machine does not yet have a MAC address. PR: 223474 (related) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Nov 6 16:41:29 2017 (r325488) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Mon Nov 6 17:27:50 2017 (r325489) @@ -196,6 +196,23 @@ boot The other utilities mentioned in the entry in the release notes, however, are unchanged. + + + [2017-11-06] An issue with &os; virtual machines with + vagrant was discovered that + affects the VirtualBox where the + virtual machine will not start on the initial boot invoked + with vagrant up. + + The issue is due to the virtual machine + MAC being unset, as &os; does not provide + a default Vagrantfile. + + It has been observed, however, that a subsequent + invocation of vagrant up will allow the + virtual machine to successfully boot, allowing access via + vagrant ssh. + From owner-svn-src-stable-11@freebsd.org Mon Nov 6 18:07:25 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A7FFE64061; Mon, 6 Nov 2017 18:07:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07B057D38F; Mon, 6 Nov 2017 18:07:24 +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 vA6I7O4v006067; Mon, 6 Nov 2017 18:07:24 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6I7Orq006066; Mon, 6 Nov 2017 18:07:24 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711061807.vA6I7Orq006066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 6 Nov 2017 18:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325491 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/tools 11/release/tools X-SVN-Commit-Revision: 325491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 18:07:25 -0000 Author: gjb Date: Mon Nov 6 18:07:23 2017 New Revision: 325491 URL: https://svnweb.freebsd.org/changeset/base/325491 Log: MFC r325156: Set a default hostname for virtual machine images. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Modified: stable/11/release/tools/vmimage.subr ============================================================================== --- stable/11/release/tools/vmimage.subr Mon Nov 6 17:59:04 2017 (r325490) +++ stable/11/release/tools/vmimage.subr Mon Nov 6 18:07:23 2017 (r325491) @@ -140,6 +140,10 @@ vm_install_base() { >> ${DESTDIR}/etc/fstab fi + local hostname + hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')" + echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf + mkdir -p ${DESTDIR}/dev mount -t devfs devfs ${DESTDIR}/dev chroot ${DESTDIR} /usr/bin/newaliases From owner-svn-src-stable-11@freebsd.org Mon Nov 6 20:08:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B31D6E66C5E; Mon, 6 Nov 2017 20:08:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85B2B8187E; Mon, 6 Nov 2017 20:08:01 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6K80K9074308; Mon, 6 Nov 2017 20:08:00 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6K80Xb074306; Mon, 6 Nov 2017 20:08:00 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201711062008.vA6K80Xb074306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 6 Nov 2017 20:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325495 - in stable/11: lib/libmt usr.bin/mt X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 325495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 20:08:01 -0000 Author: ken Date: Mon Nov 6 20:08:00 2017 New Revision: 325495 URL: https://svnweb.freebsd.org/changeset/base/325495 Log: MFC r325371 ------------------------------------------------------------------------ r325371 | ken | 2017-11-03 15:04:22 -0600 (Fri, 03 Nov 2017) | 19 lines Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the mt(1) man page. LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge formatted in a LTO-8 drive in a new, higher density format. It has a separate density code, and is only readable in an LTO-8 drive. lib/libmt/mtlib.c: Add the LTO-8 Type M density code to the density table in libmt. usr.bin/mt/mt.1: Add the LTO-8 Type M density code to the density table in the mt(1) man page. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/lib/libmt/mtlib.c stable/11/usr.bin/mt/mt.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libmt/mtlib.c ============================================================================== --- stable/11/lib/libmt/mtlib.c Mon Nov 6 19:54:25 2017 (r325494) +++ stable/11/lib/libmt/mtlib.c Mon Nov 6 20:08:00 2017 (r325495) @@ -645,6 +645,7 @@ static struct densities { { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, + { 0x5D, 19107, 485318, "LTO-M8" }, { 0x5E, 20669, 524993, "LTO-8" }, { 0x71, 11800, 299720, "3592A1 (encrypted)" }, { 0x72, 11800, 299720, "3592A2 (encrypted)" }, Modified: stable/11/usr.bin/mt/mt.1 ============================================================================== --- stable/11/usr.bin/mt/mt.1 Mon Nov 6 19:54:25 2017 (r325494) +++ stable/11/usr.bin/mt/mt.1 Mon Nov 6 20:08:00 2017 (r325495) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 11, 2017 +.Dd November 3, 2017 .Dt MT 1 .Os .Sh NAME @@ -522,6 +522,7 @@ Value Width Tracks Density Code Typ 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 +0x5D 12.7 (0.5) 5376 19,107 (485,318) C LTO-M8 14 0x5E 12.7 (0.5) 6656 20,669 (524,993) C LTO-8 0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted) 0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted) @@ -565,6 +566,10 @@ NOTES 12. This is Exabyte 8500 uncompressed format. The compressed format density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. +14. Officially known as LTO-8 Type M, abbreviated M8. This is a pristine + LTO-7 cartridge initialized with a higher density format by an LTO-8 + drive. It cannot be read by an LTO-7 drive. Uncompressed capacity + is 9TB, compared to 6TB for LTO-7 and 12TB for LTO-8. .Ed .Bd -literal -offset 2n NOTE ON QIC STREAMERS From owner-svn-src-stable-11@freebsd.org Tue Nov 7 14:26:26 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D055E5A7AE; Tue, 7 Nov 2017 14:26:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05F946A51F; Tue, 7 Nov 2017 14:26:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA7EPAFw015286; Tue, 7 Nov 2017 14:25:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA7EPAL4015285; Tue, 7 Nov 2017 14:25:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201711071425.vA7EPAL4015285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 7 Nov 2017 14:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325513 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 325513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 14:26:26 -0000 Author: pfg Date: Tue Nov 7 14:25:09 2017 New Revision: 325513 URL: https://svnweb.freebsd.org/changeset/base/325513 Log: MFC r325397: ANSI-fy exec_shell_imgact(). Fix a stray space while here. PR: 223317 Modified: stable/11/sys/kern/imgact_shell.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_shell.c ============================================================================== --- stable/11/sys/kern/imgact_shell.c Tue Nov 7 13:26:11 2017 (r325512) +++ stable/11/sys/kern/imgact_shell.c Tue Nov 7 14:25:09 2017 (r325513) @@ -97,8 +97,7 @@ CTASSERT(MAXSHELLCMDLEN >= MAXINTERP + 3); * 6.x branch on May 28, 2005 (matching __FreeBSD_version 600029). */ int -exec_shell_imgact(imgp) - struct image_params *imgp; +exec_shell_imgact(struct image_params *imgp) { const char *image_header = imgp->image_header; const char *ihp, *interpb, *interpe, *maxp, *optb, *opte, *fname; @@ -125,7 +124,7 @@ exec_shell_imgact(imgp) * However, we don't know how far into the page the contents are * valid -- the actual file might be much shorter than the page. * So find out the file size. - */ + */ error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred); if (error) return (error); From owner-svn-src-stable-11@freebsd.org Tue Nov 7 17:09:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A697E5E1FF; Tue, 7 Nov 2017 17:09:01 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45D33772BE; Tue, 7 Nov 2017 17:09:01 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA7H7j2B079834; Tue, 7 Nov 2017 17:07:45 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA7H7j8L079832; Tue, 7 Nov 2017 17:07:45 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201711071707.vA7H7j8L079832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Tue, 7 Nov 2017 17:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325518 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 325518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 17:09:01 -0000 Author: tijl Date: Tue Nov 7 17:07:45 2017 New Revision: 325518 URL: https://svnweb.freebsd.org/changeset/base/325518 Log: MFC r325232 Set the return address for stack entry points to zero. Stack unwinders treat zero as a stop condition. The value on the stack can be non-zero because thread stacks may be arbitrary memory provided via pthread_attr_setstack(3) or may be recycled from previous threads. Reference: https://lists.freebsd.org/pipermail/freebsd-current/2017-August/066855.html https://lists.freebsd.org/pipermail/freebsd-current/2017-October/067254.html Discussed with: kib Modified: stable/11/sys/amd64/amd64/vm_machdep.c stable/11/sys/i386/i386/vm_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/vm_machdep.c Tue Nov 7 16:59:52 2017 (r325517) +++ stable/11/sys/amd64/amd64/vm_machdep.c Tue Nov 7 17:07:45 2017 (r325518) @@ -511,6 +511,9 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * (((uintptr_t)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4; td->td_frame->tf_rip = (uintptr_t)entry; + /* Return address sentinel value to stop stack unwinding. */ + suword32((void *)td->td_frame->tf_rsp, 0); + /* Pass the argument to the entry point. */ suword32((void *)(td->td_frame->tf_rsp + sizeof(int32_t)), (uint32_t)(uintptr_t)arg); @@ -533,6 +536,9 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * td->td_frame->tf_fs = _ufssel; td->td_frame->tf_gs = _ugssel; td->td_frame->tf_flags = TF_HASSEGS; + + /* Return address sentinel value to stop stack unwinding. */ + suword((void *)td->td_frame->tf_rsp, 0); /* Pass the argument to the entry point. */ td->td_frame->tf_rdi = (register_t)arg; Modified: stable/11/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/11/sys/i386/i386/vm_machdep.c Tue Nov 7 16:59:52 2017 (r325517) +++ stable/11/sys/i386/i386/vm_machdep.c Tue Nov 7 17:07:45 2017 (r325518) @@ -530,6 +530,9 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * (((int)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4; td->td_frame->tf_eip = (int)entry; + /* Return address sentinel value to stop stack unwinding. */ + suword((void *)td->td_frame->tf_esp, 0); + /* Pass the argument to the entry point. */ suword((void *)(td->td_frame->tf_esp + sizeof(void *)), (int)arg); From owner-svn-src-stable-11@freebsd.org Wed Nov 8 00:40:20 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 805E6E68E85; Wed, 8 Nov 2017 00:40:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49C377BD90; Wed, 8 Nov 2017 00:40:20 +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 vA80d4R7061726; Wed, 8 Nov 2017 00:39:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA80d4Vj061725; Wed, 8 Nov 2017 00:39:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711080039.vA80d4Vj061725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 8 Nov 2017 00:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325523 - stable/11/contrib/llvm/lib/Support/Unix X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/llvm/lib/Support/Unix X-SVN-Commit-Revision: 325523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 00:40:20 -0000 Author: emaste Date: Wed Nov 8 00:39:04 2017 New Revision: 325523 URL: https://svnweb.freebsd.org/changeset/base/325523 Log: MFC r325420: lld: accept EINVAL to indicate posix_fallocate is unsupported As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to indicate that the operation is not supported. (I think this is a strange choice of errno on the part of POSIX.) PR: 223383, 223440 Reported by: Mark Millard Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/llvm/lib/Support/Unix/Path.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/lib/Support/Unix/Path.inc ============================================================================== --- stable/11/contrib/llvm/lib/Support/Unix/Path.inc Tue Nov 7 23:52:14 2017 (r325522) +++ stable/11/contrib/llvm/lib/Support/Unix/Path.inc Wed Nov 8 00:39:04 2017 (r325523) @@ -427,7 +427,7 @@ std::error_code resize_file(int FD, uint64_t Size) { // If we have posix_fallocate use it. Unlike ftruncate it always allocates // space, so we get an error if the disk is full. if (int Err = ::posix_fallocate(FD, 0, Size)) { - if (Err != EOPNOTSUPP) + if (Err != EINVAL && Err != EOPNOTSUPP) return std::error_code(Err, std::generic_category()); } #endif From owner-svn-src-stable-11@freebsd.org Wed Nov 8 08:53:46 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6541EE71961; Wed, 8 Nov 2017 08:53: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 mx1.freebsd.org (Postfix) with ESMTPS id F04CC70E72; Wed, 8 Nov 2017 08:53:45 +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 vA88rjSt063401; Wed, 8 Nov 2017 08:53:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA88ribj063395; Wed, 8 Nov 2017 08:53:44 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080853.vA88ribj063395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 08:53: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: r325534 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common cd... X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common cddl/contrib/opensolaris/li... X-SVN-Commit-Revision: 325534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 08:53:46 -0000 Author: avg Date: Wed Nov 8 08:53:44 2017 New Revision: 325534 URL: https://svnweb.freebsd.org/changeset/base/325534 Log: MFC r324163: MFV r323530,r323533,r323534: 7431 ZFS Channel Programs, and followups Also MFC-ed are the following fixes: - r324164 Add several new files to the files enabled by ZFS kernel option - r324178 unbreak kernel builds on sparc64 and powerpc - r324194 fix incorrect use of getzfsvfs_impl in r324163 - r324292 really unbreak kernel builds on sparc64 and powerpc64 Added: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 - copied unchanged from r324163, head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ - copied from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_global.h - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_global.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_iter.h - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_iter.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_prop.h - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp_prop.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c - copied, changed from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_iter.c - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_iter.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c - copied unchanged from r324163, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/11/cddl/lib/libzpool/Makefile stable/11/cddl/sbin/zfs/Makefile stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c stable/11/sys/cddl/compat/opensolaris/sys/sunddi.h stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/11/sys/conf/files stable/11/sys/conf/kern.pre.mk stable/11/sys/modules/zfs/Makefile Directory Properties: stable/11/ (props changed) Copied: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 (from r324163, head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 08:53:44 2017 (r325534, copy of r324163, head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8) @@ -0,0 +1,499 @@ +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2016 by Delphix. All Rights Reserved. +.\" +.Dd September 28, 2017 +.Dt ZFS-PROGRAM 1M +.Os +.Sh NAME +.Nm zfs program +.Nd executes ZFS channel programs +.Sh SYNOPSIS +.Cm zfs program +.Op Fl t Ar instruction-limit +.Op Fl m Ar memory-limit +.Ar pool +.Ar script +.\".Op Ar optional arguments to channel program +.Sh DESCRIPTION +The ZFS channel program interface allows ZFS administrative operations to be +run programmatically as a Lua script. +The entire script is executed atomically, with no other administrative +operations taking effect concurrently. +A library of ZFS calls is made available to channel program scripts. +Channel programs may only be run with root privileges. +.Pp +A modified version of the Lua 5.2 interpreter is used to run channel program +scripts. +The Lua 5.2 manual can be found at: +.Bd -centered -offset indent +.Lk http://www.lua.org/manual/5.2/ +.Ed +.Pp +The channel program given by +.Ar script +will be run on +.Ar pool , +and any attempts to access or modify other pools will cause an error. +.Sh OPTIONS +.Bl -tag -width "-t" +.It Fl t Ar instruction-limit +Execution time limit, in number of Lua instructions to execute. +If a channel program executes more than the specified number of instructions, +it will be stopped and an error will be returned. +The default limit is 10 million instructions, and it can be set to a maximum of +100 million instructions. +.It Fl m Ar memory-limit +Memory limit, in bytes. +If a channel program attempts to allocate more memory than the given limit, it +will be stopped and an error returned. +The default memory limit is 10 MB, and can be set to a maximum of 100 MB. +.El +.Pp +All remaining argument strings will be passed directly to the Lua script as +described in the +.Sx LUA INTERFACE +section below. +.Sh LUA INTERFACE +A channel program can be invoked either from the command line, or via a library +call to +.Fn lzc_channel_program . +.Ss Arguments +Arguments passed to the channel program are converted to a Lua table. +If invoked from the command line, extra arguments to the Lua script will be +accessible as an array stored in the argument table with the key 'argv': +.Bd -literal -offset indent +args = ... +argv = args["argv"] +-- argv == {1="arg1", 2="arg2", ...} +.Ed +.Pp +If invoked from the libZFS interface, an arbitrary argument list can be +passed to the channel program, which is accessible via the same +"..." syntax in Lua: +.Bd -literal -offset indent +args = ... +-- args == {"foo"="bar", "baz"={...}, ...} +.Ed +.Pp +Note that because Lua arrays are 1-indexed, arrays passed to Lua from the +libZFS interface will have their indices incremented by 1. +That is, the element +in +.Va arr[0] +in a C array passed to a channel program will be stored in +.Va arr[1] +when accessed from Lua. +.Ss Return Values +Lua return statements take the form: +.Bd -literal -offset indent +return ret0, ret1, ret2, ... +.Ed +.Pp +Return statements returning multiple values are permitted internally in a +channel program script, but attempting to return more than one value from the +top level of the channel program is not permitted and will throw an error. +However, tables containing multiple values can still be returned. +If invoked from the command line, a return statement: +.Bd -literal -offset indent +a = {foo="bar", baz=2} +return a +.Ed +.Pp +Will be output formatted as: +.Bd -literal -offset indent +Channel program fully executed with return value: + return: + baz: 2 + foo: 'bar' +.Ed +.Ss Fatal Errors +If the channel program encounters a fatal error while running, a non-zero exit +status will be returned. +If more information about the error is available, a singleton list will be +returned detailing the error: +.Bd -literal -offset indent +error: "error string, including Lua stack trace" +.Ed +.Pp +If a fatal error is returned, the channel program may have not executed at all, +may have partially executed, or may have fully executed but failed to pass a +return value back to userland. +.Pp +If the channel program exhausts an instruction or memory limit, a fatal error +will be generated and the program will be stopped, leaving the program partially +executed. +No attempt is made to reverse or undo any operations already performed. +Note that because both the instruction count and amount of memory used by a +channel program are deterministic when run against the same inputs and +filesystem state, as long as a channel program has run successfully once, you +can guarantee that it will finish successfully against a similar size system. +.Pp +If a channel program attempts to return too large a value, the program will +fully execute but exit with a nonzero status code and no return value. +.Pp +.Em Note: +ZFS API functions do not generate Fatal Errors when correctly invoked, they +return an error code and the channel program continues executing. +See the +.Sx ZFS API +section below for function-specific details on error return codes. +.Ss Lua to C Value Conversion +When invoking a channel program via the libZFS interface, it is necessary to +translate arguments and return values from Lua values to their C equivalents, +and vice-versa. +.Pp +There is a correspondence between nvlist values in C and Lua tables. +A Lua table which is returned from the channel program will be recursively +converted to an nvlist, with table values converted to their natural +equivalents: +.Bd -literal -offset indent +string -> string +number -> int64 +boolean -> boolean_value +nil -> boolean (no value) +table -> nvlist +.Ed +.Pp +Likewise, table keys are replaced by string equivalents as follows: +.Bd -literal -offset indent +string -> no change +number -> signed decimal string ("%lld") +boolean -> "true" | "false" +.Ed +.Pp +Any collision of table key strings (for example, the string "true" and a +true boolean value) will cause a fatal error. +.Pp +Lua numbers are represented internally as signed 64-bit integers. +.Sh LUA STANDARD LIBRARY +The following Lua built-in base library functions are available: +.Bd -literal -offset indent +assert rawlen +collectgarbage rawget +error rawset +getmetatable select +ipairs setmetatable +next tonumber +pairs tostring +rawequal type +.Ed +.Pp +All functions in the +.Em coroutine , +.Em string , +and +.Em table +built-in submodules are also available. +A complete list and documentation of these modules is available in the Lua +manual. +.Pp +The following functions base library functions have been disabled and are +not available for use in channel programs: +.Bd -literal -offset indent +dofile +loadfile +load +pcall +print +xpcall +.Ed +.Sh ZFS API +.Ss Function Arguments +Each API function takes a fixed set of required positional arguments and +optional keyword arguments. +For example, the destroy function takes a single positional string argument +(the name of the dataset to destroy) and an optional "defer" keyword boolean +argument. +When using parentheses to specify the arguments to a Lua function, only +positional arguments can be used: +.Bd -literal -offset indent +zfs.sync.destroy("rpool@snap") +.Ed +.Pp +To use keyword arguments, functions must be called with a single argument that +is a Lua table containing entries mapping integers to positional arguments and +strings to keyword arguments: +.Bd -literal -offset indent +zfs.sync.destroy({1="rpool@snap", defer=true}) +.Ed +.Pp +The Lua language allows curly braces to be used in place of parenthesis as +syntactic sugar for this calling convention: +.Bd -literal -offset indent +zfs.sync.snapshot{"rpool@snap", defer=true} +.Ed +.Ss Function Return Values +If an API function succeeds, it returns 0. +If it fails, it returns an error code and the channel program continues +executing. +API functions do not generate Fatal Errors except in the case of an +unrecoverable internal file system error. +.Pp +In addition to returning an error code, some functions also return extra +details describing what caused the error. +This extra description is given as a second return value, and will always be a +Lua table, or Nil if no error details were returned. +Different keys will exist in the error details table depending on the function +and error case. +Any such function may be called expecting a single return value: +.Bd -literal -offset indent +errno = zfs.sync.promote(dataset) +.Ed +.Pp +Or, the error details can be retrieved: +.Bd -literal -offset indent +errno, details = zfs.sync.promote(dataset) +if (errno == EEXIST) then + assert(details ~= Nil) + list_of_conflicting_snapshots = details +end +.Ed +.Pp +The following global aliases for API function error return codes are defined +for use in channel programs: +.Bd -literal -offset indent +EPERM ECHILD ENODEV ENOSPC +ENOENT EAGAIN ENOTDIR ESPIPE +ESRCH ENOMEM EISDIR EROFS +EINTR EACCES EINVAL EMLINK +EIO EFAULT ENFILE EPIPE +ENXIO ENOTBLK EMFILE EDOM +E2BIG EBUSY ENOTTY ERANGE +ENOEXEC EEXIST ETXTBSY EDQUOT +EBADF EXDEV EFBIG +.Ed +.Ss API Functions +For detailed descriptions of the exact behavior of any zfs administrative +operations, see the main +.Xr zfs 1 +manual page. +.Bl -tag -width "xx" +.It Em zfs.debug(msg) +Record a debug message in the zfs_dbgmsg log. +A log of these messages can be printed via mdb's "::zfs_dbgmsg" command, or +can be monitored live by running: +.Bd -literal -offset indent + dtrace -n 'zfs-dbgmsg{trace(stringof(arg0))}' +.Ed +.Pp +msg (string) +.Bd -ragged -compact -offset "xxxx" +Debug message to be printed. +.Ed +.It Em zfs.get_prop(dataset, property) +Returns two values. +First, a string, number or table containing the property value for the given +dataset. +Second, a string containing the source of the property (i.e. the name of the +dataset in which it was set or nil if it is readonly). +Throws a Lua error if the dataset is invalid or the property doesn't exist. +Note that Lua only supports int64 number types whereas ZFS number properties +are uint64. +This means very large values (like guid) may wrap around and appear negative. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Filesystem or snapshot path to retrieve properties from. +.Ed +.Pp +property (string) +.Bd -ragged -compact -offset "xxxx" +Name of property to retrieve. +All filesystem, snapshot and volume properties are supported except +for 'mounted' and 'iscsioptions.' +Also supports the 'written@snap' and 'written#bookmark' properties and +the '@id' properties, though the id must be in numeric +form. +.Ed +.El +.Bl -tag -width "xx" +.It Sy zfs.sync submodule +The sync submodule contains functions that modify the on-disk state. +They are executed in "syncing context". +.Pp +The available sync submodule functions are as follows: +.Bl -tag -width "xx" +.It Em zfs.sync.destroy(dataset, [defer=true|false]) +Destroy the given dataset. +Returns 0 on successful destroy, or a nonzero error code if the dataset could +not be destroyed (for example, if the dataset has any active children or +clones). +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Filesystem or snapshot to be destroyed. +.Ed +.Pp +[optional] defer (boolean) +.Bd -ragged -compact -offset "xxxx" +Valid only for destroying snapshots. +If set to true, and the snapshot has holds or clones, allows the snapshot to be +marked for deferred deletion rather than failing. +.Ed +.It Em zfs.sync.promote(dataset) +Promote the given clone to a filesystem. +Returns 0 on successful promotion, or a nonzero error code otherwise. +If EEXIST is returned, the second return value will be an array of the clone's +snapshots whose names collide with snapshots of the parent filesystem. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Clone to be promoted. +.Ed +.El +.It Sy zfs.check submodule +For each function in the zfs.sync submodule, there is a corresponding zfs.check +function which performs a "dry run" of the same operation. +Each takes the same arguments as its zfs.sync counterpart and returns 0 if the +operation would succeed, or a non-zero error code if it would fail, along with +any other error details. +That is, each has the same behavior as the corresponding sync function except +for actually executing the requested change. +For example, +.Em zfs.check.destroy("fs") +returns 0 if +.Em zfs.sync.destroy("fs") +would successfully destroy the dataset. +.Pp +The available zfs.check functions are: +.Bl -tag -width "xx" +.It Em zfs.check.destroy(dataset, [defer=true|false]) +.It Em zfs.check.promote(dataset) +.El +.It Sy zfs.list submodule +The zfs.list submodule provides functions for iterating over datasets and +properties. +Rather than returning tables, these functions act as Lua iterators, and are +generally used as follows: +.Bd -literal -offset indent +for child in zfs.list.children("rpool") do + ... +end +.Ed +.Pp +The available zfs.list functions are: +.Bl -tag -width "xx" +.It Em zfs.list.clones(snapshot) +Iterate through all clones of the given snapshot. +.Pp +snapshot (string) +.Bd -ragged -compact -offset "xxxx" +Must be a valid snapshot path in the current pool. +.Ed +.It Em zfs.list.snapshots(dataset) +Iterate through all snapshots of the given dataset. +Each snapshot is returned as a string containing the full dataset name, e.g. +"pool/fs@snap". +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Must be a valid filesystem or volume. +.Ed +.It Em zfs.list.children(dataset) +Iterate through all direct children of the given dataset. +Each child is returned as a string containing the full dataset name, e.g. +"pool/fs/child". +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Must be a valid filesystem or volume. +.Ed +.It Em zfs.list.properties(dataset) +Iterate through all user properties for the given dataset. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Must be a valid filesystem, snapshot, or volume. +.Ed +.It Em zfs.list.system_properties(dataset) +Returns an array of strings, the names of the valid system (non-user defined) +properties for the given dataset. +Throws a Lua error if the dataset is invalid. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Must be a valid filesystem, snapshot or volume. +.Ed +.El +.El +.Sh EXAMPLES +.Ss Example 1 +The following channel program recursively destroys a filesystem and all its +snapshots and children in a naive manner. +Note that this does not involve any error handling or reporting. +.Bd -literal -offset indent +function destroy_recursive(root) + for child in zfs.list.children(root) do + destroy_recursive(child) + end + for snap in zfs.list.snapshots(root) do + zfs.sync.destroy(snap) + end + zfs.sync.destroy(root) +end +destroy_recursive("pool/somefs") +.Ed +.Ss Example 2 +A more verbose and robust version of the same channel program, which +properly detects and reports errors, and also takes the dataset to destroy +as a command line argument, would be as follows: +.Bd -literal -offset indent +succeeded = {} +failed = {} + +function destroy_recursive(root) + for child in zfs.list.children(root) do + destroy_recursive(child) + end + for snap in zfs.list.snapshots(root) do + err = zfs.sync.destroy(snap) + if (err ~= 0) then + failed[snap] = err + else + succeeded[snap] = err + end + end + err = zfs.sync.destroy(root) + if (err ~= 0) then + failed[root] = err + else + succeeded[root] = err + end +end + +args = ... +argv = args["argv"] + +destroy_recursive(argv[1]) + +results = {} +results["succeeded"] = succeeded +results["failed"] = failed +return results +.Ed +.Ss Example 3 +The following function performs a forced promote operation by attempting to +promote the given clone and destroying any conflicting snapshots. +.Bd -literal -offset indent +function force_promote(ds) + errno, details = zfs.check.promote(ds) + if (errno == EEXIST) then + assert(details ~= Nil) + for i, snap in ipairs(details) do + zfs.sync.destroy(ds .. "@" .. snap) + end + elseif (errno ~= 0) then + return errno + end + return zfs.sync.promote(ds) +end +.Ed Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Nov 8 08:37:05 2017 (r325533) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Nov 8 08:53:44 2017 (r325534) @@ -286,6 +286,12 @@ .Ar snapshot .Op Ar snapshot Ns | Ns Ar filesystem .Nm +.Cm program +.Op Fl t Ar timeout +.Op Fl m Ar memory_limit +.Ar pool script +.Op Ar arg1 No ... +.Nm .Cm jail .Ar jailid Ns | Ns Ar jailname filesystem .Nm @@ -3284,6 +3290,48 @@ Give more parsable tab-separated output, without heade arrows. .It Fl t Display the path's inode change time as the first column of output. +.El +.It Xo +.Nm +.Cm program +.Op Fl t Ar timeout +.Op Fl m Ar memory_limit +.Ar pool script +.Op Ar arg1 No ... +.Xc +.Pp +Executes +.Ar script +as a ZFS channel program on +.Ar pool . +The ZFS channel +program interface allows ZFS administrative operations to be run +programmatically via a Lua script. +The entire script is executed atomically, with no other administrative +operations taking effect concurrently. +A library of ZFS calls is made available to channel program scripts. +Channel programs may only be run with root privileges. +.Pp +For full documentation of the ZFS channel program interface, see the manual +page for +.Xr zfs-program 8 . +.Bl -tag -width indent +.It Fl t Ar timeout +Execution time limit, in milliseconds. +If a channel program executes for longer than the provided timeout, it will +be stopped and an error will be returned. +The default timeout is 1000 ms, and can be set to a maximum of 10000 ms. +.It Fl m Ar memory-limit +Memory limit, in bytes. +If a channel program attempts to allocate more memory than the given limit, +it will be stopped and an error returned. +The default memory limit is 10 MB, and can be set to a maximum of 100 MB. +.Pp +All remaining argument strings are passed directly to the channel program as +arguments. +See +.Xr zfs-program 8 +for more information. .El .It Xo .Nm Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Nov 8 08:37:05 2017 (r325533) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Nov 8 08:53:44 2017 (r325534) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -111,6 +112,7 @@ static int zfs_do_diff(int argc, char **argv); static int zfs_do_jail(int argc, char **argv); static int zfs_do_unjail(int argc, char **argv); static int zfs_do_bookmark(int argc, char **argv); +static int zfs_do_channel_program(int argc, char **argv); /* * Enable a reasonable set of defaults for libumem debugging on DEBUG builds. @@ -160,6 +162,7 @@ typedef enum { HELP_RELEASE, HELP_DIFF, HELP_BOOKMARK, + HELP_CHANNEL_PROGRAM, } zfs_help_t; typedef struct zfs_command { @@ -187,6 +190,7 @@ static zfs_command_t command_table[] = { { "promote", zfs_do_promote, HELP_PROMOTE }, { "rename", zfs_do_rename, HELP_RENAME }, { "bookmark", zfs_do_bookmark, HELP_BOOKMARK }, + { "program", zfs_do_channel_program, HELP_CHANNEL_PROGRAM }, { NULL }, { "list", zfs_do_list, HELP_LIST }, { NULL }, @@ -340,6 +344,10 @@ get_usage(zfs_help_t idx) "[snapshot|filesystem]\n")); case HELP_BOOKMARK: return (gettext("\tbookmark \n")); + case HELP_CHANNEL_PROGRAM: + return (gettext("\tprogram [-t ] " + "[-m ] " + "[lua args...]\n")); } abort(); @@ -368,6 +376,18 @@ safe_malloc(size_t size) return (data); } +void * +safe_realloc(void *data, size_t size) +{ + void *newp; + if ((newp = realloc(data, size)) == NULL) { + free(data); + nomem(); + } + + return (newp); +} + static char * safe_strdup(char *str) { @@ -7094,6 +7114,194 @@ zfs_do_bookmark(int argc, char **argv) dgettext(TEXT_DOMAIN, err_msg)); } + return (ret != 0); + +usage: + usage(B_FALSE); + return (-1); +} + +static int +zfs_do_channel_program(int argc, char **argv) +{ + int ret, fd; + char c; + char *progbuf, *filename, *poolname; + size_t progsize, progread; + nvlist_t *outnvl; + uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT; + uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT; + zpool_handle_t *zhp; + + /* check options */ + while (-1 != + (c = getopt(argc, argv, "t:(instr-limit)m:(memory-limit)"))) { + switch (c) { + case 't': + case 'm': { + uint64_t arg; + char *endp; + + errno = 0; + arg = strtoull(optarg, &endp, 0); + if (errno != 0 || *endp != '\0') { + (void) fprintf(stderr, gettext( + "invalid argument " + "'%s': expected integer\n"), optarg); + goto usage; + } + + if (c == 't') { + if (arg > ZCP_MAX_INSTRLIMIT || arg == 0) { + (void) fprintf(stderr, gettext( + "Invalid instruction limit: " + "%s\n"), optarg); + return (1); + } else { + instrlimit = arg; + } + } else { + ASSERT3U(c, ==, 'm'); + if (arg > ZCP_MAX_MEMLIMIT || arg == 0) { + (void) fprintf(stderr, gettext( + "Invalid memory limit: " + "%s\n"), optarg); + return (1); + } else { + memlimit = arg; + } + } + break; + } + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + goto usage; + } + } + + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, + gettext("invalid number of arguments\n")); + goto usage; + } + + poolname = argv[0]; + filename = argv[1]; + if (strcmp(filename, "-") == 0) { + fd = 0; + filename = "standard input"; + } else if ((fd = open(filename, O_RDONLY)) < 0) { + (void) fprintf(stderr, gettext("cannot open '%s': %s\n"), + filename, strerror(errno)); + return (1); + } + + if ((zhp = zpool_open(g_zfs, poolname)) == NULL) { + (void) fprintf(stderr, gettext("cannot open pool '%s'"), + poolname); + return (1); + } + zpool_close(zhp); + + /* + * Read in the channel program, expanding the program buffer as + * necessary. + */ + progread = 0; + progsize = 1024; + progbuf = safe_malloc(progsize); + do { + ret = read(fd, progbuf + progread, progsize - progread); + progread += ret; + if (progread == progsize && ret > 0) { + progsize *= 2; + progbuf = safe_realloc(progbuf, progsize); + } + } while (ret > 0); + + if (fd != 0) + (void) close(fd); + if (ret < 0) { + free(progbuf); + (void) fprintf(stderr, + gettext("cannot read '%s': %s\n"), + filename, strerror(errno)); + return (1); + } + progbuf[progread] = '\0'; + + /* + * Any remaining arguments are passed as arguments to the lua script as + * a string array: + * { + * "argv" -> [ "arg 1", ... "arg n" ], + * } + */ + nvlist_t *argnvl = fnvlist_alloc(); + fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2); + + ret = lzc_channel_program(poolname, progbuf, instrlimit, memlimit, + argnvl, &outnvl); + + if (ret != 0) { + /* + * On error, report the error message handed back by lua if one + * exists. Otherwise, generate an appropriate error message, + * falling back on strerror() for an unexpected return code. + */ + char *errstring = NULL; + if (nvlist_exists(outnvl, ZCP_RET_ERROR)) { + (void) nvlist_lookup_string(outnvl, + ZCP_RET_ERROR, &errstring); + if (errstring == NULL) + errstring = strerror(ret); + } else { + switch (ret) { + case EINVAL: + errstring = + "Invalid instruction or memory limit."; + break; + case ENOMEM: + errstring = "Return value too large."; + break; + case ENOSPC: + errstring = "Memory limit exhausted."; + break; +#ifdef illumos + case ETIME: +#else + case ETIMEDOUT: +#endif + errstring = "Timed out."; + break; + case EPERM: + errstring = "Permission denied. Channel " + "programs must be run as root."; + break; + default: + errstring = strerror(ret); + } + } + (void) fprintf(stderr, + gettext("Channel program execution failed:\n%s\n"), + errstring); + } else { + (void) printf("Channel program fully executed "); + if (nvlist_empty(outnvl)) { + (void) printf("with no return value.\n"); + } else { + (void) printf("with return value:\n"); + dump_nvlist(outnvl, 4); + } + } + + free(progbuf); + fnvlist_free(outnvl); + fnvlist_free(argnvl); return (ret != 0); usage: Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Nov 8 08:37:05 2017 (r325533) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Nov 8 08:53:44 2017 (r325534) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. @@ -5253,6 +5253,11 @@ get_history_one(zpool_handle_t *zhp, void *data) (void) printf(" output:\n"); dump_nvlist(fnvlist_lookup_nvlist(rec, ZPOOL_HIST_OUTPUT_NVL), 8); + } + if (nvlist_exists(rec, ZPOOL_HIST_ERRNO)) { + (void) printf(" errno: %lld\n", + fnvlist_lookup_int64(rec, + ZPOOL_HIST_ERRNO)); } } else { if (!cb->internal) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Nov 8 08:37:05 2017 (r325533) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Nov 8 08:53:44 2017 (r325534) @@ -2356,6 +2356,74 @@ zfs_get_clones_nvl(zfs_handle_t *zhp) } /* + * Accepts a property and value and checks that the value + * matches the one found by the channel program. If they are + * not equal, print both of them. + */ +void +zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t intval, + const char *strval) +{ + if (!zhp->zfs_hdl->libzfs_prop_debug) + return; + int error; + char *poolname = zhp->zpool_hdl->zpool_name; + const char *program = + "args = ...\n" + "ds = args['dataset']\n" + "prop = args['property']\n" + "value, setpoint = zfs.get_prop(ds, prop)\n" + "return {value=value, setpoint=setpoint}\n"; + nvlist_t *outnvl; + nvlist_t *retnvl; + nvlist_t *argnvl = fnvlist_alloc(); + + fnvlist_add_string(argnvl, "dataset", zhp->zfs_name); + fnvlist_add_string(argnvl, "property", zfs_prop_to_name(prop)); + + error = lzc_channel_program(poolname, program, + 10 * 1000 * 1000, 10 * 1024 * 1024, argnvl, &outnvl); + + if (error == 0) { + retnvl = fnvlist_lookup_nvlist(outnvl, "return"); + if (zfs_prop_get_type(prop) == PROP_TYPE_NUMBER) { + int64_t ans; + error = nvlist_lookup_int64(retnvl, "value", &ans); + if (error != 0) { + (void) fprintf(stderr, "zcp check error: %u\n", + error); + return; + } + if (ans != intval) { + (void) fprintf(stderr, + "%s: zfs found %lld, but zcp found %lld\n", + zfs_prop_to_name(prop), + (longlong_t)intval, (longlong_t)ans); + } + } else { + char *str_ans; + error = nvlist_lookup_string(retnvl, "value", &str_ans); + if (error != 0) { + (void) fprintf(stderr, "zcp check error: %u\n", + error); + return; + } + if (strcmp(strval, str_ans) != 0) { + (void) fprintf(stderr, + "%s: zfs found %s, but zcp found %s\n", + zfs_prop_to_name(prop), + strval, str_ans); + } + } + } else { + (void) fprintf(stderr, + "zcp check failed, channel program error: %u\n", error); + } + nvlist_free(argnvl); + nvlist_free(outnvl); +} + +/* * Retrieve a property from the given object. If 'literal' is specified, then * numbers are left as exact values. Otherwise, numbers are converted to a * human-readable form. @@ -2401,6 +2469,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char &t) == 0) (void) snprintf(propbuf, proplen, "%llu", val); } + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_MOUNTPOINT: @@ -2469,7 +2538,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char /* 'legacy' or 'none' */ (void) strlcpy(propbuf, str, proplen); } - + zcp_check(zhp, prop, NULL, propbuf); break; case ZFS_PROP_ORIGIN: @@ -2477,6 +2546,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char if (str == NULL) return (-1); (void) strlcpy(propbuf, str, proplen); + zcp_check(zhp, prop, NULL, str); break; case ZFS_PROP_CLONES: @@ -2491,7 +2561,6 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char if (get_numeric_property(zhp, prop, src, &source, &val) != 0) return (-1); - /* * If quota or reservation is 0, we translate this into 'none' * (unless literal is set), and indicate that it's the default @@ -2510,6 +2579,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char else zfs_nicenum(val, propbuf, proplen); } + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_FILESYSTEM_LIMIT: @@ -2534,6 +2604,8 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char } else { zfs_nicenum(val, propbuf, proplen); } + + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_REFRATIO: @@ -2543,6 +2615,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char (void) snprintf(propbuf, proplen, "%llu.%02llux", (u_longlong_t)(val / 100), (u_longlong_t)(val % 100)); + zcp_check(zhp, prop, val, NULL); break; case ZFS_PROP_TYPE: @@ -2563,6 +2636,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char abort(); } (void) snprintf(propbuf, proplen, "%s", str); + zcp_check(zhp, prop, NULL, propbuf); break; case ZFS_PROP_MOUNTED: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:11:51 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13359E71F47; Wed, 8 Nov 2017 09:11:51 +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 mx1.freebsd.org (Postfix) with ESMTPS id D0A9D71836; Wed, 8 Nov 2017 09:11:50 +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 vA89Bnvs069729; Wed, 8 Nov 2017 09:11:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89Bn1g069727; Wed, 8 Nov 2017 09:11:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080911.vA89Bn1g069727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325535 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 325535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:11:51 -0000 Author: avg Date: Wed Nov 8 09:11:49 2017 New Revision: 325535 URL: https://svnweb.freebsd.org/changeset/base/325535 Log: MFC r324168: MFV r323531: 8521 nvlist memory leak in get_clones_stat() and spa_load_best() Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 08:53:44 2017 (r325534) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 09:11:49 2017 (r325535) @@ -1808,10 +1808,10 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) fnvlist_add_nvlist(propval, ZPROP_VALUE, val); fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES), propval); - } else { - nvlist_free(val); - nvlist_free(propval); } + + nvlist_free(val); + nvlist_free(propval); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 08:53:44 2017 (r325534) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 09:11:49 2017 (r325535) @@ -3101,6 +3101,8 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int if (config && (rewind_error || state != SPA_LOAD_RECOVER)) spa_config_set(spa, config); + else + nvlist_free(config); if (state == SPA_LOAD_RECOVER) { ASSERT3P(loadinfo, ==, NULL); From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:15:11 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C483E71FED; Wed, 8 Nov 2017 09:15:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEDAA71A1D; Wed, 8 Nov 2017 09:15:10 +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 vA89F920072066; Wed, 8 Nov 2017 09:15:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89F9Pl072064; Wed, 8 Nov 2017 09:15:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080915.vA89F9Pl072064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325536 - in stable/11: cddl/contrib/opensolaris/cmd/zfs 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/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 325536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:15:11 -0000 Author: avg Date: Wed Nov 8 09:15:09 2017 New Revision: 325536 URL: https://svnweb.freebsd.org/changeset/base/325536 Log: MFC r324170: MFV r323794: 8605 zfs channel programs: zfs.exists undocumented and non-working Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:11:49 2017 (r325535) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:15:09 2017 (r325536) @@ -289,6 +289,18 @@ msg (string) .Bd -ragged -compact -offset "xxxx" Debug message to be printed. .Ed +.It Em zfs.exists(dataset) +Returns true if the given dataset exists, or false if it doesn't. +A fatal error will be thrown if the dataset is not in the target pool. +That is, in a channel program running on rpool, +zfs.exists("rpool/nonexistent_fs") returns false, but +zfs.exists("somepool/fs_that_may_exist") will error. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Dataset to check for existence. +Must be in the target pool. +.Ed .It Em zfs.get_prop(dataset, property) Returns two values. First, a string, number or table containing the property value for the given Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Nov 8 09:11:49 2017 (r325535) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Nov 8 09:15:09 2017 (r325536) @@ -717,7 +717,7 @@ zcp_exists(lua_State *state) return (luaL_error(state, "unexpected error %d", error)); } - return (0); + return (1); } /* From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:16:33 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ACF1E72067; Wed, 8 Nov 2017 09:16:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id ED69671B8E; Wed, 8 Nov 2017 09:16:32 +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 vA89GWD0072187; Wed, 8 Nov 2017 09:16:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89GVnk072183; Wed, 8 Nov 2017 09:16:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080916.vA89GVnk072183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325537 - in stable/11: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 325537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:16:33 -0000 Author: avg Date: Wed Nov 8 09:16:31 2017 New Revision: 325537 URL: https://svnweb.freebsd.org/changeset/base/325537 Log: MFC r324196: MFV r323912: 8592 ZFS channel programs - rollback Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:15:09 2017 (r325536) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:16:31 2017 (r325537) @@ -8,9 +8,9 @@ .\" http://www.illumos.org/license/CDDL. .\" .\" -.\" Copyright (c) 2016 by Delphix. All Rights Reserved. +.\" Copyright (c) 2016, 2017 by Delphix. All rights reserved. .\" -.Dd September 28, 2017 +.Dd October 02, 2016 .Dt ZFS-PROGRAM 1M .Os .Sh NAME @@ -361,6 +361,17 @@ dataset (string) .Bd -ragged -compact -offset "xxxx" Clone to be promoted. .Ed +.It Em zfs.sync.rollback(filesystem) +Rollback to the previous snapshot for a dataset. +Returns 0 on successful rollback, or a nonzero error code otherwise. +Rollbacks can be performed on filesystems or zvols, but not on snapshots +or mounted datasets. +EBUSY is returned in the case where the filesystem is mounted. +.Pp +filesystem (string) +.Bd -ragged -compact -offset "xxxx" +Filesystem to rollback. +.Ed .El .It Sy zfs.check submodule For each function in the zfs.sync submodule, there is a corresponding zfs.check @@ -380,6 +391,7 @@ The available zfs.check functions are: .Bl -tag -width "xx" .It Em zfs.check.destroy(dataset, [defer=true|false]) .It Em zfs.check.promote(dataset) +.It Em zfs.check.rollback(filesystem) .El .It Sy zfs.list submodule The zfs.list submodule provides functions for iterating over datasets and Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 09:15:09 2017 (r325536) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 09:16:31 2017 (r325537) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -2538,14 +2538,7 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *own return (0); } -typedef struct dsl_dataset_rollback_arg { - const char *ddra_fsname; - const char *ddra_tosnap; - void *ddra_owner; - nvlist_t *ddra_result; -} dsl_dataset_rollback_arg_t; - -static int +int dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) { dsl_dataset_rollback_arg_t *ddra = arg; @@ -2653,7 +2646,7 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx) return (0); } -static void +void dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx) { dsl_dataset_rollback_arg_t *ddra = arg; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Nov 8 09:15:09 2017 (r325536) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Nov 8 09:16:31 2017 (r325537) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -237,6 +237,13 @@ typedef struct dsl_dataset_promote_arg { cred_t *cr; } dsl_dataset_promote_arg_t; +typedef struct dsl_dataset_rollback_arg { + const char *ddra_fsname; + const char *ddra_tosnap; + void *ddra_owner; + nvlist_t *ddra_result; +} dsl_dataset_rollback_arg_t; + /* * The max length of a temporary tag prefix is the number of hex digits * required to express UINT64_MAX plus one for the hyphen. @@ -375,6 +382,9 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_data void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx); boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds); boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds); + +int dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx); +void dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx); int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner, nvlist_t *result); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Wed Nov 8 09:15:09 2017 (r325536) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Wed Nov 8 09:16:31 2017 (r325537) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2016, 2017 by Delphix. All rights reserved. */ #include "lua.h" @@ -177,6 +177,37 @@ zcp_synctask_promote(lua_State *state, boolean_t sync, return (err); } +static int zcp_synctask_rollback(lua_State *, boolean_t, nvlist_t *err_details); +static zcp_synctask_info_t zcp_synctask_rollback_info = { + .name = "rollback", + .func = zcp_synctask_rollback, + .space_check = ZFS_SPACE_CHECK_RESERVED, + .blocks_modified = 1, + .pargs = { + {.za_name = "filesystem", .za_lua_type = LUA_TSTRING}, + {NULL, 0} + }, + .kwargs = { + {NULL, 0} + } +}; + +static int +zcp_synctask_rollback(lua_State *state, boolean_t sync, nvlist_t *err_details) +{ + int err; + const char *dsname = lua_tostring(state, 1); + dsl_dataset_rollback_arg_t ddra = { 0 }; + + ddra.ddra_fsname = dsname; + ddra.ddra_result = err_details; + + err = zcp_sync_task(state, dsl_dataset_rollback_check, + dsl_dataset_rollback_sync, &ddra, sync, dsname); + + return (err); +} + void zcp_synctask_wrapper_cleanup(void *arg) { @@ -247,6 +278,7 @@ zcp_load_synctask_lib(lua_State *state, boolean_t sync zcp_synctask_info_t *zcp_synctask_funcs[] = { &zcp_synctask_destroy_info, &zcp_synctask_promote_info, + &zcp_synctask_rollback_info, NULL }; From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:22:07 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FCBFE72259; Wed, 8 Nov 2017 09:22:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2B5771FA8; Wed, 8 Nov 2017 09:22:06 +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 vA89M5gC075396; Wed, 8 Nov 2017 09:22:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89M5Jr075387; Wed, 8 Nov 2017 09:22:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080922.vA89M5Jr075387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:22:05 +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: r325538 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/... X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 325538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:22:07 -0000 Author: avg Date: Wed Nov 8 09:22:04 2017 New Revision: 325538 URL: https://svnweb.freebsd.org/changeset/base/325538 Log: MFC r324197: MFV r323913: 8600 ZFS channel programs - snapshot Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Wed Nov 8 09:22:04 2017 (r325538) @@ -10,7 +10,7 @@ .\" .\" Copyright (c) 2016, 2017 by Delphix. All rights reserved. .\" -.Dd October 02, 2016 +.Dd October 02, 2017 .Dt ZFS-PROGRAM 1M .Os .Sh NAME @@ -372,6 +372,18 @@ filesystem (string) .Bd -ragged -compact -offset "xxxx" Filesystem to rollback. .Ed +.It Em zfs.sync.snapshot(dataset) +Create a snapshot of a filesystem. +Returns 0 if the snapshot was successfully created, +and a nonzero error code otherwise. +.Pp +Note: Taking a snapshot will fail on any pool older than legacy version 27. +To enable taking snapshots from ZCP scripts, the pool must be upgraded. +.Pp +dataset (string) +.Bd -ragged -compact -offset "xxxx" +Name of snapshot to create. +.Ed .El .It Sy zfs.check submodule For each function in the zfs.sync submodule, there is a corresponding zfs.check @@ -392,6 +404,7 @@ The available zfs.check functions are: .It Em zfs.check.destroy(dataset, [defer=true|false]) .It Em zfs.check.promote(dataset) .It Em zfs.check.rollback(filesystem) +.It Em zfs.check.snapshot(dataset) .El .It Sy zfs.list submodule The zfs.list submodule provides functions for iterating over datasets and Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Nov 8 09:22:04 2017 (r325538) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. @@ -160,7 +160,12 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, if (resultp != NULL) { *resultp = NULL; - zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024); + if (ioc == ZFS_IOC_CHANNEL_PROGRAM) { + zc.zc_nvlist_dst_size = fnvlist_lookup_uint64(source, + ZCP_ARG_MEMLIMIT); + } else { + zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024); + } zc.zc_nvlist_dst = (uint64_t)(uintptr_t) malloc(zc.zc_nvlist_dst_size); #ifdef illumos @@ -178,7 +183,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, * If ioctl exited with ENOMEM, we retry the ioctl after * increasing the size of the destination nvlist. * - * Channel programs that exit with ENOMEM probably ran over the + * Channel programs that exit with ENOMEM ran over the * lua memory sandbox; they should not be retried. */ if (errno == ENOMEM && resultp != NULL && Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Nov 8 09:22:04 2017 (r325538) @@ -1134,13 +1134,6 @@ dsl_dataset_snapshot_reserve_space(dsl_dataset_t *ds, return (0); } -typedef struct dsl_dataset_snapshot_arg { - nvlist_t *ddsa_snaps; - nvlist_t *ddsa_props; - nvlist_t *ddsa_errors; - cred_t *ddsa_cr; -} dsl_dataset_snapshot_arg_t; - int dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, const char *snapname, dmu_tx_t *tx, boolean_t recv, uint64_t cnt, cred_t *cr) @@ -1200,7 +1193,7 @@ dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, con return (0); } -static int +int dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx) { dsl_dataset_snapshot_arg_t *ddsa = arg; @@ -1477,7 +1470,7 @@ dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, cons spa_history_log_internal_ds(ds->ds_prev, "snapshot", tx, ""); } -static void +void dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx) { dsl_dataset_snapshot_arg_t *ddsa = arg; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Nov 8 09:22:04 2017 (r325538) @@ -244,6 +244,13 @@ typedef struct dsl_dataset_rollback_arg { nvlist_t *ddra_result; } dsl_dataset_rollback_arg_t; +typedef struct dsl_dataset_snapshot_arg { + nvlist_t *ddsa_snaps; + nvlist_t *ddsa_props; + nvlist_t *ddsa_errors; + cred_t *ddsa_cr; +} dsl_dataset_snapshot_arg_t; + /* * The max length of a temporary tag prefix is the number of hex digits * required to express UINT64_MAX plus one for the hyphen. @@ -276,6 +283,8 @@ uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *); uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin, uint64_t flags, dmu_tx_t *tx); +void dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx); +int dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx); int dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors); void dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx); int dsl_dataset_promote_check(void *arg, dmu_tx_t *tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Wed Nov 8 09:22:04 2017 (r325538) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2016, 2017 by Delphix. All rights reserved. */ #ifndef _SYS_ZCP_H @@ -136,8 +136,6 @@ typedef struct zcp_lib_info { const zcp_arg_t pargs[4]; const zcp_arg_t kwargs[2]; } zcp_lib_info_t; - -int zcp_nvlist_to_lua(lua_State *, nvlist_t *, char *, int); #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Wed Nov 8 09:22:04 2017 (r325538) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2016, 2017 by Delphix. All rights reserved. */ /* @@ -109,10 +109,15 @@ #define ETIME ETIMEDOUT #endif +#define ZCP_NVLIST_MAX_DEPTH 20 + uint64_t zfs_lua_check_instrlimit_interval = 100; uint64_t zfs_lua_max_instrlimit = ZCP_MAX_INSTRLIMIT; uint64_t zfs_lua_max_memlimit = ZCP_MAX_MEMLIMIT; +/* + * Forward declarations for mutually recursive functions + */ static int zcp_nvpair_value_to_lua(lua_State *, nvpair_t *, char *, int); static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); @@ -219,8 +224,6 @@ zcp_cleanup(lua_State *state) zcp_clear_cleanup(state); } } - -#define ZCP_NVLIST_MAX_DEPTH 20 /* * Convert the lua table at the given index on the Lua stack to an nvlist Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_global.c Wed Nov 8 09:22:04 2017 (r325538) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2016, 2017 by Delphix. All rights reserved. */ #include @@ -62,7 +62,12 @@ static const zcp_errno_global_t errno_globals[] = { {"EPIPE", EPIPE}, {"EDOM", EDOM}, {"ERANGE", ERANGE}, + {"EDEADLK", EDEADLK}, + {"ENOLCK", ENOLCK}, + {"ECANCELED", ECANCELED}, + {"ENOTSUP", ENOTSUP}, {"EDQUOT", EDQUOT}, + {"ENAMETOOLONG", ENAMETOOLONG}, {NULL, 0} }; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Wed Nov 8 09:22:04 2017 (r325538) @@ -39,10 +39,10 @@ typedef int (zcp_synctask_func_t)(lua_State *, boolean typedef struct zcp_synctask_info { const char *name; zcp_synctask_func_t *func; - zfs_space_check_t space_check; - int blocks_modified; const zcp_arg_t pargs[4]; const zcp_arg_t kwargs[2]; + zfs_space_check_t space_check; + int blocks_modified; } zcp_synctask_info_t; /* @@ -91,8 +91,6 @@ static int zcp_synctask_destroy(lua_State *, boolean_t static zcp_synctask_info_t zcp_synctask_destroy_info = { .name = "destroy", .func = zcp_synctask_destroy, - .space_check = ZFS_SPACE_CHECK_NONE, - .blocks_modified = 0, .pargs = { {.za_name = "filesystem | snapshot", .za_lua_type = LUA_TSTRING}, {NULL, 0} @@ -100,7 +98,9 @@ static zcp_synctask_info_t zcp_synctask_destroy_info = .kwargs = { {.za_name = "defer", .za_lua_type = LUA_TBOOLEAN}, {NULL, 0} - } + }, + .space_check = ZFS_SPACE_CHECK_NONE, + .blocks_modified = 0 }; /* ARGSUSED */ @@ -140,19 +140,19 @@ zcp_synctask_destroy(lua_State *state, boolean_t sync, return (err); } -static int zcp_synctask_promote(lua_State *, boolean_t, nvlist_t *err_details); +static int zcp_synctask_promote(lua_State *, boolean_t, nvlist_t *); static zcp_synctask_info_t zcp_synctask_promote_info = { .name = "promote", .func = zcp_synctask_promote, - .space_check = ZFS_SPACE_CHECK_RESERVED, - .blocks_modified = 3, .pargs = { {.za_name = "clone", .za_lua_type = LUA_TSTRING}, {NULL, 0} }, .kwargs = { {NULL, 0} - } + }, + .space_check = ZFS_SPACE_CHECK_RESERVED, + .blocks_modified = 3 }; static int @@ -208,6 +208,58 @@ zcp_synctask_rollback(lua_State *state, boolean_t sync return (err); } +static int zcp_synctask_snapshot(lua_State *, boolean_t, nvlist_t *); +static zcp_synctask_info_t zcp_synctask_snapshot_info = { + .name = "snapshot", + .func = zcp_synctask_snapshot, + .pargs = { + {.za_name = "filesystem@snapname | volume@snapname", + .za_lua_type = LUA_TSTRING}, + {NULL, 0} + }, + .kwargs = { + {NULL, 0} + }, + .space_check = ZFS_SPACE_CHECK_NORMAL, + .blocks_modified = 3 +}; + +/* ARGSUSED */ +static int +zcp_synctask_snapshot(lua_State *state, boolean_t sync, nvlist_t *err_details) +{ + int err; + dsl_dataset_snapshot_arg_t ddsa = { 0 }; + const char *dsname = lua_tostring(state, 1); + zcp_run_info_t *ri = zcp_run_info(state); + + /* + * We only allow for a single snapshot rather than a list, so the + * error list output is unnecessary. + */ + ddsa.ddsa_errors = NULL; + ddsa.ddsa_props = NULL; + ddsa.ddsa_cr = ri->zri_cred; + ddsa.ddsa_snaps = fnvlist_alloc(); + fnvlist_add_boolean(ddsa.ddsa_snaps, dsname); + + /* + * On old pools, the ZIL must not be active when a snapshot is created, + * but we can't suspend the ZIL because we're already in syncing + * context. + */ + if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { + return (ENOTSUP); + } + + err = zcp_sync_task(state, dsl_dataset_snapshot_check, + dsl_dataset_snapshot_sync, &ddsa, sync, dsname); + + fnvlist_free(ddsa.ddsa_snaps); + + return (err); +} + void zcp_synctask_wrapper_cleanup(void *arg) { @@ -279,6 +331,7 @@ zcp_load_synctask_lib(lua_State *state, boolean_t sync &zcp_synctask_destroy_info, &zcp_synctask_promote_info, &zcp_synctask_rollback_info, + &zcp_synctask_snapshot_info, NULL }; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 8 09:16:31 2017 (r325537) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 8 09:22:04 2017 (r325538) @@ -27,7 +27,7 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014, 2016 Joyent, Inc. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -3789,7 +3789,7 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t if (instrlimit == 0 || instrlimit > zfs_lua_max_instrlimit) return (EINVAL); - if (memlimit == 0 || memlimit > ZCP_MAX_MEMLIMIT) + if (memlimit == 0 || memlimit > zfs_lua_max_memlimit) return (EINVAL); return (zcp_eval(poolname, program, instrlimit, memlimit, From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:25:33 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FF06E723B8; Wed, 8 Nov 2017 09:25:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 590B1721E6; Wed, 8 Nov 2017 09:25:33 +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 vA89PWAV076473; Wed, 8 Nov 2017 09:25:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89PWXG076472; Wed, 8 Nov 2017 09:25:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080925.vA89PWXG076472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325539 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 325539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:25:33 -0000 Author: avg Date: Wed Nov 8 09:25:32 2017 New Revision: 325539 URL: https://svnweb.freebsd.org/changeset/base/325539 Log: MFC r324757: remove spa_sync_on assert from spa_async_thread_vd Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 09:22:04 2017 (r325538) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 09:25:32 2017 (r325539) @@ -6252,8 +6252,6 @@ spa_async_thread_vd(void *arg) spa_t *spa = arg; int tasks; - ASSERT(spa->spa_sync_on); - mutex_enter(&spa->spa_async_lock); tasks = spa->spa_async_tasks; retry: From owner-svn-src-stable-11@freebsd.org Wed Nov 8 09:37:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FAD8E7267B; Wed, 8 Nov 2017 09:37: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 mx1.freebsd.org (Postfix) with ESMTPS id 4EDEE727C3; Wed, 8 Nov 2017 09:37: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 vA89b0Dh080835; Wed, 8 Nov 2017 09:37:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89b056080828; Wed, 8 Nov 2017 09:37:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080937.vA89b056080828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325541 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 325541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:37:01 -0000 Author: avg Date: Wed Nov 8 09:36:59 2017 New Revision: 325541 URL: https://svnweb.freebsd.org/changeset/base/325541 Log: MFC r324195: MFV r323795: 8604 Avoid unnecessary work search in VFS when unmounting snapshots Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Wed Nov 8 09:35:06 2017 (r325540) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Wed Nov 8 09:36:59 2017 (r325541) @@ -488,23 +488,29 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d if (nvlist_next_nvpair(snaps, NULL) == NULL) return (0); - nvlist_t *arg = fnvlist_alloc(); - nvlist_t *snaps_normalized = fnvlist_alloc(); /* * lzc_destroy_snaps() is documented to take an nvlist whose - * values "don't matter". We need to convert that nvlist to one - * that we know can be converted to LUA. + * values "don't matter". We need to convert that nvlist to + * one that we know can be converted to LUA. We also don't + * care about any duplicate entries because the nvlist will + * be converted to a LUA table which should take care of this. */ + nvlist_t *snaps_normalized; + VERIFY0(nvlist_alloc(&snaps_normalized, 0, KM_SLEEP)); for (nvpair_t *pair = nvlist_next_nvpair(snaps, NULL); pair != NULL; pair = nvlist_next_nvpair(snaps, pair)) { fnvlist_add_boolean_value(snaps_normalized, nvpair_name(pair), B_TRUE); } + + nvlist_t *arg; + VERIFY0(nvlist_alloc(&arg, 0, KM_SLEEP)); fnvlist_add_nvlist(arg, "snaps", snaps_normalized); fnvlist_free(snaps_normalized); fnvlist_add_boolean_value(arg, "defer", defer); - nvlist_t *wrapper = fnvlist_alloc(); + nvlist_t *wrapper; + VERIFY0(nvlist_alloc(&wrapper, 0, KM_SLEEP)); fnvlist_add_nvlist(wrapper, ZCP_ARG_ARGLIST, arg); fnvlist_free(arg); @@ -538,7 +544,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d program, 0, zfs_lua_max_memlimit, - fnvlist_lookup_nvpair(wrapper, ZCP_ARG_ARGLIST), result); + nvlist_next_nvpair(wrapper, NULL), result); if (error != 0) { char *errorstr = NULL; (void) nvlist_lookup_string(result, ZCP_RET_ERROR, &errorstr); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Nov 8 09:35:06 2017 (r325540) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Wed Nov 8 09:36:59 2017 (r325541) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved. - * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright 2016 RackTop Systems. * Copyright (c) 2014 Integros [integros.com] */ @@ -424,9 +424,10 @@ extern int zfs_secpolicy_snapshot_perms(const char *, extern int zfs_secpolicy_rename_perms(const char *, const char *, cred_t *); extern int zfs_secpolicy_destroy_perms(const char *, cred_t *); extern int zfs_busy(void); -extern int zfs_unmount_snap(const char *); +extern void zfs_unmount_snap(const char *); extern void zfs_destroy_unmount_origin(const char *); extern int getzfsvfs_impl(struct objset *, struct zfsvfs **); +extern int getzfsvfs(const char *, struct zfsvfs **); /* * ZFS minor numbers can refer to either a control device instance or Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 8 09:35:06 2017 (r325540) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 8 09:36:59 2017 (r325541) @@ -1459,7 +1459,8 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp) return (error); } -static int +#ifdef illumos +int getzfsvfs(const char *dsname, zfsvfs_t **zfvp) { objset_t *os; @@ -1471,16 +1472,44 @@ getzfsvfs(const char *dsname, zfsvfs_t **zfvp) error = getzfsvfs_impl(os, zfvp); dmu_objset_rele(os, FTAG); - if (error == 0) { - error = vfs_busy((*zfvp)->z_vfs, 0); - vfs_rel((*zfvp)->z_vfs); - if (error != 0) { - *zfvp = NULL; - error = SET_ERROR(ESRCH); - } + return (error); +} + +#else + +static int +getzfsvfs_ref(const char *dsname, zfsvfs_t **zfvp) +{ + objset_t *os; + int error; + + error = dmu_objset_hold(dsname, FTAG, &os); + if (error != 0) + return (error); + + error = getzfsvfs_impl(os, zfvp); + dmu_objset_rele(os, FTAG); + return (error); +} + +int +getzfsvfs(const char *dsname, zfsvfs_t **zfvp) +{ + objset_t *os; + int error; + + error = getzfsvfs_ref(dsname, zfvp); + if (error != 0) + return (error); + error = vfs_busy((*zfvp)->z_vfs, 0); + vfs_rel((*zfvp)->z_vfs); + if (error != 0) { + *zfvp = NULL; + error = SET_ERROR(ESRCH); } return (error); } +#endif /* * Find a zfsvfs_t for a mounted filesystem, or create our own, in which @@ -3054,27 +3083,6 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc) return (error); } -/* - * Search the vfs list for a specified resource. Returns a pointer to it - * or NULL if no suitable entry is found. The caller of this routine - * is responsible for releasing the returned vfs pointer. - */ -static vfs_t * -zfs_get_vfs(const char *resource) -{ - vfs_t *vfsp; - - mtx_lock(&mountlist_mtx); - TAILQ_FOREACH(vfsp, &mountlist, mnt_list) { - if (strcmp(refstr_value(vfsp->vfs_resource), resource) == 0) { - vfs_ref(vfsp); - break; - } - } - mtx_unlock(&mountlist_mtx); - return (vfsp); -} - /* ARGSUSED */ static void zfs_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx) @@ -3556,30 +3564,29 @@ zfs_ioc_nextboot(const char *unused, nvlist_t *innvl, * Returns 0 if the argument is not a snapshot, or it is not currently a * filesystem, or we were able to unmount it. Returns error code otherwise. */ -int +void zfs_unmount_snap(const char *snapname) { - vfs_t *vfsp; - zfsvfs_t *zfsvfs; -#ifdef illumos - int err; -#endif + vfs_t *vfsp = NULL; + zfsvfs_t *zfsvfs = NULL; if (strchr(snapname, '@') == NULL) - return (0); + return; - vfsp = zfs_get_vfs(snapname); - if (vfsp == NULL) - return (0); + int err = getzfsvfs_ref(snapname, &zfsvfs); + if (err != 0) { + ASSERT3P(zfsvfs, ==, NULL); + return; + } + vfsp = zfsvfs->z_vfs; - zfsvfs = vfsp->vfs_data; ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os))); #ifdef illumos err = vn_vfswlock(vfsp->vfs_vnodecovered); VFS_RELE(vfsp); if (err != 0) - return (SET_ERROR(err)); + return; #endif /* @@ -3590,14 +3597,14 @@ zfs_unmount_snap(const char *snapname) #else (void) dounmount(vfsp, MS_FORCE, curthread); #endif - return (0); } /* ARGSUSED */ static int zfs_unmount_snap_cb(const char *snapname, void *arg) { - return (zfs_unmount_snap(snapname)); + zfs_unmount_snap(snapname); + return (0); } /* @@ -3620,7 +3627,7 @@ zfs_destroy_unmount_origin(const char *fsname) char originname[ZFS_MAX_DATASET_NAME_LEN]; dsl_dataset_name(ds->ds_prev, originname); dmu_objset_rele(os, FTAG); - (void) zfs_unmount_snap(originname); + zfs_unmount_snap(originname); } else { dmu_objset_rele(os, FTAG); } @@ -3661,9 +3668,7 @@ zfs_ioc_destroy_snaps(const char *poolname, nvlist_t * (name[poollen] != '/' && name[poollen] != '@')) return (SET_ERROR(EXDEV)); - error = zfs_unmount_snap(name); - if (error != 0) - return (error); + zfs_unmount_snap(nvpair_name(pair)); #if defined(__FreeBSD__) zvol_remove_minors(name); #endif @@ -3809,11 +3814,8 @@ zfs_ioc_destroy(zfs_cmd_t *zc) { int err; - if (zc->zc_objset_type == DMU_OST_ZFS) { - err = zfs_unmount_snap(zc->zc_name); - if (err != 0) - return (err); - } + if (zc->zc_objset_type == DMU_OST_ZFS) + zfs_unmount_snap(zc->zc_name); if (strchr(zc->zc_name, '@')) err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy); @@ -3885,7 +3887,9 @@ recursive_unmount(const char *fsname, void *arg) char fullname[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname); - return (zfs_unmount_snap(fullname)); + zfs_unmount_snap(fullname); + + return (0); } /* From owner-svn-src-stable-11@freebsd.org Wed Nov 8 11:25:21 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C14FE4F788; Wed, 8 Nov 2017 11:25:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1399C75826; Wed, 8 Nov 2017 11:25:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8BPKV8027440; Wed, 8 Nov 2017 11:25:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8BPJwH027434; Wed, 8 Nov 2017 11:25:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081125.vA8BPJwH027434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 11:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325542 - in stable/11/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Commit-Revision: 325542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 11:25:21 -0000 Author: kib Date: Wed Nov 8 11:25:19 2017 New Revision: 325542 URL: https://svnweb.freebsd.org/changeset/base/325542 Log: MFC r325270: Consistently ensure that we do not load MXCSR with reserved bits set. Modified: stable/11/sys/amd64/amd64/fpu.c stable/11/sys/amd64/amd64/machdep.c stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/isa/npx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/fpu.c ============================================================================== --- stable/11/sys/amd64/amd64/fpu.c Wed Nov 8 09:36:59 2017 (r325541) +++ stable/11/sys/amd64/amd64/fpu.c Wed Nov 8 11:25:19 2017 (r325542) @@ -806,6 +806,7 @@ fpusetregs(struct thread *td, struct savefpu *addr, ch struct pcb *pcb; int error; + addr->sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Wed Nov 8 09:36:59 2017 (r325541) +++ stable/11/sys/amd64/amd64/machdep.c Wed Nov 8 11:25:19 2017 (r325542) @@ -2248,7 +2248,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - struct savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -2261,9 +2260,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char error = 0; } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpstate = (struct savefpu *)&mcp->mc_fpstate; - fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; - error = fpusetregs(td, fpstate, xfpustate, xfpustate_len); + error = fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); } else return (EINVAL); return (error); Modified: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Wed Nov 8 09:36:59 2017 (r325541) +++ stable/11/sys/i386/i386/machdep.c Wed Nov 8 11:25:19 2017 (r325542) @@ -3147,7 +3147,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - union savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -3161,10 +3160,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char error = 0; } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpstate = (union savefpu *)&mcp->mc_fpstate; - if (cpu_fxsr) - fpstate->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; - error = npxsetregs(td, fpstate, xfpustate, xfpustate_len); + error = npxsetregs(td, (union savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); } else return (EINVAL); return (error); Modified: stable/11/sys/i386/isa/npx.c ============================================================================== --- stable/11/sys/i386/isa/npx.c Wed Nov 8 09:36:59 2017 (r325541) +++ stable/11/sys/i386/isa/npx.c Wed Nov 8 11:25:19 2017 (r325542) @@ -1053,6 +1053,8 @@ npxsetregs(struct thread *td, union savefpu *addr, cha if (!hw_float) return (ENXIO); + if (cpu_fxsr) + addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { From owner-svn-src-stable-11@freebsd.org Wed Nov 8 11:44:04 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 143C9E4FE02; Wed, 8 Nov 2017 11:44:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFAA6761C1; Wed, 8 Nov 2017 11:44:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8Bi2mI035477; Wed, 8 Nov 2017 11:44:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8Bi2ft035476; Wed, 8 Nov 2017 11:44:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081144.vA8Bi2ft035476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 11:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325544 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 325544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 11:44:04 -0000 Author: kib Date: Wed Nov 8 11:44:02 2017 New Revision: 325544 URL: https://svnweb.freebsd.org/changeset/base/325544 Log: MFC r325285, r325447: Restore an optimization that was temporary disabled by r324665. Modified: stable/11/sys/amd64/amd64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Wed Nov 8 11:39:42 2017 (r325543) +++ stable/11/sys/amd64/amd64/pmap.c Wed Nov 8 11:44:02 2017 (r325544) @@ -2896,8 +2896,8 @@ reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) { - struct pv_chunk *pc, *pc_marker; - struct pv_chunk_header pc_marker_b; + struct pv_chunk *pc, *pc_marker, *pc_marker_end; + struct pv_chunk_header pc_marker_b, pc_marker_end_b; struct md_page *pvh; pd_entry_t *pde; pmap_t next_pmap, pmap; @@ -2910,6 +2910,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l uint64_t inuse; int bit, field, freed; bool start_di; + static int active_reclaims = 0; PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); @@ -2918,7 +2919,9 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PG_G = PG_A = PG_M = PG_RW = 0; SLIST_INIT(&free); bzero(&pc_marker_b, sizeof(pc_marker_b)); + bzero(&pc_marker_end_b, sizeof(pc_marker_end_b)); pc_marker = (struct pv_chunk *)&pc_marker_b; + pc_marker_end = (struct pv_chunk *)&pc_marker_end_b; /* * A delayed invalidation block should already be active if @@ -2928,12 +2931,21 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l start_di = pmap_not_in_di(); mtx_lock(&pv_chunks_mutex); + active_reclaims++; TAILQ_INSERT_HEAD(&pv_chunks, pc_marker, pc_lru); - while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != NULL && + TAILQ_INSERT_TAIL(&pv_chunks, pc_marker_end, pc_lru); + while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != pc_marker_end && SLIST_EMPTY(&free)) { next_pmap = pc->pc_pmap; - if (next_pmap == NULL) /* marker */ + if (next_pmap == NULL) { + /* + * The next chunk is a marker. However, it is + * not our marker, so active_reclaims must be + * > 1. Consequently, the next_chunk code + * will not rotate the pv_chunks list. + */ goto next_chunk; + } mtx_unlock(&pv_chunks_mutex); /* @@ -3047,8 +3059,24 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l next_chunk: TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); TAILQ_INSERT_AFTER(&pv_chunks, pc, pc_marker, pc_lru); + if (active_reclaims == 1 && pmap != NULL) { + /* + * Rotate the pv chunks list so that we do not + * scan the same pv chunks that could not be + * freed (because they contained a wired + * and/or superpage mapping) on every + * invocation of reclaim_pv_chunk(). + */ + while ((pc = TAILQ_FIRST(&pv_chunks)) != pc_marker) { + MPASS(pc->pc_pmap != NULL); + TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); + } + } } TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); + TAILQ_REMOVE(&pv_chunks, pc_marker_end, pc_lru); + active_reclaims--; mtx_unlock(&pv_chunks_mutex); reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di); if (m_pc == NULL && !SLIST_EMPTY(&free)) { From owner-svn-src-stable-11@freebsd.org Wed Nov 8 11:47:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFF7DE5009F; Wed, 8 Nov 2017 11:47:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA3A97645D; Wed, 8 Nov 2017 11:47:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8Bl0j3035623; Wed, 8 Nov 2017 11:47:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8Bl0Mq035622; Wed, 8 Nov 2017 11:47:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081147.vA8Bl0Mq035622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 11:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325545 - stable/11/usr.bin/top X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.bin/top X-SVN-Commit-Revision: 325545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 11:47:02 -0000 Author: kib Date: Wed Nov 8 11:47:00 2017 New Revision: 325545 URL: https://svnweb.freebsd.org/changeset/base/325545 Log: MFC r324972: Tweaks to the top swap size calculations. PR: 223149 Modified: stable/11/usr.bin/top/machine.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Wed Nov 8 11:44:02 2017 (r325544) +++ stable/11/usr.bin/top/machine.c Wed Nov 8 11:47:00 2017 (r325545) @@ -1671,8 +1671,9 @@ static int swapmode(int *retavail, int *retfree) { int n; - int pagesize = getpagesize(); struct kvm_swap swapary[1]; + static int pagesize = 0; + static u_long swap_maxpages = 0; *retavail = 0; *retfree = 0; @@ -1682,6 +1683,16 @@ swapmode(int *retavail, int *retfree) n = kvm_getswapinfo(kd, swapary, 1, 0); if (n < 0 || swapary[0].ksw_total == 0) return (0); + + if (pagesize == 0) + pagesize = getpagesize(); + if (swap_maxpages == 0) + GETSYSCTL("vm.swap_maxpages", swap_maxpages); + + /* ksw_total contains the total size of swap all devices which may + exceed the maximum swap size allocatable in the system */ + if ( swapary[0].ksw_total > swap_maxpages ) + swapary[0].ksw_total = swap_maxpages; *retavail = CONVERT(swapary[0].ksw_total); *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used); From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:00:51 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29C79E50A71; Wed, 8 Nov 2017 12:00:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7DD076DF9; Wed, 8 Nov 2017 12:00:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8C0nF8042405; Wed, 8 Nov 2017 12:00:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8C0npY042404; Wed, 8 Nov 2017 12:00:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081200.vA8C0npY042404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325546 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 325546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:00:51 -0000 Author: kib Date: Wed Nov 8 12:00:49 2017 New Revision: 325546 URL: https://svnweb.freebsd.org/changeset/base/325546 Log: MFC r325271: Use designated initializers for pmc sysent and module data. Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 11:47:00 2017 (r325545) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:00:49 2017 (r325546) @@ -311,27 +311,23 @@ SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_syspm /* The `sysent' for the new syscall */ static struct sysent pmc_sysent = { - 2, /* sy_narg */ - pmc_syscall_handler /* sy_call */ + .sy_narg = 2, + .sy_call = pmc_syscall_handler, }; static struct syscall_module_data pmc_syscall_mod = { - load, - NULL, - &pmc_syscall_num, - &pmc_sysent, -#if (__FreeBSD_version >= 1100000) - { 0, NULL }, - SY_THR_STATIC_KLD, -#else - { 0, NULL } -#endif + .chainevh = load, + .chainarg = NULL, + .offset = &pmc_syscall_num, + .new_sysent = &pmc_sysent, + .old_sysent = { .sy_narg = 0, .sy_call = NULL }, + .flags = SY_THR_STATIC_KLD, }; static moduledata_t pmc_mod = { - PMC_MODULE_NAME, - syscall_module_handler, - &pmc_syscall_mod + .name = PMC_MODULE_NAME, + .evhand = syscall_module_handler, + .priv = &pmc_syscall_mod, }; #ifdef EARLY_AP_STARTUP From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:03:12 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B926DE510BF; Wed, 8 Nov 2017 12:03:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79E347729D; Wed, 8 Nov 2017 12:03:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8C3BJ7044220; Wed, 8 Nov 2017 12:03:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8C3BGi044219; Wed, 8 Nov 2017 12:03:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081203.vA8C3BGi044219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325547 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 325547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:03:12 -0000 Author: kib Date: Wed Nov 8 12:03:11 2017 New Revision: 325547 URL: https://svnweb.freebsd.org/changeset/base/325547 Log: MFC r325273: Minor style tweaks. Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:00:49 2017 (r325546) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:03:11 2017 (r325547) @@ -2876,8 +2876,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a error = 0; atomic_add_int(&pmc_stats.pm_syscalls, 1); - switch(op) - { + switch (op) { /* @@ -4037,7 +4036,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a PICKUP_GIANT(); - return error; + return (error); } /* From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:07:03 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D99AE51258; Wed, 8 Nov 2017 12:07:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBFEB7749B; Wed, 8 Nov 2017 12:07: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 vA8C714R044399; Wed, 8 Nov 2017 12:07:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8C71xd044398; Wed, 8 Nov 2017 12:07:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081207.vA8C71xd044398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325548 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 325548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:07:03 -0000 Author: kib Date: Wed Nov 8 12:07:01 2017 New Revision: 325548 URL: https://svnweb.freebsd.org/changeset/base/325548 Log: MFC r325274: There is no use for dropping Giant in the pmc syscall. Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:03:11 2017 (r325547) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:07:01 2017 (r325548) @@ -2860,8 +2860,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_a PMC_GET_SX_XLOCK(ENOSYS); - DROP_GIANT(); - is_sx_downgraded = 0; is_sx_locked = 1; @@ -4033,8 +4031,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_a if (error) atomic_add_int(&pmc_stats.pm_syscall_errors, 1); - - PICKUP_GIANT(); return (error); } From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:10:15 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ABE7E51330; Wed, 8 Nov 2017 12:10:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D0BF7761C; Wed, 8 Nov 2017 12:10:15 +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 vA8CAE0Q044576; Wed, 8 Nov 2017 12:10:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8CAE8M044575; Wed, 8 Nov 2017 12:10:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081210.vA8CAE8M044575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:10: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: r325549 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 325549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:10:15 -0000 Author: kib Date: Wed Nov 8 12:10:14 2017 New Revision: 325549 URL: https://svnweb.freebsd.org/changeset/base/325549 Log: MFC r325275: In hwpmc, do not double-close the logging file. Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:07:01 2017 (r325548) +++ stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:10:14 2017 (r325549) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -254,6 +255,7 @@ pmclog_loop(void *arg) struct ucred *ownercred; struct ucred *mycred; struct thread *td; + sigset_t unb; struct uio auio; struct iovec aiov; size_t nbytes; @@ -261,6 +263,11 @@ pmclog_loop(void *arg) po = (struct pmc_owner *) arg; p = po->po_owner; td = curthread; + + SIGEMPTYSET(unb); + SIGADDSET(unb, SIGHUP); + (void)kern_sigprocmask(td, SIG_UNBLOCK, &unb, NULL, 0); + mycred = td->td_ucred; PROC_LOCK(p); @@ -295,16 +302,8 @@ pmclog_loop(void *arg) mtx_unlock_spin(&po->po_mtx); /* No more buffers and shutdown required. */ - if (po->po_flags & PMC_PO_SHUTDOWN) { - mtx_unlock(&pmc_kthread_mtx); - /* - * Close the file to get PMCLOG_EOF - * error in pmclog(3). - */ - fo_close(po->po_file, curthread); - mtx_lock(&pmc_kthread_mtx); + if (po->po_flags & PMC_PO_SHUTDOWN) break; - } (void) msleep(po, &pmc_kthread_mtx, PWAIT, "pmcloop", 0); @@ -545,19 +544,16 @@ pmclog_schedule_io(struct pmc_owner *po) static void pmclog_stop_kthread(struct pmc_owner *po) { - /* - * Close the file to force the thread out of fo_write, - * unset flag, wakeup the helper thread, - * wait for it to exit - */ - if (po->po_file != NULL) - fo_close(po->po_file, curthread); - mtx_lock(&pmc_kthread_mtx); po->po_flags &= ~PMC_PO_OWNS_LOGFILE; + if (po->po_kthread != NULL) { + PROC_LOCK(po->po_kthread); + kern_psignal(po->po_kthread, SIGHUP); + PROC_UNLOCK(po->po_kthread); + } wakeup_one(po); - if (po->po_kthread) + while (po->po_kthread) msleep(po->po_kthread, &pmc_kthread_mtx, PPAUSE, "pmckstp", 0); mtx_unlock(&pmc_kthread_mtx); } From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:11:56 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F384CE51446; Wed, 8 Nov 2017 12:11:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDBD0779B8; Wed, 8 Nov 2017 12:11:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA8CBs5F048323; Wed, 8 Nov 2017 12:11:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8CBsV6048322; Wed, 8 Nov 2017 12:11:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081211.vA8CBsV6048322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:11: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: r325550 - stable/11/sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/hwpmc X-SVN-Commit-Revision: 325550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:11:56 -0000 Author: kib Date: Wed Nov 8 12:11:54 2017 New Revision: 325550 URL: https://svnweb.freebsd.org/changeset/base/325550 Log: MFC r325276: Be protective and check the po_file validity before dropping the ref. Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:10:14 2017 (r325549) +++ stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:11:54 2017 (r325550) @@ -685,8 +685,11 @@ pmclog_deconfigure_log(struct pmc_owner *po) } /* drop a reference to the fd */ - error = fdrop(po->po_file, curthread); - po->po_file = NULL; + if (po->po_file != NULL) { + error = fdrop(po->po_file, curthread); + po->po_file = NULL; + } else + error = 0; po->po_error = 0; return (error); From owner-svn-src-stable-11@freebsd.org Wed Nov 8 12:13:27 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17060E51678; Wed, 8 Nov 2017 12:13: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 mx1.freebsd.org (Postfix) with ESMTPS id E283F77B5E; Wed, 8 Nov 2017 12:13:26 +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 vA8CDPZY048446; Wed, 8 Nov 2017 12:13:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8CDPdA048443; Wed, 8 Nov 2017 12:13:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081213.vA8CDPdA048443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 12:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325551 - in stable/11/sys: dev/hwpmc sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: dev/hwpmc sys X-SVN-Commit-Revision: 325551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 12:13:27 -0000 Author: kib Date: Wed Nov 8 12:13:25 2017 New Revision: 325551 URL: https://svnweb.freebsd.org/changeset/base/325551 Log: MFC r325277: Do not run pmclog_configure_log() without pmc_sx protection. Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c stable/11/sys/dev/hwpmc/hwpmc_mod.c stable/11/sys/sys/pmclog.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:11:54 2017 (r325550) +++ stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 8 12:13:25 2017 (r325551) @@ -239,6 +239,54 @@ pmclog_get_buffer(struct pmc_owner *po) return (plb ? 0 : ENOMEM); } +struct pmclog_proc_init_args { + struct proc *kthr; + struct pmc_owner *po; + bool exit; + bool acted; +}; + +int +pmclog_proc_create(struct thread *td, void **handlep) +{ + struct pmclog_proc_init_args *ia; + int error; + + ia = malloc(sizeof(*ia), M_TEMP, M_WAITOK | M_ZERO); + error = kproc_create(pmclog_loop, ia, &ia->kthr, + RFHIGHPID, 0, "hwpmc: proc(%d)", td->td_proc->p_pid); + if (error == 0) + *handlep = ia; + return (error); +} + +void +pmclog_proc_ignite(void *handle, struct pmc_owner *po) +{ + struct pmclog_proc_init_args *ia; + + ia = handle; + mtx_lock(&pmc_kthread_mtx); + MPASS(!ia->acted); + MPASS(ia->po == NULL); + MPASS(!ia->exit); + MPASS(ia->kthr != NULL); + if (po == NULL) { + ia->exit = true; + } else { + ia->po = po; + KASSERT(po->po_kthread == NULL, + ("[pmclog,%d] po=%p kthread (%p) already present", + __LINE__, po, po->po_kthread)); + po->po_kthread = ia->kthr; + } + wakeup(ia); + while (!ia->acted) + msleep(ia, &pmc_kthread_mtx, PWAIT, "pmclogw", 0); + mtx_unlock(&pmc_kthread_mtx); + free(ia, M_TEMP); +} + /* * Log handler loop. * @@ -248,7 +296,7 @@ pmclog_get_buffer(struct pmc_owner *po) static void pmclog_loop(void *arg) { - int error; + struct pmclog_proc_init_args *ia; struct pmc_owner *po; struct pmclog_buffer *lb; struct proc *p; @@ -259,15 +307,34 @@ pmclog_loop(void *arg) struct uio auio; struct iovec aiov; size_t nbytes; + int error; - po = (struct pmc_owner *) arg; - p = po->po_owner; td = curthread; SIGEMPTYSET(unb); SIGADDSET(unb, SIGHUP); (void)kern_sigprocmask(td, SIG_UNBLOCK, &unb, NULL, 0); + ia = arg; + MPASS(ia->kthr == curproc); + MPASS(!ia->acted); + mtx_lock(&pmc_kthread_mtx); + while (ia->po == NULL && !ia->exit) + msleep(ia, &pmc_kthread_mtx, PWAIT, "pmclogi", 0); + if (ia->exit) { + ia->acted = true; + wakeup(ia); + mtx_unlock(&pmc_kthread_mtx); + kproc_exit(0); + } + MPASS(ia->po != NULL); + po = ia->po; + ia->acted = true; + wakeup(ia); + mtx_unlock(&pmc_kthread_mtx); + ia = NULL; + + p = po->po_owner; mycred = td->td_ucred; PROC_LOCK(p); @@ -572,15 +639,11 @@ pmclog_stop_kthread(struct pmc_owner *po) int pmclog_configure_log(struct pmc_mdep *md, struct pmc_owner *po, int logfd) { - int error; struct proc *p; cap_rights_t rights; - /* - * As long as it is possible to get a LOR between pmc_sx lock and - * proctree/allproc sx locks used for adding a new process, assure - * the former is not held here. - */ - sx_assert(&pmc_sx, SA_UNLOCKED); + int error; + + sx_assert(&pmc_sx, SA_XLOCKED); PMCDBG2(LOG,CFG,1, "config po=%p logfd=%d", po, logfd); p = po->po_owner; @@ -589,9 +652,6 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_o if (po->po_flags & PMC_PO_OWNS_LOGFILE) return (EBUSY); - KASSERT(po->po_kthread == NULL, - ("[pmclog,%d] po=%p kthread (%p) already present", __LINE__, po, - po->po_kthread)); KASSERT(po->po_file == NULL, ("[pmclog,%d] po=%p file (%p) already present", __LINE__, po, po->po_file)); @@ -604,10 +664,6 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_o /* mark process as owning a log file */ po->po_flags |= PMC_PO_OWNS_LOGFILE; - error = kproc_create(pmclog_loop, po, &po->po_kthread, - RFHIGHPID, 0, "hwpmc: proc(%d)", p->p_pid); - if (error) - goto error; /* mark process as using HWPMCs */ PROC_LOCK(p); @@ -624,10 +680,6 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_o return (0); error: - /* shutdown the thread */ - if (po->po_kthread) - pmclog_stop_kthread(po); - KASSERT(po->po_kthread == NULL, ("[pmclog,%d] po=%p kthread not " "stopped", __LINE__, po)); Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:11:54 2017 (r325550) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 8 12:13:25 2017 (r325551) @@ -2854,20 +2854,31 @@ static const char *pmc_op_to_name[] = { static int pmc_syscall_handler(struct thread *td, void *syscall_args) { - int error, is_sx_downgraded, is_sx_locked, op; + int error, is_sx_downgraded, op; struct pmc_syscall_args *c; + void *pmclog_proc_handle; void *arg; - PMC_GET_SX_XLOCK(ENOSYS); - - is_sx_downgraded = 0; - is_sx_locked = 1; - - c = (struct pmc_syscall_args *) syscall_args; - + c = (struct pmc_syscall_args *)syscall_args; op = c->pmop_code; arg = c->pmop_data; + if (op == PMC_OP_CONFIGURELOG) { + /* + * We cannot create the logging process inside + * pmclog_configure_log() because there is a LOR + * between pmc_sx and process structure locks. + * Instead, pre-create the process and ignite the loop + * if everything is fine, otherwise direct the process + * to exit. + */ + error = pmclog_proc_create(td, &pmclog_proc_handle); + if (error != 0) + goto done_syscall; + } + PMC_GET_SX_XLOCK(ENOSYS); + is_sx_downgraded = 0; + PMCDBG3(MOD,PMS,1, "syscall op=%d \"%s\" arg=%p", op, pmc_op_to_name[op], arg); @@ -2890,15 +2901,16 @@ pmc_syscall_handler(struct thread *td, void *syscall_a struct pmc_owner *po; struct pmc_op_configurelog cl; - sx_assert(&pmc_sx, SX_XLOCKED); - - if ((error = copyin(arg, &cl, sizeof(cl))) != 0) + if ((error = copyin(arg, &cl, sizeof(cl))) != 0) { + pmclog_proc_ignite(pmclog_proc_handle, NULL); break; + } /* mark this process as owning a log file */ p = td->td_proc; if ((po = pmc_find_owner_descriptor(p)) == NULL) if ((po = pmc_allocate_owner_descriptor(p)) == NULL) { + pmclog_proc_ignite(pmclog_proc_handle, NULL); error = ENOMEM; break; } @@ -2910,10 +2922,11 @@ pmc_syscall_handler(struct thread *td, void *syscall_a * de-configure it. */ if (cl.pm_logfd >= 0) { - sx_xunlock(&pmc_sx); - is_sx_locked = 0; error = pmclog_configure_log(md, po, cl.pm_logfd); + pmclog_proc_ignite(pmclog_proc_handle, error == 0 ? + po : NULL); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { + pmclog_proc_ignite(pmclog_proc_handle, NULL); pmclog_process_closelog(po); error = pmclog_close(po); if (error == 0) { @@ -2923,11 +2936,10 @@ pmc_syscall_handler(struct thread *td, void *syscall_a pmc_stop(pm); error = pmclog_deconfigure_log(po); } - } else + } else { + pmclog_proc_ignite(pmclog_proc_handle, NULL); error = EINVAL; - - if (error) - break; + } } break; @@ -4022,13 +4034,11 @@ pmc_syscall_handler(struct thread *td, void *syscall_a break; } - if (is_sx_locked != 0) { - if (is_sx_downgraded) - sx_sunlock(&pmc_sx); - else - sx_xunlock(&pmc_sx); - } - + if (is_sx_downgraded) + sx_sunlock(&pmc_sx); + else + sx_xunlock(&pmc_sx); +done_syscall: if (error) atomic_add_int(&pmc_stats.pm_syscall_errors, 1); Modified: stable/11/sys/sys/pmclog.h ============================================================================== --- stable/11/sys/sys/pmclog.h Wed Nov 8 12:11:54 2017 (r325550) +++ stable/11/sys/sys/pmclog.h Wed Nov 8 12:13:25 2017 (r325551) @@ -260,6 +260,8 @@ int pmclog_deconfigure_log(struct pmc_owner *_po); int pmclog_flush(struct pmc_owner *_po); int pmclog_close(struct pmc_owner *_po); void pmclog_initialize(void); +int pmclog_proc_create(struct thread *td, void **handlep); +void pmclog_proc_ignite(void *handle, struct pmc_owner *po); void pmclog_process_callchain(struct pmc *_pm, struct pmc_sample *_ps); void pmclog_process_closelog(struct pmc_owner *po); void pmclog_process_dropnotify(struct pmc_owner *po); From owner-svn-src-stable-11@freebsd.org Thu Nov 9 17:47:35 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59B0FE56FE4; Thu, 9 Nov 2017 17:47:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FFF670B23; Thu, 9 Nov 2017 17:47:35 +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 vA9HlY6l002663; Thu, 9 Nov 2017 17:47:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9HlYki002662; Thu, 9 Nov 2017 17:47:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091747.vA9HlYki002662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:47: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: r325600 - stable/11/sys/ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/include/rdma X-SVN-Commit-Revision: 325600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:47:35 -0000 Author: hselasky Date: Thu Nov 9 17:47:33 2017 New Revision: 325600 URL: https://svnweb.freebsd.org/changeset/base/325600 Log: MFC r324492: Make sure the IPv6 scope ID gets zeroed inside the GID. Else searching for a valid GID entry based on IPv6 addresses can fail. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/include/rdma/ib_addr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_addr.h Thu Nov 9 17:02:20 2017 (r325599) +++ stable/11/sys/ofed/include/rdma/ib_addr.h Thu Nov 9 17:47:33 2017 (r325600) @@ -157,6 +157,12 @@ static inline int rdma_ip2gid(struct sockaddr *addr, u case AF_INET6: memcpy(gid->raw, &((struct sockaddr_in6 *)addr)->sin6_addr, 16); + /* make sure scope ID gets zeroed inside GID */ + if (IN6_IS_SCOPE_LINKLOCAL((struct in6_addr *)gid->raw) || + IN6_IS_ADDR_MC_INTFACELOCAL((struct in6_addr *)gid->raw)) { + gid->raw[2] = 0; + gid->raw[3] = 0; + } break; default: return -EINVAL; From owner-svn-src-stable-11@freebsd.org Thu Nov 9 17:49:46 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8377BE5705C; Thu, 9 Nov 2017 17:49: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 mx1.freebsd.org (Postfix) with ESMTPS id 5D15C70C93; Thu, 9 Nov 2017 17:49: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 vA9HnjbQ002787; Thu, 9 Nov 2017 17:49:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9HnjEJ002786; Thu, 9 Nov 2017 17:49:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091749.vA9HnjEJ002786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325601 - stable/11/sys/contrib/rdma/krping X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/contrib/rdma/krping X-SVN-Commit-Revision: 325601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:49:46 -0000 Author: hselasky Date: Thu Nov 9 17:49:45 2017 New Revision: 325601 URL: https://svnweb.freebsd.org/changeset/base/325601 Log: MFC r324490: Add support for parsing and using IPv6 addresses in krping. Sponsored by: Mellanox Technologies Modified: stable/11/sys/contrib/rdma/krping/krping.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/11/sys/contrib/rdma/krping/krping.c Thu Nov 9 17:47:33 2017 (r325600) +++ stable/11/sys/contrib/rdma/krping/krping.c Thu Nov 9 17:49:45 2017 (r325601) @@ -85,6 +85,7 @@ static const struct krping_option krping_opts[] = { {"count", OPT_INT, 'C'}, {"size", OPT_INT, 'S'}, {"addr", OPT_STRING, 'a'}, + {"addr6", OPT_STRING, 'A'}, {"port", OPT_INT, 'p'}, {"verbose", OPT_NOPARAM, 'v'}, {"validate", OPT_NOPARAM, 'V'}, @@ -219,7 +220,11 @@ struct krping_cb { struct krping_stats stats; uint16_t port; /* dst port in NBO */ - struct in_addr addr; /* dst addr in NBO */ + union { + struct in_addr v4; + struct in6_addr v6; + } addr; /* dst addr in NBO */ + int addr_type; /* AF_INET or AF_INET6 */ char *addr_str; /* dst addr string */ int verbose; /* verbose logging */ int count; /* ping count */ @@ -1599,15 +1604,31 @@ static int fastreg_supported(struct krping_cb *cb, int static int krping_bind_server(struct krping_cb *cb) { - struct sockaddr_in sin; + union { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } sin; int ret; memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof sin; - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = cb->addr.s_addr; - sin.sin_port = cb->port; + switch (cb->addr_type) { + case AF_INET: + sin.v4.sin_len = sizeof sin.v4; + sin.v4.sin_family = AF_INET; + sin.v4.sin_addr = cb->addr.v4; + sin.v4.sin_port = cb->port; + break; + case AF_INET6: + sin.v6.sin6_len = sizeof sin.v6; + sin.v6.sin6_family = AF_INET6; + sin.v6.sin6_addr = cb->addr.v6; + sin.v6.sin6_port = cb->port; + break; + default: + return (-EINVAL); + } + ret = rdma_bind_addr(cb->cm_id, (struct sockaddr *) &sin); if (ret) { PRINTF(cb, "rdma_bind_addr error %d\n", ret); @@ -3058,15 +3079,31 @@ static int krping_connect_client(struct krping_cb *cb) static int krping_bind_client(struct krping_cb *cb) { - struct sockaddr_in sin; + union { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } sin; int ret; memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof sin; - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = cb->addr.s_addr; - sin.sin_port = cb->port; + switch (cb->addr_type) { + case AF_INET: + sin.v4.sin_len = sizeof sin.v4; + sin.v4.sin_family = AF_INET; + sin.v4.sin_addr = cb->addr.v4; + sin.v4.sin_port = cb->port; + break; + case AF_INET6: + sin.v6.sin6_len = sizeof sin.v6; + sin.v6.sin6_family = AF_INET6; + sin.v6.sin6_addr = cb->addr.v6; + sin.v6.sin6_port = cb->port; + break; + default: + return (-EINVAL); + } + ret = rdma_resolve_addr(cb->cm_id, NULL, (struct sockaddr *) &sin, 2000); if (ret) { @@ -3139,12 +3176,29 @@ err1: krping_free_qp(cb); } +static uint16_t +krping_get_ipv6_scope_id(char *name) +{ + struct ifnet *ifp; + uint16_t retval; + + if (name == NULL) + return (0); + ifp = ifunit_ref(name); + if (ifp == NULL) + return (0); + retval = ifp->if_index; + if_rele(ifp); + return (retval); +} + int krping_doit(char *cmd, void *cookie) { struct krping_cb *cb; int op; int ret = 0; char *optarg; + char *scope; unsigned long optint; cb = kzalloc(sizeof(*cb), GFP_KERNEL); @@ -3161,6 +3215,7 @@ int krping_doit(char *cmd, void *cookie) cb->size = 64; cb->txdepth = RPING_SQ_DEPTH; cb->mem = DMA; + cb->addr_type = AF_INET; init_waitqueue_head(&cb->sem); while ((op = krping_getopt("krping", &cmd, krping_opts, NULL, &optarg, @@ -3168,11 +3223,33 @@ int krping_doit(char *cmd, void *cookie) switch (op) { case 'a': cb->addr_str = optarg; - DEBUG_LOG(cb, "ipaddr (%s)\n", optarg); - if (!inet_aton(optarg, &cb->addr)) { + cb->addr_type = AF_INET; + DEBUG_LOG(cb, "ipv4addr (%s)\n", optarg); + if (inet_pton(AF_INET, optarg, &cb->addr) != 1) { PRINTF(cb, "bad addr string %s\n", optarg); ret = EINVAL; + } + break; + case 'A': + cb->addr_str = optarg; + cb->addr_type = AF_INET6; + DEBUG_LOG(cb, "ipv6addr (%s)\n", optarg); + scope = strstr(optarg, "%"); + /* extract scope ID, if any */ + if (scope != NULL) + *scope++ = 0; + /* extract IPv6 network address */ + if (inet_pton(AF_INET6, optarg, &cb->addr) != 1) { + PRINTF(cb, "bad addr string %s\n", + optarg); + ret = EINVAL; + } else if (IN6_IS_SCOPE_LINKLOCAL(&cb->addr.v6) || + IN6_IS_ADDR_MC_INTFACELOCAL(&cb->addr.v6)) { + uint16_t scope_id = krping_get_ipv6_scope_id(scope); + DEBUG_LOG(cb, "ipv6 scope ID = %d\n", scope_id); + cb->addr.v6.s6_addr[2] = scope_id >> 8; + cb->addr.v6.s6_addr[3] = scope_id & 0xFF; } break; case 'p': From owner-svn-src-stable-11@freebsd.org Thu Nov 9 17:54:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2132E572E9; Thu, 9 Nov 2017 17:54:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBBC7118A; Thu, 9 Nov 2017 17:54:01 +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 vA9Hs0VT006993; Thu, 9 Nov 2017 17:54:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9Hs08J006992; Thu, 9 Nov 2017 17:54:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091754.vA9Hs08J006992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325603 - stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 325603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:54:02 -0000 Author: hselasky Date: Thu Nov 9 17:54:00 2017 New Revision: 325603 URL: https://svnweb.freebsd.org/changeset/base/325603 Log: MFC r324491: Use common rdma_ip2gid() function instead of custom mlx5_ip2gid() one. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 17:51:55 2017 (r325602) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 17:54:00 2017 (r325603) @@ -562,26 +562,6 @@ mlx5_make_default_gid(struct net_device *dev, union ib mlx5_addrconf_ifid_eui48(&gid->raw[8], dev); } -static inline int -mlx5_ip2gid(const struct sockaddr *addr, union ib_gid *gid) -{ - switch (addr->sa_family) { - case AF_INET: - ipv6_addr_set_v4mapped(((const struct sockaddr_in *)addr)->sin_addr.s_addr, - (struct in6_addr *)gid->raw); - break; - case AF_INET6: - memcpy(gid->raw, &((const struct sockaddr_in6 *)addr)->sin6_addr, 16); - /* clear SCOPE ID */ - gid->raw[2] = 0; - gid->raw[3] = 0; - break; - default: - return -EINVAL; - } - return 0; -} - static void mlx5_ib_roce_port_update(void *arg) { @@ -639,7 +619,7 @@ mlx5_ib_roce_port_update(void *arg) gid_index >= MLX5_IB_GID_MAX) continue; memset(&gid_temp, 0, sizeof(gid_temp)); - mlx5_ip2gid(ifa->ifa_addr, &gid_temp); + rdma_ip2gid(ifa->ifa_addr, &gid_temp); /* check for existing entry */ for (j = 0; j != gid_index; j++) { if (bcmp(&gid_temp, &port->gid_table[j], sizeof(gid_temp)) == 0) From owner-svn-src-stable-11@freebsd.org Thu Nov 9 17:58:59 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA4E9E574E3; Thu, 9 Nov 2017 17:58:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D5947146A; Thu, 9 Nov 2017 17:58:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA9HwwYI007229; Thu, 9 Nov 2017 17:58:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9Hwva2007220; Thu, 9 Nov 2017 17:58:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091758.vA9Hwva2007220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:58: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: r325604 - in stable/11/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Commit-Revision: 325604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:59:00 -0000 Author: hselasky Date: Thu Nov 9 17:58:57 2017 New Revision: 325604 URL: https://svnweb.freebsd.org/changeset/base/325604 Log: MFC r324792: The remote DMA TCP portspace selector, RDMA_PS_TCP, is used for both iWarp and RoCE in ibcore. The selection of RDMA_PS_TCP can not be used to indicate iWarp protocol use. Backport the proper IB device capabilities from Linux upstream to distinguish between iWarp and RoCE. Only allocate the additional socket required for iWarp for RDMA IDs when at least one iWarp device present. This resolves interopability issues between iWarp and RoCE in ibcore Reviewed by: np @ Differential Revision: https://reviews.freebsd.org/D12563 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/provider.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/11/sys/ofed/drivers/infiniband/core/cma.c stable/11/sys/ofed/drivers/infiniband/core/device.c stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c stable/11/sys/ofed/include/rdma/ib_mad.h stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/provider.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/provider.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/provider.c Thu Nov 9 17:58:57 2017 (r325604) @@ -388,6 +388,24 @@ c4iw_query_port(struct ib_device *ibdev, u8 port, stru return 0; } +static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + int err; + + immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + + return 0; +} + /* * Returns -errno on error. */ @@ -471,6 +489,7 @@ c4iw_register_device(struct c4iw_dev *dev) ibdev->post_send = c4iw_post_send; ibdev->post_recv = c4iw_post_receive; ibdev->uverbs_abi_ver = C4IW_UVERBS_ABI_VERSION; + ibdev->get_port_immutable = c4iw_port_immutable; iwcm = kmalloc(sizeof(*iwcm), GFP_KERNEL); if (iwcm == NULL) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 17:58:57 2017 (r325604) @@ -1670,6 +1670,57 @@ static void destroy_dev_resources(struct mlx5_ib_resou mlx5_ib_dealloc_pd(devr->p0); } +static u32 get_core_cap_flags(struct ib_device *ibdev) +{ + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, 1); + u8 l3_type_cap = MLX5_CAP_ROCE(dev->mdev, l3_type); + u8 roce_version_cap = MLX5_CAP_ROCE(dev->mdev, roce_version); + u32 ret = 0; + + if (ll == IB_LINK_LAYER_INFINIBAND) + return RDMA_CORE_PORT_IBA_IB; + + ret = RDMA_CORE_PORT_RAW_PACKET; + + if (!(l3_type_cap & MLX5_ROCE_L3_TYPE_IPV4_CAP)) + return ret; + + if (!(l3_type_cap & MLX5_ROCE_L3_TYPE_IPV6_CAP)) + return ret; + + if (roce_version_cap & MLX5_ROCE_VERSION_1_CAP) + ret |= RDMA_CORE_PORT_IBA_ROCE; + + if (roce_version_cap & MLX5_ROCE_VERSION_2_CAP) + ret |= RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; + + return ret; +} + +static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); + int err; + + immutable->core_cap_flags = get_core_cap_flags(ibdev); + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags = get_core_cap_flags(ibdev); + if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + + return 0; +} + static void enable_dc_tracer(struct mlx5_ib_dev *dev) { struct device *device = dev->ib_dev.dma_device; @@ -2115,6 +2166,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.attach_mcast = mlx5_ib_mcg_attach; dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach; dev->ib_dev.process_mad = mlx5_ib_process_mad; + dev->ib_dev.get_port_immutable = mlx5_port_immutable; dev->ib_dev.alloc_fast_reg_mr = mlx5_ib_alloc_fast_reg_mr; dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list; dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list; Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Nov 9 17:58:57 2017 (r325604) @@ -1576,7 +1576,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, cons int gid_type; if ((ll == IB_LINK_LAYER_ETHERNET) || (ah->ah_flags & IB_AH_GRH)) { - int len = dev->ib_dev.gid_tbl_len[port - 1]; + int len = dev->mdev->port_caps[port - 1].gid_table_len; if (ah->grh.sgid_index >= len) { printf("mlx5_ib: ERR: ""sgid_index (%u) too large. max is %d\n", ah->grh.sgid_index, len - 1); return -EINVAL; Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 17:58:57 2017 (r325604) @@ -75,11 +75,6 @@ static int def_prec2sl = 3; module_param_named(def_prec2sl, def_prec2sl, int, 0644); MODULE_PARM_DESC(def_prec2sl, "Default value for SL priority with RoCE. Valid values 0 - 7"); -static int unify_tcp_port_space = 1; -module_param(unify_tcp_port_space, int, 0644); -MODULE_PARM_DESC(unify_tcp_port_space, "Unify the host TCP and RDMA port " - "space allocation (default=1)"); - static int debug_level = 0; #define cma_pr(level, priv, format, arg...) \ printk(level "CMA: %p: %s: " format, ((struct rdma_id_priv *) priv) , __func__, ## arg) @@ -198,6 +193,7 @@ struct rdma_id_private { /* cache for mc record params */ struct ib_sa_mcmember_rec rec; int is_valid_rec; + int unify_ps_tcp; }; struct cma_multicast { @@ -799,29 +795,24 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib int ret = 0; id_priv = container_of(id, struct rdma_id_private, id); - switch (rdma_node_get_transport(id_priv->id.device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (!id_priv->cm_id.ib || (id_priv->id.qp_type == IB_QPT_UD)) ret = cma_ib_init_qp_attr(id_priv, qp_attr, qp_attr_mask); else ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, qp_attr, qp_attr_mask); + if (qp_attr->qp_state == IB_QPS_RTR) qp_attr->rq_psn = id_priv->seq_num; - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { if (!id_priv->cm_id.iw) { qp_attr->qp_access_flags = 0; *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS; } else ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, qp_attr_mask); - break; - default: + } else ret = -ENOSYS; - break; - } return ret; } @@ -1082,6 +1073,10 @@ static void __rdma_free(struct work_struct *work) if (id_priv->internal_id) cma_deref_id(id_priv->id.context); + if (id_priv->sock != NULL && !id_priv->internal_id && + !id_priv->unify_ps_tcp) + sock_release(id_priv->sock); + kfree(id_priv->id.route.path_rec); kfree(id_priv); } @@ -1105,8 +1100,7 @@ void rdma_destroy_id(struct rdma_cm_id *id) mutex_unlock(&id_priv->handler_mutex); if (id_priv->cma_dev) { - switch (rdma_node_get_transport(id_priv->id.device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id_priv->id.device, 1)) { spin_lock_irqsave(&id_priv->cm_lock, flags); if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) { ib = id_priv->cm_id.ib; @@ -1115,14 +1109,9 @@ void rdma_destroy_id(struct rdma_cm_id *id) ib_destroy_cm_id(ib); } else spin_unlock_irqrestore(&id_priv->cm_lock, flags); - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id_priv->id.device, 1)) { if (id_priv->cm_id.iw) iw_destroy_cm_id(id_priv->cm_id.iw); - break; - default: - break; } cma_leave_mc_groups(id_priv); cma_release_dev(id_priv); @@ -2118,27 +2107,15 @@ int rdma_resolve_route(struct rdma_cm_id *id, int time return -EINVAL; atomic_inc(&id_priv->refcount); - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: - switch (rdma_port_get_link_layer(id->device, id->port_num)) { - case IB_LINK_LAYER_INFINIBAND: - ret = cma_resolve_ib_route(id_priv, timeout_ms); - break; - case IB_LINK_LAYER_ETHERNET: - ret = cma_resolve_iboe_route(id_priv); - break; - default: - ret = -ENOSYS; - } - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + if (rdma_cap_ib_sa(id->device, id->port_num)) + ret = cma_resolve_ib_route(id_priv, timeout_ms); + else if (rdma_protocol_roce(id->device, id->port_num)) + ret = cma_resolve_iboe_route(id_priv); + else if (rdma_protocol_iwarp(id->device, id->port_num)) ret = cma_resolve_iw_route(id_priv, timeout_ms); - break; - default: + else ret = -ENOSYS; - break; - } + if (ret) goto err; @@ -2585,6 +2562,10 @@ static int cma_get_tcp_port(struct rdma_id_private *id (struct sockaddr *) &id_priv->id.route.addr.src_addr, ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr)); #else + SOCK_LOCK(sock); + sock->so_options |= SO_REUSEADDR; + SOCK_UNLOCK(sock); + ret = -sobind(sock, (struct sockaddr *)&id_priv->id.route.addr.src_addr, curthread); @@ -2609,6 +2590,7 @@ static int cma_get_tcp_port(struct rdma_id_private *id static int cma_get_port(struct rdma_id_private *id_priv) { + struct cma_device *cma_dev; struct idr *ps; int ret; @@ -2618,7 +2600,18 @@ static int cma_get_port(struct rdma_id_private *id_pri break; case RDMA_PS_TCP: ps = &tcp_ps; - if (unify_tcp_port_space) { + + mutex_lock(&lock); + /* check if there are any iWarp IB devices present */ + list_for_each_entry(cma_dev, &dev_list, list) { + if (rdma_protocol_iwarp(cma_dev->device, 1)) { + id_priv->unify_ps_tcp = 1; + break; + } + } + mutex_unlock(&lock); + + if (id_priv->unify_ps_tcp) { ret = cma_get_tcp_port(id_priv); if (ret) goto out; @@ -2690,19 +2683,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) id_priv->backlog = backlog; if (id->device) { - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, 1)) { ret = cma_ib_listen(id_priv); if (ret) goto err; - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, 1)) { ret = cma_iw_listen(id_priv, backlog); if (ret) goto err; - break; - default: + } else { ret = -ENOSYS; goto err; } @@ -3071,21 +3060,15 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_co id_priv->srq = conn_param->srq; } - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (id->qp_type == IB_QPT_UD) ret = cma_resolve_ib_udp(id_priv, conn_param); else ret = cma_connect_ib(id_priv, conn_param); - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) ret = cma_connect_iw(id_priv, conn_param); - break; - default: + else ret = -ENOSYS; - break; - } if (ret) goto err; @@ -3191,8 +3174,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_con id_priv->srq = conn_param->srq; } - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (id->qp_type == IB_QPT_UD) { if (conn_param) ret = cma_send_sidr_rep(id_priv, IB_SIDR_SUCCESS, @@ -3207,15 +3189,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_con else ret = cma_rep_recv(id_priv); } - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) ret = cma_accept_iw(id_priv, conn_param); - break; - default: + else ret = -ENOSYS; - break; - } if (ret) goto reject; @@ -3259,8 +3236,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *pri if (!id_priv->cm_id.ib) return -EINVAL; - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (id->qp_type == IB_QPT_UD) ret = cma_send_sidr_rep(id_priv, IB_SIDR_REJECT, private_data, private_data_len); @@ -3270,16 +3246,12 @@ int rdma_reject(struct rdma_cm_id *id, const void *pri IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, private_data, private_data_len); } - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { ret = iw_cm_reject(id_priv->cm_id.iw, private_data, private_data_len); - break; - default: + } else ret = -ENOSYS; - break; - } + return ret; } EXPORT_SYMBOL(rdma_reject); @@ -3293,8 +3265,7 @@ int rdma_disconnect(struct rdma_cm_id *id) if (!id_priv->cm_id.ib) return -EINVAL; - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { ret = cma_modify_qp_err(id_priv); if (ret) goto out; @@ -3304,15 +3275,11 @@ int rdma_disconnect(struct rdma_cm_id *id) cma_dbg(id_priv, "sending DREP\n"); ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0); } - break; - case RDMA_TRANSPORT_IWARP: - case RDMA_TRANSPORT_SCIF: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { ret = iw_cm_disconnect(id_priv->cm_id.iw, 0); - break; - default: + } else ret = -EINVAL; - break; - } + out: return ret; } Modified: stable/11/sys/ofed/drivers/infiniband/core/device.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/device.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/drivers/infiniband/core/device.c Thu Nov 9 17:58:57 2017 (r325604) @@ -90,7 +90,8 @@ static int ib_device_check_mandatory(struct ib_device IB_MANDATORY_FUNC(poll_cq), IB_MANDATORY_FUNC(req_notify_cq), IB_MANDATORY_FUNC(get_dma_mr), - IB_MANDATORY_FUNC(dereg_mr) + IB_MANDATORY_FUNC(dereg_mr), + IB_MANDATORY_FUNC(get_port_immutable) }; int i; @@ -149,13 +150,13 @@ static int alloc_name(char *name) return 0; } -static int start_port(struct ib_device *device) +static int rdma_start_port(struct ib_device *device) { return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; } -static int end_port(struct ib_device *device) +static int rdma_end_port(struct ib_device *device) { return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : device->phys_port_cnt; @@ -193,6 +194,7 @@ EXPORT_SYMBOL(ib_alloc_device); void ib_dealloc_device(struct ib_device *device) { if (device->reg_state == IB_DEV_UNINITIALIZED) { + kfree(device->port_immutable); kfree(device); return; } @@ -225,43 +227,42 @@ static int add_client_context(struct ib_device *device return 0; } -static int read_port_table_lengths(struct ib_device *device) +static int verify_immutable(const struct ib_device *dev, u8 port) { - struct ib_port_attr *tprops = NULL; - int num_ports, ret = -ENOMEM; - u8 port_index; + return WARN_ON(!rdma_cap_ib_mad(dev, port) && + rdma_max_mad_size(dev, port) != 0); +} - tprops = kmalloc(sizeof *tprops, GFP_KERNEL); - if (!tprops) - goto out; +static int read_port_immutable(struct ib_device *device) +{ + int ret; + u8 start_port = rdma_start_port(device); + u8 end_port = rdma_end_port(device); + u8 port; - num_ports = end_port(device) - start_port(device) + 1; + /** + * device->port_immutable is indexed directly by the port number to make + * access to this data as efficient as possible. + * + * Therefore port_immutable is declared as a 1 based array with + * potential empty slots at the beginning. + */ + device->port_immutable = kzalloc(sizeof(*device->port_immutable) + * (end_port + 1), + GFP_KERNEL); + if (!device->port_immutable) + return -ENOMEM; - device->pkey_tbl_len = kmalloc(sizeof *device->pkey_tbl_len * num_ports, - GFP_KERNEL); - device->gid_tbl_len = kmalloc(sizeof *device->gid_tbl_len * num_ports, - GFP_KERNEL); - if (!device->pkey_tbl_len || !device->gid_tbl_len) - goto err; - - for (port_index = 0; port_index < num_ports; ++port_index) { - ret = ib_query_port(device, port_index + start_port(device), - tprops); + for (port = start_port; port <= end_port; ++port) { + ret = device->get_port_immutable(device, port, + &device->port_immutable[port]); if (ret) - goto err; - device->pkey_tbl_len[port_index] = tprops->pkey_tbl_len; - device->gid_tbl_len[port_index] = tprops->gid_tbl_len; - } + return ret; - ret = 0; - goto out; - -err: - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); -out: - kfree(tprops); - return ret; + if (verify_immutable(device, port)) + return -EINVAL; + } + return 0; } /** @@ -297,10 +298,11 @@ int ib_register_device(struct ib_device *device, spin_lock_init(&device->event_handler_lock); spin_lock_init(&device->client_data_lock); - ret = read_port_table_lengths(device); + + ret = read_port_immutable(device); if (ret) { - printk(KERN_WARNING "Couldn't create table lengths cache for device %s\n", - device->name); + printk(KERN_WARNING "Couldn't create per port immutable data %s\n", + device->name); goto out; } @@ -308,8 +310,7 @@ int ib_register_device(struct ib_device *device, if (ret) { printk(KERN_WARNING "Couldn't register device %s with driver model\n", device->name); - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); + kfree(device->port_immutable); goto out; } @@ -351,9 +352,6 @@ void ib_unregister_device(struct ib_device *device) list_del(&device->core_list); - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); - mutex_unlock(&device_mutex); ib_device_unregister_sysfs(device); @@ -578,7 +576,7 @@ int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr) { - if (port_num < start_port(device) || port_num > end_port(device)) + if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) return -EINVAL; return device->query_port(device, port_num, port_attr); @@ -656,7 +654,7 @@ int ib_modify_port(struct ib_device *device, if (!device->modify_port) return -ENOSYS; - if (port_num < start_port(device) || port_num > end_port(device)) + if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask, @@ -679,8 +677,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid union ib_gid tmp_gid; int ret, port, i; - for (port = start_port(device); port <= end_port(device); ++port) { - for (i = 0; i < device->gid_tbl_len[port - start_port(device)]; ++i) { + for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { + for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { ret = ib_query_gid(device, port, i, &tmp_gid); if (ret) return ret; @@ -712,7 +710,7 @@ int ib_find_pkey(struct ib_device *device, u16 tmp_pkey; int partial_ix = -1; - for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) { + for (i = 0; i < device->port_immutable[port_num].pkey_tbl_len; ++i) { ret = ib_query_pkey(device, port_num, i, &tmp_pkey); if (ret) return ret; Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c Thu Nov 9 17:58:57 2017 (r325604) @@ -2230,6 +2230,38 @@ static int mlx4_ib_dev_idx(struct mlx4_dev *dev) return -1; } +static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + struct mlx4_ib_dev *mdev = to_mdev(ibdev); + int err; + + if (mlx4_ib_port_link_layer(ibdev, port_num) == IB_LINK_LAYER_INFINIBAND) { + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + } else { + if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE) + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; + if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCEV2) + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE | + RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; + immutable->core_cap_flags |= RDMA_CORE_PORT_RAW_PACKET; + if (immutable->core_cap_flags & (RDMA_CORE_PORT_IBA_ROCE | + RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + } + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + + return 0; +} + static void *mlx4_ib_add(struct mlx4_dev *dev) { struct mlx4_ib_dev *ibdev; @@ -2361,6 +2393,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.attach_mcast = mlx4_ib_mcg_attach; ibdev->ib_dev.detach_mcast = mlx4_ib_mcg_detach; ibdev->ib_dev.process_mad = mlx4_ib_process_mad; + ibdev->ib_dev.get_port_immutable = mlx4_port_immutable; ibdev->ib_dev.get_netdev = mlx4_ib_get_netdev; ibdev->ib_dev.ioctl = mlx4_ib_ioctl; ibdev->ib_dev.query_values = mlx4_ib_query_values; Modified: stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c Thu Nov 9 17:58:57 2017 (r325604) @@ -1297,6 +1297,25 @@ out: return err; } +static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + int err; + + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + + return 0; +} + int mthca_register_device(struct mthca_dev *dev) { int ret; @@ -1376,6 +1395,7 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.reg_phys_mr = mthca_reg_phys_mr; dev->ib_dev.reg_user_mr = mthca_reg_user_mr; dev->ib_dev.dereg_mr = mthca_dereg_mr; + dev->ib_dev.get_port_immutable = mthca_port_immutable; if (dev->mthca_flags & MTHCA_FLAG_FMR) { dev->ib_dev.alloc_fmr = mthca_alloc_fmr; Modified: stable/11/sys/ofed/include/rdma/ib_mad.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_mad.h Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/include/rdma/ib_mad.h Thu Nov 9 17:58:57 2017 (r325604) @@ -134,6 +134,7 @@ enum { IB_MGMT_SA_DATA = 200, IB_MGMT_DEVICE_HDR = 64, IB_MGMT_DEVICE_DATA = 192, + IB_MGMT_MAD_SIZE = IB_MGMT_MAD_HDR + IB_MGMT_MAD_DATA, }; struct ib_mad_hdr { Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Nov 9 17:54:00 2017 (r325603) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Nov 9 17:58:57 2017 (r325604) @@ -348,6 +348,56 @@ union rdma_protocol_stats { struct iw_protocol_stats iw; }; +/* Define bits for the various functionality this port needs to be supported by + * the core. + */ +/* Management 0x00000FFF */ +#define RDMA_CORE_CAP_IB_MAD 0x00000001 +#define RDMA_CORE_CAP_IB_SMI 0x00000002 +#define RDMA_CORE_CAP_IB_CM 0x00000004 +#define RDMA_CORE_CAP_IW_CM 0x00000008 +#define RDMA_CORE_CAP_IB_SA 0x00000010 +#define RDMA_CORE_CAP_OPA_MAD 0x00000020 + +/* Address format 0x000FF000 */ +#define RDMA_CORE_CAP_AF_IB 0x00001000 +#define RDMA_CORE_CAP_ETH_AH 0x00002000 +#define RDMA_CORE_CAP_OPA_AH 0x00004000 + +/* Protocol 0xFFF00000 */ +#define RDMA_CORE_CAP_PROT_IB 0x00100000 +#define RDMA_CORE_CAP_PROT_ROCE 0x00200000 +#define RDMA_CORE_CAP_PROT_IWARP 0x00400000 +#define RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP 0x00800000 +#define RDMA_CORE_CAP_PROT_RAW_PACKET 0x01000000 +#define RDMA_CORE_CAP_PROT_USNIC 0x02000000 + +#define RDMA_CORE_PORT_IBA_IB (RDMA_CORE_CAP_PROT_IB \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_SMI \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_IB_SA \ + | RDMA_CORE_CAP_AF_IB) +#define RDMA_CORE_PORT_IBA_ROCE (RDMA_CORE_CAP_PROT_ROCE \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_AF_IB \ + | RDMA_CORE_CAP_ETH_AH) +#define RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP \ + (RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_AF_IB \ + | RDMA_CORE_CAP_ETH_AH) +#define RDMA_CORE_PORT_IWARP (RDMA_CORE_CAP_PROT_IWARP \ + | RDMA_CORE_CAP_IW_CM) +#define RDMA_CORE_PORT_INTEL_OPA (RDMA_CORE_PORT_IBA_IB \ + | RDMA_CORE_CAP_OPA_MAD) + +#define RDMA_CORE_PORT_RAW_PACKET (RDMA_CORE_CAP_PROT_RAW_PACKET) + +#define RDMA_CORE_PORT_USNIC (RDMA_CORE_CAP_PROT_USNIC) + struct ib_port_attr { enum ib_port_state state; enum ib_mtu max_mtu; @@ -1623,6 +1673,14 @@ struct ib_dma_mapping_ops { }; struct iw_cm_verbs; + +struct ib_port_immutable { + int pkey_tbl_len; + int gid_tbl_len; + u32 core_cap_flags; + u32 max_mad_size; +}; + struct ib_exp_device_attr; struct ib_exp_qp_init_attr; @@ -1639,8 +1697,10 @@ struct ib_device { struct list_head client_data_list; struct ib_cache cache; - int *pkey_tbl_len; - int *gid_tbl_len; + /** + * port_immutable is indexed by port number + */ + struct ib_port_immutable *port_immutable; int num_comp_vectors; @@ -1845,6 +1905,15 @@ struct ib_device { u32 cmd_n; spinlock_t cmd_perf_lock; + + /** + * The following mandatory functions are used only at device + * registration. Keep functions such as these at the end of this + * structure to avoid cache line misses when accessing struct ib_device + * in fast paths. + */ + int (*get_port_immutable)(struct ib_device *, u8, struct ib_port_immutable *); + /* * Experimental data and functions */ @@ -1927,6 +1996,252 @@ int ib_query_port(struct ib_device *device, enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num); + +static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IB; +} + +static inline bool rdma_protocol_roce(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & + (RDMA_CORE_CAP_PROT_ROCE | RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP); +} + +static inline bool rdma_protocol_roce_udp_encap(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP; +} + +static inline bool rdma_protocol_roce_eth_encap(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE; +} + +static inline bool rdma_protocol_iwarp(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IWARP; +} + +static inline bool rdma_ib_or_roce(const struct ib_device *device, u8 port_num) +{ + return rdma_protocol_ib(device, port_num) || + rdma_protocol_roce(device, port_num); +} + +/** + * rdma_cap_ib_mad - Check if the port of a device supports Infiniband + * Management Datagrams. + * @device: Device to check + * @port_num: Port number to check + * + * Management Datagrams (MAD) are a required part of the InfiniBand + * specification and are supported on all InfiniBand devices. A slightly + * extended version are also supported on OPA interfaces. + * + * Return: true if the port supports sending/receiving of MAD packets. + */ +static inline bool rdma_cap_ib_mad(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_MAD; +} + +/** + * rdma_cap_opa_mad - Check if the port of device provides support for OPA + * Management Datagrams. + * @device: Device to check + * @port_num: Port number to check + * + * Intel OmniPath devices extend and/or replace the InfiniBand Management + * datagrams with their own versions. These OPA MADs share many but not all of + * the characteristics of InfiniBand MADs. + * + * OPA MADs differ in the following ways: + * + * 1) MADs are variable size up to 2K + * IBTA defined MADs remain fixed at 256 bytes + * 2) OPA SMPs must carry valid PKeys + * 3) OPA SMP packets are a different format + * + * Return: true if the port supports OPA MAD packet formats. + */ +static inline bool rdma_cap_opa_mad(struct ib_device *device, u8 port_num) +{ + return (device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_OPA_MAD) + == RDMA_CORE_CAP_OPA_MAD; +} + +/** + * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband + * Subnet Management Agent (SMA) on the Subnet Management Interface (SMI). + * @device: Device to check + * @port_num: Port number to check + * + * Each InfiniBand node is required to provide a Subnet Management Agent + * that the subnet manager can access. Prior to the fabric being fully + * configured by the subnet manager, the SMA is accessed via a well known + * interface called the Subnet Management Interface (SMI). This interface + * uses directed route packets to communicate with the SM to get around the + * chicken and egg problem of the SM needing to know what's on the fabric + * in order to configure the fabric, and needing to configure the fabric in + * order to send packets to the devices on the fabric. These directed + * route packets do not need the fabric fully configured in order to reach + * their destination. The SMI is the only method allowed to send + * directed route packets on an InfiniBand fabric. + * + * Return: true if the port provides an SMI. + */ +static inline bool rdma_cap_ib_smi(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_SMI; +} + +/** + * rdma_cap_ib_cm - Check if the port of device has the capability Infiniband + * Communication Manager. + * @device: Device to check + * @port_num: Port number to check + * + * The InfiniBand Communication Manager is one of many pre-defined General + * Service Agents (GSA) that are accessed via the General Service + * Interface (GSI). It's role is to facilitate establishment of connections + * between nodes as well as other management related tasks for established + * connections. + * + * Return: true if the port supports an IB CM (this does not guarantee that + * a CM is actually running however). + */ +static inline bool rdma_cap_ib_cm(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_CM; +} + +/** + * rdma_cap_iw_cm - Check if the port of device has the capability IWARP + * Communication Manager. + * @device: Device to check + * @port_num: Port number to check + * + * Similar to above, but specific to iWARP connections which have a different + * managment protocol than InfiniBand. + * + * Return: true if the port supports an iWARP CM (this does not guarantee that + * a CM is actually running however). + */ +static inline bool rdma_cap_iw_cm(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IW_CM; +} + +/** + * rdma_cap_ib_sa - Check if the port of device has the capability Infiniband + * Subnet Administration. + * @device: Device to check + * @port_num: Port number to check + * + * An InfiniBand Subnet Administration (SA) service is a pre-defined General + * Service Agent (GSA) provided by the Subnet Manager (SM). On InfiniBand + * fabrics, devices should resolve routes to other hosts by contacting the + * SA to query the proper route. + * + * Return: true if the port should act as a client to the fabric Subnet + * Administration interface. This does not imply that the SA service is + * running locally. + */ +static inline bool rdma_cap_ib_sa(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_SA; +} + +/** + * rdma_cap_ib_mcast - Check if the port of device has the capability Infiniband + * Multicast. + * @device: Device to check + * @port_num: Port number to check + * + * InfiniBand multicast registration is more complex than normal IPv4 or + * IPv6 multicast registration. Each Host Channel Adapter must register + * with the Subnet Manager when it wishes to join a multicast group. It + * should do so only once regardless of how many queue pairs it subscribes + * to this group. And it should leave the group only after all queue pairs + * attached to the group have been detached. + * + * Return: true if the port must undertake the additional adminstrative + * overhead of registering/unregistering with the SM and tracking of the + * total number of queue pairs attached to the multicast group. + */ +static inline bool rdma_cap_ib_mcast(const struct ib_device *device, u8 port_num) +{ + return rdma_cap_ib_sa(device, port_num); +} + +/** + * rdma_cap_af_ib - Check if the port of device has the capability + * Native Infiniband Address. + * @device: Device to check + * @port_num: Port number to check + * + * InfiniBand addressing uses a port's GUID + Subnet Prefix to make a default + * GID. RoCE uses a different mechanism, but still generates a GID via + * a prescribed mechanism and port specific data. + * + * Return: true if the port uses a GID address to identify devices on the + * network. + */ +static inline bool rdma_cap_af_ib(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_AF_IB; +} + +/** + * rdma_cap_eth_ah - Check if the port of device has the capability *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Thu Nov 9 19:08:31 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC9B8E58EE6; Thu, 9 Nov 2017 19:08:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 983D673B9D; Thu, 9 Nov 2017 19:08: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 vA9J8Uu8036778; Thu, 9 Nov 2017 19:08:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9J8UMx036777; Thu, 9 Nov 2017 19:08:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091908.vA9J8UMx036777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 19:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325612 - 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: 325612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 19:08:31 -0000 Author: hselasky Date: Thu Nov 9 19:08:30 2017 New Revision: 325612 URL: https://svnweb.freebsd.org/changeset/base/325612 Log: MFC r325278: Unconditionally include "opt_inet6.h" in the LinuxKPI. This makes sure the INET6 macro gets properly defined, also for kernel module builds. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/in6.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/in6.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/in6.h Thu Nov 9 19:00:11 2017 (r325611) +++ stable/11/sys/compat/linuxkpi/common/include/linux/in6.h Thu Nov 9 19:08:30 2017 (r325612) @@ -31,8 +31,6 @@ #ifndef _LINUX_IN6_H_ #define _LINUX_IN6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #endif /* _LINUX_IN6_H_ */ From owner-svn-src-stable-11@freebsd.org Thu Nov 9 19:52:58 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED94BE5A29E; Thu, 9 Nov 2017 19:52:58 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6727675E89; Thu, 9 Nov 2017 19:52:58 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA9Jqv0T058797; Thu, 9 Nov 2017 19:52:57 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9Jqvo0058789; Thu, 9 Nov 2017 19:52:57 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201711091952.vA9Jqvo0058789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 9 Nov 2017 19:52: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: r325618 - in stable/11: share/man/man4 sys/conf sys/contrib/dev/liquidio sys/dev/ixgbe sys/dev/liquidio sys/dev/liquidio/base sys/modules sys/modules/lio X-SVN-Group: stable-11 X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/conf sys/contrib/dev/liquidio sys/dev/ixgbe sys/dev/liquidio sys/dev/liquidio/base sys/modules sys/modules/lio X-SVN-Commit-Revision: 325618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 19:52:59 -0000 Author: sbruno Date: Thu Nov 9 19:52:56 2017 New Revision: 325618 URL: https://svnweb.freebsd.org/changeset/base/325618 Log: Merge r323509 and r324994 adding Cavium LiquidIO Driver (lio) to stable/11. Submitted by: pkanneganti@cavium.com ((Prasad V Kanneganti) Sponsored by: Cavium Networks Differential Revision: https://reviews.freebsd.org/D12425 Added: stable/11/share/man/man4/liquidio.4 (contents, props changed) stable/11/sys/contrib/dev/liquidio/ stable/11/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu stable/11/sys/dev/liquidio/ stable/11/sys/dev/liquidio/base/ stable/11/sys/dev/liquidio/base/cn23xx_pf_device.c (contents, props changed) stable/11/sys/dev/liquidio/base/cn23xx_pf_device.h (contents, props changed) stable/11/sys/dev/liquidio/base/cn23xx_pf_regs.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_common.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_config.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_console.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_ctrl.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_ctrl.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_device.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_device.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_droq.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_droq.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_image.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_iq.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_mem_ops.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_mem_ops.h (contents, props changed) stable/11/sys/dev/liquidio/base/lio_request_manager.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_response_manager.c (contents, props changed) stable/11/sys/dev/liquidio/base/lio_response_manager.h (contents, props changed) stable/11/sys/dev/liquidio/lio_bsd.h (contents, props changed) stable/11/sys/dev/liquidio/lio_core.c (contents, props changed) stable/11/sys/dev/liquidio/lio_ioctl.c (contents, props changed) stable/11/sys/dev/liquidio/lio_ioctl.h (contents, props changed) stable/11/sys/dev/liquidio/lio_main.c (contents, props changed) stable/11/sys/dev/liquidio/lio_main.h (contents, props changed) stable/11/sys/dev/liquidio/lio_network.h (contents, props changed) stable/11/sys/dev/liquidio/lio_rss.c (contents, props changed) stable/11/sys/dev/liquidio/lio_rss.h (contents, props changed) stable/11/sys/dev/liquidio/lio_rxtx.c (contents, props changed) stable/11/sys/dev/liquidio/lio_rxtx.h (contents, props changed) stable/11/sys/dev/liquidio/lio_sysctl.c (contents, props changed) stable/11/sys/modules/lio/ stable/11/sys/modules/lio/Makefile (contents, props changed) Modified: stable/11/share/man/man4/Makefile stable/11/share/man/man4/altq.4 stable/11/share/man/man4/vlan.4 stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Thu Nov 9 19:46:40 2017 (r325617) +++ stable/11/share/man/man4/Makefile Thu Nov 9 19:52:56 2017 (r325618) @@ -258,6 +258,7 @@ MAN= aac.4 \ led.4 \ lge.4 \ ${_linux.4} \ + ${_liquidio.4} \ lm75.4 \ lmc.4 \ lo.4 \ @@ -821,6 +822,7 @@ _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 _io.4= io.4 _linux.4= linux.4 +_liquidio.4= liquidio.4 _ndis.4= ndis.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 Modified: stable/11/share/man/man4/altq.4 ============================================================================== --- stable/11/share/man/man4/altq.4 Thu Nov 9 19:46:40 2017 (r325617) +++ stable/11/share/man/man4/altq.4 Thu Nov 9 19:52:56 2017 (r325618) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2015 +.Dd September 20, 2017 .Dt ALTQ 4 .Os .Sh NAME @@ -155,6 +155,7 @@ They have been applied to the following hardware drive .Xr ixgbe 4 , .Xr jme 4 , .Xr le 4 , +.Xr liquidio 4 , .Xr msk 4 , .Xr mxge 4 , .Xr my 4 , Added: stable/11/share/man/man4/liquidio.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/liquidio.4 Thu Nov 9 19:52:56 2017 (r325618) @@ -0,0 +1,133 @@ +.\" BSD LICENSE +.\" +.\" Copyright(c) 2017 Cavium, Inc.. All rights reserved. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" * Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" * 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. +.\" * Neither the name of Cavium, Inc. nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" $FreeBSD$ +.\" +.Dd September 20, 2017 +.Dt LIQUIDIO 4 +.Os +.Sh NAME +.Nm liquidio +.Nd "Cavium 10Gb/25Gb Ethernet driver for the FreeBSD operating system" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device lio" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_lio_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for 23XX 10Gb/25Gb Ethernet adapters. +The driver supports Jumbo Frames, Transmit/Receive checksum +offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), +VLAN tag insertion/extraction, VLAN checksum offload, +VLAN TSO, and Receive Side Steering (RSS) +.Pp +Support for Jumbo Frames is provided via the interface MTU setting. +Selecting an MTU larger than 1500 bytes with the +.Xr ifconfig 8 +utility configures the adapter to receive and transmit Jumbo Frames. +The maximum MTU size for Jumbo Frames is 16000. +.Pp +For more information on configuring this device, see ifconfig(8). +.Sh HARDWARE +The +.Nm +driver supports the following cards: +.Pp +.Bl -bullet -compact +.It +LiquidIO II CN2350 210SV/225SV +.It +LiquidIO II CN2360 210SV/225SV +.El +.Sh LOADER TUBABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Pp +.Bl -tag -width indent +.It Va hw.lio.fw_type +.Pp +String that specifies type of firmware to be loaded. +Default is "nic". Use "none" to load firmware from flash. +.It Va hw.lio.num_queues_per_pf0 +.Pp +Unsigned integers that specify number of queues per PF0. +Valid range is 0 to 64. +Use 0 to derive autoconfigures based on the number of +cpus with a max of 8 +.It Va hw.lio.num_queues_per_pf1 +.Pp +Unsigned integers that specify number of queues per PF1. +Valid range is 0 to 64. +Use 0 to derive autoconfigures based on the number of +cpus with a max of 8 +.It Va hw.lio.console_bitmask +.Pp +Bitmask indicating which consoles have debug output +redirected to syslog. +.It Va hw.lio.rss +.Pp +To enable/disable driver RSS support +.It Va hw.lio.hwlro +.Pp +To enable/disable hardware LRO +.Sh SUPPORT +For general information and support, +go to the Cavium support website at: +.Pa http://support.cavium.com . +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Derek Chickles Aq Mt derek.chickles@cavium.com . Modified: stable/11/share/man/man4/vlan.4 ============================================================================== --- stable/11/share/man/man4/vlan.4 Thu Nov 9 19:46:40 2017 (r325617) +++ stable/11/share/man/man4/vlan.4 Thu Nov 9 19:52:56 2017 (r325618) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 8, 2016 +.Dd September 20, 2017 .Dt VLAN 4 .Os .Sh NAME @@ -135,6 +135,7 @@ in hardware: .Xr ixgb 4 , .Xr ixgbe 4 , .Xr jme 4 , +.Xr liquidio 4 , .Xr msk 4 , .Xr mxge 4 , .Xr nxge 4 , Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Thu Nov 9 19:46:40 2017 (r325617) +++ stable/11/sys/conf/NOTES Thu Nov 9 19:52:56 2017 (r325618) @@ -1981,6 +1981,7 @@ device xmphy # XaQti XMAC II # lge: Support for PCI gigabit ethernet adapters based on the Level 1 # LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX, # SMC TigerCard 1000 (SMC9462SX), and some Addtron cards. +# lio: Support for Cavium 23XX Ethernet adapters # malo: Marvell Libertas wireless NICs. # mwl: Marvell 88W8363 802.11n wireless NICs. # Requires the mwl firmware module Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Nov 9 19:46:40 2017 (r325617) +++ stable/11/sys/conf/files Thu Nov 9 19:52:56 2017 (r325618) @@ -2162,6 +2162,62 @@ dev/le/if_le_pci.c optional le pci dev/le/lance.c optional le dev/led/led.c standard dev/lge/if_lge.c optional lge +dev/liquidio/base/cn23xx_pf_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_console.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_ctrl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_device.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_droq.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_mem_ops.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_request_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/base/lio_response_manager.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_core.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_ioctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_main.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rss.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_rxtx.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +dev/liquidio/lio_sysctl.c optional lio \ + compile-with "${NORMAL_C} \ + -I$S/dev/liquidio -I$S/dev/liquidio/base -DSMP" +lio.c optional lio \ + compile-with "${AWK} -f $S/tools/fw_stub.awk lio_23xx_nic.bin.fw:lio_23xx_nic.bin -mlio_23xx_nic.bin -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "lio.c" +lio_23xx_nic.bin.fw.fwo optional lio \ + dependency "lio_23xx_nic.bin.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "lio_23xx_nic.bin.fw.fwo" +lio_23xx_nic.bin.fw optional lio \ + dependency "$S/contrib/dev/liquidio/lio_23xx_nic.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "lio_23xx_nic.bin.fw" dev/lmc/if_lmc.c optional lmc dev/malo/if_malo.c optional malo dev/malo/if_malohal.c optional malo Added: stable/11/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/dev/liquidio/lio_23xx_nic.bin.uu Thu Nov 9 19:52:56 2017 (r325618) @@ -0,0 +1,28149 @@ +begin 644 lio_23xx_nic.bin +M0TY)0S$N-BXQ``````````````!B;V]T;V-T(#!X,C$P,#`P,#`@;G5M8V]R +M97,])"AN=6UC;W)E]`#``````/`(4&&>]_\B,0E:, +M_[$`"```B"W_OP`P_[4`*/^T`"#_LP`8_[(`$!!```3_L```/`00"PP"?WID +MA#F`/!#__#P4__`V$``)-I0`)0`0A#@`%*7X-A!``3P3$`M\$@`[-I0!`WY2 +M"<,`$(=X/!44&&9S.9``$I$\`!2E.`)0$"4\`P`@W$8```(#&"V.HE:,`D,8 +M)680``APQ2CR`+0H+0"R*"7]`#@4 +MH``$`````/R````#X``(`````-RB``A\I4@!?$,(`GQ"2((``QR\``(5/`!B +M$"4`12@E_(4```/@``@`````?(9Z`#P%``T`!C(``(`0+32E`P!\`K@'0`-X +M``#%*"L0H``N/`4#`!1%``@\!0#_`&0P)C2E_Q``Q2@D%*``&B0"``$#X``( +M`````!1```<`9#`F-*7_#P#%*"04H``2)`(``0/@``@`````/`4!`!1%``<\ +M!@(``&0H)GRE>@`4H``))`(``0/@``@`````%$8`!0!D$"8DI?\?`$4H)!"@ +M_^@D`@`!?((&@!1```,\!0#_`^``"```$"TTI?\0`&48)`"%("0`9!@K$&#_ +M^20"``$#X``(`````!1%``@\!0#_`&0P)C2E_T``Q2@D%*``)20"``$#X``( +M`````!1```<`9#`F-*7_/P#%*"04H``=)`(``0/@``@`````/`4(`!1%``@\ +M!0#_`&0P)C2E_S@`Q2@D%*``$R0"``$#X``(`````#P%`@`410`(/`4`_P!D +M,"8TI?]``,4H)!2@``DD`@`!`^``"``````\!0$`%$4`!`!D*"9\I7H`$*#_ +ML"0"``%\@@=`$$``"#P%__)\8K@`-*7]`#0&C0``12@A`*8H*Q2@_Z8D`@`! +M?(('@!!```<\!?_R?&:X`#2E<```Q2@A+*4$`!2@_YTD`@`!!($`!SP%__)\ +M9K@`-*5L``#%*"$LI0$`%*#_E20"``%\@@<`$$``"'R"!H`\!0`-?&:X`#2E +ME0``Q2@K$*#_C"0"``%\@@:`$$#_I0`````\`@#_-$+_0`!B&"0`@A`D`&(0 +M*Q!`_YX``````^``""0"``$`````9[W_./^_`,#_O@"X`(#P+?^Q`(``H(@M +M_[<`L/^V`*C_M0"@_[0`F/^S`)#_L@"(#`(P7O^P`'@,`(=Z`$`@+3P%``,\ +M`Q0`)`(``?QE1<@D!20`/`,4`#P&``?\947`)`4`0#P#%``TQO___&5%N#P# +M%`#\8$6P/`4`/S2E__X\`Q0`_&5%J#P#%`#\8D6@)`4`"(^$@8`\`Q0`_&5% +MF#P#%`#\9D60/`,4`/QB18@\`Q0`#`"(&*QB18`00`#W/`,4``P`&#@````` +M#`!^N``````40`"3/`(4&`P`?'*,1%=D%$``=#P$$`L,`&[6`````!1``-\\ +M`Q0`D&(!&!!``63_HP!P/`0!SCP&$`LTA!@`)`4`@&3&/M@,`+1>/!`4`!!` +M`-C^`D8(/`8!S@!`("T``"@M#`)F8#3&&``\`Q08W&)6@#P$$`O>`T8(/`40 +M"SP&$`L\!Q`+9(0^\&2E/Q#\0P`X9,8_&`P`%Y9DYS\@*\(`!!1``&\GWO_\ +M9B(`('/>^/)F,0`8`%[P+3P7$`L\%A`+/!40"SP4$`L\$Q`+"``!<3P2$`L, +M`C@L9@0`#-XP``!FI3]8)`8`#0P"@G0"`"`M$$``-P`````"`"`M9H4_:`P" +M@G0D!@`/$$``3``````"`"`M9F4_>`P"@G0D!@`1$$``0@`````"`"`M9D4_ +MD`P"@G0D!@`.$$``.`````!F,0`($CX`1SP$$`O>,```/`40"V2E/S@D!@`' +M#`*"=`(`("T40``&`@`@+20#``$\`A0`K$-%U-XP```"`"`M9N4_0`P"@G0D +M!@`'%$``!@(`("TD`P`!/`(4&*Q#5HS>,````@`@+6;%/T@,`H)T)`8`#!!` +M_\<"`"`M9J4_6`P"@G0D!@`-%$#_S`(`("T,`C?^``````@``5S>,```#``7 +MEF2$/GC?OP#`)`(``=^^`+C?MP"PW[8`J-^U`*#?M`"8W[,`D-^R`(C?L0"` +MW[``>`/@``AGO0#(#`(X9&8$``X(``%O9C$`"`P",%8`````"``!:-XP```, +M`CA&9@0`#P@``6+>,```/`00"PP`%Y9DA#Y`"``!F=^_`,`\!!`+/`40"V2$ +M/Z!DI3^P`Z`P+0P`%Y8\$!(4/`@Q+C4(-BX\`A(4K$B^,#P&$`L\!Q`+9$.^ +M,&3&/\ADYS_@9@2^H"0%`&HD`C$`#`)_UJ1B``1F!;Z@`Z`@+0P"@?"@H`!I +M#``%I@`````,`'W8CX2!@!1`_\7?OP#`#``&L@`````40/_!W[\`P#P#%!C< +M8E:`/`,4&-QC5WC\0P``/`(4&-Q%5H!DI`!@#`#..&2E`&@\`A08W$-6@#P" +M%!ED0IY8/`0`"P!$("UD8P!PW$@``-Q'``C<1@`0W$4`&&1"`"#\:```_&<` +M"/QF`!#\90`8%$3_]F1C`"`,`#[<`````!1`_Z'?OP#`#``^W@`````,`C%T +M``````P`?>@`````$$``$#P$$`L,`!>69(1`(`@``9G?OP#`/`00"PP`%Y9D +MA#ZH"``!F=^_`,`\!!`+#``7EF2$/_`(``&9W[\`P/^C`'`,`(=L``````P` +M!T``````#`(Q#@`````,`(@8CX2!@!!``$??HP!PD&(!&!!``)LD!0(`#`$X +M'"0$#``,`)3H)`0``0P`B$0\$@"O/!4``GP$`#M\A`G##`%93@``@"T,`3R. +M/!$4`#P4`,1F4X0`-K6A@-XB1@``5!@MC&20,`($*"H0H``+`````'(5&`,F +M$``!`$,H+0!S("T"12@M`$0@+0P`09;\H(0@"``"+MXB1@`,`)1PC&60-`P` +M``H`````/`4`#7P$`#LTI?`5#`#`)'R$"<,D`X`!``, +M`E:`W$,``-Q$`&#<10!H/`(4&`P`SD#\0U=X)`0``PP!.&(``"@MW@56@#P# +M%!D\!``+9&.>6&2B`'``1"`MW$D``-Q(``C<1P`0W$8`&&1"`"#\:0``_&@` +M"/QG`!#\9@`8%$3_]F1C`"#``"$/A^0A(*`$#X"0````#>`A5X`%$8*Q1@__AD0@`!#``" +MO@`````\`A`+9$(V8!!```4D`@`!/`00#@P"S9ADA)P`)`(``:)B%7#?OP`@ +MW[,`&-^R`!#?L0`(W[````/@``AGO0`H9[W_^/^_``#?OP```^``"&>]``@` +M````/`(0"V>]__AD0C/8$$``!O^_```\!!`./`42$F2$G``,`LSV9*45@#P$ +M$@_<@MJX$$``!CP"``!D0@``$$``!-^_````0/@)9(3:N-^_```(``+.9[T` +M"&>]__C_OP``W[\```/@``AGO0`(````````$"```!@@```@(```*"```#`@ +M```X(```0"```$@@``!0(```6"```&`@``!H(```<"```'@@``"H(```L"`` +M`+@@``#`(```R"```-`@``#8(```X"```/`@``#X(#P<$A-GG)'```#X+0.@ +M\"T\"2``0`A@``$)0"4\"00``0E`)4"(8``\"0$`1,GX`"0)__]$J0``1*D( +M`$2I$`!$J1@`1*D@`$2I*`!$J3``1*DX`$2I0`!$J4@`1*E0`$2I6`!$J6`` +M1*EH`$2I<`!$J7@`1*F``$2IB`!$J9``1*F8`$2IH`!$J:@`1*FP`$2IN`!$ +MJ<``1*G(`$2IT`!$J=@`1*G@`$2IZ`!$J?``1*GX`&($```\&1(29SD58`P" +M9M#_)````````#P9$A)G.15@WR0``#P9$`=G.<\8$R``!@`````#(/@)```` +M`!```!\``````````$`9>`$D!/P``R3()"0$``T`!"`\-(0`#?\D`(#_)`$` +M_R0!@/\D`@#_)`*`_R0#`/\D`X#_)`0`_R0$@````0\```$/0!E@`#P$_[\T +MA/__`R3()$"98``\&1`*9SG?F`,@^`D`````$````@``````````/!D0`&]_@`\`@#$ +M_[0!T#P4%`#_MP'HWI=&`/^_`?C_O@'P_[8!X`+B$"W_M0'8_[,!R/^R`<#_ +ML0&X_[`!L(Q"D#000`#]_Z0!J#P2$A(\%0`)9E(>,```F"T``(`M/!$4&#:U +MH(```````Z`@+0``*"TD!@&@#`)F8'X6^`,T`JZ`X@`(V%X` +MX8XB5HP40`$R/`00"P``N"T``'@M``!P+0``:"T``&`M``!8+0``4"T``$@M +M``!`+0``."T``#`M```H+0``("T``!@M``#`+0`6\3@`%LBX/`(4``/9R"_< +M0D8(`S;(+3P>`^"T`61`M`_/X+61"`&@`````W%X`&-Q9 +M````?A@M_Z,`>`,9P"W<60`@`)D@+?^D`(#<60#H`+DH+?^E`4C<60$``-DP +M+?^F`6#<60$X`/DX+?^G`9C<60$(`1E`+?^H`6C<60!``3E(+?^I`*#<60!( +M`5E0+?^J`*C<60!0`7E8+?^K`+#<60!8`9E@+?^L`+C<60!@`;EH+?^M`,#< +M60!H`=EP+?^N`,C<60!P`?EX+?^O`-#<60!X`%40+0+YN"T47__3_[<`V#0" +MKH`#H"@MD +M`:#<2```W$<`"-Q&`!#<10`89$(`(/QH``#\9P`(_&8`$/QE`!@41/_V9&,` +M(-Z71@`\`@#$)A```692`:`"XA`MC$*0-`("$"L40/\-9G,!H-^_`?C?O@'P +MW[#?M0'8W[0!T-^S`69(0[6(XB5HS?I0#8$*``!P`````00/^R`````#P$$`L,`!>69(0[>(XB +M5HP00/^LWZ8!J#P"%!C<0U=H/`00"]^B`4ADA#N8WD4!2`##`!\`8`'T`$`P +M+0!%$"\``!@2`$,`'P!@`?0,`!>6```H$@@`!)".(E:,#``7EF2$.]B.(E:, +MWZ4!0!"@``<`````$$#_MP.@$"T\!!`+#``7EF2$._".(E:,$$#_L#P$$`T, +M`!>69(0HN`@`!+0#H!`M/`00"PP`%Y9DA#GXCB)6C-^E`(`0H/\]WZ,`B!1` +M`&@`````"``$3P``$"T``````@`H+0P`%Y9DA#G`W[@`8-^C`'C?I`"`WZ4! +M2-^F`6#?IP&8WZ@!:-^I`*#?J@"HWZL`L-^L`+C?K0#`WZX`R-^O`-`(``/R +MW[<`V-^E`:@\`A08W$-7:#P$$`O>0@!@9(0YT`+`,"T`HP`?`&`!]`+"$"\` +M`"@2`$4`'P"@`?0,`!>6```H$@@`!#Z.(E:,/`00"PP`%Y9DA#NX"``$E8XB +M5HP\!!`+#``7EF2$.Q@(``2&CB)6C#P$$`L,`!>69(0[.`@`!(N.(E:,/`00 +M"PP`%Y9DA#GH"``$FHXB5HP\!!`+#``7EF2$.?@(``2?CB)6C#P$$`L,`!>6 +M9(0[R`@`!*2.(E:,WZ(!H#P$$`MDA#H@`N(H+0"^*"T,`!>6`+8H+P@`!$^. +M(E:,/`00"PP`%Y9DA#HP"``$5(XB5HP\!!`+#``7EF2$.D@(``19CB)6C#P$ +M$`L,`!>69(0Z"`@`!*F.(E:,/`00"PP`%Y9DA#H@"``$KHXB5HP\!!`+#``7 +MEF2$.>@(``1#CB)6C#P$$`L,`!>69(0Z"`@`!$J.(E:,/`00"PP`%Y9DA#I@ +M"``$7HXB5HP\!!`+#``7EF2$.G@(``1CCB)6C#P$$`L,`!>69(0ZD`@`!&B. +M(E:,/`00"PP`%Y9DA#JH"``$;8XB5HP\!!`+#``7EF2$.K@(``1RCB)6C#P$ +M$`L,`!>69(0ZT`@`!'>.(E:,/`00"PP`%Y9DA#KH"``$?(XB5HP\!!`+#``7 +MEF2$.P`(``2!CB)6C``````\!!`+9[W_^/^_```,`!>69(0\`#P$$`L,`!>6 +M9(0\(-^_```\!!`-9[T`"`@`%Y9DA"BX`````&>]_Z@`@$`M_[(`&#P2%!B. +M0E:,_[\`4/^^`$C_MP!`_[8`./^U`##_M``H_[,`(/^Q`!`40`!L_[``"#P4 +M%!B.@E=D$$``-3P3`H\\%108-G-<*3P6`#``$YQX``"`+69SZX5FM5:0`!.< +M^#P7%``VUN1@"``%V#9S]<,`````)A```0("$"L00``ECD)6C'X1^`,`$1"X +M?J(0"A!`__B.@E=DWN5&``(V("W?@H,0``0@N`"D("T00`!6C)X`(`!>$"T` +M`"`M```!#W!$)-^.0E:,%$``("0")Q#>Y$8``C:(+=^"@Q``$8BX`)&(+1!` +M`$..,0`@`%$0+280``$```$/_$```````0^.@E=D`@(0*Q1`_]]^$?@#CD)6 +MC!1``"3?OP!0W[X`2-^W`$#?M@`XW[4`,-^T`"C?LP`@W[(`&-^Q`!#?L``( +M`^``"&>]`%@``````@`H+7""$`,\!!`+_Z@``&2$/$``2``?`0`!]```$!(` +M`C"Z`-,`'0``,!``!C"Z``9(N``&.3@!)S@M``8P```'2+@`Z3@M`$69(0\,`@`!]__A\ +M!``[_[\```P`R-Y\A`G#/`00"P``*"T,`!>69(0\4#P$$`T,`!>69(0HN#P$ +M$``,`+&J)`4(`!!``#P``"`M/`40"V2E/(@`0#`M)`<(``P`R]`\"``"/`1` +M``P`L:HD!0$`$$``220$``(\!1`+9*4\F`!`,"TD!P$`#`#+T#P(`$`\!`@` +M#`"QJB0%!``00``P)`0``SP%$`MDI3RH`$`P+20'!``,`,O0/`@``CP$"``, +M`+&J)`4$`!!``#LD!``%/`40"V2E/,``0#`M)`<$``P`R]`\"``"/`0"``P` +ML:HD!0$`$$``(20$``0\!1`+9*4\V`!`,"TD!P$`#`#+T#P(``(,`(@Z```` +M`!1```PD`P`!#`&*R#P$``$``A`K"``&D'!#`#H\!!`+/`40"V2$/&@,`GZ\ +M9*4\B"0#``'?OP```&`0+0/@``AGO0`(/`00"SP%$`MDA#QH#`)^O&2E/*@( +M``:0)`,``3P$$`L\!1`+9(0\:`P"?KQDI3S8"``&D"0#``$\!!`+/`40"V2$ +M/&@,`GZ\9*4\F`@`!I`D`P`!`````#P$$`L\!1`+9(0\:`P"?KQDI3S`"``& +MD"0#``$`````9[W_N/^P```D$``!_[\`0/^W`#C_M@`P_[4`*/^T`"#_LP`8 +M_[(`$`P`!C[_L0`($$``#0````#?OP!``@`0+=^W`#C?M@`PW[4`*-^T`"#? +MLP`8W[(`$-^Q``C?L````^``"&>]`$@,`!,8`````!1``$$\!!`+#``2\@`` +M```40``W/`00"PP`%T`D$``!%$#_ZM^_`$`,`(5.`````!1`_^;?OP!`/`+_ +M@#1"`0$``A(\-$(!H-Q"``````$//!44&(ZB5V000``[/!84&#P3`#```(`M +M9M96D"04__\\%Q0`"``&\C9SY&``````CJ)79`("$"L00``P/`/_X'X1^`,` +M$1"X?L(0"A!`__@F$``!)`3__PP`T*P",X@M$%0`.@!`D"W>XD8``!&(N`!1 +MB"VN,@`@WX*#$!!``#D``````%*0+0```0_^0``````!#P@`!N^.HE=D```` +M`#P%$`MDA#T`#``7EF2E1%`(``;4`````#P%$`MDA#SH#``7EF2E1%#?OP!` +MW[<`.`(`$"W?M@`PW[4`*-^T`"#?LP`8W[(`$-^Q``C?L````^``"&>]`$@\ +M`__@)!```31C`%4``QVX-&,`#0`#'3A\`@`[?$()PS1C``@``A$\`$,0)20# +M``'\0P``#``4<@`````40/^0``````P`9.(``(`M"``&P=^_`$`\!!`+)!`` +M`0P`%Y9DA#TH"``&P=^_`$`,`-#X``````@`!P/?@H,0`````&>]__C_OP`` +M#`"%8@`````40``%)`,``0P`?>0````````!#P``&"W?OP```&`0+0/@``AG +MO0`(9[W_N/^_`$#_MP`X_[8`,/^U`"C_M``@_[,`&/^R`!#_L0`(&*``)?^P +M```D%0`!/!00"P`5JCP`@(`M``"X+0``B"UFM?_X)!;__V:4/4`(``=U`*"8 +M+7[2_\:2`@`!?&,6`I('``(P:`#_`B`H+0*`("TF,0`!#``7EGQ'>@22`@`" +MD@,``0)`@"U\8GH$,$+__Q(S``H`5[@AW@,``'QF.`$`U1`M?$(X`11`_^H` +M0)`M"``'90``D"T``+@MW[\`0`+@*"W?M@`P/`00"]^W`#ADA#UHW[4`*-^T +M`"#?LP`8W[(`$-^Q``C?L```"``7EF>]`$AGO?_(_[,`*'T31,+_L@`@,/(# +M__^P`!``@(`M_[\`,/^Q`!C<@P`(C(8`#'QD2((PB0#_`-(P)@`)2,)\`O`[ +M$$#__GX%2`$D"P"`?`H`.Q"K`)D``!`M`(!0+0`)2,!\"CC$``0B`@$J2"4` +M@%`M?2-8AB0$``'^`P`(K@8`#-X#``A\@P@&_@,`"````4\D!``!/`/__'R" +M>P8T8P`+?(*`=\L4(&?&-<`B0%`@%\<=P&``4HO"0#``$`12@D +M``,8O!"C`'4\`P`!E@4`L#1C``$R. +M`@"H?$,%@!1@`%$P0P$`_!&!`-X"`!B6!``8D@,`!'Q"2`$H8P`"%&``5WR" +M_`9\`GM&_`*!"/D1`,@D!0`"```!3SP"%!C<0E=XD$,`#0)#&",L8@"`$$`` +M!3P"%!C<0D@8?$,9BA1@`"\D!``)``X;\ +M$8$`W@(`&)8$`!B2`P`$?$)(`2AC``(08/^K?(+\!B0#``$(``?A?&)[1@`` +M``!]2@G#``E(P``*&@`(``>P`&E()0````"&`@!H/`,4`-QE1@@\`P`)-&.@ +M@'P$`#M\A/@#``(Q.'"#(`,``ABX`,,8+P!B$"T``AEX`*00+0!#$"W<0P&8 +M9&,``?Q#`9B.`@"H?$,%@!1@`'0\!``!W@,`J#2$``$`!"%\`&0H)!"D`",` +M````E@4`N"0$`@$R`P"@`&(8+8QF``!H9``,:&(`!'R%^`-\27P#`25(+0`$(#Z( +M90```24H+0`"$#Y\QAX#`*0H+0"B*"TLP@`&%$``"P`%%#HD!``4``8PN``` +M````@Q`M9(0`!(A"``!\0O@#%(;_^P"B*"T`!10Z9&0`"GRE>`,`11`M``(L +M.GQ">`,`HB@M``44.GRE>`,`11`M.$+__Z""``$``@H"H($``-X#`*@(``A< +MC@(`J-X#`)@\`@`!-$(D!R0%``,``A.\?&1(`0`#(`I\@D@%"``'Y/P"@1`` +M$EI`-2D`57#J"3,`"4J\-2D`4`%I2"T!24@EW2H``'U*>`$`"D@`?41X!0#) +M,"H0P/].K$D``'P$C`8D`@`)"``('7Q$_P8(``@`9$(=L'Q#!@`08``*,$)` +M`)8%`+C_IP```@`@+1!``$C_J``(#`!K*`````#?IP``WZ@`"-X"`*@D`P(! +M``,;O`!#("00@P`;`````)8%`+`R]_[C_MP`X?1=$PO^V`#``H+`M_[4`*`+@J"W_M``@?111@O^S`!@`X)@M +M_[(`$`$`D"W_L````("`+?^_`$#_L0`(```!3SP"`0$PX___$*``5P!B&"5\ +M`O`[$$#__CP"__PD!`!!-$(`"P`$(SQ\!0`[``(3?'RE"<,TA`"```4R`'RB +M.09\Q.T&?&(9!7Y1`,+\1```?D,$0@`1C;A^1`D"D@(`$'QQWL:6`P`(?I'4 +M!GR1_X808`$;?%&L!WQQ>`=P1`!O`!$=NCAC``$``Q@``(,8)!!@``\`%B@K +M<$,`K@!E&"048``+`````-X&``!\PU@",&0(`!2``#X`8#@M``8SO@!%*",P +MQ#``#``^V`"'("7>`@"H/`,``20%`@$T8P`!``4HO"0$``$``QE\`$4H)``$ +M(+P0I``R`$,0)!!#`%0`````C@(`J'Q#!8`48``<`````'Z2@8;Z0@#Y`F`@ +M+=X&`!@"("@M```X+20(``$,`7L\```````"$`#?OP!`W[<`.-^V`##?M0`H +MW[0`(-^S`!C?L@`0W[$`"-^P```#X``(9[T`2'P"\#L40/^K/`+__`@`"9(` +M`````````-X#`*A\9`H"$(#_XGQD"L(4@`!;)`0`098"`+``5[@A)O<``0@` +M"7U^\?8'`````#!C#_`(``EG`&`X+0`````00P!C`````(X"`*A\0P6`%&`` +M]S!"`"#>`P"H)`("`0`"$[P`8A@D$&(`A0````".`@"H?$,&`!!@_\8````` +MW@,`J'QD#`(0@/_"?&0,PA"``$DD!``A``0CO`!D&"0D!``!``0CO!!D`*

`P"@E@(`N`!B +M$"V,1@``:$0`#&A#``1\A?@#?&=\`P#E*"T`!"`^B$<```"G*"T``Q@^?,8> +M`P"D*"T`HR@M+,,`!A1@``L`!1PZ)`0`%``&,+@``````((8+62$``2(8P`` +M?&/X`Q2&__L`HR@M``4<.F1$``I\I7@#`&48+0`#+#I\8W@#`*,H+0`%'#I\ +MI7@#`&48+3AC__^@@P`!``,*`J"!```(``EZC@(`J``$(7P`9!@D)`0``0`$ +M(7P09`!G,$(`0!!`_WX"`"`ME@4`L`P`:ZH`M2@A"``)?GZ2@88`````E@(` +MN`!7N"$F]P`!"``)?7[Q]@<`````E@(`L-X#`*``8A@MC&8``&AD``QH8@`$ +M?(7X`WQ'?`,`Y3@M``0@/HAE````Y2@M``(0/GS&'@,`I"@M`*(H+2S"``84 +M0``+``44.B0$`!0`!C"X``````"#$"UDA``$B$(``'Q"^`,4AO_[`*(H+0`% +M%#ID9``*?*5X`P!%$"T``BPZ?$)X`P"B*"T`!10Z?*5X`P!%$"TX0O__H((` +M`0`""@*@@0``"``)JXX"`*B6`@"XW@,`H`!B&"V,9@``:&0`#&AB``1\A?@# +M?$=\`P#E."T`!"`^B&4```#E*"T``A`^?,8>`P"D*"T`HB@M+,(`!A1```L` +M!10Z)`0`%``&,+@``````(,0+62$``2(0@``?$+X`Q2&__L`HB@M``44.F1D +M``I\I7@#`$40+0`"+#I\0G@#`*(H+0`%%#I\I7@#`$40+3A"__^@@@`!``(* +M`J"!```(``FUC@(`J)8%`+`"`"`M#`!K*`"U*"$(``E^?I*!AI8%`+@"`"`M +M#`!K*`"U*"$(``E^?I*!ACP$$`L\!A`+/`<0"V2$/8`D!02]9,9$:`P"7IID +MYSWX/`+_@#1"`2E\`P`[``(2/'QC"<-\8CD&W$(``!!``"\D`___)`0``WQB +M_\8D`P`!``,8?'R1"`;\0P`(-`.``/Q````D!``!_$,`$'Y)!(+\0``@?E(V +MP]X#`$@`":`+`B`H+20(``'\0P!(W@,`0/Q#`$#>`P`H_%0`4'R#_P8"8"`M +M?D/5!OQ#`"A\0T@!W@8`&``"&`H`8!`M`&`X+20#__]\9T(&"``)A`!).`J6 +M!0"P$$``!0(`("T,`&LH``````@`":_>`P"H#`!KJ@`````(``FOW@,`J#P$ +M$`L,`!>69(0^&`@`"8<``!`M9[W_4/^S`)``@)@M_[(`B/^_`*C_M0"@_[0` +MF/^Q`(#_L`!XW)``&'X0.`$2``%*`,"0+20"__]\4/_&`@6`+0``J"V2`P`, +MD@(`#7QB>@0T`X$`,$+__Q!#`/$D$0`.`A&(+3P#0`".(@``CA3__`!`("U\ +M!-@$$(,`FP`4H@("("`M9Z4`2*.@`%AGI@!0_Z``2`P`:VAGIP!8DZ(`6``` +M6"UP101N<$,!K@"C&"408``&```@+=^C`$B49```E&,``@`$7``!8U@E$D`` +M.C0*__^69@`.-`C__S0)__\T!___D@4`!@`%+#C_I0`P/`40(4BE0@`\!?__ +M2*4"`8^E`#!(I0(&CZ4`-$BE`@9()`(!D@4``'R"?`,`!2PX_Z4`.#P%$"%( +MI4(`/`7__TBE`@&/I0`X2*4"!H^E`#Q(I0(&2"0"`30#__\2@``-?(5\`P`4 +MH#P\`Q`A_[0`0$BC0@`\`___2*,"`8^C`$!(HP(&CZ,`1$BC`@9((P(!?&-\ +M`Q)``-;?OP"H`$40)M^U`*``1A`FW[0`F`!#$";?LP"0W[(`B-^Q`(#?L`!X +M`^``"&>]`+#>(P`(_Z,``#P#$"%(HT(`/`/__TBC`@&/HP``2*,"!H^C``1( +MHP(&2","`=XE`!#_I0`(/`40(4BE0@!\`W@'2*,"`8^C``A(HP(&CZ,`#$BC +M`@9((P(!WB4`&``#'`(P9____Z4`$#P%$"%(I4(```,<`$BC`@&/I0`02*4" +M!H^E`!1(I0(&2"4"`=XE`"#_I0`8/`40(4BE0@!(HP(!CZ,`&$BC`@:/HP`< +M2*,"!D@I`@$`%:PX?2E\`P*B$"7_H@`@/`(0(4BB0@`\`O__2*("`8^B`"!( +MH@(&CZ(`)$BB`@9(*@(!```P+7U*?`,0@/^.-`C__P`+6#P\`A`A_ZL`*$BB +M0@`\`O__2*("`8^B`"A(H@(&CZ(`+$BB`@9(*`(!"``*[7T(?`,`````EB4` +M!@``,"V2(P`),*4__Q2@``P``"`M<&<$;G!E`:X`Y2@E$*``!WQ"'@,``A"X +M`B(0+91$``"40@`"``0T.`#","6.(@`,$D``/XXE`!"69P`.-`C__S0*__\T +M"?__D@8`!@`&-#C_I@!@/`80(4BF0@`\!O__2*8"`8^F`&!(I@(&CZ8`9$BF +M`@9()0(!D@8``'RE?`,`!C0X_Z8`:#P&$"%(ID(`/`;__TBF`@&/I@!H2*8" +M!H^F`&Q(I@(&2"0"`30#__\2@``-?(1\`P`4HCP\`A`A_[0`<$BB0@`\`O__ +M2*("`8^B`'!(H@(&CZ(`=$BB`@9((P(!?&-\`Q)``$W?OP"H`*00)M^U`*`` +M1Q`FW[0`F`!#$";?LP"0W[(`B-^Q`(#?L`!X`^``"&>]`+``````EA4`#B01 +M`!((``K,,K4/_P`%*#Q\0O@#`*(0)?^B`$@\`A`A2*)"`#P"__](H@(!CZ(` +M2$BB`@:/H@!,2*("!D@I`@$`%:PX?2E\`P*C&"4\`A`A_Z,`4$BB0@`\`O__ +M2*("`8^B`%!(H@(&CZ(`5$BB`@9(*@(!```X+7U*?`,0@/^I-`C__P`&,#P\ +M`A`A_Z8`6$BB0@`\`O__2*("`8^B`%A(H@(&CZ(`7$BB`@9(*`(!"``+AGT( +M?`,``````2`/@``AGO0"P"``*PP``@"VD +M@``@```0+0"`&"TD"0`_)`@!`-QE```D1@!`9&,`"!"@``5PIS@D``8```H+6>D!@`D!@(`_[\(8/^^"%C_MPA0/!<4`/^V"$@``+`M +M_[4(0/^T"#C_LP@P_[((*/^Q""`,`F9@_[`(&&>D!````"@M#`)F8"0&`@`` +M`"@M)`8"``P"9F!GI`(``Z`@+0``*"T,`F9@)`8"`#P%`/\\`O_P-*7_/SP$ +M``TT0@`C0`9X`#2$EP``Q2@D``(2_'"D("JOI`@```#(+0@`#+,T7@#XW0(` +M"``$)WQ\0@]"``(7?!!$`",`````)SD``20"`0`3(@`29M8(`-[H1@`T`JZ` +MJ!``" +MQS@M``!H+32EH(!F50(`-QB&H-TN````\A`M9.;^````("W<0P```$40+11& +M__T`@R`MW2\"``"`B"T`]1`M```8+=Q&````11`M%$?__0!F&"T1X``%`&`0 +M+0!O,"L4P`%1``````!O&"\1P``%_2("``".$"L40`%.``````".("\1@``) +M_3$``'!P&`-PD"`#`&P`'P&``?0``!@2`(P`'P&``?0``"`2``0P*P`#$"L` +MPA`D$$``\@``````9``?`(`!]-T&!&C=!`1X_68``/U$`````!`2+$0'T!2` +M`.P`````+$,/H!!@``5D0_!@)`,`"/UC``#]0P``9$/P8"QC#Z`08``%9$/@ +MP"0#``;]8P``_4,``&1#X,`L8P^@$&``!61#T2`D`P`$_6,``/U#``!D0]$@ +M+&,?0!!@`10L0DX@)`(``OUB``#]0@``D0(`-R6M``%E*0`(96L`"&5*``@! +MHA`J%$#_J63G``A\`O@[WZ,("`!#$"L40`$L`````'P"^#L`0Q`OW0,$0!!@ +M`2+?HP@0D0,`-A!@`&D\`Q0`/!'^,=QD1@@\`P'/-&.^"#8QY@`\&``!`$Q@ +M+0"#("T\`P`)904(J`.@,"UGIP(``L0@+0``2"TT8Z"`9C("`#<8AJ`D%0`( +M`````-RN````D1`M9(W^````6"W<2@```$,0+11-__T!:E@M$<``!0%@4"T! +M;A`K%$``^0`````!;E@OW*X"``"2$"W\J@````!0+=Q-````0Q`M%$3__0%- +M4"T1P``%`4`0+0%.:"L5H`#N``````%.4"\1@``)_*("`'%04`-Q<%@#`4P` +M'P&``?0``%`2`6P`'P&``?0``%@2``MH*P`*$"L!HA`D$$``D``````!2P`? +M`6`!]-T-!(#="P1X_.T``/S+`````!`2+$L'T!5@`(H`````+$H/H!%```)D +M2O!@_/4``"U*#Z`10``#_-4``"0*``;\Z@``9$K@P"0+``8M2@^@$4```_S+ +M```D"@`$_.H``&1*T2`D"P`$+4H?0!%``*_\RP``)`(``OSB``#\P@``D0(` +M-B4I``%DI0`(9,8`"&3G``@!(A`J%$#_K&2$``@R9``_%(``!```$"V-`PST +MC0(-``!B$".1#0`W/`X4&-W#5WC`90)T%*#__B0%``'@90)T$*#_^P`````\ +M!?^``!2C0#2E`1\"A"`E``4I/`!-&"$TI2@M`$,8*@`%*3C\I```W*0``!!@ +M`&4\!O^```(4>#3&`1\``"@M``8PO"0*`1@TQ@0!)`___P`&,;@\"0`"`$88 +M+63&`&`(``X$`$8@+0.F,"W#/"<(``T(`&\8+0`.<"<(``T.`(X@+=T*!(C=`@1P_.H```@` +M#;?\P@``)`H``BQ"3B`40/]2_,H``"0"``'\X@``"``-M_S"``#=`P1@W0($ +M +M%!C_HP`(`&`P+=_%5VC<0T6(CX2!@/^&@OAPHQ@##`"((/Q#18@40`&'```` +M``P`AVP\%/^`#`"(1C:4`0%\`P`[?&,)PP`4ICBOHP`$/`,`_S1C_S\VE``# +M0`1X`/^@`"``@Q@DKZ,`$```B"T``(`M/!44`#P6%```%*0X`````)."@P`P +M0@#_%$``!0````"3@H,!,$(`_Q!```:?@H&`)C$``20"``(2(@%1`````)^" +M@8`D`P`!``(0^`!4$"W\0P``#`"(((^$@8`40`"X``````P`B!2/A(&`%$`` +MIMZC1@!\$_@[?`+P.Q!`__Z/HP`$/`+__#1"``L``A-\?&(Y!MQ"```$0`!' +M`````'Q72`$2X`!$)`/__P+@D"U\`!#$"\`PA`K%$``$Y^$@8`\`Q0`C&)% +MU!!```4\!!0`_[(`"(R"1=`00``+GX2!@/^R``@,``.\`N`@+0P`A;@"X"`M +M#`"&B@+@("T,``6T`N`@+9^$@8`\`@`PWJ-&`#1"Y&``@A`M``(0N`!B$"V, +M4@`@?`/X.]^"@Q`00``,`'.8+P!2$"T```$/"``.KG!3`!D\`@#$`&(0+8Q$ +MD#`,`)0NC$60-`@`#L<`````#`#0^`````#?@H,0`%(0+0```0\(``ZN<%,` +M&0P`A-8`````"``.PP`````,`C!B`D`@+0@`#PL\`A!BW0(`""0#``$``B\^ +M$*,`"GQ&-0(,`'WF`D`@+1!`_X``````#`"4L`)`("T(``\+/`(08@`````\ +M`Q`+``80^&1C0%!\8A(*`$``"``````,`&RL`D`@+8Y"`*@$0`!^``````P` +M)+X"0"`M"``/"SP"$&(`````W04`$`)`("T``#`M#`!9%'[W2`%\`P`[```! +M3SP"_X!\8PG#-$(!*0`"$CQ\8CD&_%<```@`#PL\`A!B`````)97`$X"0"`M +MCD<`J``7N``,`&RL_Z<`*-^G`"@2X``,)N/__P)`$"TD!O__)`7__]Q$`$#< +M0@"8```!3W!&`!D```%/)&/__Q1E__D`@!`M!.#_10`````,`3=4`D`@+0@` +M#PL\`A!B#`!,X@)`("T(``\+/`(08MY$`#`,`>2`?O=(`7P#`#L```%//`+_ +M@'QC"<,T0@$I``(5^#1"``$``A1X?&(Y!OQ7```(``\+/`(08@`````,`>L< +M`D`@+0@`#PL\`A!B#``OA@)`("T(``\+/`(08@P`2&X"0"`M"``/"SP"$&(, +M`"YJ`D`@+0@`#PL\`A!B#``P"`)`("T(``\+/`(08@P`+?("0"`M"``/"SP" +M$&(,`"H8`D`@+0@`#PL\`A!B#``JH@)`("T(``\+/`(08@P`0QX"0"`M"``/ +M"SP"$&(,`'1(`D`@+0@`#PL\`A!B`D,@+_^D`!@(``\_`E>X+0P`K+(````` +M"``.NY^"@8`,`##&``````P`3)@"0"`M"``/-?^R`"`,`)3N``````@`#R`` +M````WD(`F````4\D`___<$,`&0```4\(``\+/`(08@P`AF8`````#`!NQ@`` +M```,`$#\``````@`#ID``````````&>]_[`\`P#$_[(`$#P2%`#>0D8`_[\` +M2/^^`$#_MP`X`$,8+?^V`##_M0`H_[0`(/^S`!C_L0`(_[```)1CD"(08`!- +M)!:``3P5__``%K2X-K4`(S;68`$`%:WX`L"@+3:U!$,`%K1X`!2D^#;6(`4` +M%:TX-I2*`0``@"TT%ZZ``!:S>#:U`$@(`!!O`!2B^##F`/\D!P$``.8H"R0' +M(```YB`+,$(`/SP(__``HB@M-0@`(P`%*C@`"$+\`+4H+34(`/@`HR@E`&@X +M)=RB```D!@`!)A```3!"`#\`@B`M``0@^`"4("T`@Q@EW&(``'S"M8=\PH0' +M_&(``-Y"1@#@!`F"T"8"`M#`$X8@!`*"U^(PL#``,9/"0% +M`@``=B`EW(8``"0$0`!\QA@"R,#_RC#'``(``"`M"``040``*"W?OP!(W[X` +M0-^W`#C?M@`PW[4`*-^T`"#?LP`8W[(`$-^Q``C?L````^``"&>]`%`0H``- +M```0+7RC/`,P8P#_+&,``A1@``1\I3`#`^``""0"``$`````)(0`?C"E`/\4 +MI/_Z``````/@``@`````/`,4&-QB5W@00``'<(<3!% +M`G00H/_[`````#P"_X!PA@$R-$(!'P`"$3PT0B@M``(1./Q'``!D0@U@`,(P +M+=S"``!\13P#,*4`_P`%*"L4H``$)(@`?CP"``%]`C`'_,(``-QF5W@0P``$ +M`````````4^LP`)T```!3Q2@`!_<95=X?$8T`GQ".`(`!"-\$*``!W!&$`/` +MI@)T%,#__B0&``'@I@)T$,#_^P`````\!O^```(4>#3&`1\`P"@M``8V.``% +M*3PTQ@`!-*4H+0`&-#@`1A`M``4I./RG``#\1```W&)7>!!```0````````! +M3ZQ``G0```%/`^``"`````!GO?_H_[````"`@"W_OP`0#`&72O^Q``@2```5 +M`$"(+0`","L`!C`O`@`@+0``*"T,`F9@,,8`")(B`,JF`@``DB(`Q*("``*2 +M(@#%H@(``Y(B`,:B`@`$DB(`QZ("``62(@#(H@(`!I(B`,FB`@`'W[\`$-^Q +M``C?L````^``"&>]`!@`````9[W^J"0&`0#_LP$@`*"8+?^P`0@``"@M_[(! +M&`"`@"W_L0$0`Z`@+?^_`5!^$?@#_[X!2#P2%`#_MP%`_[8!./^U`3`,`F9@ +M_[0!*#0$KH!R)"@#WD)&``!%*"W1$8`)`8``0""("VLD``` +MWD=&``#B$"W<1``(?,3_QGP$]T;\1``(CL0``*!``#:@0``WI$0`,*Q7#02. +MQ``0K$0`$([&`!`DQ@`6K$8`&!*``*W?HP$`?`,H!'QC^`-P91@#`.,8+=QC +M`"```R(^``,L/C"$`/\PI0#__$,`('RD>@0P@___K$,`%#0#KH`D!A70`Z`P+1!` +M`'T`0*@M```H+3P&``@,`F9@`J`@+?[3(&C^TR!@9J4`.`)@,"T``!@M9J@` +M,`@`$<<\!P`(`````-[&(&@!`Q`M9&,`0/S"``#>9``(_*0``/YB``C\L__X +M%&?_]V2E`$`,`"06`@`@+1:```0T`JZ`#``K9`(`("TT`JZ````H+7(BB`/> +M0D8`)`9```!1$"T,`F9@W$0N2#P"%!C<0E=H/`4(,=Y#1@`TI2;I``4L.``" +M(+@``C'X`,0@+S2E>-4`@B`M``44N'R$X`%D0O?/`((`'0!QB"T``"`0/`(` +MQ`!B$"T`!"$Z_B0N4)1#D"(D8P`!I$.0(H["`#PD0@`!KL(`/-^_`5#?O@%( +MW[]`5@"8"@M9(1$X`(`,"T,`!>6`J`X+0@`$8Z.P@`\ +M/`00"SP%$`MDA$4@#`)^O&2E27`\!!`+_L`@6#P%$`MDA$5(#``7EF2E26`( +M`!'ZW[\!4#P$$`L\!1`+9(1%B`P`%Y9DI4E@"``1^M^_`5!GO?VH```H+?^Q +M`A`D!@$`_[("&`"`B"W_OP)09Z0!`/^^`D@\$A0`_[<"0/^V`CC_M0(P_[0" +M*/^S`B`,`F9@_[`""-Y"1@`T`ZZ`1D8`,N4/_S"E__\R]___```0+0##&"W<9``P_'8. +M(/QW#BBL=0XP?H1[QOQD`#`0H``$_',N2"0%``%\I'.&_&0`,"0#%=`D!P!` +MD`0`,`+/* +M9Z0!`&>D`0```"@M#`)F8"0&`0`\!1`+9Z0!``*@,"T,`H!&9*5%$`P`L\IG +MI`$`/`(4`/Z`(%@(`!)WW%Y&`!!```,D`@!`"``2=ZZ"`#@(`!)WKH``.&>] +M_^C_OP`0_[$`"#P1$`L,`9=*_[```&8D1=@,`+.(``*`*P`0@"\00``1,A`` +M"-Q"```D$``!$$``!0``("T`0"`M)`+__WQ$_\8LD``!#``0Y@````#?OP`0 +M`@`0+=^Q``C?L````^``"&>]`!@\"1```@`@+0``*"T``#`M)`<`"&8H1=@, +M`+1H92E#F`@`$P@L4``!/`,4`)!C`1@48``#```0+0/@``@`````/`0`Q3P& +M$`MGO?^@-(00@"0%`(!DQD7H_[(`,#P2%`#_OP!8_[8`4/^U`$C_M`!`_[,` +M./^Q`"@,`+1>_[``(!!``27^0D8`/`8`Q0!`("T``"@M#`)F8#3&$(#>0D8` +M/`,4&```@"W<8U:`-!.N@"04`0`(`!-!_&(`"``````F$``!$A0`$-Y"1@!R +M$X@#`%&(+=XB+D@40/_Y)`1```P`L:HD!0"`$$`!$@!`J"T`0"`M```H+0P" +M9F`D!D``"``3/OXU+D@\`P#$)`4`0`!#&"TD!/__/!8``CP5`*ZL99&```"` +M+:QED80VUJ&`_&21B#:UA`#\9)&0)!0`"'(6B`,D!0#_)`8`*"80``$"-8@M +M`%$0+613(1!D42$X#`)F8`)@("T,``P,`F`@+0P`#"`"8"`M)`4`_R0&`"@, +M`F9@`B`@+0P`#`P"("`M#``,(`(@("T6%/_IWD)&`#P#`,0`0Q`M)`,``0P! +METJ@0Y`D$$``Y@````"41@#`),+_U#!#__\L8P`J%&``%#P#$`L\!1`+`Z`@ +M+0P"@$9DI490/`00"V2$1G`,`!>6`Z`H+20"___?OP!8W[8`4-^U`$C?M`!` +MW[,`.-^R`##?L0`HW[``(`/@``AGO0!@<$)X\F1C2!!\8A(*`$``"``````D +M`H`!/`7_\``"%+@\!!`,W(2/P#1"8`,``A>X-*4`(WP#`#M\8PG#-$(`,``# +M&3P`!2K\_Z0```!B$"7\0```-*4`^-Y&1@``92@EW*0``#P#`,3<1P`````@ +M+0##,"T`!S@_K,>1F"0&``C\1@``/`<0`-RE``!DYT)(W$(``#P&%`#>148` +M_,=&B#P'$````A`_9.="B`"C&"T\!A0`K&*1G`P`$*+\QT:`#``0HB0$``$\ +M"!0`90@``-Y*1@`\!`##-(20````&"TD!O__)`4`"`%$("T`@!`MK$8``"1C +M``$49?_]9$(`!(T&```8P``3/`,`KCP)``(T8X0``0`H+0%#&"T``!`M-2FA +M@`````",I@`(9*4`!*Q@`$BL9@```&D8+:R"```D0@`!C08```!&."H4X/_V +M9(0`!#P"`,0\!!`+`4)0+62$1H"M1I`P`Z`H+8T"``0,`!>6K4*0-`@`$XP` +M`!`M)`(`31#"`'$`````)`(S`*>B``0\`DY)-$)#,J^B```D`H`!/`3_\``" +M%+@TA``C-$)@`P`$(OP``A>X-(0`^'P#`#M\8PG#-$(`,``#&3P\!A```&(0 +M)0!D&"7\0```9,9"2-QC`````"`MW$,``#P"%`#>148`_$9&B#P"`,0``Q@_ +M`*(0+:Q#D9@\`Q``9&-"B#P"%``,`!"B_$-&@`P`$*(D!``!/`@4``@`$\IE +M"``H/`+_\#1"`",``A+\-$(5L-Q"```P0@`'$$``.CP#$`L\`Q`+/`@4`-QE +M1B!D8D8@90@`>-Q$``B40P`0D$(`$O^E``#_I``(IZ,`$`@`$\JCH@`2/`(W +M.#P(%``T0GAX90@`4*^B```(`!/*HZ``!#P"$`P\"!0`W$.,(&1"C""40@`( +M90@`\/^C```(`!/*IZ(`"#P"$`P\"!0`W$*,"&4(`,@(`!/*_Z(``#P"$`P\ +M"!0`W$*,J&4(`/`(`!/*_Z(``#P$$`L\!1`+9(1%^`P`%Y9DI4F("``3C"0" +M``$\!!`+/`40"V2$1I`,`!>69*5)J`@`$XPD`@`!"``3C```$"T\"!0`W&5& +M.&1B1C@(`!0P90@`H"0",P"GH@`$/`).231"0S<(`!/^KZ(````````#X``( +M`````&>]_Y@\`@"O_[``&#P0%`#>`T8`)`7___^_`&#_O@!8_[<`4`!B$"W_ +MM@!(_[4`0/^T`#C_LP`P_[(`*/^Q`"`,`2F(C$2$`-X"1@`\`P#$`$,8+8QC +MD#`L9``"%(``%``````\%``")!$``3:4H8`\$P"O/!(`Q'XC^`,D!?__<'08 +M`R8Q``$`0Q`M`F(0+0P!*8B,1(0`W@)&``!2&"V,8Y`P`B,@*Q2`__,````` +M$&``/SP$$`LD%8`!/!3_\``5K/@VE``C-K7`!P`4HOQ\$P`[`!6NN'YS"<,` +M$YD\-K5``S:4`/@\%@`"``"(+3;6H8`\$@"O`!6H^`)TH"5^/O@#)C$``7/6 +M\`,`7A`M`D(0+8Q7A``,`3AF`N`@+0P!.PX`0"`MW@-&`"0&!=P"X"`M`'X8 +M+0)#&"W<980(K&:$$"0&/H"L9H04)`8``7S%M8=\1:Q'#`$X>OQEA`@"X"`M +M#`$X9@!`\"TSW@`#<$(1,@!>\"TD`@7X`![U.`/5\"T#T_`E_\(``-X"1@#> +M@P``/`,`Q`!#&"V,8Y`P`B,8*Q1@_]=^/O@#/`00"PP`%Y9DA$;`#`"()``` +M``#>!$8`/`<`Q"0%``8``!@M`( +M`D8`_K8`*`!4$"T"0A`M9E*$`(Q&A`#_I@`0#`$X9@#`("W?I@`0`$"X+0P! +M.'H`P"`MW@1&``*2*"W_H@`0#`!!E@"%("W?H@`0)`.``3+H``<``QSX``A! +M.#1CP`N`$"$"TT8T`A``(5.``#&/@"("`M`$,0+20%``'?HP`` +M)C$``0!#$"7?HP`(_%8``-QB```D`@`$#``E//ZB`!C>!$8`/`(`Q`""$"V, +M0I`P`B(0*Q!``!\`````?C3X`SP"`*YRDQ@#-$*$`#P2`*\`8A@M`(.H+:Z@ +M`$P"H"`MKJ``4*Z@`%2NH`!$#``F*@````#>!D8`C\16C#P%`,0`Q2@MW*>0 +M*'SG>`$0@/^Y`H>P+3P$$`L"("@M`L`P+0P`%Y9DA$<("``5`W(SH`,````` +M```!#]^_`&```!`MW[X`6-^W`%#?M@!(W[4`0-^T`#C?LP`PW[(`*-^Q`"#? +ML``8`^``"&>]`&AGO?[8_[4!`/^T`/C_L@#H_[``V```@"W_OP$@_[X!&/^W +M`1#_M@$(_[,`\`P!.PS_L0#@?!(`.WY2"<,`0*`M&$``#P)`J"T`$I0`)!$` +M"0@`%7D`0)@M)A```1(3`%P`````,@0`_S2$W@`,`3L.`)(@)0`"$``44?_W +M`````"0$__\"D*`F`A0@"P``*"T,`3@H/!?_\#;W`",#H"@M`!>Z_`!`@"T, +M`2``&CHP!J`K>X):.C`&FCHP!H#`$G7J.C`&=\$``[?A`) +MPP`0A``,`3L,``"P+1A```T`0*`M"``5JP!`D"TFU@`!$M(`#"0"`#\RQ`#_ +M-(3>``P!.PX`D"`E``(0`!11__<`````$I8``R0"`#\RPP`_`&`0+3P#__`" +M8A`M-&,`(P`"$C@``QWX9G,!`#1C!$,``QTX-&,`0`!#$"T`51`EW$,``'_# +M*4?\0P``WN(``"0"`@`68O_;W[\!(```$"W?O@$8W[]^B#<8D8` +M/`0`Q/^T!;`D!?___[\%V/^^!=``1"`M_[<%R/^V!<#_M06X_[,%J/^R!:#_ +ML068_[`%D(R$D##_H`48?`,`._^@!2```QG"_Z`%*#!T``/_H`4PKZ4%&/^@ +M!-C_H`3@_Z`$Z/^@!/#_H`3X_Z`%`/^@!0@8@`$0_Z`%$#P(__P`%$D\-0@` +M"0``J"W_H`5@``A$.*^C!8`U"$`!``A'>`$H0"7_J`6(WZ,%8#P%``(TI:&` +M?!'^A'!E(`./I06`/`,`KV1FA`!\L`P`098PT@__WZ,%B`*`("TD!?__)`8`"-QB +M```P0@`_?%&L!"0"^:,,`6G`?%%X!`1``0O_H@5H9[8$W`*`("TD!?__9[`% +M&`P!:R;_M@5P`@"X+0``F"T\!1`+`L#P+=^F!5@"8#@MKN(```.@("T$0`#P +M9*5'<`P"@$8``````!,8^`(@("TD!?__`Z`P+20'"``\"``"#`#)W@.CL"TT +M!/FCKL($W``"$#^NP@38E\(``!!$`-`\!!`+`L#P+=_&!-@\!1`+W[8%<&2$ +M1XADI4G(`@"8+7S&2@(``/`M#``7EC#&__\(`!96)!<`""?>``%FF/@"@"`MCA8```.SF"W>90389A``!`+` +M,"U\I4H"#`%>[#"E__\#TB@A`H`@+0P!7Q("P#`MWF@$V#P$$`L#P#@M9(1' +MJ`+`*"U]"$H"`D`P+0P`%Y8Q"/__WF4$V`*`("TD!@`!)`<``20(!1%\I4H" +M)`D&(C"E__\D"@`!#`$A0"0+!`"OO@4\`]F!3BOI04X`H`@+=YB!-BO +MO@5$K[X%2"?>``&OH`5,?$)*`J^B!4`,`5WHKZ`%4"0&``@7QO_.WZ0%6&>E +M!``,`2@!`@"T"`"`M#`$X8@!`*"TD!H`!WZ,%>``&-+@T +MQF`!``8T>#3&(`4``RD\``8S>"ZC``(`IB`EW(0``!!@``I\A!@"`J08%^A@ +M``#3&`$@D`P`!`$80+3P&%```12@E +MWZ(%8"1"``'_H@5@W*(``"0%@`$`!2RX-*5@`3!"`#\`!2RX`((@+32E10$` +M!2LX``0@^'R%$@H`A2`MWZ4%8'QB4H=\8AC'?&((1_R"```\!/_PW,)&`#2$ +M`",`!"+\-(0`^-R#```\`P#$`$,8+8QCD#``HQ@J%&#^_M^C!6#?OP78```0 +M+=^^!=#?MP7(W[8%P-^U!;C?M`6PW[,%J-^R!:#?L068W[`%D`/@``AGO07@ +M)G,``20&``AF]P`$$F;_5&?>``@"@"`M#`%K)B0%__\\!1`+WZ8%6`)@."VN +MX@```Z`@+01!_Q)DI4=P/`00"SP%$`O?M@5P9(1'2&2E2<@,`!>6`@"8+0@` +M%E```/`M"``6V"05``(\!!`+/`40"V2$1R`,`!>69*5)R-^_!=C?O@70)`+_ +M_]^W!]!>!GO?\P +M_[\`R/^R`,#_L0"X#`'E!/^P`+`,`>4V`$`@+0P!/;@`````)`/__Q!#`$`\ +M!!`+```!#WP2`#M^4@G#)!```0)`("T,`5EZ`D"(+3P#_^`T8P!5/`+_\``# +M';@T0@`C-&,`#0`"%'@``QTX-$(`$31C``@``A:X`!*1/``1,3P"0Y`E-$(" +M`/Y`````PA`EW$,``#P'__`TYP`C`B`@+0`'.OP#H"@M-.<`^'X#2D?\0P`` +M`,] +M`-``````#``5U@`````40/_UW[\`R`@`%X'?L@#`#``7EF2$1^#?OP#(W[(` +MP"0"``'?L0"XW[``L`/@``AGO0#0`````&>]@!`T`H"8_[1_8#0#@*#_LG]0 +M_[%_2/^_?W#_M7]H_[-_6/^P?T!GO?\@`%T0+0!]&"W\10```(`0+?QF```T +M!H"H`-TP+30#@+#\QP``-`:`N`!]&"T`W3`M_&@``#0#@,#\R0``-`:`R`!] +M&"T`W3`M_&H``#0'@`#\RP``-`:`F`.F&"TT!H`0`-TP+0.G."W\PP``-`.` +M&`!`,"T`?1@M)`(`.`.@("V@8@``-`.`&20"`$``?1@MH&(``#0#@-``?1@M +M-`*`6/SC```T`X!@`%T0+0!]&"WT3```]&T``#0"@&@T`X!P`%T0+0!]&"WT +M3@``]&\``#0"@'@T`X"``%T0+0!]&"WT4```]'$``#0"@(@T`X"0`%T0+0!] +M&"WT4@``]',``#0"@`@T`X#0`'T8+0!=$"W\0P``#`*?T#0%@`"?@X&`/`44 +M`#0$@`!DI4:0`$"(+0`#D/@``QOX`D.0+20"__\"19`MCD,```!D*"L0H``% +M`Z"@+8Y%``0`I"`K%(``.P`````T%8````````(B@"H`0#`M`C`P"P`"$"H` +M$1@J`H`H+0!B$"0`P(`M$$``)`#`F"V.0@`$?$3X`P)B&"%DA``(`'48*Q1@ +M``,"1"`M`J*8(P)@@"T,`F5<`@`P+0```0^.1``$`C"((XY#```"D*`M)`+_ +M_P"3F"$R`,"8+6>]`.#?OW]PW[5_:-^T?V#? +MLW]8W[)_4-^Q?TC?L']``^``"&>]?_``````)&)__P!%$",(`!?Z,$)__SP" +M%!B,1%=D$(``$#P"%``DA/__?(3X`V1"1I``!!CX-`6`"``$(_@`12@M`&08 +M+30$@`@`HQ@MK$```*Q```0`1!`M%$/__``````\`Q``/`(4&&1C7E@#X``( +M_$-MF&>]_^@T`X``_[````"`@"W_OP`0_[$`"(R"````0R`K$(``&@````". +M!``$`(,H*Q"@`!8D17__`*0H(P`%*"]`!AGO?_0_[0`(#P4%!B.@E=D +M_[\`*/^S`!C_L@`0_[$`"!!``!G_L```/!'_@#P3%``V,0$!``"`+0`1CCAF +M]`#!GO?_X/`(>W/^E```T0F]!2*)"````$"U(H@(! +MBZ(``DBB`@:3H@`&2*("!).B``=(H@($2"("`0`"$$`D!___"``8MB1(`@`0 +M2``)`````'!#03(`PQ@MC&4`"!2G__HD0@`!WZ(``*QD``C\8@```^``"&>] +M``AGO?_@_[\`&/^R`!#_L0`(`*"(+?^P```,`3AF`("`+0(`("T,`3AZ`$"0 +M+20#@`$R4@`'``,<^#!"``,T8\`'`!*1.``#'K@"0B`M-&-``0`$)3@``QCX +M?`(`.WQ""<,`@R`M``(1/`""$"7<0P``$B``%20"``$D`@`#?$,8AWP"`#M\ +M0@G#/`7_\``"$3PTI0`C`$0@)0`%*OS\@P``-*4`^-^_`!@`11`EW[(`$-^Q +M``C?L```W$(```/@``AGO0`@``````@`&.!\0QB'9[W_X/^_`!C_L@`0_[$` +M"`"@B"W_L```#`$X9@"`@"T"`"`M#`$X>@!`D"TD`X`!,E(`!P`#'/@P0@`# +M-&/`!P`2D3@``QXX`D(@+31C$`L`!"4X``,9>'P"`#M\0@G#`(,@+0`"$3P` +M@A`EW$,``!(@`!,D`@`!?$,YQWP"`#M\0@G#/`7_\``"$3PTI0`C`$0@)0`% +M*OS\@P``-*4`^-^_`!@`11`EW[(`$-^Q``C?L```W$(```/@``AGO0`@"``9 +M$WP#.<>0B```/`,0"]R)``!D8TH@D(<`!)""``,\!!`+9(1*&'TI!<,`B!@+ +M/`00"V2$2BA\1WH$`&!`+3P#$`MD8THP`(D8"SP$$`MDA$GP"``7E@!@2"T` +M````-`*N@&>]_VAP@A`#_[(`6/^D`$`\$A0`WD1&`/^S`&#_L`!(_[\`D/^^ +M`(C_MP"`_[8`>/^U`'#_M`!H_[$`4/^E`#``@B@MD*(`-WP3`#M^148``C80+0(`("UD0@`#`Z`P+0`"$/@`HA`MW$<`('SG +M5X,PY___`.`H+0P!7<0`X/`MCZ@`"`4!_X\\!/_P/`S_\```N"TUC``C``QE +M^#6,!$D(`!F8``RM.`````#?I`!`-`.N@'"#&`,`0Q`M_$`,Z*!``#;?OP"0 +MW[X`B-^W`(#?M@!XW[4`<-^T`&C?LP!@W[(`6-^Q`%#?L`!(`^``"&>]`)@( +M`!EZ_Z,`(`@`&78``+@M,((`/Q1```0T`ZZ``^``"`````````````0A@P`$ +M(8!P@R`#/`,4`-QH1@`\`_^`-&,!*7P'`#L``QH\?.<)PWSC.0;<9P```00@ +M+9"(`CB,@PST$.``&`$#0"$`X!@M)`G__SP$__!](__&-(0``R0)`(5GO?_X +M``E-?``$(OS_OP``?.0X!?QI``#\8@`(K&4`!/QF`!````%/```H+7R'>@(, +M`(G.)`8``=^_```#X``(9[T`"#P$$`L(`!>69(1*J``````\`__P9[W_J#1C +M`"/_M@`X``,:_``$LCLT8S@8_[,`(``6L?C_MP!``L.8+?^U`#`"8+@M_[0` +M*'P7*0;_OP!0?G.2`O^^`$@PA`#__[(`&`"@H"W_L0`0`,"H+?^P``C>X@`` +M?`+&!_[B```D`@$8$F(`13P"``$\`__P-&,`(S1"``(``QK\,)(`'S1C.`!^ +M0F('`L.`+0(`B"U^$)("?!$I!OXB```D`@$8$@(`1P`````,`+=2)`0``SP# +M``$T8X:@/`0AC7!#$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$`!T``"@0``4L +MNGP"^#L\!/_P`*(H+32$`",`!"+\-(0X$`+$("U\!"D&`````'P#^#MD8P/H +M?`+X.P!#$"L40/_]`````-R"``#(40`%`````'P#^#L`91@K%&#_]`````#( +M4``$,$/__R0"`4$08@`@`````-^_`%#?O@!(W[<`0-^V`#C?M0`PW[0`*-^S +M`"#?L@`8W[$`$-^P``@#X``(9[T`6-QBR.`\`__P-&,`(SP"``$``QK\-$(` +M`C1C.``PD@`?`L.`+7Y"8@<"`(@M?A"2`GP1*0;^(@``)`(!&!8"_[L````` +M"``:?]QBR/C>X@``?`+&!_[B```D`@$8$F("#3P"__`D`P`0-$(`(P`"$OPT +M0C@(`L*P+0+`\"U^UI("?!XI!O_#```D`P$8$L,!_@`````D`@`6?D)B!_XB +M```D`@$8$@(!\SP"__!\`_@[_Z,```P`MU(D!``#/`0``32$AJ`\!2&-<$00 +M`S2E[T'?HP````4L.#2E:]L`!2QX-*4TVP!%`!W?P@`````@$``$)+K(40`/ +M`(,@+0````!\`O@[`((0*Q1```H`````?`/X.V1C`&1\`O@[`$,0*Q1`__T` +M````W\(``.A1__0`````WN(````5JL`VHP!`?`+&!_[B```D`@$8$F(!PSP" +M__`P8O___\(``"0"`1@2P@&X/`+_\"0"``%^0F('_B(``"0"`1@2`@&M/`+_ +M\'P#^#O_HP``#`"W4B0$``,\!``!-(2&H#P%(8UP1!`#-*7O0=^C````!2PX +M-*5KVP`%+'@TI33;`$4`'=_"`````"`0``0DNLA1``X`@R`M?`+X.P""$"L4 +M0``*`````'P#^#MD8P!D?`+X.P!#$"L40/_]`````-_"``#H4?_T`````-[B +M````%*"`-I0``7P"Q@?^X@``)`(!&!)B`7X\`O_P,I3__R0"`1C_U```$L(! +MX@``?`+&!_[B```D`@$8$F(! +M/#P"__#_P```)`(!&!+"`3(\`O_P)`(``WY"8@?^(@``)`(!&!("`2<\`O_P +M?`/X._^C```,`+=2)`0``SP$``$TA(:@/`4AC7!$$`,TI>]!WZ,````%+#@T +MI6O;``4L>#2E--L`10`=W\(`````(!``!"2ZR%$`#P"#("T`````?`+X.P"" +M$"L40``*`````'P#^#MD8P!D?`+X.P!#$"L40/_]`````-_"``#H4?_T```` +M`-[B```VHP!0?`+&!_[B```D`@$8$F(`^#P"__`P8O___\(``"0"`1@2P@#M +M/`+_\"0"``%^0F('_B(``"0"`1@2`@#B/`+_\'P5^#L,`+=2)`0``SP#``$T +M8X:@/`0AC7!#$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$`!W?P@`````@$``$ +M)+K(40`/`)4@+0````!\`O@[`((0*Q1```H`````?`/X.V1C`&1\`O@[`$,0 +M*Q1`__T`````W\(``.A1__0`````WN(``'P"Q@?^X@``)`(!&!)B`+<\`O_P +M_]0``"0"`1@2P@"M/`+_\"0"``)^0F('_B(``"0"`1@2`@"B/`+_\'P4^#L, +M`+=2)`0``SP#``$T8X:@/`0AC7!#$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$ +M`!W?P@`````@$``$)+K(40`/`)0@+0````!\`O@[`((0*Q1```H`````?`/X +M.V1C`&1\`O@[`$,0*Q1`__T`````W\(``.A1__0`````WN(``'P"Q@?^X@`` +M)`(!&!)B`'<\`O_P_\```"0"`1@2P@!M/`+_\"0"``-^0F('_B(``"0"`1@2 +M`@!B/`+_\'P4^#L,`+=2)`0``SP#``$T8X:@/`0AC7!#$`,TA.]!``0D.#2$ +M:]L`!"1X-(0TVP!$`!W?P@`````@$``$)+K(40`/`)0@+0````!\`O@[`((0 +M*Q1```H`````?`/X.V1C`&1\`O@[`$,0*Q1`__T`````W\(``.A1__0````` +MWN(``'P"Q@?^X@``)`(!&!)B`#<\`O_P_\```"0"`1@2P@`M/`+_\"0"`!9^ +M0F('_B(``"0"`1@2`@`B/`+_\'P0^#L,`+=2)`0``SP#``$T8X:@/`0AC7!# +M$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$`!T``"`0``0DN@"0("T`````W\(` +M`,A1_E@`````?`+X.P""$"L40/Y4`````'P#^#MD8P!D`````'P"^#L`0Q`K +M%$#__0`````(`!Q.`````#1"`",``A+\-$(`^`@`'#W<0@``-$(`(P`"$OPT +M0@#XW$(```@`'#@D`@`6-$(`(P`"$OPT0@#X"``<,]Q"```T0@`C``(2_#1" +M`/@(`!P-W$(``#1"`",``A+\-$(`^-Q"```(`!P()`(``S1"`",``A+\-$(` +M^`@`'`/<0@``-$(`(P`"$OPT0@#X"``;W=Q"```T0@`C``(2_#1"`/C<0@`` +M"``;V"0"``(T0@`C``(2_#1"`/@(`!O3W$(``#1"`",``A+\-$(`^`@`&ZW< +M0@``-$(`(P`"$OPT0@#XW$(```@`&Z@D`@`!-$(`(P`"$OPT0@#XW$(```@` +M&Z,P8O__-$(`(P`"$OPT0@#X"``;>=Q"```T0@`C``(2_#1"`/C<0@``"``; +M="0"``,T0@`C``(2_#1"`/@(`!MOW$(``#1"`",``A+\-$(`^`@`&TC<0@`` +M-$(`(P`"$OPT0@#XW$(```@`&T,D`@`"-$(`(P`"$OPT0@#XW$(```@`&SXR +ME/__-$(`(P`"$OPT0@#X"``;%-Q"```T0@`C``(2_#1"`/C<0@``"``;#R0" +M``$T0@`C``(2_#1"`/C<0@``"``;"C!B__\T0@`C``(2_#1"`/@(`!K?W$(` +M`-Q"R/`(`!K:)`(`%C1"`",``A+\-$(`^-Q"```(`!K-/`+_\`````!GO?_H +M_[\`$/^Q``@`@(@M#`$X9O^P```"("`M#`$X>@!`@"T\!/_\`!"$>#2$``D" +M`A`M``0D>``"&KADA(`+```0+0`$)S@TA!``?&0J"NBN`!=DA``@?&0:"LAB +M``_?OP`0?&4`0WQD",-\HI2',(0`_WQBG,]`!@`````"``=!GQBB`X@`` +MR*`!2`````!\`L8'?C&(`_[B```2(`)#)`(!&!("!&(\`O_P/`/_\#P"``$T +M8P`C-$(``0`#&OPR__``@B`M-]X`(P`>\OPWWC@0 +M`K[P+7P>*09\`_@[9&,#Z'P"^#L`0Q`K%$#__0````#?P@``R%$`!0````!\ +M`_@[`&08*Q1@__0`````WN0``'Q%!`,D`___`$48"P"`$"U\`L8'_N(``"0" +M`1@2`@0<,';__SP"``$T0@`$?F)B!_Y"```D`@$8$B(#X#P"__`,`+=2)`0` +M`SP#``$T8X:@/`0AC7!#$`,TA.]!``0D.#2$:]L`!"1X-(0TVP!$`!T``"`0 +M``0DNGP"^#L`@B`M?`/X.V1C`^A\`O@[`$,0*Q1`__T`````W\(``,A1``4` +M````?`/X.P!D&"L48/_T`````'Q$!`,D`___`$08"S+6`0`RUO__,&/\'Q;` +M`XD``R@`/`,4&,J```6,8E:,%$`"F3P$$`LTI0`@``4H`#*$``(0@``%```` +M`!1``KH\!!`+-*4`0``%*``RA``$$(``!0`````40`*K/`00"S2E`(``!2@` +M,H0`"!"```4`````%$`"G#P$$`LTI0$```4H`#*$`!`0@``',H<`(!1``HT\ +M!!`+EZ8`!C3$`0"GI``&,H<`(!#@``8`````%$`"?3P$$`N7HP`&-'0"`*>T +M``840`,T/`00#=[B```PH___?`+&!_[B```D`@$8$@(#.#P"__`\`O_P-$(` +M(P`"$OPT0C@(`J*H+0*@H"U^M9("?!0I!OZ#```D`P$8$J,#/``````D`@`$ +M?F)B!_Y"```D`@$8$B(#/3P"__!\`_@[_Z,`"`P`MU(D!``#/`0``32$AJ`\ +M!B&-<$00`S3&[T'?HP`(``8T.#3&:]L`!C1X-,8TVP!&`!W>@@`````@$``$ +M)+K(40`.`(,@+7P"^#L`@A`K%$``"@````!\`_@[9&,`9'P"^#L`0Q`K%$#_ +M_0````#>@@``Z%'_]``````6P`)D`````-[B``!\`L8'_N(``"0"`1@2`@-Z +M/`+_\#P"``%^8F('_D(``"0"`1@2(@-O/`+_\`P`MU(D!``#/`,``31CAJ`\ +M!"&-<$,0`S2$[T$`!"0X-(1KVP`$)'@TA#3;`$0`'0``(!``!"2Z?`+X.P"" +M("T`````?`/X.V1C`^A\`O@[`$,0*Q1`__T`````W\(``,A1``4`````?`/X +M.P!D&"L48/_T`````'Q$!`,D`___`$08"R0"``'>Y```,&/__WQ#8P=\!,8' +M_N0``'Q#2D#2$--L`1``=WH(`````(!``!"2ZR%$`#P"0("T`````?`+X +M.P""$"L40``*`````'P#^#MD8P!D?`+X.P!#$"L40/_]`````-Z"``#H4?_T +M`````-^_`&```!`MW[X`6-^W`%#?M@!(W[4`0-^T`#C?LP`PW[(`*-^Q`"#? *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Nov 10 08:42:38 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1BDAE6852E; Fri, 10 Nov 2017 08:42:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D8F56B51A; Fri, 10 Nov 2017 08:42:38 +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 vAA8gbkr082838; Fri, 10 Nov 2017 08:42:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAA8gb16082836; Fri, 10 Nov 2017 08:42:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711100842.vAA8gb16082836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 10 Nov 2017 08:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325636 - stable/11/sys/fs/cuse X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/fs/cuse X-SVN-Commit-Revision: 325636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 08:42:38 -0000 Author: hselasky Date: Fri Nov 10 08:42:37 2017 New Revision: 325636 URL: https://svnweb.freebsd.org/changeset/base/325636 Log: MFC r325362: Allow CUSE(3) to free all memory mapped memory by using regular SWAP objects instead of malloc(). The SWAP objects are automagically freed when there are no more consumers. This greatly simplifies the mmap logic inside CUSE(3) in the kernel. This change fixes an issue where mmapped memory can accumulate and never get freed, if many different mmap sizes are needed over time. Further this change fixes memory leaks when the CUSE(3) kernel module is unloaded. While at it make sure the CUSE_ALLOC_PAGES_MAX limit is treated as an exclusive limit. CUSE(3) memory maps must be less than CUSE_ALLOC_PAGES_MAX number of pages. Reviewed by: kib @ Differential Revision: https://reviews.freebsd.org/D11392 Sponsored by: Mellanox Technologies Modified: stable/11/sys/fs/cuse/cuse.c stable/11/sys/fs/cuse/cuse_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/cuse/cuse.c ============================================================================== --- stable/11/sys/fs/cuse/cuse.c Fri Nov 10 08:31:40 2017 (r325635) +++ stable/11/sys/fs/cuse/cuse.c Fri Nov 10 08:42:37 2017 (r325636) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2010-2013 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2010-2017 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,9 @@ #include #include +#include +#include +#include #include #include @@ -69,8 +73,6 @@ MODULE_VERSION(cuse, 1); */ MODULE_VERSION(cuse4bsd, 1); -#define NBUSY ((uint8_t *)1) - #ifdef FEATURE FEATURE(cuse, "Userspace character devices"); #endif @@ -94,10 +96,10 @@ struct cuse_client_command { }; struct cuse_memory { - struct cuse_server *owner; - uint8_t *virtaddr; + TAILQ_ENTRY(cuse_memory) entry; + vm_object_t object; uint32_t page_count; - uint32_t is_allocated; + uint32_t alloc_nr; }; struct cuse_server_dev { @@ -112,6 +114,7 @@ struct cuse_server { TAILQ_HEAD(, cuse_client_command) head; TAILQ_HEAD(, cuse_server_dev) hdev; TAILQ_HEAD(, cuse_client) hcli; + TAILQ_HEAD(, cuse_memory) hmem; struct cv cv; struct selinfo selinfo; pid_t pid; @@ -128,8 +131,8 @@ struct cuse_client { uint8_t ioctl_buffer[CUSE_BUFFER_MAX] __aligned(4); - int fflags; /* file flags */ - int cflags; /* client flags */ + int fflags; /* file flags */ + int cflags; /* client flags */ #define CUSE_CLI_IS_CLOSING 0x01 #define CUSE_CLI_KNOTE_NEED_READ 0x02 #define CUSE_CLI_KNOTE_NEED_WRITE 0x04 @@ -140,14 +143,13 @@ struct cuse_client { #define CUSE_CLIENT_CLOSING(pcc) \ ((pcc)->cflags & CUSE_CLI_IS_CLOSING) -static MALLOC_DEFINE(M_CUSE, "cuse", "CUSE memory"); +static MALLOC_DEFINE(M_CUSE, "cuse", "CUSE memory"); static TAILQ_HEAD(, cuse_server) cuse_server_head; static struct mtx cuse_mtx; static struct cdev *cuse_dev; static struct cuse_server *cuse_alloc_unit[CUSE_DEVICES_MAX]; static int cuse_alloc_unit_id[CUSE_DEVICES_MAX]; -static struct cuse_memory cuse_mem[CUSE_ALLOC_UNIT_MAX]; static void cuse_server_wakeup_all_client_locked(struct cuse_server *pcs); static void cuse_client_kqfilter_read_detach(struct knote *kn); @@ -173,7 +175,7 @@ static d_ioctl_t cuse_client_ioctl; static d_read_t cuse_client_read; static d_write_t cuse_client_write; static d_poll_t cuse_client_poll; -static d_mmap_t cuse_client_mmap; +static d_mmap_single_t cuse_client_mmap_single; static d_kqfilter_t cuse_client_kqfilter; static struct cdevsw cuse_client_devsw = { @@ -186,7 +188,7 @@ static struct cdevsw cuse_client_devsw = { .d_read = cuse_client_read, .d_write = cuse_client_write, .d_poll = cuse_client_poll, - .d_mmap = cuse_client_mmap, + .d_mmap_single = cuse_client_mmap_single, .d_kqfilter = cuse_client_kqfilter, }; @@ -196,7 +198,7 @@ static d_ioctl_t cuse_server_ioctl; static d_read_t cuse_server_read; static d_write_t cuse_server_write; static d_poll_t cuse_server_poll; -static d_mmap_t cuse_server_mmap; +static d_mmap_single_t cuse_server_mmap_single; static struct cdevsw cuse_server_devsw = { .d_version = D_VERSION, @@ -208,7 +210,7 @@ static struct cdevsw cuse_server_devsw = { .d_read = cuse_server_read, .d_write = cuse_server_write, .d_poll = cuse_server_poll, - .d_mmap = cuse_server_mmap, + .d_mmap_single = cuse_server_mmap_single, }; static void cuse_client_is_closing(struct cuse_client *); @@ -252,7 +254,6 @@ cuse_kern_init(void *arg) (CUSE_VERSION >> 16) & 0xFF, (CUSE_VERSION >> 8) & 0xFF, (CUSE_VERSION >> 0) & 0xFF); } - SYSINIT(cuse_kern_init, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_init, 0); static void @@ -280,7 +281,6 @@ cuse_kern_uninit(void *arg) mtx_destroy(&cuse_mtx); } - SYSUNINIT(cuse_kern_uninit, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_uninit, 0); static int @@ -398,74 +398,80 @@ cuse_convert_error(int error) } static void -cuse_server_free_memory(struct cuse_server *pcs) +cuse_vm_memory_free(struct cuse_memory *mem) { - struct cuse_memory *mem; - uint32_t n; + /* last user is gone - free */ + vm_object_deallocate(mem->object); - for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { - mem = &cuse_mem[n]; - - /* this memory is never freed */ - if (mem->owner == pcs) { - mem->owner = NULL; - mem->is_allocated = 0; - } - } + /* free CUSE memory */ + free(mem, M_CUSE); } static int -cuse_server_alloc_memory(struct cuse_server *pcs, - struct cuse_memory *mem, uint32_t page_count) +cuse_server_alloc_memory(struct cuse_server *pcs, uint32_t alloc_nr, + uint32_t page_count) { - void *ptr; + struct cuse_memory *temp; + struct cuse_memory *mem; + vm_object_t object; int error; - cuse_lock(); + mem = malloc(sizeof(*mem), M_CUSE, M_WAITOK | M_ZERO); + if (mem == NULL) + return (ENOMEM); - if (mem->virtaddr == NBUSY) { - cuse_unlock(); - return (EBUSY); + object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * page_count, + VM_PROT_DEFAULT, 0, curthread->td_ucred); + if (object == NULL) { + error = ENOMEM; + goto error_0; } - if (mem->virtaddr != NULL) { - if (mem->is_allocated != 0) { - cuse_unlock(); - return (EBUSY); - } - if (mem->page_count == page_count) { - mem->is_allocated = 1; - mem->owner = pcs; - cuse_unlock(); - return (0); - } + + cuse_lock(); + /* check if allocation number already exists */ + TAILQ_FOREACH(temp, &pcs->hmem, entry) { + if (temp->alloc_nr == alloc_nr) + break; + } + if (temp != NULL) { cuse_unlock(); - return (EBUSY); + error = EBUSY; + goto error_1; } - memset(mem, 0, sizeof(*mem)); + mem->object = object; + mem->page_count = page_count; + mem->alloc_nr = alloc_nr; + TAILQ_INSERT_TAIL(&pcs->hmem, mem, entry); + cuse_unlock(); - mem->virtaddr = NBUSY; + return (0); - cuse_unlock(); +error_1: + vm_object_deallocate(object); +error_0: + free(mem, M_CUSE); + return (error); +} - ptr = malloc(page_count * PAGE_SIZE, M_CUSE, M_WAITOK | M_ZERO); - if (ptr == NULL) - error = ENOMEM; - else - error = 0; +static int +cuse_server_free_memory(struct cuse_server *pcs, uint32_t alloc_nr) +{ + struct cuse_memory *mem; cuse_lock(); - - if (error) { - mem->virtaddr = NULL; + TAILQ_FOREACH(mem, &pcs->hmem, entry) { + if (mem->alloc_nr == alloc_nr) + break; + } + if (mem == NULL) { cuse_unlock(); - return (error); + return (EINVAL); } - mem->virtaddr = ptr; - mem->page_count = page_count; - mem->is_allocated = 1; - mem->owner = pcs; + TAILQ_REMOVE(&pcs->hmem, mem, entry); cuse_unlock(); + cuse_vm_memory_free(mem); + return (0); } @@ -646,10 +652,10 @@ cuse_server_free_dev(struct cuse_server_dev *pcsd) } static void -cuse_server_free(void *arg) +cuse_server_unref(struct cuse_server *pcs) { - struct cuse_server *pcs = arg; struct cuse_server_dev *pcsd; + struct cuse_memory *mem; cuse_lock(); pcs->refs--; @@ -672,7 +678,12 @@ cuse_server_free(void *arg) cuse_lock(); } - cuse_server_free_memory(pcs); + while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) { + TAILQ_REMOVE(&pcs->hmem, mem, entry); + cuse_unlock(); + cuse_vm_memory_free(mem); + cuse_lock(); + } knlist_clear(&pcs->selinfo.si_note, 1); knlist_destroy(&pcs->selinfo.si_note); @@ -686,6 +697,15 @@ cuse_server_free(void *arg) free(pcs, M_CUSE); } +static void +cuse_server_free(void *arg) +{ + struct cuse_server *pcs = arg; + + /* drop refcount */ + cuse_server_unref(pcs); +} + static int cuse_server_open(struct cdev *dev, int fflags, int devtype, struct thread *td) { @@ -700,13 +720,13 @@ cuse_server_open(struct cdev *dev, int fflags, int dev free(pcs, M_CUSE); return (ENOMEM); } - /* store current process ID */ pcs->pid = curproc->p_pid; TAILQ_INIT(&pcs->head); TAILQ_INIT(&pcs->hdev); TAILQ_INIT(&pcs->hcli); + TAILQ_INIT(&pcs->hmem); cv_init(&pcs->cv, "cuse-server-cv"); @@ -1093,12 +1113,12 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, error = ENOMEM; break; } - if (pai->page_count > CUSE_ALLOC_PAGES_MAX) { + if (pai->page_count >= CUSE_ALLOC_PAGES_MAX) { error = ENOMEM; break; } error = cuse_server_alloc_memory(pcs, - &cuse_mem[pai->alloc_nr], pai->page_count); + pai->alloc_nr, pai->page_count); break; case CUSE_IOCTL_FREE_MEMORY: @@ -1108,16 +1128,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, error = ENOMEM; break; } - /* we trust the character device driver in this case */ - - cuse_lock(); - if (cuse_mem[pai->alloc_nr].owner == pcs) { - cuse_mem[pai->alloc_nr].is_allocated = 0; - cuse_mem[pai->alloc_nr].owner = NULL; - } else { - error = EINVAL; - } - cuse_unlock(); + error = cuse_server_free_memory(pcs, pai->alloc_nr); break; case CUSE_IOCTL_GET_SIG: @@ -1276,49 +1287,49 @@ cuse_server_poll(struct cdev *dev, int events, struct } static int -cuse_server_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) +cuse_server_mmap_single(struct cdev *dev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot) { - uint32_t page_nr = offset / PAGE_SIZE; + uint32_t page_nr = *offset / PAGE_SIZE; uint32_t alloc_nr = page_nr / CUSE_ALLOC_PAGES_MAX; struct cuse_memory *mem; struct cuse_server *pcs; - uint8_t *ptr; int error; - if (alloc_nr >= CUSE_ALLOC_UNIT_MAX) - return (ENOMEM); - error = cuse_server_get(&pcs); if (error != 0) - pcs = NULL; + return (error); cuse_lock(); - mem = &cuse_mem[alloc_nr]; - - /* try to enforce slight ownership */ - if ((pcs != NULL) && (mem->owner != pcs)) { - cuse_unlock(); - return (EINVAL); + /* lookup memory structure */ + TAILQ_FOREACH(mem, &pcs->hmem, entry) { + if (mem->alloc_nr == alloc_nr) + break; } - if (mem->virtaddr == NULL) { + if (mem == NULL) { cuse_unlock(); return (ENOMEM); } - if (mem->virtaddr == NBUSY) { - cuse_unlock(); - return (ENOMEM); - } + /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; - if (page_nr >= mem->page_count) { cuse_unlock(); return (ENXIO); } - ptr = mem->virtaddr + (page_nr * PAGE_SIZE); + /* verify mmap size */ + if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || + (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { + cuse_unlock(); + return (EINVAL); + } + vm_object_reference(mem->object); + *object = mem->object; cuse_unlock(); - *paddr = vtophys(ptr); + /* set new VM object offset to use */ + *offset = page_nr * PAGE_SIZE; + /* success */ return (0); } @@ -1351,7 +1362,7 @@ cuse_client_free(void *arg) free(pcc, M_CUSE); /* drop reference on server */ - cuse_server_free(pcs); + cuse_server_unref(pcs); } static int @@ -1394,13 +1405,13 @@ cuse_client_open(struct cdev *dev, int fflags, int dev pcc = malloc(sizeof(*pcc), M_CUSE, M_WAITOK | M_ZERO); if (pcc == NULL) { /* drop reference on server */ - cuse_server_free(pcs); + cuse_server_unref(pcs); return (ENOMEM); } if (devfs_set_cdevpriv(pcc, &cuse_client_free)) { printf("Cuse: Cannot set cdevpriv.\n"); /* drop reference on server */ - cuse_server_free(pcs); + cuse_server_unref(pcs); free(pcc, M_CUSE); return (ENOMEM); } @@ -1550,7 +1561,6 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in error = ENOMEM; break; } - len = uio->uio_iov->iov_len; cuse_lock(); @@ -1610,7 +1620,6 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i error = ENOMEM; break; } - len = uio->uio_iov->iov_len; cuse_lock(); @@ -1753,59 +1762,56 @@ cuse_client_poll(struct cdev *dev, int events, struct } return (revents); - pollnval: +pollnval: /* XXX many clients don't understand POLLNVAL */ return (events & (POLLHUP | POLLPRI | POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM)); } static int -cuse_client_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) +cuse_client_mmap_single(struct cdev *dev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot) { - uint32_t page_nr = offset / PAGE_SIZE; + uint32_t page_nr = *offset / PAGE_SIZE; uint32_t alloc_nr = page_nr / CUSE_ALLOC_PAGES_MAX; struct cuse_memory *mem; - struct cuse_server *pcs; struct cuse_client *pcc; - uint8_t *ptr; int error; - if (alloc_nr >= CUSE_ALLOC_UNIT_MAX) - return (ENOMEM); - error = cuse_client_get(&pcc); if (error != 0) - pcs = NULL; - else - pcs = pcc->server; + return (error); cuse_lock(); - mem = &cuse_mem[alloc_nr]; - - /* try to enforce slight ownership */ - if ((pcs != NULL) && (mem->owner != pcs)) { - cuse_unlock(); - return (EINVAL); + /* lookup memory structure */ + TAILQ_FOREACH(mem, &pcc->server->hmem, entry) { + if (mem->alloc_nr == alloc_nr) + break; } - if (mem->virtaddr == NULL) { + if (mem == NULL) { cuse_unlock(); return (ENOMEM); } - if (mem->virtaddr == NBUSY) { - cuse_unlock(); - return (ENOMEM); - } + /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; - if (page_nr >= mem->page_count) { cuse_unlock(); return (ENXIO); } - ptr = mem->virtaddr + (page_nr * PAGE_SIZE); + /* verify mmap size */ + if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || + (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { + cuse_unlock(); + return (EINVAL); + } + vm_object_reference(mem->object); + *object = mem->object; cuse_unlock(); - *paddr = vtophys(ptr); + /* set new VM object offset to use */ + *offset = page_nr * PAGE_SIZE; + /* success */ return (0); } Modified: stable/11/sys/fs/cuse/cuse_ioctl.h ============================================================================== --- stable/11/sys/fs/cuse/cuse_ioctl.h Fri Nov 10 08:31:40 2017 (r325635) +++ stable/11/sys/fs/cuse/cuse_ioctl.h Fri Nov 10 08:42:37 2017 (r325636) @@ -35,6 +35,7 @@ #define CUSE_BUF_MIN_PTR 0x10000UL #define CUSE_BUF_MAX_PTR 0x20000UL #define CUSE_ALLOC_UNIT_MAX 128 /* units */ +/* All memory allocations must be less than the following limit */ #define CUSE_ALLOC_PAGES_MAX (((16UL * 1024UL * 1024UL) + PAGE_SIZE - 1) / PAGE_SIZE) struct cuse_dev; From owner-svn-src-stable-11@freebsd.org Fri Nov 10 11:19:34 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B420E6AD28; Fri, 10 Nov 2017 11:19:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C8CD6F1AC; Fri, 10 Nov 2017 11:19:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAABJX7R045458; Fri, 10 Nov 2017 11:19:33 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAABJXKs045457; Fri, 10 Nov 2017 11:19:33 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201711101119.vAABJXKs045457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 10 Nov 2017 11:19: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: r325639 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 325639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 11:19:34 -0000 Author: ae Date: Fri Nov 10 11:19:33 2017 New Revision: 325639 URL: https://svnweb.freebsd.org/changeset/base/325639 Log: MFC r325355: Use correct pointer in key_updateaddresses() when updating NAT-T config. key_updateaddresses() is used to update SA addresses and NAT-T configuration in SADB_UPDATE message. This is done using cloning SA content from old SA into new one. But addresses and NAT-T configuration are taking from SADB_UPDATE message. Use newsa pointer to set NAT-T properties into cloned SA. PR: 223382 Modified: stable/11/sys/netipsec/key.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/key.c ============================================================================== --- stable/11/sys/netipsec/key.c Fri Nov 10 09:49:08 2017 (r325638) +++ stable/11/sys/netipsec/key.c Fri Nov 10 11:19:33 2017 (r325639) @@ -5100,7 +5100,7 @@ key_updateaddresses(struct socket *so, struct mbuf *m, newsav->natt = NULL; newsav->sah = sah; newsav->state = SADB_SASTATE_MATURE; - error = key_setnatt(sav, mhp); + error = key_setnatt(newsav, mhp); if (error != 0) goto fail; From owner-svn-src-stable-11@freebsd.org Fri Nov 10 12:28:45 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D2B0E6CD32; Fri, 10 Nov 2017 12:28:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBCF271565; Fri, 10 Nov 2017 12:28:44 +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 vAACShP4075477; Fri, 10 Nov 2017 12:28:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAACShgh075476; Fri, 10 Nov 2017 12:28:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101228.vAACShgh075476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 12:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325642 - 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: 325642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:28:45 -0000 Author: kib Date: Fri Nov 10 12:28:43 2017 New Revision: 325642 URL: https://svnweb.freebsd.org/changeset/base/325642 Log: MFC r325567: Zero whole struct ptrace_lwpinfo to not leak kernel stack data. Security: CVE-2017-1086 Modified: stable/11/sys/kern/sys_process.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sys_process.c ============================================================================== --- stable/11/sys/kern/sys_process.c Fri Nov 10 12:07:56 2017 (r325641) +++ stable/11/sys/kern/sys_process.c Fri Nov 10 12:28:43 2017 (r325642) @@ -504,6 +504,7 @@ ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl, struct ptrace_lwpinfo32 *pl32) { + bzero(pl32, sizeof(*pl32)); pl32->pl_lwpid = pl->pl_lwpid; pl32->pl_event = pl->pl_event; pl32->pl_flags = pl->pl_flags; @@ -1316,6 +1317,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } else #endif pl = addr; + bzero(pl, sizeof(*pl)); pl->pl_lwpid = td2->td_tid; pl->pl_event = PL_EVENT_NONE; pl->pl_flags = 0; @@ -1336,8 +1338,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi pl->pl_siginfo = td2->td_si; } } - if ((pl->pl_flags & PL_FLAG_SI) == 0) - bzero(&pl->pl_siginfo, sizeof(pl->pl_siginfo)); if (td2->td_dbgflags & TDB_SCE) pl->pl_flags |= PL_FLAG_SCE; else if (td2->td_dbgflags & TDB_SCX) From owner-svn-src-stable-11@freebsd.org Fri Nov 10 12:42:52 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3634DE6D21F; Fri, 10 Nov 2017 12:42:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D4BF71DF7; Fri, 10 Nov 2017 12:42:51 +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 vAACgpiT083731; Fri, 10 Nov 2017 12:42:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAACgpMD083730; Fri, 10 Nov 2017 12:42:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101242.vAACgpMD083730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 12:42:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325644 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 325644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:42:52 -0000 Author: kib Date: Fri Nov 10 12:42:50 2017 New Revision: 325644 URL: https://svnweb.freebsd.org/changeset/base/325644 Log: MFC r324794: Do not overwrite clean blocks on pageout. Modified: stable/11/sys/vm/vnode_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Fri Nov 10 12:31:58 2017 (r325643) +++ stable/11/sys/vm/vnode_pager.c Fri Nov 10 12:42:50 2017 (r325644) @@ -1138,7 +1138,24 @@ vnode_pager_putpages(vm_object_t object, vm_page_t *m, VM_OBJECT_WLOCK(object); } +static int +vn_off2bidx(vm_ooffset_t offset) +{ + return ((offset & PAGE_MASK) / DEV_BSIZE); +} + +static bool +vn_dirty_blk(vm_page_t m, vm_ooffset_t offset) +{ + + KASSERT(IDX_TO_OFF(m->pindex) <= offset && + offset < IDX_TO_OFF(m->pindex + 1), + ("page %p pidx %ju offset %ju", m, (uintmax_t)m->pindex, + (uintmax_t)offset)); + return ((m->dirty & ((vm_page_bits_t)1 << vn_off2bidx(offset))) != 0); +} + /* * This is now called from local media FS's to operate against their * own vnodes if they fail to implement VOP_PUTPAGES. @@ -1154,10 +1171,12 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page { vm_object_t object; vm_page_t m; - vm_ooffset_t poffset; + vm_ooffset_t maxblksz, next_offset, poffset, prev_offset; struct uio auio; struct iovec aiov; + off_t prev_resid, wrsz; int count, error, i, maxsize, ncount, pgoff, ppscheck; + bool in_hole; static struct timeval lastfail; static int curfail; @@ -1219,34 +1238,102 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page for (i = ncount; i < count; i++) rtvals[i] = VM_PAGER_BAD; } - for (i = 0; i < ncount - ((btoc(maxsize) & PAGE_MASK) != 0); i++) - MPASS(ma[i]->dirty == VM_PAGE_BITS_ALL); - VM_OBJECT_WUNLOCK(object); - aiov.iov_base = NULL; - aiov.iov_len = maxsize; auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - auio.uio_offset = poffset; auio.uio_segflg = UIO_NOCOPY; auio.uio_rw = UIO_WRITE; - auio.uio_resid = maxsize; auio.uio_td = NULL; - error = VOP_WRITE(vp, &auio, vnode_pager_putpages_ioflags(flags), - curthread->td_ucred); - PCPU_INC(cnt.v_vnodeout); - PCPU_ADD(cnt.v_vnodepgsout, ncount); + maxblksz = roundup2(poffset + maxsize, DEV_BSIZE); - ppscheck = 0; - if (error != 0 && (ppscheck = ppsratecheck(&lastfail, &curfail, 1)) - != 0) - printf("vnode_pager_putpages: I/O error %d\n", error); - if (auio.uio_resid != 0 && (ppscheck != 0 || - ppsratecheck(&lastfail, &curfail, 1) != 0)) - printf("vnode_pager_putpages: residual I/O %zd at %ju\n", - auio.uio_resid, (uintmax_t)ma[0]->pindex); - for (i = 0; i < ncount; i++) + for (prev_offset = poffset; prev_offset < maxblksz;) { + /* Skip clean blocks. */ + for (in_hole = true; in_hole && prev_offset < maxblksz;) { + m = ma[OFF_TO_IDX(prev_offset - poffset)]; + for (i = vn_off2bidx(prev_offset); + i < sizeof(vm_page_bits_t) * NBBY && + prev_offset < maxblksz; i++) { + if (vn_dirty_blk(m, prev_offset)) { + in_hole = false; + break; + } + prev_offset += DEV_BSIZE; + } + } + if (in_hole) + goto write_done; + + /* Find longest run of dirty blocks. */ + for (next_offset = prev_offset; next_offset < maxblksz;) { + m = ma[OFF_TO_IDX(next_offset - poffset)]; + for (i = vn_off2bidx(next_offset); + i < sizeof(vm_page_bits_t) * NBBY && + next_offset < maxblksz; i++) { + if (!vn_dirty_blk(m, next_offset)) + goto start_write; + next_offset += DEV_BSIZE; + } + } +start_write: + if (next_offset > poffset + maxsize) + next_offset = poffset + maxsize; + + /* + * Getting here requires finding a dirty block in the + * 'skip clean blocks' loop. + */ + MPASS(prev_offset < next_offset); + + VM_OBJECT_WUNLOCK(object); + aiov.iov_base = NULL; + auio.uio_iovcnt = 1; + auio.uio_offset = prev_offset; + prev_resid = auio.uio_resid = aiov.iov_len = next_offset - + prev_offset; + error = VOP_WRITE(vp, &auio, + vnode_pager_putpages_ioflags(flags), curthread->td_ucred); + + wrsz = prev_resid - auio.uio_resid; + if (wrsz == 0) { + if (ppsratecheck(&lastfail, &curfail, 1) != 0) { + vn_printf(vp, "vnode_pager_putpages: " + "zero-length write at %ju resid %zd\n", + auio.uio_offset, auio.uio_resid); + } + VM_OBJECT_WLOCK(object); + break; + } + + /* Adjust the starting offset for next iteration. */ + prev_offset += wrsz; + MPASS(auio.uio_offset == prev_offset); + + ppscheck = 0; + if (error != 0 && (ppscheck = ppsratecheck(&lastfail, + &curfail, 1)) != 0) + vn_printf(vp, "vnode_pager_putpages: I/O error %d\n", + error); + if (auio.uio_resid != 0 && (ppscheck != 0 || + ppsratecheck(&lastfail, &curfail, 1) != 0)) + vn_printf(vp, "vnode_pager_putpages: residual I/O %zd " + "at %ju\n", auio.uio_resid, + (uintmax_t)ma[0]->pindex); + VM_OBJECT_WLOCK(object); + if (error != 0 || auio.uio_resid != 0) + break; + } +write_done: + /* Mark completely processed pages. */ + for (i = 0; i < OFF_TO_IDX(prev_offset - poffset); i++) rtvals[i] = VM_PAGER_OK; + /* Mark partial EOF page. */ + if (prev_offset == poffset + maxsize && (prev_offset & PAGE_MASK) != 0) + rtvals[i++] = VM_PAGER_OK; + /* Unwritten pages in range, free bonus if the page is clean. */ + for (; i < ncount; i++) + rtvals[i] = ma[i]->dirty == 0 ? VM_PAGER_OK : VM_PAGER_ERROR; + VM_OBJECT_WUNLOCK(object); + PCPU_ADD(cnt.v_vnodepgsout, i); + PCPU_INC(cnt.v_vnodeout); return (rtvals[0]); } From owner-svn-src-stable-11@freebsd.org Fri Nov 10 12:45:10 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D760DE6D29D; Fri, 10 Nov 2017 12:45:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A40D371F40; Fri, 10 Nov 2017 12:45: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 vAACj9UZ083895; Fri, 10 Nov 2017 12:45:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAACj9Ls083894; Fri, 10 Nov 2017 12:45:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101245.vAACj9Ls083894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 12:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325645 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 325645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:45:11 -0000 Author: kib Date: Fri Nov 10 12:45:09 2017 New Revision: 325645 URL: https://svnweb.freebsd.org/changeset/base/325645 Log: MFC r324807: Take the vm object lock in read mode in vnode_generic_putpages(). Modified: stable/11/sys/vm/vnode_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Fri Nov 10 12:42:50 2017 (r325644) +++ stable/11/sys/vm/vnode_pager.c Fri Nov 10 12:45:09 2017 (r325645) @@ -1211,8 +1211,14 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page * We do not under any circumstances truncate the valid bits, as * this will screw up bogus page replacement. */ - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); if (maxsize + poffset > object->un_pager.vnp.vnp_size) { + if (!VM_OBJECT_TRYUPGRADE(object)) { + VM_OBJECT_RUNLOCK(object); + VM_OBJECT_WLOCK(object); + if (maxsize + poffset <= object->un_pager.vnp.vnp_size) + goto downgrade; + } if (object->un_pager.vnp.vnp_size > poffset) { maxsize = object->un_pager.vnp.vnp_size - poffset; ncount = btoc(maxsize); @@ -1237,6 +1243,8 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page } for (i = ncount; i < count; i++) rtvals[i] = VM_PAGER_BAD; +downgrade: + VM_OBJECT_LOCK_DOWNGRADE(object); } auio.uio_iov = &aiov; @@ -1283,7 +1291,7 @@ start_write: */ MPASS(prev_offset < next_offset); - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); aiov.iov_base = NULL; auio.uio_iovcnt = 1; auio.uio_offset = prev_offset; @@ -1299,7 +1307,7 @@ start_write: "zero-length write at %ju resid %zd\n", auio.uio_offset, auio.uio_resid); } - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); break; } @@ -1317,7 +1325,7 @@ start_write: vn_printf(vp, "vnode_pager_putpages: residual I/O %zd " "at %ju\n", auio.uio_resid, (uintmax_t)ma[0]->pindex); - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); if (error != 0 || auio.uio_resid != 0) break; } @@ -1331,7 +1339,7 @@ write_done: /* Unwritten pages in range, free bonus if the page is clean. */ for (; i < ncount; i++) rtvals[i] = ma[i]->dirty == 0 ? VM_PAGER_OK : VM_PAGER_ERROR; - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); PCPU_ADD(cnt.v_vnodepgsout, i); PCPU_INC(cnt.v_vnodeout); return (rtvals[0]); From owner-svn-src-stable-11@freebsd.org Fri Nov 10 12:54:34 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBB68E6D638; Fri, 10 Nov 2017 12:54:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B86C7724F4; Fri, 10 Nov 2017 12:54:34 +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 vAACsXVM088011; Fri, 10 Nov 2017 12:54:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAACsXaq088010; Fri, 10 Nov 2017 12:54:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101254.vAACsXaq088010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 12: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: r325646 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 325646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:54:35 -0000 Author: kib Date: Fri Nov 10 12:54:33 2017 New Revision: 325646 URL: https://svnweb.freebsd.org/changeset/base/325646 Log: MFC r303627 (by alc): Restore the historical behavior of "sysctl vm.swap_idle_enabled=1". Modified: stable/11/sys/vm/vm_pageout.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_pageout.c ============================================================================== --- stable/11/sys/vm/vm_pageout.c Fri Nov 10 12:45:09 2017 (r325645) +++ stable/11/sys/vm/vm_pageout.c Fri Nov 10 12:54:33 2017 (r325646) @@ -1670,9 +1670,10 @@ drop_page: vm_pagequeue_unlock(pq); #if !defined(NO_SWAPPING) /* - * Idle process swapout -- run once per second. + * Idle process swapout -- run once per second when we are reclaiming + * pages. */ - if (vm_swap_idle_enabled) { + if (vm_swap_idle_enabled && pass > 0) { static long lsec; if (time_second != lsec) { vm_req_vmdaemon(VM_SWAP_IDLE); From owner-svn-src-stable-11@freebsd.org Fri Nov 10 13:17:42 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 801B4E6DA66; Fri, 10 Nov 2017 13:17:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27AE172DA1; Fri, 10 Nov 2017 13:17:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAADHf61096394; Fri, 10 Nov 2017 13:17:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAADHfDL096388; Fri, 10 Nov 2017 13:17:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101317.vAADHfDL096388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 13:17: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: r325647 - in stable/11/sys: conf sys vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: conf sys vm X-SVN-Commit-Revision: 325647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 13:17:42 -0000 Author: kib Date: Fri Nov 10 13:17:40 2017 New Revision: 325647 URL: https://svnweb.freebsd.org/changeset/base/325647 Log: MFC r324795: Move swapout code into vm/vm_swapout.c. Added: stable/11/sys/vm/vm_swapout.c - copied, changed from r324795, head/sys/vm/vm_swapout.c stable/11/sys/vm/vm_swapout_dummy.c - copied unchanged from r324795, head/sys/vm/vm_swapout_dummy.c Modified: stable/11/sys/conf/files stable/11/sys/sys/_kstack_cache.h stable/11/sys/vm/vm_extern.h stable/11/sys/vm/vm_glue.c stable/11/sys/vm/vm_pageout.c stable/11/sys/vm/vm_pageout.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Fri Nov 10 12:54:33 2017 (r325646) +++ stable/11/sys/conf/files Fri Nov 10 13:17:40 2017 (r325647) @@ -4608,6 +4608,7 @@ vm/swap_pager.c standard vm/uma_core.c standard vm/uma_dbg.c standard vm/memguard.c optional DEBUG_MEMGUARD +vm/vm_domain.c standard vm/vm_fault.c standard vm/vm_glue.c standard vm/vm_init.c standard @@ -4622,7 +4623,8 @@ vm/vm_pager.c standard vm/vm_phys.c standard vm/vm_radix.c standard vm/vm_reserv.c standard -vm/vm_domain.c standard +vm/vm_swapout.c optional !NO_SWAPPING +vm/vm_swapout_dummy.c optional NO_SWAPPING vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard Modified: stable/11/sys/sys/_kstack_cache.h ============================================================================== --- stable/11/sys/sys/_kstack_cache.h Fri Nov 10 12:54:33 2017 (r325646) +++ stable/11/sys/sys/_kstack_cache.h Fri Nov 10 13:17:40 2017 (r325647) @@ -38,6 +38,10 @@ struct kstack_cache_entry { extern struct kstack_cache_entry *kstack_cache; +#ifndef KSTACK_MAX_PAGES +#define KSTACK_MAX_PAGES 32 +#endif + #endif Modified: stable/11/sys/vm/vm_extern.h ============================================================================== --- stable/11/sys/vm/vm_extern.h Fri Nov 10 12:54:33 2017 (r325646) +++ stable/11/sys/vm/vm_extern.h Fri Nov 10 13:17:40 2017 (r325647) @@ -71,7 +71,6 @@ void kmem_init(vm_offset_t, vm_offset_t); void kmem_init_zero_region(void); void kmeminit(void); -void swapout_procs(int); int kernacc(void *, int, int); int useracc(void *, int, int); int vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int); Modified: stable/11/sys/vm/vm_glue.c ============================================================================== --- stable/11/sys/vm/vm_glue.c Fri Nov 10 12:54:33 2017 (r325646) +++ stable/11/sys/vm/vm_glue.c Fri Nov 10 13:17:40 2017 (r325647) @@ -101,13 +101,6 @@ __FBSDID("$FreeBSD$"); #include -#ifndef NO_SWAPPING -static int swapout(struct proc *); -static void swapclear(struct proc *); -static void vm_thread_swapin(struct thread *td); -static void vm_thread_swapout(struct thread *td); -#endif - /* * MPSAFE * @@ -308,10 +301,6 @@ SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_R SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0, ""); -#ifndef KSTACK_MAX_PAGES -#define KSTACK_MAX_PAGES 32 -#endif - /* * Create the kernel stack (including pcb for i386) for a new thread. * This routine directly affects the fork perf for a process and @@ -527,80 +516,7 @@ intr_prof_stack_use(struct thread *td, struct trapfram } #endif /* KSTACK_USAGE_PROF */ -#ifndef NO_SWAPPING /* - * Allow a thread's kernel stack to be paged out. - */ -static void -vm_thread_swapout(struct thread *td) -{ - vm_object_t ksobj; - vm_page_t m; - int i, pages; - - cpu_thread_swapout(td); - pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - pmap_qremove(td->td_kstack, pages); - VM_OBJECT_WLOCK(ksobj); - for (i = 0; i < pages; i++) { - m = vm_page_lookup(ksobj, i); - if (m == NULL) - panic("vm_thread_swapout: kstack already missing?"); - vm_page_dirty(m); - vm_page_lock(m); - vm_page_unwire(m, PQ_INACTIVE); - vm_page_unlock(m); - } - VM_OBJECT_WUNLOCK(ksobj); -} - -/* - * Bring the kernel stack for a specified thread back in. - */ -static void -vm_thread_swapin(struct thread *td) -{ - vm_object_t ksobj; - vm_page_t ma[KSTACK_MAX_PAGES]; - int pages; - - pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - VM_OBJECT_WLOCK(ksobj); - (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, - pages); - for (int i = 0; i < pages;) { - int j, a, count, rv; - - vm_page_assert_xbusied(ma[i]); - if (ma[i]->valid == VM_PAGE_BITS_ALL) { - vm_page_xunbusy(ma[i]); - i++; - continue; - } - vm_object_pip_add(ksobj, 1); - for (j = i + 1; j < pages; j++) - if (ma[j]->valid == VM_PAGE_BITS_ALL) - break; - rv = vm_pager_has_page(ksobj, ma[i]->pindex, NULL, &a); - KASSERT(rv == 1, ("%s: missing page %p", __func__, ma[i])); - count = min(a + 1, j - i); - rv = vm_pager_get_pages(ksobj, ma + i, count, NULL, NULL); - KASSERT(rv == VM_PAGER_OK, ("%s: cannot get kstack for proc %d", - __func__, td->td_proc->p_pid)); - vm_object_pip_wakeup(ksobj); - for (j = i; j < i + count; j++) - vm_page_xunbusy(ma[j]); - i += count; - } - VM_OBJECT_WUNLOCK(ksobj); - pmap_qenter(td->td_kstack, ma, pages); - cpu_thread_swapin(td); -} -#endif /* !NO_SWAPPING */ - -/* * Implement fork's actions on an address space. * Here we arrange for the address space to be copied or referenced, * allocate a user struct (pcb and kernel stack), then call the @@ -673,425 +589,8 @@ vm_waitproc(p) } void -faultin(p) - struct proc *p; -{ -#ifdef NO_SWAPPING - - PROC_LOCK_ASSERT(p, MA_OWNED); - if ((p->p_flag & P_INMEM) == 0) - panic("faultin: proc swapped out with NO_SWAPPING!"); -#else /* !NO_SWAPPING */ - struct thread *td; - - PROC_LOCK_ASSERT(p, MA_OWNED); - /* - * If another process is swapping in this process, - * just wait until it finishes. - */ - if (p->p_flag & P_SWAPPINGIN) { - while (p->p_flag & P_SWAPPINGIN) - msleep(&p->p_flag, &p->p_mtx, PVM, "faultin", 0); - return; - } - if ((p->p_flag & P_INMEM) == 0) { - /* - * Don't let another thread swap process p out while we are - * busy swapping it in. - */ - ++p->p_lock; - p->p_flag |= P_SWAPPINGIN; - PROC_UNLOCK(p); - - /* - * We hold no lock here because the list of threads - * can not change while all threads in the process are - * swapped out. - */ - FOREACH_THREAD_IN_PROC(p, td) - vm_thread_swapin(td); - PROC_LOCK(p); - swapclear(p); - p->p_swtick = ticks; - - wakeup(&p->p_flag); - - /* Allow other threads to swap p out now. */ - --p->p_lock; - } -#endif /* NO_SWAPPING */ -} - -/* - * This swapin algorithm attempts to swap-in processes only if there - * is enough space for them. Of course, if a process waits for a long - * time, it will be swapped in anyway. - */ -void -swapper(void) -{ - struct proc *p; - struct thread *td; - struct proc *pp; - int slptime; - int swtime; - int ppri; - int pri; - -loop: - if (vm_page_count_min()) { - VM_WAIT; - goto loop; - } - - pp = NULL; - ppri = INT_MIN; - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state == PRS_NEW || - p->p_flag & (P_SWAPPINGOUT | P_SWAPPINGIN | P_INMEM)) { - PROC_UNLOCK(p); - continue; - } - swtime = (ticks - p->p_swtick) / hz; - FOREACH_THREAD_IN_PROC(p, td) { - /* - * An otherwise runnable thread of a process - * swapped out has only the TDI_SWAPPED bit set. - * - */ - thread_lock(td); - if (td->td_inhibitors == TDI_SWAPPED) { - slptime = (ticks - td->td_slptick) / hz; - pri = swtime + slptime; - if ((td->td_flags & TDF_SWAPINREQ) == 0) - pri -= p->p_nice * 8; - /* - * if this thread is higher priority - * and there is enough space, then select - * this process instead of the previous - * selection. - */ - if (pri > ppri) { - pp = p; - ppri = pri; - } - } - thread_unlock(td); - } - PROC_UNLOCK(p); - } - sx_sunlock(&allproc_lock); - - /* - * Nothing to do, back to sleep. - */ - if ((p = pp) == NULL) { - tsleep(&proc0, PVM, "swapin", MAXSLP * hz / 2); - goto loop; - } - PROC_LOCK(p); - - /* - * Another process may be bringing or may have already - * brought this process in while we traverse all threads. - * Or, this process may even be being swapped out again. - */ - if (p->p_flag & (P_INMEM | P_SWAPPINGOUT | P_SWAPPINGIN)) { - PROC_UNLOCK(p); - goto loop; - } - - /* - * We would like to bring someone in. (only if there is space). - * [What checks the space? ] - */ - faultin(p); - PROC_UNLOCK(p); - goto loop; -} - -void kick_proc0(void) { wakeup(&proc0); } - -#ifndef NO_SWAPPING - -/* - * Swap_idle_threshold1 is the guaranteed swapped in time for a process - */ -static int swap_idle_threshold1 = 2; -SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold1, CTLFLAG_RW, - &swap_idle_threshold1, 0, "Guaranteed swapped in time for a process"); - -/* - * Swap_idle_threshold2 is the time that a process can be idle before - * it will be swapped out, if idle swapping is enabled. - */ -static int swap_idle_threshold2 = 10; -SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold2, CTLFLAG_RW, - &swap_idle_threshold2, 0, "Time before a process will be swapped out"); - -/* - * First, if any processes have been sleeping or stopped for at least - * "swap_idle_threshold1" seconds, they are swapped out. If, however, - * no such processes exist, then the longest-sleeping or stopped - * process is swapped out. Finally, and only as a last resort, if - * there are no sleeping or stopped processes, the longest-resident - * process is swapped out. - */ -void -swapout_procs(action) -int action; -{ - struct proc *p; - struct thread *td; - int didswap = 0; - -retry: - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - struct vmspace *vm; - int minslptime = 100000; - int slptime; - - PROC_LOCK(p); - /* - * Watch out for a process in - * creation. It may have no - * address space or lock yet. - */ - if (p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - /* - * An aio daemon switches its - * address space while running. - * Perform a quick check whether - * a process has P_SYSTEM. - * Filter out exiting processes. - */ - if ((p->p_flag & (P_SYSTEM | P_WEXIT)) != 0) { - PROC_UNLOCK(p); - continue; - } - _PHOLD_LITE(p); - PROC_UNLOCK(p); - sx_sunlock(&allproc_lock); - - /* - * Do not swapout a process that - * is waiting for VM data - * structures as there is a possible - * deadlock. Test this first as - * this may block. - * - * Lock the map until swapout - * finishes, or a thread of this - * process may attempt to alter - * the map. - */ - vm = vmspace_acquire_ref(p); - if (vm == NULL) - goto nextproc2; - if (!vm_map_trylock(&vm->vm_map)) - goto nextproc1; - - PROC_LOCK(p); - if (p->p_lock != 1 || (p->p_flag & (P_STOPPED_SINGLE | - P_TRACED | P_SYSTEM)) != 0) - goto nextproc; - - /* - * only aiod changes vmspace, however it will be - * skipped because of the if statement above checking - * for P_SYSTEM - */ - if ((p->p_flag & (P_INMEM|P_SWAPPINGOUT|P_SWAPPINGIN)) != P_INMEM) - goto nextproc; - - switch (p->p_state) { - default: - /* Don't swap out processes in any sort - * of 'special' state. */ - break; - - case PRS_NORMAL: - /* - * do not swapout a realtime process - * Check all the thread groups.. - */ - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - if (PRI_IS_REALTIME(td->td_pri_class)) { - thread_unlock(td); - goto nextproc; - } - slptime = (ticks - td->td_slptick) / hz; - /* - * Guarantee swap_idle_threshold1 - * time in memory. - */ - if (slptime < swap_idle_threshold1) { - thread_unlock(td); - goto nextproc; - } - - /* - * Do not swapout a process if it is - * waiting on a critical event of some - * kind or there is a thread whose - * pageable memory may be accessed. - * - * This could be refined to support - * swapping out a thread. - */ - if (!thread_safetoswapout(td)) { - thread_unlock(td); - goto nextproc; - } - /* - * If the system is under memory stress, - * or if we are swapping - * idle processes >= swap_idle_threshold2, - * then swap the process out. - */ - if (((action & VM_SWAP_NORMAL) == 0) && - (((action & VM_SWAP_IDLE) == 0) || - (slptime < swap_idle_threshold2))) { - thread_unlock(td); - goto nextproc; - } - - if (minslptime > slptime) - minslptime = slptime; - thread_unlock(td); - } - - /* - * If the pageout daemon didn't free enough pages, - * or if this process is idle and the system is - * configured to swap proactively, swap it out. - */ - if ((action & VM_SWAP_NORMAL) || - ((action & VM_SWAP_IDLE) && - (minslptime > swap_idle_threshold2))) { - _PRELE(p); - if (swapout(p) == 0) - didswap++; - PROC_UNLOCK(p); - vm_map_unlock(&vm->vm_map); - vmspace_free(vm); - goto retry; - } - } -nextproc: - PROC_UNLOCK(p); - vm_map_unlock(&vm->vm_map); -nextproc1: - vmspace_free(vm); -nextproc2: - sx_slock(&allproc_lock); - PRELE(p); - } - sx_sunlock(&allproc_lock); - /* - * If we swapped something out, and another process needed memory, - * then wakeup the sched process. - */ - if (didswap) - wakeup(&proc0); -} - -static void -swapclear(p) - struct proc *p; -{ - struct thread *td; - - PROC_LOCK_ASSERT(p, MA_OWNED); - - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - td->td_flags |= TDF_INMEM; - td->td_flags &= ~TDF_SWAPINREQ; - TD_CLR_SWAPPED(td); - if (TD_CAN_RUN(td)) - if (setrunnable(td)) { -#ifdef INVARIANTS - /* - * XXX: We just cleared TDI_SWAPPED - * above and set TDF_INMEM, so this - * should never happen. - */ - panic("not waking up swapper"); -#endif - } - thread_unlock(td); - } - p->p_flag &= ~(P_SWAPPINGIN|P_SWAPPINGOUT); - p->p_flag |= P_INMEM; -} - -static int -swapout(p) - struct proc *p; -{ - struct thread *td; - - PROC_LOCK_ASSERT(p, MA_OWNED); -#if defined(SWAP_DEBUG) - printf("swapping out %d\n", p->p_pid); -#endif - - /* - * The states of this process and its threads may have changed - * by now. Assuming that there is only one pageout daemon thread, - * this process should still be in memory. - */ - KASSERT((p->p_flag & (P_INMEM|P_SWAPPINGOUT|P_SWAPPINGIN)) == P_INMEM, - ("swapout: lost a swapout race?")); - - /* - * remember the process resident count - */ - p->p_vmspace->vm_swrss = vmspace_resident_count(p->p_vmspace); - /* - * Check and mark all threads before we proceed. - */ - p->p_flag &= ~P_INMEM; - p->p_flag |= P_SWAPPINGOUT; - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - if (!thread_safetoswapout(td)) { - thread_unlock(td); - swapclear(p); - return (EBUSY); - } - td->td_flags &= ~TDF_INMEM; - TD_SET_SWAPPED(td); - thread_unlock(td); - } - td = FIRST_THREAD_IN_PROC(p); - ++td->td_ru.ru_nswap; - PROC_UNLOCK(p); - - /* - * This list is stable because all threads are now prevented from - * running. The list is only modified in the context of a running - * thread in this process. - */ - FOREACH_THREAD_IN_PROC(p, td) - vm_thread_swapout(td); - - PROC_LOCK(p); - p->p_flag &= ~P_SWAPPINGOUT; - p->p_swtick = ticks; - return (0); -} -#endif /* !NO_SWAPPING */ Modified: stable/11/sys/vm/vm_pageout.c ============================================================================== --- stable/11/sys/vm/vm_pageout.c Fri Nov 10 12:54:33 2017 (r325646) +++ stable/11/sys/vm/vm_pageout.c Fri Nov 10 13:17:40 2017 (r325647) @@ -141,19 +141,6 @@ SYSINIT(pagedaemon, SI_SUB_KTHREAD_PAGE, SI_ORDER_SECO SDT_PROVIDER_DEFINE(vm); SDT_PROBE_DEFINE(vm, , , vm__lowmem_scan); -#if !defined(NO_SWAPPING) -/* the kernel process "vm_daemon"*/ -static void vm_daemon(void); -static struct proc *vmproc; - -static struct kproc_desc vm_kp = { - "vmdaemon", - vm_daemon, - &vmproc -}; -SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, kproc_start, &vm_kp); -#endif - /* Pagedaemon activity rates, in subdivisions of one second. */ #define VM_LAUNDER_RATE 10 #define VM_INACT_SCAN_RATE 2 @@ -171,26 +158,11 @@ static enum { VM_LAUNDRY_SHORTFALL } vm_laundry_request = VM_LAUNDRY_IDLE; -#if !defined(NO_SWAPPING) -static int vm_pageout_req_swapout; /* XXX */ -static int vm_daemon_needed; -static struct mtx vm_daemon_mtx; -/* Allow for use by vm_pageout before vm_daemon is initialized. */ -MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF); -#endif static int vm_pageout_update_period; static int disable_swap_pageouts; static int lowmem_period = 10; static time_t lowmem_uptime; -#if defined(NO_SWAPPING) -static int vm_swap_enabled = 0; -static int vm_swap_idle_enabled = 0; -#else -static int vm_swap_enabled = 1; -static int vm_swap_idle_enabled = 0; -#endif - static int vm_panic_on_oom = 0; SYSCTL_INT(_vm, OID_AUTO, panic_on_oom, @@ -208,18 +180,6 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_update_period, SYSCTL_INT(_vm, OID_AUTO, lowmem_period, CTLFLAG_RW, &lowmem_period, 0, "Low memory callback period"); -#if defined(NO_SWAPPING) -SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, - CTLFLAG_RD, &vm_swap_enabled, 0, "Enable entire process swapout"); -SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled, - CTLFLAG_RD, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria"); -#else -SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, - CTLFLAG_RW, &vm_swap_enabled, 0, "Enable entire process swapout"); -SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled, - CTLFLAG_RW, &vm_swap_idle_enabled, 0, "Allow swapout on idle criteria"); -#endif - SYSCTL_INT(_vm, OID_AUTO, disable_swapspace_pageouts, CTLFLAG_RW, &disable_swap_pageouts, 0, "Disallow swapout of dirty pages"); @@ -261,11 +221,6 @@ static boolean_t vm_pageout_fallback_object_lock(vm_pa static int vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall); static void vm_pageout_laundry_worker(void *arg); -#if !defined(NO_SWAPPING) -static void vm_pageout_map_deactivate_pages(vm_map_t, long); -static void vm_pageout_object_deactivate_pages(pmap_t, vm_object_t, long); -static void vm_req_vmdaemon(int req); -#endif static boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); /* @@ -604,172 +559,7 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, return (numpagedout); } -#if !defined(NO_SWAPPING) /* - * vm_pageout_object_deactivate_pages - * - * Deactivate enough pages to satisfy the inactive target - * requirements. - * - * The object and map must be locked. - */ -static void -vm_pageout_object_deactivate_pages(pmap_t pmap, vm_object_t first_object, - long desired) -{ - vm_object_t backing_object, object; - vm_page_t p; - int act_delta, remove_mode; - - VM_OBJECT_ASSERT_LOCKED(first_object); - if ((first_object->flags & OBJ_FICTITIOUS) != 0) - return; - for (object = first_object;; object = backing_object) { - if (pmap_resident_count(pmap) <= desired) - goto unlock_return; - VM_OBJECT_ASSERT_LOCKED(object); - if ((object->flags & OBJ_UNMANAGED) != 0 || - object->paging_in_progress != 0) - goto unlock_return; - - remove_mode = 0; - if (object->shadow_count > 1) - remove_mode = 1; - /* - * Scan the object's entire memory queue. - */ - TAILQ_FOREACH(p, &object->memq, listq) { - if (pmap_resident_count(pmap) <= desired) - goto unlock_return; - if (vm_page_busied(p)) - continue; - PCPU_INC(cnt.v_pdpages); - vm_page_lock(p); - if (p->wire_count != 0 || p->hold_count != 0 || - !pmap_page_exists_quick(pmap, p)) { - vm_page_unlock(p); - continue; - } - act_delta = pmap_ts_referenced(p); - if ((p->aflags & PGA_REFERENCED) != 0) { - if (act_delta == 0) - act_delta = 1; - vm_page_aflag_clear(p, PGA_REFERENCED); - } - if (!vm_page_active(p) && act_delta != 0) { - vm_page_activate(p); - p->act_count += act_delta; - } else if (vm_page_active(p)) { - if (act_delta == 0) { - p->act_count -= min(p->act_count, - ACT_DECLINE); - if (!remove_mode && p->act_count == 0) { - pmap_remove_all(p); - vm_page_deactivate(p); - } else - vm_page_requeue(p); - } else { - vm_page_activate(p); - if (p->act_count < ACT_MAX - - ACT_ADVANCE) - p->act_count += ACT_ADVANCE; - vm_page_requeue(p); - } - } else if (vm_page_inactive(p)) - pmap_remove_all(p); - vm_page_unlock(p); - } - if ((backing_object = object->backing_object) == NULL) - goto unlock_return; - VM_OBJECT_RLOCK(backing_object); - if (object != first_object) - VM_OBJECT_RUNLOCK(object); - } -unlock_return: - if (object != first_object) - VM_OBJECT_RUNLOCK(object); -} - -/* - * deactivate some number of pages in a map, try to do it fairly, but - * that is really hard to do. - */ -static void -vm_pageout_map_deactivate_pages(map, desired) - vm_map_t map; - long desired; -{ - vm_map_entry_t tmpe; - vm_object_t obj, bigobj; - int nothingwired; - - if (!vm_map_trylock(map)) - return; - - bigobj = NULL; - nothingwired = TRUE; - - /* - * first, search out the biggest object, and try to free pages from - * that. - */ - tmpe = map->header.next; - while (tmpe != &map->header) { - if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { - obj = tmpe->object.vm_object; - if (obj != NULL && VM_OBJECT_TRYRLOCK(obj)) { - if (obj->shadow_count <= 1 && - (bigobj == NULL || - bigobj->resident_page_count < obj->resident_page_count)) { - if (bigobj != NULL) - VM_OBJECT_RUNLOCK(bigobj); - bigobj = obj; - } else - VM_OBJECT_RUNLOCK(obj); - } - } - if (tmpe->wired_count > 0) - nothingwired = FALSE; - tmpe = tmpe->next; - } - - if (bigobj != NULL) { - vm_pageout_object_deactivate_pages(map->pmap, bigobj, desired); - VM_OBJECT_RUNLOCK(bigobj); - } - /* - * Next, hunt around for other pages to deactivate. We actually - * do this search sort of wrong -- .text first is not the best idea. - */ - tmpe = map->header.next; - while (tmpe != &map->header) { - if (pmap_resident_count(vm_map_pmap(map)) <= desired) - break; - if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { - obj = tmpe->object.vm_object; - if (obj != NULL) { - VM_OBJECT_RLOCK(obj); - vm_pageout_object_deactivate_pages(map->pmap, obj, desired); - VM_OBJECT_RUNLOCK(obj); - } - } - tmpe = tmpe->next; - } - - /* - * Remove all mappings if a process is swapped out, this will free page - * table pages. - */ - if (desired == 0 && nothingwired) { - pmap_remove(vm_map_pmap(map), vm_map_min(map), - vm_map_max(map)); - } - - vm_map_unlock(map); -} -#endif /* !defined(NO_SWAPPING) */ - -/* * Attempt to acquire all of the necessary locks to launder a page and * then call through the clustering layer to PUTPAGES. Wait a short * time for a vnode lock. @@ -1511,14 +1301,12 @@ drop_page: vm_pagequeue_unlock(pq); } -#if !defined(NO_SWAPPING) /* * Wakeup the swapout daemon if we didn't free the targeted number of * pages. */ - if (vm_swap_enabled && page_shortage > 0) - vm_req_vmdaemon(VM_SWAP_NORMAL); -#endif + if (page_shortage > 0) + vm_swapout_run(); /* * If the inactive queue scan fails repeatedly to meet its @@ -1668,19 +1456,8 @@ drop_page: vm_page_unlock(m); } vm_pagequeue_unlock(pq); -#if !defined(NO_SWAPPING) - /* - * Idle process swapout -- run once per second when we are reclaiming - * pages. - */ - if (vm_swap_idle_enabled && pass > 0) { - static long lsec; - if (time_second != lsec) { - vm_req_vmdaemon(VM_SWAP_IDLE); - lsec = time_second; - } - } -#endif + if (pass > 0) + vm_swapout_run_idle(); return (page_shortage <= 0); } @@ -2106,167 +1883,3 @@ pagedaemon_wakeup(void) wakeup(&vm_pageout_wanted); } } - -#if !defined(NO_SWAPPING) -static void -vm_req_vmdaemon(int req) -{ - static int lastrun = 0; - - mtx_lock(&vm_daemon_mtx); - vm_pageout_req_swapout |= req; - if ((ticks > (lastrun + hz)) || (ticks < lastrun)) { - wakeup(&vm_daemon_needed); - lastrun = ticks; - } - mtx_unlock(&vm_daemon_mtx); -} - -static void -vm_daemon(void) -{ - struct rlimit rsslim; - struct proc *p; - struct thread *td; - struct vmspace *vm; - int breakout, swapout_flags, tryagain, attempts; -#ifdef RACCT - uint64_t rsize, ravailable; -#endif - - while (TRUE) { - mtx_lock(&vm_daemon_mtx); - msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", -#ifdef RACCT - racct_enable ? hz : 0 -#else - 0 -#endif - ); - swapout_flags = vm_pageout_req_swapout; - vm_pageout_req_swapout = 0; - mtx_unlock(&vm_daemon_mtx); - if (swapout_flags) - swapout_procs(swapout_flags); - - /* - * scan the processes for exceeding their rlimits or if - * process is swapped out -- deactivate pages - */ - tryagain = 0; - attempts = 0; -again: - attempts++; - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - vm_pindex_t limit, size; - - /* - * if this is a system process or if we have already - * looked at this process, skip it. - */ - PROC_LOCK(p); - if (p->p_state != PRS_NORMAL || - p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) { - PROC_UNLOCK(p); - continue; - } - /* - * if the process is in a non-running type state, - * don't touch it. - */ - breakout = 0; - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - if (!TD_ON_RUNQ(td) && - !TD_IS_RUNNING(td) && - !TD_IS_SLEEPING(td) && - !TD_IS_SUSPENDED(td)) { - thread_unlock(td); - breakout = 1; - break; - } - thread_unlock(td); - } - if (breakout) { - PROC_UNLOCK(p); - continue; - } - /* - * get a limit - */ - lim_rlimit_proc(p, RLIMIT_RSS, &rsslim); - limit = OFF_TO_IDX( - qmin(rsslim.rlim_cur, rsslim.rlim_max)); - - /* - * let processes that are swapped out really be - * swapped out set the limit to nothing (will force a - * swap-out.) - */ - if ((p->p_flag & P_INMEM) == 0) - limit = 0; /* XXX */ - vm = vmspace_acquire_ref(p); - _PHOLD_LITE(p); - PROC_UNLOCK(p); - if (vm == NULL) { - PRELE(p); - continue; - } - sx_sunlock(&allproc_lock); - - size = vmspace_resident_count(vm); - if (size >= limit) { - vm_pageout_map_deactivate_pages( - &vm->vm_map, limit); - size = vmspace_resident_count(vm); - } -#ifdef RACCT - if (racct_enable) { - rsize = IDX_TO_OFF(size); - PROC_LOCK(p); - if (p->p_state == PRS_NORMAL) - racct_set(p, RACCT_RSS, rsize); - ravailable = racct_get_available(p, RACCT_RSS); - PROC_UNLOCK(p); - if (rsize > ravailable) { - /* - * Don't be overly aggressive; this - * might be an innocent process, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Nov 11 12:08:08 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6EB3E699F0; Sat, 11 Nov 2017 12:08:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80E267F0F8; Sat, 11 Nov 2017 12:08:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vABC87S2085542; Sat, 11 Nov 2017 12:08:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vABC87Ub085541; Sat, 11 Nov 2017 12:08:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711111208.vABC87Ub085541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Nov 2017 12:08: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: r325709 - 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: 325709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Nov 2017 12:08:08 -0000 Author: kib Date: Sat Nov 11 12:08:07 2017 New Revision: 325709 URL: https://svnweb.freebsd.org/changeset/base/325709 Log: MFC r325386: Convert explicit panic() call to assert. Modified: stable/11/sys/kern/kern_umtx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_umtx.c ============================================================================== --- stable/11/sys/kern/kern_umtx.c Sat Nov 11 11:01:50 2017 (r325708) +++ stable/11/sys/kern/kern_umtx.c Sat Nov 11 12:08:07 2017 (r325709) @@ -1577,8 +1577,7 @@ umtx_pi_setowner(struct umtx_pi *pi, struct thread *ow uq_owner = owner->td_umtxq; mtx_assert(&umtx_lock, MA_OWNED); - if (pi->pi_owner != NULL) - panic("pi_owner != NULL"); + MPASS(pi->pi_owner == NULL); pi->pi_owner = owner; TAILQ_INSERT_TAIL(&uq_owner->uq_pi_contested, pi, pi_link); } From owner-svn-src-stable-11@freebsd.org Sat Nov 11 12:09:34 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D7F4E69A71; Sat, 11 Nov 2017 12:09:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 375A17F232; Sat, 11 Nov 2017 12:09:34 +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 vABC9XWU085666; Sat, 11 Nov 2017 12:09:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vABC9X3n085665; Sat, 11 Nov 2017 12:09:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711111209.vABC9X3n085665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Nov 2017 12:09: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: r325710 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/i386/i386 X-SVN-Commit-Revision: 325710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Nov 2017 12:09:34 -0000 Author: kib Date: Sat Nov 11 12:09:33 2017 New Revision: 325710 URL: https://svnweb.freebsd.org/changeset/base/325710 Log: MFC r325387: Eliminate unused load. Modified: stable/11/sys/i386/i386/swtch.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/swtch.s ============================================================================== --- stable/11/sys/i386/i386/swtch.s Sat Nov 11 12:08:07 2017 (r325709) +++ stable/11/sys/i386/i386/swtch.s Sat Nov 11 12:09:33 2017 (r325710) @@ -262,7 +262,6 @@ sw1: popfl movl %edx, PCPU(CURPCB) - movl TD_TID(%ecx),%eax movl %ecx, PCPU(CURTHREAD) /* into next thread */ /* From owner-svn-src-stable-11@freebsd.org Sat Nov 11 12:12:28 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36808E69C44; Sat, 11 Nov 2017 12:12:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 001DB7F5E2; Sat, 11 Nov 2017 12:12: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 vABCCRjP089919; Sat, 11 Nov 2017 12:12:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vABCCQNH089917; Sat, 11 Nov 2017 12:12:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711111212.vABCCQNH089917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Nov 2017 12:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325711 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 325711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Nov 2017 12:12:28 -0000 Author: kib Date: Sat Nov 11 12:12:26 2017 New Revision: 325711 URL: https://svnweb.freebsd.org/changeset/base/325711 Log: MFC r325388: x86: Do not emit unused TD_TID symbols. Modified: stable/11/sys/amd64/amd64/genassym.c stable/11/sys/i386/i386/genassym.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/genassym.c ============================================================================== --- stable/11/sys/amd64/amd64/genassym.c Sat Nov 11 12:09:33 2017 (r325710) +++ stable/11/sys/amd64/amd64/genassym.c Sat Nov 11 12:12:26 2017 (r325711) @@ -81,7 +81,6 @@ ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); -ASSYM(TD_TID, offsetof(struct thread, td_tid)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); Modified: stable/11/sys/i386/i386/genassym.c ============================================================================== --- stable/11/sys/i386/i386/genassym.c Sat Nov 11 12:09:33 2017 (r325710) +++ stable/11/sys/i386/i386/genassym.c Sat Nov 11 12:12:26 2017 (r325711) @@ -88,7 +88,6 @@ ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_MD, offsetof(struct thread, td_md)); -ASSYM(TD_TID, offsetof(struct thread, td_tid)); ASSYM(TDP_CALLCHAIN, TDP_CALLCHAIN); From owner-svn-src-stable-11@freebsd.org Sat Nov 11 12:16:21 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17CB9E69D49; Sat, 11 Nov 2017 12:16:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D59BC7F74E; Sat, 11 Nov 2017 12:16:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vABCGJYs090160; Sat, 11 Nov 2017 12:16:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vABCGJ3b090158; Sat, 11 Nov 2017 12:16:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711111216.vABCGJ3b090158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Nov 2017 12:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325712 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 325712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Nov 2017 12:16:21 -0000 Author: kib Date: Sat Nov 11 12:16:19 2017 New Revision: 325712 URL: https://svnweb.freebsd.org/changeset/base/325712 Log: MFC r325389: C++17 requires quick_exit(3) to be async-signal safe. Modified: stable/11/lib/libc/stdlib/quick_exit.3 stable/11/lib/libc/stdlib/quick_exit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/quick_exit.3 ============================================================================== --- stable/11/lib/libc/stdlib/quick_exit.3 Sat Nov 11 12:12:26 2017 (r325711) +++ stable/11/lib/libc/stdlib/quick_exit.3 Sat Nov 11 12:16:19 2017 (r325712) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2014 +.Dd November 4, 2017 .Dt QUICK_EXIT 3 .Os .Sh NAME @@ -44,6 +44,17 @@ with .Xr at_quick_exit 3 but not any C++ destructors or cleanup code registered with .Xr atexit 3 . +The +.Xr stdio 3 +file buffers are not flushed. +.Pp +The function +.Fn quick_exit +is +.Em async-signal safe +when the functions registered with +.Xr at_quick_exit 3 +are. .Sh RETURN VALUES The .Fn quick_exit Modified: stable/11/lib/libc/stdlib/quick_exit.c ============================================================================== --- stable/11/lib/libc/stdlib/quick_exit.c Sat Nov 11 12:12:26 2017 (r325711) +++ stable/11/lib/libc/stdlib/quick_exit.c Sat Nov 11 12:16:19 2017 (r325712) @@ -26,6 +26,8 @@ * $FreeBSD$ */ +#include +#include #include #include @@ -60,6 +62,7 @@ at_quick_exit(void (*func)(void)) h->cleanup = func; pthread_mutex_lock(&atexit_mutex); h->next = handlers; + __compiler_membar(); handlers = h; pthread_mutex_unlock(&atexit_mutex); return (0); @@ -74,7 +77,9 @@ quick_exit(int status) * XXX: The C++ spec requires us to call std::terminate if there is an * exception here. */ - for (h = handlers; NULL != h; h = h->next) + for (h = handlers; NULL != h; h = h->next) { + __compiler_membar(); h->cleanup(); + } _Exit(status); }