From owner-svn-src-user@FreeBSD.ORG Sun May 8 21:40:43 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64922106564A; Sun, 8 May 2011 21:40:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0273C8FC08; Sun, 8 May 2011 21:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48LegEX063274; Sun, 8 May 2011 21:40:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48LeguU063273; Sun, 8 May 2011 21:40:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105082140.p48LeguU063273@svn.freebsd.org> From: Andriy Gapon Date: Sun, 8 May 2011 21:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221670 - user/avg X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 21:40:43 -0000 Author: avg Date: Sun May 8 21:40:42 2011 New Revision: 221670 URL: http://svn.freebsd.org/changeset/base/221670 Log: create a place for my projects Added: user/avg/ From owner-svn-src-user@FreeBSD.ORG Sun May 8 21:46:13 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39F741065675; Sun, 8 May 2011 21:46:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105308FC14; Sun, 8 May 2011 21:46:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48LkCc1063478; Sun, 8 May 2011 21:46:12 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48LkCvw063477; Sun, 8 May 2011 21:46:12 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105082146.p48LkCvw063477@svn.freebsd.org> From: Andriy Gapon Date: Sun, 8 May 2011 21:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221671 - user/avg/xcpu X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 21:46:13 -0000 Author: avg Date: Sun May 8 21:46:12 2011 New Revision: 221671 URL: http://svn.freebsd.org/changeset/base/221671 Log: create a branch for my "cross-cpu" changes this includes: - cpu stopping, hard and soft - cpu rendezvous - x86 tlb shootdowns - interactions of the above and extends to implementation of: - panic(9) - kdb - cpu resetting Added: - copied from r221670, head/ Directory Properties: user/avg/xcpu/ (props changed) From owner-svn-src-user@FreeBSD.ORG Mon May 9 00:04:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90E2A1065677; Mon, 9 May 2011 00:04:36 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81AA88FC1B; Mon, 9 May 2011 00:04:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4904aZl067629; Mon, 9 May 2011 00:04:36 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4904ahw067625; Mon, 9 May 2011 00:04:36 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201105090004.p4904ahw067625@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 9 May 2011 00:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221672 - user/gabor/tre-integration/include X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 00:04:36 -0000 Author: gabor Date: Mon May 9 00:04:36 2011 New Revision: 221672 URL: http://svn.freebsd.org/changeset/base/221672 Log: - Bring in TRE headers into include so that it can be built as a part of the base system. - It is still called tre.h for compatibility of TRE-specific applications so regex.h only contains an include to it Added: user/gabor/tre-integration/include/tre.h - copied unchanged from r221610, user/gabor/tre-integration/contrib/tre/lib/tre.h Replaced: user/gabor/tre-integration/include/regex.h - copied unchanged from r221610, user/gabor/tre-integration/contrib/tre/lib/regex.h Modified: user/gabor/tre-integration/include/Makefile Modified: user/gabor/tre-integration/include/Makefile ============================================================================== --- user/gabor/tre-integration/include/Makefile Sun May 8 21:46:12 2011 (r221671) +++ user/gabor/tre-integration/include/Makefile Mon May 9 00:04:36 2011 (r221672) @@ -22,7 +22,7 @@ INCS= a.out.h ar.h assert.h bitstring.h signal.h spawn.h stab.h \ stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \ strings.h sysexits.h tar.h termios.h tgmath.h \ - time.h timeconv.h timers.h ttyent.h \ + time.h timeconv.h timers.h tre.h ttyent.h \ ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \ wchar.h wctype.h wordexp.h Copied: user/gabor/tre-integration/include/regex.h (from r221610, user/gabor/tre-integration/contrib/tre/lib/regex.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gabor/tre-integration/include/regex.h Mon May 9 00:04:36 2011 (r221672, copy of r221610, user/gabor/tre-integration/contrib/tre/lib/regex.h) @@ -0,0 +1,36 @@ +/* + regex.h - TRE legacy API + + This software is released under a BSD-style license. + See the file LICENSE for details and copyright. + + This header is for source level compatibility with old code using + the header which defined the TRE API functions without + a prefix. New code should include instead. + +*/ + +#ifndef TRE_REXEX_H +#define TRE_REGEX_H 1 + +#include "tre.h" + +#define regcomp tre_regcomp +#define regerror tre_regerror +#define regexec tre_regexec +#define regfree tre_regfree + +#define regacomp tre_regacomp +#define regaexec tre_regaexec +#define regancomp tre_regancomp +#define reganexec tre_reganexec +#define regawncomp tre_regawncomp +#define regawnexec tre_regawnexec +#define regncomp tre_regncomp +#define regnexec tre_regnexec +#define regwcomp tre_regwcomp +#define regwexec tre_regwexec +#define regwncomp tre_regwncomp +#define regwnexec tre_regwnexec + +#endif /* TRE_REGEX_H */ Copied: user/gabor/tre-integration/include/tre.h (from r221610, user/gabor/tre-integration/contrib/tre/lib/tre.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gabor/tre-integration/include/tre.h Mon May 9 00:04:36 2011 (r221672, copy of r221610, user/gabor/tre-integration/contrib/tre/lib/tre.h) @@ -0,0 +1,227 @@ +/* + tre.h - TRE public API definitions + + This software is released under a BSD-style license. + See the file LICENSE for details and copyright. + +*/ + +#ifndef TRE_H +#define TRE_H 1 + +#include + +#define TRE_WCHAR 1 +#define TRE_APPROX 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int regoff_t; +typedef struct { + size_t re_nsub; /* Number of parenthesized subexpressions. */ + void *value; /* For internal use only. */ +} regex_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + + +typedef enum { + REG_OK = 0, /* No error. */ + /* POSIX tre_regcomp() return error codes. (In the order listed in the + standard.) */ + REG_NOMATCH, /* No match. */ + REG_BADPAT, /* Invalid regexp. */ + REG_ECOLLATE, /* Unknown collating element. */ + REG_ECTYPE, /* Unknown character class name. */ + REG_EESCAPE, /* Trailing backslash. */ + REG_ESUBREG, /* Invalid back reference. */ + REG_EBRACK, /* "[]" imbalance */ + REG_EPAREN, /* "\(\)" or "()" imbalance */ + REG_EBRACE, /* "\{\}" or "{}" imbalance */ + REG_BADBR, /* Invalid content of {} */ + REG_ERANGE, /* Invalid use of range operator */ + REG_ESPACE, /* Out of memory. */ + REG_BADRPT /* Invalid use of repetition operators. */ +} reg_errcode_t; + +/* POSIX tre_regcomp() flags. */ +#define REG_EXTENDED 1 +#define REG_ICASE (REG_EXTENDED << 1) +#define REG_NEWLINE (REG_ICASE << 1) +#define REG_NOSUB (REG_NEWLINE << 1) + +/* Extra tre_regcomp() flags. */ +#define REG_BASIC 0 +#define REG_LITERAL (REG_NOSUB << 1) +#define REG_RIGHT_ASSOC (REG_LITERAL << 1) +#define REG_UNGREEDY (REG_RIGHT_ASSOC << 1) + +/* POSIX tre_regexec() flags. */ +#define REG_NOTBOL 1 +#define REG_NOTEOL (REG_NOTBOL << 1) + +/* Extra tre_regexec() flags. */ +#define REG_APPROX_MATCHER (REG_NOTEOL << 1) +#define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1) + +/* REG_NOSPEC and REG_LITERAL mean the same thing. */ +#if defined(REG_LITERAL) && !defined(REG_NOSPEC) +#define REG_NOSPEC REG_LITERAL +#elif defined(REG_NOSPEC) && !defined(REG_LITERAL) +#define REG_LITERAL REG_NOSPEC +#endif /* defined(REG_NOSPEC) */ + +/* The maximum number of iterations in a bound expression. */ +#undef RE_DUP_MAX +#define RE_DUP_MAX 255 + +/* The POSIX.2 regexp functions */ +extern int +tre_regcomp(regex_t *preg, const char *regex, int cflags); + +extern int +tre_regexec(const regex_t *preg, const char *string, size_t nmatch, + regmatch_t pmatch[], int eflags); + +extern size_t +tre_regerror(int errcode, const regex_t *preg, char *errbuf, + size_t errbuf_size); + +extern void +tre_regfree(regex_t *preg); + +#ifdef TRE_WCHAR +#include + +/* Wide character versions (not in POSIX.2). */ +extern int +tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags); + +extern int +tre_regwexec(const regex_t *preg, const wchar_t *string, + size_t nmatch, regmatch_t pmatch[], int eflags); +#endif /* TRE_WCHAR */ + +/* Versions with a maximum length argument and therefore the capability to + handle null characters in the middle of the strings (not in POSIX.2). */ +extern int +tre_regncomp(regex_t *preg, const char *regex, size_t len, int cflags); + +extern int +tre_regnexec(const regex_t *preg, const char *string, size_t len, + size_t nmatch, regmatch_t pmatch[], int eflags); + +#ifdef TRE_WCHAR +extern int +tre_regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags); + +extern int +tre_regwnexec(const regex_t *preg, const wchar_t *string, size_t len, + size_t nmatch, regmatch_t pmatch[], int eflags); +#endif /* TRE_WCHAR */ + +#ifdef TRE_APPROX + +/* Approximate matching parameter struct. */ +typedef struct { + int cost_ins; /* Default cost of an inserted character. */ + int cost_del; /* Default cost of a deleted character. */ + int cost_subst; /* Default cost of a substituted character. */ + int max_cost; /* Maximum allowed cost of a match. */ + + int max_ins; /* Maximum allowed number of inserts. */ + int max_del; /* Maximum allowed number of deletes. */ + int max_subst; /* Maximum allowed number of substitutes. */ + int max_err; /* Maximum allowed number of errors total. */ +} regaparams_t; + +/* Approximate matching result struct. */ +typedef struct { + size_t nmatch; /* Length of pmatch[] array. */ + regmatch_t *pmatch; /* Submatch data. */ + int cost; /* Cost of the match. */ + int num_ins; /* Number of inserts in the match. */ + int num_del; /* Number of deletes in the match. */ + int num_subst; /* Number of substitutes in the match. */ +} regamatch_t; + + +/* Approximate matching functions. */ +extern int +tre_regaexec(const regex_t *preg, const char *string, + regamatch_t *match, regaparams_t params, int eflags); + +extern int +tre_reganexec(const regex_t *preg, const char *string, size_t len, + regamatch_t *match, regaparams_t params, int eflags); +#ifdef TRE_WCHAR +/* Wide character approximate matching. */ +extern int +tre_regawexec(const regex_t *preg, const wchar_t *string, + regamatch_t *match, regaparams_t params, int eflags); + +extern int +tre_regawnexec(const regex_t *preg, const wchar_t *string, size_t len, + regamatch_t *match, regaparams_t params, int eflags); +#endif /* TRE_WCHAR */ + +/* Sets the parameters to default values. */ +extern void +tre_regaparams_default(regaparams_t *params); +#endif /* TRE_APPROX */ + +#ifdef TRE_WCHAR +typedef wchar_t tre_char_t; +#else /* !TRE_WCHAR */ +typedef unsigned char tre_char_t; +#endif /* !TRE_WCHAR */ + +typedef struct { + int (*get_next_char)(tre_char_t *c, unsigned int *pos_add, void *context); + void (*rewind)(size_t pos, void *context); + int (*compare)(size_t pos1, size_t pos2, size_t len, void *context); + void *context; +} tre_str_source; + +extern int +tre_reguexec(const regex_t *preg, const tre_str_source *string, + size_t nmatch, regmatch_t pmatch[], int eflags); + +/* Returns the version string. The returned string is static. */ +extern char * +tre_version(void); + +/* Returns the value for a config parameter. The type to which `result' + must point to depends of the value of `query', see documentation for + more details. */ +extern int +tre_config(int query, void *result); + +enum { + TRE_CONFIG_APPROX, + TRE_CONFIG_WCHAR, + TRE_CONFIG_MULTIBYTE, + TRE_CONFIG_SYSTEM_ABI, + TRE_CONFIG_VERSION +}; + +/* Returns 1 if the compiled pattern has back references, 0 if not. */ +extern int +tre_have_backrefs(const regex_t *preg); + +/* Returns 1 if the compiled pattern uses approximate matching features, + 0 if not. */ +extern int +tre_have_approx(const regex_t *preg); + +#ifdef __cplusplus +} +#endif +#endif /* TRE_H */ + +/* EOF */ From owner-svn-src-user@FreeBSD.ORG Mon May 9 00:29:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90349106566C; Mon, 9 May 2011 00:29:20 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8160C8FC12; Mon, 9 May 2011 00:29:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p490TKkr068373; Mon, 9 May 2011 00:29:20 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p490TKE9068363; Mon, 9 May 2011 00:29:20 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201105090029.p490TKE9068363@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 9 May 2011 00:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221673 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 00:29:20 -0000 Author: gabor Date: Mon May 9 00:29:20 2011 New Revision: 221673 URL: http://svn.freebsd.org/changeset/base/221673 Log: - Remove tre.h and regex.h from here as they became system headers - Include tre.h as a system header Deleted: user/gabor/tre-integration/contrib/tre/lib/regex.h user/gabor/tre-integration/contrib/tre/lib/tre.h Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c user/gabor/tre-integration/contrib/tre/lib/regerror.c user/gabor/tre-integration/contrib/tre/lib/regexec.c user/gabor/tre-integration/contrib/tre/lib/tre-compile.c user/gabor/tre-integration/contrib/tre/lib/tre-internal.h user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c user/gabor/tre-integration/contrib/tre/lib/tre-stack.h Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Mon May 9 00:29:20 2011 (r221673) @@ -13,8 +13,8 @@ #include #include #include +#include -#include "tre.h" #include "tre-internal.h" #include "xmalloc.h" Modified: user/gabor/tre-integration/contrib/tre/lib/regerror.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regerror.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/regerror.c Mon May 9 00:29:20 2011 (r221673) @@ -11,6 +11,7 @@ #endif /* HAVE_CONFIG_H */ #include +#include #ifdef HAVE_WCHAR_H #include #endif /* HAVE_WCHAR_H */ @@ -19,7 +20,6 @@ #endif /* HAVE_WCTYPE_H */ #include "tre-internal.h" -#include "tre.h" #ifdef HAVE_GETTEXT #include Modified: user/gabor/tre-integration/contrib/tre/lib/regexec.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regexec.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/regexec.c Mon May 9 00:29:20 2011 (r221673) @@ -30,6 +30,7 @@ char *alloca (); #include #include #include +#include #ifdef HAVE_WCHAR_H #include #endif /* HAVE_WCHAR_H */ @@ -45,7 +46,6 @@ char *alloca (); #include #include "tre-internal.h" -#include "tre.h" #include "xmalloc.h" Modified: user/gabor/tre-integration/contrib/tre/lib/tre-compile.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Mon May 9 00:29:20 2011 (r221673) @@ -19,6 +19,7 @@ #include #include #include +#include #include "tre-internal.h" #include "tre-mem.h" @@ -26,7 +27,6 @@ #include "tre-ast.h" #include "tre-parse.h" #include "tre-compile.h" -#include "tre.h" #include "xmalloc.h" /* Modified: user/gabor/tre-integration/contrib/tre/lib/tre-internal.h ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Mon May 9 00:29:20 2011 (r221673) @@ -18,7 +18,7 @@ #endif /* !HAVE_WCTYPE_H */ #include -#include "tre.h" +#include #ifdef TRE_DEBUG #include Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-match-approx.c Mon May 9 00:29:20 2011 (r221673) @@ -33,6 +33,7 @@ char *alloca (); #include #include #include +#include #include #ifdef HAVE_WCHAR_H #include @@ -49,7 +50,6 @@ char *alloca (); #include "tre-internal.h" #include "tre-match-utils.h" -#include "tre.h" #include "xmalloc.h" #define TRE_M_COST 0 Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-match-backtrack.c Mon May 9 00:29:20 2011 (r221673) @@ -54,6 +54,7 @@ char *alloca (); #include #include #include +#include #ifdef HAVE_WCHAR_H #include #endif /* HAVE_WCHAR_H */ @@ -70,7 +71,6 @@ char *alloca (); #include "tre-internal.h" #include "tre-mem.h" #include "tre-match-utils.h" -#include "tre.h" #include "xmalloc.h" typedef struct { Modified: user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-match-parallel.c Mon May 9 00:29:20 2011 (r221673) @@ -47,6 +47,7 @@ char *alloca (); #include #include #include +#include #ifdef HAVE_WCHAR_H #include #endif /* HAVE_WCHAR_H */ @@ -62,7 +63,6 @@ char *alloca (); #include "tre-internal.h" #include "tre-match-utils.h" -#include "tre.h" #include "xmalloc.h" Modified: user/gabor/tre-integration/contrib/tre/lib/tre-stack.h ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-stack.h Mon May 9 00:04:36 2011 (r221672) +++ user/gabor/tre-integration/contrib/tre/lib/tre-stack.h Mon May 9 00:29:20 2011 (r221673) @@ -10,7 +10,7 @@ #ifndef TRE_STACK_H #define TRE_STACK_H 1 -#include "tre.h" +#include typedef struct tre_stack_rec tre_stack_t; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:01:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45F271065673; Mon, 9 May 2011 07:01:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 389D18FC12; Mon, 9 May 2011 07:01:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4971KWk080184; Mon, 9 May 2011 07:01:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4971KTn080181; Mon, 9 May 2011 07:01:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090701.p4971KTn080181@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:01:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221674 - in user/avg/xcpu/sys: kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:01:20 -0000 Author: avg Date: Mon May 9 07:01:19 2011 New Revision: 221674 URL: http://svn.freebsd.org/changeset/base/221674 Log: make panicstr a volatile pointer this is just to be safe and extra correct rather than to fix any real issue Modified: user/avg/xcpu/sys/kern/kern_shutdown.c user/avg/xcpu/sys/sys/systm.h Modified: user/avg/xcpu/sys/kern/kern_shutdown.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 00:29:20 2011 (r221673) +++ user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:01:19 2011 (r221674) @@ -127,7 +127,7 @@ SYSCTL_NODE(_kern, OID_AUTO, shutdown, C * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. */ -const char *panicstr; +const char * volatile panicstr; int dumping; /* system is dumping */ int rebooting; /* system is rebooting */ Modified: user/avg/xcpu/sys/sys/systm.h ============================================================================== --- user/avg/xcpu/sys/sys/systm.h Mon May 9 00:29:20 2011 (r221673) +++ user/avg/xcpu/sys/sys/systm.h Mon May 9 07:01:19 2011 (r221674) @@ -47,7 +47,7 @@ extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* kern_reboot() has been called. */ -extern const char *panicstr; /* panic message */ +extern const char * volatile panicstr; /* panic message */ extern char version[]; /* system version */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:03:01 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E15DC1065673; Mon, 9 May 2011 07:03:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3FC18FC12; Mon, 9 May 2011 07:03:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497315D080273; Mon, 9 May 2011 07:03:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49731wY080271; Mon, 9 May 2011 07:03:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090703.p49731wY080271@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221675 - user/avg/xcpu/sys/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:03:02 -0000 Author: avg Date: Mon May 9 07:03:01 2011 New Revision: 221675 URL: http://svn.freebsd.org/changeset/base/221675 Log: add a macro to identify a panic thread the macro is placed into systm.h as all potential users of this macro should already include this header file Modified: user/avg/xcpu/sys/sys/systm.h Modified: user/avg/xcpu/sys/sys/systm.h ============================================================================== --- user/avg/xcpu/sys/sys/systm.h Mon May 9 07:01:19 2011 (r221674) +++ user/avg/xcpu/sys/sys/systm.h Mon May 9 07:03:01 2011 (r221675) @@ -109,6 +109,15 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) /* + * If we have already panic'd and this is the thread that called + * panic(), then don't block on any mutexes but silently succeed. + * Otherwise, the kernel will deadlock since the scheduler isn't + * going to run the thread that holds the lock we need. + */ +#define IS_PANIC_THREAD() \ + (panicstr != NULL && (curthread->td_flags & TDF_INPANIC) != 0) + +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files. From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:04:14 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADB2106566B; Mon, 9 May 2011 07:04:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DCB18FC0A; Mon, 9 May 2011 07:04:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4974EcB080347; Mon, 9 May 2011 07:04:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4974EOU080345; Mon, 9 May 2011 07:04:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090704.p4974EOU080345@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221676 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:04:14 -0000 Author: avg Date: Mon May 9 07:04:14 2011 New Revision: 221676 URL: http://svn.freebsd.org/changeset/base/221676 Log: generic_stop_cpus: move timeout detection code from under DIAGNOSTIC ... and also increase it a bit. IMO it's better to detect and report the (rather serious) condition and allow a system to proceed somehow rather than be stuck in an endless loop. Modified: user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:03:01 2011 (r221675) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:04:14 2011 (r221676) @@ -232,12 +232,10 @@ generic_stop_cpus(cpumask_t map, u_int t /* spin */ cpu_spinwait(); i++; -#ifdef DIAGNOSTIC - if (i == 100000) { + if (i == 100000000) { printf("timeout stopping cpus\n"); break; } -#endif } stopping_cpu = NOCPU; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:05:06 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 871EE1065689; Mon, 9 May 2011 07:05:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 717C08FC1F; Mon, 9 May 2011 07:05:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49756Mv080428; Mon, 9 May 2011 07:05:06 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49756Ff080416; Mon, 9 May 2011 07:05:06 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090705.p49756Ff080416@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221677 - in user/avg/xcpu/sys: amd64/amd64 kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:05:06 -0000 Author: avg Date: Mon May 9 07:05:06 2011 New Revision: 221677 URL: http://svn.freebsd.org/changeset/base/221677 Log: re-implement hard stopping of CPUs and use it enforce panic(9) context Hard stopping changes: - stop_cpus_hard interface is intentionally narrowed to always act on all other cpus - stop_cpus_hard keeps its own accounting of stopped cpus completely disregarding soft stopping of cpus (pausing, suspending) - no recursion whatsoever is allowed for stop_cpus_hard; all callers must check if they are already in "super" mode - protect stop function with spinlock context - avoid potential deadlock between two cpus already being in nmi context (e.g. because of hardware) and trying to stop each other by checking the stopped bit while spinning on stopper lock; this is possibly an arch-specific thing [x86]; The last item is what I call a cross-cpu deadlock avoidance approach. General idea: if a CPU can't grab a lock protecting cross-/intra-CPU interactions, then while spinning on the lock the CPU should check for incoming cross-CPU events possibly posted by a CPU that currently holds the lock. In this scheme an IPI is used only to interrupt a CPU so that it can notice a new event, but the actual event should be passed via the memory (a bit in a cpu set - like newly introduced hard_stopping_cpus, or some other variable). Panic context changes: - ensure that only one (panic-ing) CPU runs after panic(9) call by stopping other CPUs using stop_cpus_hard() - disable interrupts/preemption early in panic(9) and do re-enable (this most probably breaks sync-on-panic behavior) - allow a panic-ing thread to penetrate all locks and never sleep on conditions (lockmgr locks are exempt actually): o mutex, spin mutex, rwlock, rmlock, sx: allow lock/unlock operations to unconditionally succeed for a thread in panic [jhb] o tsleep, msleep (msleep_spin, _sleep): return success without waiting for a thread in panic [jhb] o cv code already does that when panisctr != NULL - boot(): do not rebind to bsp if panic-ing [mdf] - in all places where we want to stop other cpus first check if they are not stopped already cpu_reset() and cpustop_hard_handler() are only (re-)implemented for amd64 at the moment. Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c user/avg/xcpu/sys/amd64/amd64/vm_machdep.c user/avg/xcpu/sys/kern/kern_mutex.c user/avg/xcpu/sys/kern/kern_rmlock.c user/avg/xcpu/sys/kern/kern_rwlock.c user/avg/xcpu/sys/kern/kern_shutdown.c user/avg/xcpu/sys/kern/kern_sx.c user/avg/xcpu/sys/kern/kern_synch.c user/avg/xcpu/sys/kern/subr_kdb.c user/avg/xcpu/sys/kern/subr_smp.c user/avg/xcpu/sys/sys/smp.h Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:05:06 2011 (r221677) @@ -1360,8 +1360,40 @@ ipi_all_but_self(u_int ipi) lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } +void +cpuhardstop_handler(void) +{ + cpumask_t cpumask; + u_int cpu; + + cpumask = PCPU_GET(cpumask); + + /* Just return if this is a belated NMI */ + if ((hard_stopping_cpus & cpumask) == 0) + return; + + cpu = PCPU_GET(cpuid); + savectx(&stoppcbs[cpu]); + + /* Indicate that we are stopped */ + atomic_set_int(&hard_stopped_cpus, cpumask); + atomic_clear_int(&hard_stopping_cpus, cpumask); + + /* Wait for restart */ + while ((hard_started_cpus & cpumask) == 0) { + /* BSP can be asked to reset system while spinning here. */ + if (cpu == 0 && cpustop_hook != NULL) { + cpustop_hook(); + cpustop_hook = NULL; + } + ia32_pause(); + } + atomic_clear_int(&hard_started_cpus, cpumask); + atomic_clear_int(&hard_stopped_cpus, cpumask); +} + int -ipi_nmi_handler() +ipi_nmi_handler(void) { cpumask_t cpumask; @@ -1376,7 +1408,7 @@ ipi_nmi_handler() return (1); atomic_clear_int(&ipi_nmi_pending, cpumask); - cpustop_handler(); + cpuhardstop_handler(); return (0); } Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:05:06 2011 (r221677) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -531,12 +532,13 @@ cpu_reset() u_int cnt; if (smp_active) { - map = PCPU_GET(other_cpus) & ~stopped_cpus; - if (map != 0) { - printf("cpu_reset: Stopping other CPUs\n"); - stop_cpus(map); + if (panicstr == NULL && !kdb_active) { + map = PCPU_GET(other_cpus) & ~stopped_cpus; + if (map != 0) { + printf("cpu_reset: Stopping other CPUs\n"); + stop_cpus(map); + } } - if (PCPU_GET(cpuid) != 0) { cpu_reset_proxyid = PCPU_GET(cpuid); cpustop_restartfunc = cpu_reset_proxy; Modified: user/avg/xcpu/sys/kern/kern_mutex.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_mutex.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_mutex.c Mon May 9 07:05:06 2011 (r221677) @@ -348,6 +348,9 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t return; } + if (IS_PANIC_THREAD()) + return; + lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); if (LOCK_LOG_TEST(&m->lock_object, opts)) @@ -507,6 +510,9 @@ _mtx_lock_spin(struct mtx *m, uintptr_t uint64_t waittime = 0; #endif + if (IS_PANIC_THREAD()) + return; + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m); @@ -577,6 +583,10 @@ retry: m->mtx_recurse++; break; } + + if (IS_PANIC_THREAD()) + return; + lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); /* Give interrupts a chance while we spin. */ @@ -663,6 +673,9 @@ _mtx_unlock_sleep(struct mtx *m, int opt return; } + if (IS_PANIC_THREAD()) + return; + /* * We have to lock the chain before the turnstile so this turnstile * can be removed from the hash list if it is empty. Modified: user/avg/xcpu/sys/kern/kern_rmlock.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_rmlock.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_rmlock.c Mon May 9 07:05:06 2011 (r221677) @@ -279,6 +279,9 @@ _rm_rlock_hard(struct rmlock *rm, struct return (1); } + if (IS_PANIC_THREAD()) + return (1); + /* * We allow readers to aquire a lock even if a writer is blocked if * the lock is recursive and the reader already holds the lock. @@ -385,6 +388,9 @@ _rm_unlock_hard(struct thread *td,struct if (!tracker->rmp_flags) return; + if (IS_PANIC_THREAD()) + return; + mtx_lock_spin(&rm_spinlock); LIST_REMOVE(tracker, rmp_qentry); @@ -436,6 +442,9 @@ _rm_wlock(struct rmlock *rm) else mtx_lock(&rm->rm_lock_mtx); + if (IS_PANIC_THREAD()) + return; + if (rm->rm_writecpus != all_cpus) { /* Get all read tokens back */ Modified: user/avg/xcpu/sys/kern/kern_rwlock.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_rwlock.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_rwlock.c Mon May 9 07:05:06 2011 (r221677) @@ -323,6 +323,9 @@ _rw_rlock(struct rwlock *rw, const char rw->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); + if (IS_PANIC_THREAD()) + return; + for (;;) { #ifdef KDTRACE_HOOKS spin_cnt++; @@ -532,6 +535,9 @@ _rw_runlock(struct rwlock *rw, const cha WITNESS_UNLOCK(&rw->lock_object, 0, file, line); LOCK_LOG_LOCK("RUNLOCK", &rw->lock_object, 0, 0, file, line); + if (IS_PANIC_THREAD()) + return; + /* TODO: drop "owner of record" here. */ for (;;) { @@ -659,6 +665,9 @@ _rw_wlock_hard(struct rwlock *rw, uintpt return; } + if (IS_PANIC_THREAD()) + return; + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, rw->lock_object.lo_name, (void *)rw->rw_lock, file, line); @@ -820,6 +829,9 @@ _rw_wunlock_hard(struct rwlock *rw, uint return; } + if (IS_PANIC_THREAD()) + return; + KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS), ("%s: neither of the waiter flags are set", __func__)); Modified: user/avg/xcpu/sys/kern/kern_shutdown.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:05:06 2011 (r221677) @@ -121,6 +121,13 @@ SYSCTL_INT(_kern, OID_AUTO, sync_on_pani &sync_on_panic, 0, "Do a sync before rebooting from a panic"); TUNABLE_INT("kern.sync_on_panic", &sync_on_panic); +#ifdef SMP +static int stop_cpus_on_panic = 1; +SYSCTL_INT(_kern, OID_AUTO, stop_cpus_on_panic, CTLFLAG_RW | CTLFLAG_TUN, + &stop_cpus_on_panic, 0, "stop other CPUs when entering the debugger"); +TUNABLE_INT("kern.stop_cpus_on_panic", &stop_cpus_on_panic); +#endif + SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); /* @@ -283,10 +290,12 @@ kern_reboot(int howto) * systems don't shutdown properly (i.e., ACPI power off) if we * run on another processor. */ - thread_lock(curthread); - sched_bind(curthread, 0); - thread_unlock(curthread); - KASSERT(PCPU_GET(cpuid) == 0, ("%s: not running on cpu 0", __func__)); + if (panicstr == NULL) { + thread_lock(curthread); + sched_bind(curthread, 0); + thread_unlock(curthread); + KASSERT(PCPU_GET(cpuid) == 0, ("boot: not running on cpu 0")); + } #endif /* We're in the process of rebooting. */ rebooting = 1; @@ -530,27 +539,19 @@ shutdown_reset(void *junk, int howto) void panic(const char *fmt, ...) { -#ifdef SMP - static volatile u_int panic_cpu = NOCPU; -#endif struct thread *td = curthread; int bootopt, newpanic; + int did_stop_cpus; va_list ap; static char buf[256]; - critical_enter(); + spinlock_enter(); #ifdef SMP - /* - * We don't want multiple CPU's to panic at the same time, so we - * use panic_cpu as a simple spinlock. We have to keep checking - * panic_cpu if we are spinning in case the panic on the first - * CPU is canceled. - */ - if (panic_cpu != PCPU_GET(cpuid)) - while (atomic_cmpset_int(&panic_cpu, NOCPU, - PCPU_GET(cpuid)) == 0) - while (panic_cpu != NOCPU) - ; /* nothing */ + if (stop_cpus_on_panic && panicstr == NULL && !kdb_active) { + stop_cpus_hard(); + did_stop_cpus = 1; + } else + did_stop_cpus = 0; #endif bootopt = RB_AUTOBOOT | RB_DUMP; @@ -586,8 +587,13 @@ panic(const char *fmt, ...) /* See if the user aborted the panic, in which case we continue. */ if (panicstr == NULL) { #ifdef SMP - atomic_store_rel_int(&panic_cpu, NOCPU); + if (did_stop_cpus) + unstop_cpus_hard(); + else + atomic_store_rel_int(&panic_cpu, NOCPU); #endif + + spinlock_exit(); return; } #endif @@ -595,9 +601,10 @@ panic(const char *fmt, ...) /*thread_lock(td); */ td->td_flags |= TDF_INPANIC; /* thread_unlock(td); */ + if (!sync_on_panic) bootopt |= RB_NOSYNC; - critical_exit(); + kern_reboot(bootopt); } Modified: user/avg/xcpu/sys/kern/kern_sx.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_sx.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_sx.c Mon May 9 07:05:06 2011 (r221677) @@ -493,6 +493,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t return (0); } + if (IS_PANIC_THREAD()) + return (0); + if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, sx->lock_object.lo_name, (void *)sx->sx_lock, file, line); @@ -691,6 +694,10 @@ _sx_xunlock_hard(struct sx *sx, uintptr_ CTR2(KTR_LOCK, "%s: %p unrecursing", __func__, sx); return; } + + if (IS_PANIC_THREAD()) + return; + MPASS(sx->sx_lock & (SX_LOCK_SHARED_WAITERS | SX_LOCK_EXCLUSIVE_WAITERS)); if (LOCK_LOG_TEST(&sx->lock_object, 0)) @@ -753,6 +760,9 @@ _sx_slock_hard(struct sx *sx, int opts, int64_t sleep_time = 0; #endif + if (IS_PANIC_THREAD()) + return (0); + /* * As with rwlocks, we don't make any attempt to try to block * shared locks once there is an exclusive waiter. @@ -919,6 +929,9 @@ _sx_sunlock_hard(struct sx *sx, const ch uintptr_t x; int wakeup_swapper; + if (IS_PANIC_THREAD()) + return; + for (;;) { x = sx->sx_lock; Modified: user/avg/xcpu/sys/kern/kern_synch.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_synch.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/kern_synch.c Mon May 9 07:05:06 2011 (r221677) @@ -158,7 +158,7 @@ _sleep(void *ident, struct lock_object * else class = NULL; - if (cold) { + if (cold || IS_PANIC_THREAD()) { /* * During autoconfiguration, just return; * don't run any other threads or panic below, @@ -260,7 +260,7 @@ msleep_spin(void *ident, struct mtx *mtx KASSERT(p != NULL, ("msleep1")); KASSERT(ident != NULL && TD_IS_RUNNING(td), ("msleep")); - if (cold) { + if (cold || IS_PANIC_THREAD()) { /* * During autoconfiguration, just return; * don't run any other threads or panic below, Modified: user/avg/xcpu/sys/kern/subr_kdb.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_kdb.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/subr_kdb.c Mon May 9 07:05:06 2011 (r221677) @@ -211,10 +211,7 @@ kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS void kdb_panic(const char *msg) { - -#ifdef SMP - stop_cpus_hard(PCPU_GET(other_cpus)); -#endif + printf("KDB: panic\n"); panic("%s", msg); } @@ -515,8 +512,11 @@ kdb_trap(int type, int code, struct trap intr = intr_disable(); #ifdef SMP - if ((did_stop_cpus = kdb_stop_cpus) != 0) - stop_cpus_hard(PCPU_GET(other_cpus)); + if (kdb_stop_cpus && panicstr == NULL && !kdb_active) { + stop_cpus_hard(); + did_stop_cpus = 1; + } else + did_stop_cpus = 0; #endif kdb_active++; @@ -543,7 +543,7 @@ kdb_trap(int type, int code, struct trap #ifdef SMP if (did_stop_cpus) - restart_cpus(stopped_cpus); + unstop_cpus_hard(); #endif intr_restore(intr); Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:05:06 2011 (r221677) @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); #ifdef SMP volatile cpumask_t stopped_cpus; volatile cpumask_t started_cpus; +volatile cpumask_t hard_stopped_cpus; +volatile cpumask_t hard_started_cpus; +volatile cpumask_t hard_stopping_cpus; cpumask_t idle_cpus_mask; cpumask_t hlt_cpus_mask; cpumask_t logical_cpus_mask; @@ -207,9 +210,9 @@ generic_stop_cpus(cpumask_t map, u_int t KASSERT( #if defined(__amd64__) - type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, + type == IPI_STOP || type == IPI_SUSPEND, #else - type == IPI_STOP || type == IPI_STOP_HARD, + type == IPI_STOP #endif ("%s: invalid stop type", __func__)); @@ -249,13 +252,6 @@ stop_cpus(cpumask_t map) return (generic_stop_cpus(map, IPI_STOP)); } -int -stop_cpus_hard(cpumask_t map) -{ - - return (generic_stop_cpus(map, IPI_STOP_HARD)); -} - #if defined(__amd64__) int suspend_cpus(cpumask_t map) @@ -297,6 +293,82 @@ restart_cpus(cpumask_t map) return 1; } +void +stop_cpus_hard(void) +{ + static volatile u_int hard_stopper_cpu = NOCPU; + cpumask_t map; + cpumask_t mask; + u_int cpu; + int i; + + if (!smp_started) + return; + + /* Ensure non-preemtable context, just in case. */ + spinlock_enter(); + + map = PCPU_GET(other_cpus); + mask = PCPU_GET(cpumask); + cpu = PCPU_GET(cpuid); + + CTR2(KTR_SMP, "stop_cpus(%x) with %u type", map, IPI_STOP_HARD); + + if (cpu != hard_stopper_cpu) { + while (atomic_cmpset_int(&hard_stopper_cpu, NOCPU, cpu) == 0) + while (hard_stopper_cpu != NOCPU) { + if ((mask & hard_stopping_cpus) != 0) + cpuhardstop_handler(); + else + cpu_spinwait(); + } + } else { + /* + * Recursion here is not expected. + */ + atomic_store_rel_int(&hard_stopper_cpu, NOCPU); + panic("hard stop recursion\n"); + } + + atomic_set_int(&hard_stopping_cpus, map); + ipi_all_but_self(IPI_STOP_HARD); + + i = 0; + while ((hard_stopped_cpus & map) != map) { + cpu_spinwait(); + i++; + if (i == 10000000) { + /* Should not happen; other CPU stuck in NMI handler? */ + printf("timeout stopping cpus\n"); + break; + } + } + + atomic_store_rel_int(&hard_stopper_cpu, NOCPU); + + spinlock_exit(); + return; +} + +void +unstop_cpus_hard(void) +{ + cpumask_t map; + + if (!smp_started) + return; + + map = PCPU_GET(other_cpus); + CTR1(KTR_SMP, "restart_cpus(%x)", map); + + /* signal other cpus to restart */ + atomic_store_rel_int(&hard_started_cpus, map); + + /* wait for each to clear its bit */ + while ((hard_stopped_cpus & map) != 0) + cpu_spinwait(); +} + /* * All-CPU rendezvous. CPUs are signalled, all execute the setup function * (if specified), rendezvous, execute the action function (if specified), Modified: user/avg/xcpu/sys/sys/smp.h ============================================================================== --- user/avg/xcpu/sys/sys/smp.h Mon May 9 07:04:14 2011 (r221676) +++ user/avg/xcpu/sys/sys/smp.h Mon May 9 07:05:06 2011 (r221677) @@ -73,6 +73,9 @@ extern int smp_active; extern int smp_cpus; extern volatile cpumask_t started_cpus; extern volatile cpumask_t stopped_cpus; +extern volatile cpumask_t hard_started_cpus; +extern volatile cpumask_t hard_stopped_cpus; +extern volatile cpumask_t hard_stopping_cpus; extern cpumask_t idle_cpus_mask; extern cpumask_t hlt_cpus_mask; extern cpumask_t logical_cpus_mask; @@ -161,10 +164,12 @@ void cpu_mp_start(void); void forward_signal(struct thread *); int restart_cpus(cpumask_t); int stop_cpus(cpumask_t); -int stop_cpus_hard(cpumask_t); #if defined(__amd64__) int suspend_cpus(cpumask_t); #endif +void stop_cpus_hard(void); +void unstop_cpus_hard(void); +void cpuhardstop_handler(void); void smp_rendezvous_action(void); extern struct mtx smp_ipi_mtx; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:05:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD2531065687; Mon, 9 May 2011 07:05:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A45A98FC19; Mon, 9 May 2011 07:05:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4975axn080484; Mon, 9 May 2011 07:05:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4975ai0080480; Mon, 9 May 2011 07:05:36 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090705.p4975ai0080480@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221678 - in user/avg/xcpu/sys: amd64/amd64 kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:05:36 -0000 Author: avg Date: Mon May 9 07:05:36 2011 New Revision: 221678 URL: http://svn.freebsd.org/changeset/base/221678 Log: change generic_stop_cpus to use the same approach hard_stop_cpus Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c user/avg/xcpu/sys/kern/subr_smp.c user/avg/xcpu/sys/sys/smp.h Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:05:06 2011 (r221677) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:05:36 2011 (r221678) @@ -1422,9 +1422,13 @@ cpustop_handler(void) cpumask_t cpumask; u_int cpu; - cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); + /* Just return if this is a belated NMI */ + if ((stopping_cpus & cpumask) == 0) + return; + + cpu = PCPU_GET(cpuid); savectx(&stoppcbs[cpu]); /* Indicate that we are stopped */ Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:05:06 2011 (r221677) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:05:36 2011 (r221678) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #ifdef SMP volatile cpumask_t stopped_cpus; volatile cpumask_t started_cpus; +volatile cpumask_t stopping_cpus; volatile cpumask_t hard_stopped_cpus; volatile cpumask_t hard_started_cpus; volatile cpumask_t hard_stopping_cpus; @@ -205,7 +206,9 @@ forward_signal(struct thread *td) static int generic_stop_cpus(cpumask_t map, u_int type) { - static volatile u_int stopping_cpu = NOCPU; + static volatile u_int stopper_cpu = NOCPU; + cpumask_t mask; + int cpu; int i; KASSERT( @@ -221,13 +224,29 @@ generic_stop_cpus(cpumask_t map, u_int t CTR2(KTR_SMP, "stop_cpus(%x) with %u type", map, type); - if (stopping_cpu != PCPU_GET(cpuid)) - while (atomic_cmpset_int(&stopping_cpu, NOCPU, - PCPU_GET(cpuid)) == 0) - while (stopping_cpu != NOCPU) - cpu_spinwait(); /* spin */ + /* Ensure non-preemtable context, just in case. */ + spinlock_enter(); + + mask = PCPU_GET(cpumask); + cpu = PCPU_GET(cpuid); + + if (cpu != stopper_cpu) { + while (atomic_cmpset_int(&stopper_cpu, NOCPU, cpu) == 0) + while (stopper_cpu != NOCPU) { + if ((mask & stopping_cpus) != 0) + cpustop_handler(); + else + cpu_spinwait(); + } + } else { + /* + * Recursion here is not expected. + */ + panic("cpu stop recursion\n"); + } /* send the stop IPI to all CPUs in map */ + stopping_cpus = map; ipi_selected(map, type); i = 0; @@ -241,7 +260,7 @@ generic_stop_cpus(cpumask_t map, u_int t } } - stopping_cpu = NOCPU; + spinlock_exit(); return (1); } Modified: user/avg/xcpu/sys/sys/smp.h ============================================================================== --- user/avg/xcpu/sys/sys/smp.h Mon May 9 07:05:06 2011 (r221677) +++ user/avg/xcpu/sys/sys/smp.h Mon May 9 07:05:36 2011 (r221678) @@ -73,6 +73,7 @@ extern int smp_active; extern int smp_cpus; extern volatile cpumask_t started_cpus; extern volatile cpumask_t stopped_cpus; +extern volatile cpumask_t stopping_cpus; extern volatile cpumask_t hard_started_cpus; extern volatile cpumask_t hard_stopped_cpus; extern volatile cpumask_t hard_stopping_cpus; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:06:35 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7CF81065670; Mon, 9 May 2011 07:06:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE4218FC08; Mon, 9 May 2011 07:06:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4976YN4080558; Mon, 9 May 2011 07:06:34 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4976Ypv080553; Mon, 9 May 2011 07:06:34 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090706.p4976Ypv080553@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221679 - in user/avg/xcpu/sys: amd64/amd64 kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:06:35 -0000 Author: avg Date: Mon May 9 07:06:34 2011 New Revision: 221679 URL: http://svn.freebsd.org/changeset/base/221679 Log: simplify the way of execution of reset on BSP instead of restarting the BSP and having a special restart hook, the hook is placed in the spin loop and it is triggered simply by setting hook function to non-NULL Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c user/avg/xcpu/sys/amd64/amd64/vm_machdep.c user/avg/xcpu/sys/kern/subr_smp.c user/avg/xcpu/sys/sys/smp.h Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:06:34 2011 (r221679) @@ -1435,16 +1435,17 @@ cpustop_handler(void) atomic_set_int(&stopped_cpus, cpumask); /* Wait for restart */ - while (!(started_cpus & cpumask)) - ia32_pause(); + while ((started_cpus & cpumask) == 0) { + if (cpu == 0 && cpustop_hook != NULL) { + cpustop_hook(); + cpustop_hook = NULL; + } + ia32_pause(); + } atomic_clear_int(&started_cpus, cpumask); atomic_clear_int(&stopped_cpus, cpumask); - - if (cpu == 0 && cpustop_restartfunc != NULL) { - cpustop_restartfunc(); - cpustop_restartfunc = NULL; - } + return; } /* Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:06:34 2011 (r221679) @@ -541,12 +541,11 @@ cpu_reset() } if (PCPU_GET(cpuid) != 0) { cpu_reset_proxyid = PCPU_GET(cpuid); - cpustop_restartfunc = cpu_reset_proxy; cpu_reset_proxy_active = 0; printf("cpu_reset: Restarting BSP\n"); /* Restart CPU #0. */ - atomic_store_rel_int(&started_cpus, 1 << 0); + cpustop_hook = cpu_reset_proxy; cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 10000000) Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:06:34 2011 (r221679) @@ -63,7 +63,7 @@ cpumask_t idle_cpus_mask; cpumask_t hlt_cpus_mask; cpumask_t logical_cpus_mask; -void (*cpustop_restartfunc)(void); +void (* volatile cpustop_hook)(void); #endif /* This is used in modules that need to work in both SMP and UP. */ cpumask_t all_cpus; Modified: user/avg/xcpu/sys/sys/smp.h ============================================================================== --- user/avg/xcpu/sys/sys/smp.h Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/sys/smp.h Mon May 9 07:06:34 2011 (r221679) @@ -68,7 +68,7 @@ struct cpu_group *smp_topo_2level(int l2 int l1count, int l1flags); struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu); -extern void (*cpustop_restartfunc)(void); +extern void (* volatile cpustop_hook)(void); extern int smp_active; extern int smp_cpus; extern volatile cpumask_t started_cpus; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:07:19 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C01F106564A; Mon, 9 May 2011 07:07:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 441ED8FC15; Mon, 9 May 2011 07:07:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4977JKD080622; Mon, 9 May 2011 07:07:19 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4977JdK080620; Mon, 9 May 2011 07:07:19 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090707.p4977JdK080620@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221680 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:07:19 -0000 Author: avg Date: Mon May 9 07:07:18 2011 New Revision: 221680 URL: http://svn.freebsd.org/changeset/base/221680 Log: a style nit in panic() Modified: user/avg/xcpu/sys/kern/kern_shutdown.c Modified: user/avg/xcpu/sys/kern/kern_shutdown.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:06:34 2011 (r221679) +++ user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:07:18 2011 (r221680) @@ -556,7 +556,7 @@ panic(const char *fmt, ...) bootopt = RB_AUTOBOOT | RB_DUMP; newpanic = 0; - if (panicstr) + if (panicstr != NULL) bootopt |= RB_NOSYNC; else { panicstr = fmt; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:08:28 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E41BB106566C; Mon, 9 May 2011 07:08:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6D568FC1E; Mon, 9 May 2011 07:08:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4978S1Y080700; Mon, 9 May 2011 07:08:28 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4978SQq080698; Mon, 9 May 2011 07:08:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090708.p4978SQq080698@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:08:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221681 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:08:29 -0000 Author: avg Date: Mon May 9 07:08:28 2011 New Revision: 221681 URL: http://svn.freebsd.org/changeset/base/221681 Log: some whitespace nits Modified: user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:07:18 2011 (r221680) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:08:28 2011 (r221681) @@ -120,7 +120,7 @@ static volatile int smp_rv_waiters[3]; * Shared mutex to restrict busywaits between smp_rendezvous() and * smp(_targeted)_tlb_shootdown(). A deadlock occurs if both of these * functions trigger at once and cause multiple CPUs to busywait with - * interrupts disabled. + * interrupts disabled. */ struct mtx smp_ipi_mtx; @@ -281,7 +281,7 @@ suspend_cpus(cpumask_t map) #endif /* - * Called by a CPU to restart stopped CPUs. + * Called by a CPU to restart stopped CPUs. * * Usually (but not necessarily) called with 'stopped_cpus' as its arg. * @@ -389,7 +389,7 @@ unstop_cpus_hard(void) } /* - * All-CPU rendezvous. CPUs are signalled, all execute the setup function + * All-CPU rendezvous. CPUs are signalled, all execute the setup function * (if specified), rendezvous, execute the action function (if specified), * rendezvous again, execute the teardown function (if specified), and then * resume. From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:09:01 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A640D106564A; Mon, 9 May 2011 07:09:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 994D18FC1E; Mon, 9 May 2011 07:09:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49791Ga080757; Mon, 9 May 2011 07:09:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49791Li080755; Mon, 9 May 2011 07:09:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090709.p49791Li080755@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221682 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:09:01 -0000 Author: avg Date: Mon May 9 07:09:01 2011 New Revision: 221682 URL: http://svn.freebsd.org/changeset/base/221682 Log: some whitespace nits Modified: user/avg/xcpu/sys/kern/kern_shutdown.c Modified: user/avg/xcpu/sys/kern/kern_shutdown.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:08:28 2011 (r221681) +++ user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:09:01 2011 (r221682) @@ -311,7 +311,7 @@ kern_reboot(int howto) */ EVENTHANDLER_INVOKE(shutdown_pre_sync, howto); - /* + /* * Now sync filesystems */ if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { @@ -433,7 +433,7 @@ kern_reboot(int howto) */ EVENTHANDLER_INVOKE(shutdown_post_sync, howto); - if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) + if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) doadump(); /* Now that we're going to really halt the system... */ From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:09:51 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65521106564A; Mon, 9 May 2011 07:09:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 582078FC08; Mon, 9 May 2011 07:09:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4979pG4080821; Mon, 9 May 2011 07:09:51 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4979p6o080819; Mon, 9 May 2011 07:09:51 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090709.p4979p6o080819@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221683 - user/avg/xcpu/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:09:51 -0000 Author: avg Date: Mon May 9 07:09:51 2011 New Revision: 221683 URL: http://svn.freebsd.org/changeset/base/221683 Log: a whitespace nit Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:09:01 2011 (r221682) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:09:51 2011 (r221683) @@ -1411,7 +1411,7 @@ ipi_nmi_handler(void) cpuhardstop_handler(); return (0); } - + /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:10:27 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FA7A106566B; Mon, 9 May 2011 07:10:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 426D28FC0A; Mon, 9 May 2011 07:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497ARgN080888; Mon, 9 May 2011 07:10:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497ARNO080886; Mon, 9 May 2011 07:10:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090710.p497ARNO080886@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221684 - user/avg/xcpu/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:10:27 -0000 Author: avg Date: Mon May 9 07:10:26 2011 New Revision: 221684 URL: http://svn.freebsd.org/changeset/base/221684 Log: a whitespace nit Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:09:51 2011 (r221683) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:10:26 2011 (r221684) @@ -517,7 +517,7 @@ cpu_reset_proxy() cpu_reset_proxy_active = 1; while (cpu_reset_proxy_active == 1) ; /* Wait for other cpu to see that we've started */ - stop_cpus((1< Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B000E1065670; Mon, 9 May 2011 07:11:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887218FC12; Mon, 9 May 2011 07:11:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497B11Z080959; Mon, 9 May 2011 07:11:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497B1uW080957; Mon, 9 May 2011 07:11:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090711.p497B1uW080957@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221685 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:11:01 -0000 Author: avg Date: Mon May 9 07:11:01 2011 New Revision: 221685 URL: http://svn.freebsd.org/changeset/base/221685 Log: a style nit Modified: user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:10:26 2011 (r221684) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:11:01 2011 (r221685) @@ -309,7 +309,7 @@ restart_cpus(cpumask_t map) while ((stopped_cpus & map) != 0) cpu_spinwait(); - return 1; + return (1); } void From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:11:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5191D106566B; Mon, 9 May 2011 07:11:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4432F8FC08; Mon, 9 May 2011 07:11:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497Ba3H081016; Mon, 9 May 2011 07:11:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497BaMq081014; Mon, 9 May 2011 07:11:36 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090711.p497BaMq081014@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221686 - user/avg/xcpu/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:11:36 -0000 Author: avg Date: Mon May 9 07:11:35 2011 New Revision: 221686 URL: http://svn.freebsd.org/changeset/base/221686 Log: increase how long we wait for BSP to become active, amd64 only Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:11:01 2011 (r221685) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:11:35 2011 (r221686) @@ -548,7 +548,7 @@ cpu_reset() cpustop_hook = cpu_reset_proxy; cnt = 0; - while (cpu_reset_proxy_active == 0 && cnt < 10000000) + while (cpu_reset_proxy_active == 0 && cnt < 100000000) cnt++; /* Wait for BSP to announce restart */ if (cpu_reset_proxy_active == 0) printf("cpu_reset: Failed to restart BSP\n"); From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:13:09 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55312106566B; Mon, 9 May 2011 07:13:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F078FC18; Mon, 9 May 2011 07:13:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497D9IM081103; Mon, 9 May 2011 07:13:09 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497D9aH081101; Mon, 9 May 2011 07:13:09 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090713.p497D9aH081101@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221687 - user/avg/xcpu/sys/amd64/amd64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:13:09 -0000 Author: avg Date: Mon May 9 07:13:08 2011 New Revision: 221687 URL: http://svn.freebsd.org/changeset/base/221687 Log: do reset on current CPU if somehow BSP doesn't become active, amd64 only Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:11:35 2011 (r221686) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:13:08 2011 (r221687) @@ -550,8 +550,11 @@ cpu_reset() cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 100000000) cnt++; /* Wait for BSP to announce restart */ - if (cpu_reset_proxy_active == 0) + if (cpu_reset_proxy_active == 0) { printf("cpu_reset: Failed to restart BSP\n"); + cpu_reset_real(); + } + enable_intr(); cpu_reset_proxy_active = 2; From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:14:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB2C2106564A; Mon, 9 May 2011 07:14:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCDF28FC13; Mon, 9 May 2011 07:14:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497EGYv081177; Mon, 9 May 2011 07:14:16 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497EGg0081173; Mon, 9 May 2011 07:14:16 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090714.p497EGg0081173@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221688 - in user/avg/xcpu/sys: amd64/amd64 kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:14:16 -0000 Author: avg Date: Mon May 9 07:14:16 2011 New Revision: 221688 URL: http://svn.freebsd.org/changeset/base/221688 Log: re-implement smp rendezvous code - create one rendezvous (outgoing) mailbox per each cpu where a cpu would place its rendezvous request directed to other cpus - create a cpu mask for each cpu where other cpus can set a bit to indicate that they send a rendezvous request to the cpu in question - send an ipi only for a first rv request, piggyback subsequent requests if a target cpu is still processing previous incoming requests - many-to-many rv requests can be sent now, there is no locking, the only limitation is that a cpu can have only a single outgoing request at a time - to avoid deadlocks, when a cpu waits for its requested to be completed by target cpus, it also checks for and processes incoming requests - to avoid deadlock with cpu stopping logic, cpus also check for stop requests while waiting - there can be only one cpu asking other cpus to stop; this is implemented via a handrolled spin mutex analogue; similar to the above, to avoid deadlocks a cpu spinning for this lock also checks for an incoming stop request - implement tlb shootdowns via smp rendezvous mechanism, no special ipis are needed now, amd64 only (see if the code can be further simplified) - thus the smp_ipi_mtx is not needed any longer Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c user/avg/xcpu/sys/kern/kern_shutdown.c user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:13:08 2011 (r221687) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:14:16 2011 (r221688) @@ -1087,67 +1087,66 @@ SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_ &ipi_masked_range_size, 0, ""); #endif /* COUNT_XINVLTLB_HITS */ -/* - * Flush the TLB on all other CPU's - */ +struct tlb_shootdown_params { + u_int type; + vm_offset_t addr1; + vm_offset_t addr2; +}; + static void -smp_tlb_shootdown(u_int vector, vm_offset_t addr1, vm_offset_t addr2) +tlb_shootdown_action(void *arg) { - u_int ncpu; + struct tlb_shootdown_params *params; + vm_offset_t addr; - ncpu = mp_ncpus - 1; /* does not shootdown self */ - if (ncpu < 1) - return; /* no other cpus */ - if (!(read_rflags() & PSL_I)) - panic("%s: interrupts disabled", __func__); - mtx_lock_spin(&smp_ipi_mtx); - smp_tlb_addr1 = addr1; - smp_tlb_addr2 = addr2; - atomic_store_rel_int(&smp_tlb_wait, 0); - ipi_all_but_self(vector); - while (smp_tlb_wait < ncpu) - ia32_pause(); - mtx_unlock_spin(&smp_ipi_mtx); + params = (struct tlb_shootdown_params *)arg; + switch (params->type) { + case IPI_INVLCACHE: + wbinvd(); + break; + case IPI_INVLTLB: + invltlb(); + break; + case IPI_INVLPG: + invlpg(params->addr1); + break; + case IPI_INVLRNG: + for (addr = params->addr1; addr < params->addr2; + addr += PAGE_SIZE) + invlpg(addr); + break; + default: + panic("Unknown TLB shootdown type %u", params->type); + } } static void -smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, + vm_offset_t addr1, vm_offset_t addr2) { - int ncpu, othercpus; + struct tlb_shootdown_params params; - othercpus = mp_ncpus - 1; - if (mask == (cpumask_t)-1) { - ncpu = othercpus; - if (ncpu < 1) - return; - } else { - mask &= ~PCPU_GET(cpumask); - if (mask == 0) - return; - ncpu = bitcount32(mask); - if (ncpu > othercpus) { - /* XXX this should be a panic offence */ - printf("SMP: tlb shootdown to %d other cpus (only have %d)\n", - ncpu, othercpus); - ncpu = othercpus; - } - /* XXX should be a panic, implied by mask == 0 above */ - if (ncpu < 1) - return; - } +#if 0 if (!(read_rflags() & PSL_I)) panic("%s: interrupts disabled", __func__); - mtx_lock_spin(&smp_ipi_mtx); - smp_tlb_addr1 = addr1; - smp_tlb_addr2 = addr2; - atomic_store_rel_int(&smp_tlb_wait, 0); - if (mask == (cpumask_t)-1) - ipi_all_but_self(vector); - else - ipi_selected(mask, vector); - while (smp_tlb_wait < ncpu) - ia32_pause(); - mtx_unlock_spin(&smp_ipi_mtx); +#endif + params.type = vector; + params.addr1 = addr1; + params.addr2 = addr2; + smp_rendezvous_cpus(mask & all_cpus & ~(1 << curcpu), + smp_no_rendevous_barrier, tlb_shootdown_action, + smp_no_rendevous_barrier, ¶ms); +} + +/* + * Flush the TLB on all other CPU's + */ +static void +smp_tlb_shootdown(u_int vector, vm_offset_t addr1, vm_offset_t addr2) +{ + + smp_targeted_tlb_shootdown(all_cpus & ~(1 << curcpu), + vector, addr1, addr2); } /* Modified: user/avg/xcpu/sys/kern/kern_shutdown.c ============================================================================== --- user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:13:08 2011 (r221687) +++ user/avg/xcpu/sys/kern/kern_shutdown.c Mon May 9 07:14:16 2011 (r221688) @@ -509,26 +509,9 @@ shutdown_reset(void *junk, int howto) printf("Rebooting...\n"); DELAY(1000000); /* wait 1 sec for printf's to complete and be read */ - /* - * Acquiring smp_ipi_mtx here has a double effect: - * - it disables interrupts avoiding CPU0 preemption - * by fast handlers (thus deadlocking against other CPUs) - * - it avoids deadlocks against smp_rendezvous() or, more - * generally, threads busy-waiting, with this spinlock held, - * and waiting for responses by threads on other CPUs - * (ie. smp_tlb_shootdown()). - * - * For the !SMP case it just needs to handle the former problem. - */ -#ifdef SMP - mtx_lock_spin(&smp_ipi_mtx); -#else spinlock_enter(); -#endif - - /* cpu_boot(howto); */ /* doesn't do anything at the moment */ cpu_reset(); - /* NOTREACHED */ /* assuming reset worked */ + /* NOTREACHED */ } /* Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:13:08 2011 (r221687) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:14:16 2011 (r221688) @@ -101,6 +101,10 @@ SYSCTL_INT(_kern_smp, OID_AUTO, topology "Topology override setting; 0 is default provided by hardware."); TUNABLE_INT("kern.smp.topology", &smp_topology); +unsigned int coalesced_ipi_count; +SYSCTL_INT(_kern_smp, OID_AUTO, coalesced_ipi_count, CTLFLAG_RD, + &coalesced_ipi_count, 0, "Count of coalesced SMP rendezvous IPIs"); + #ifdef SMP /* Enable forwarding of a signal to a process running on a different CPU */ static int forward_signal_enabled = 1; @@ -109,14 +113,20 @@ SYSCTL_INT(_kern_smp, OID_AUTO, forward_ "Forwarding of a signal to a process on a different CPU"); /* Variables needed for SMP rendezvous. */ -static volatile int smp_rv_ncpus; -static void (*volatile smp_rv_setup_func)(void *arg); -static void (*volatile smp_rv_action_func)(void *arg); -static void (*volatile smp_rv_teardown_func)(void *arg); -static void *volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; +struct smp_rendezvous_data { + void (*smp_rv_setup_func)(void *arg); + void (*smp_rv_action_func)(void *arg); + void (*smp_rv_teardown_func)(void *arg); + void *smp_rv_func_arg; + volatile int smp_rv_waiters[2]; + int smp_rv_ncpus; +}; + +static DPCPU_DEFINE(struct smp_rendezvous_data, smp_rv_data); +static volatile DPCPU_DEFINE(cpumask_t, smp_rv_senders); +static volatile DPCPU_DEFINE(cpumask_t, smp_rv_count); -/* +/* * Shared mutex to restrict busywaits between smp_rendezvous() and * smp(_targeted)_tlb_shootdown(). A deadlock occurs if both of these * functions trigger at once and cause multiple CPUs to busywait with @@ -397,39 +407,44 @@ unstop_cpus_hard(void) * Note that the supplied external functions _must_ be reentrant and aware * that they are running in parallel and in an unknown lock context. */ -void -smp_rendezvous_action(void) +static void +smp_rendezvous_action_body(int cpu) { - void* local_func_arg = smp_rv_func_arg; - void (*local_setup_func)(void*) = smp_rv_setup_func; - void (*local_action_func)(void*) = smp_rv_action_func; - void (*local_teardown_func)(void*) = smp_rv_teardown_func; - - /* Ensure we have up-to-date values. */ - atomic_add_acq_int(&smp_rv_waiters[0], 1); - while (smp_rv_waiters[0] < smp_rv_ncpus) - cpu_spinwait(); + volatile struct smp_rendezvous_data *rv; + void *local_func_arg; + void (*local_setup_func)(void*); + void (*local_action_func)(void*); + void (*local_teardown_func)(void*); + int ncpus; + + rv = DPCPU_ID_PTR(cpu, smp_rv_data); + local_func_arg = rv->smp_rv_func_arg; + local_setup_func = rv->smp_rv_setup_func; + local_action_func = rv->smp_rv_action_func; + local_teardown_func = rv->smp_rv_teardown_func; + ncpus = rv->smp_rv_ncpus; /* setup function */ if (local_setup_func != smp_no_rendevous_barrier) { - if (smp_rv_setup_func != NULL) - smp_rv_setup_func(smp_rv_func_arg); + if (local_setup_func != NULL) + local_setup_func(local_func_arg); /* spin on entry rendezvous */ - atomic_add_int(&smp_rv_waiters[1], 1); - while (smp_rv_waiters[1] < smp_rv_ncpus) - cpu_spinwait(); + atomic_add_int(&rv->smp_rv_waiters[0], 1); + while (rv->smp_rv_waiters[0] < ncpus) + cpu_spinwait(); } /* action function */ if (local_action_func != NULL) local_action_func(local_func_arg); - /* spin on exit rendezvous */ - atomic_add_int(&smp_rv_waiters[2], 1); + atomic_add_int(&rv->smp_rv_waiters[1], 1); if (local_teardown_func == smp_no_rendevous_barrier) return; - while (smp_rv_waiters[2] < smp_rv_ncpus) + + /* spin on exit rendezvous */ + while (rv->smp_rv_waiters[1] < ncpus) cpu_spinwait(); /* teardown function */ @@ -438,13 +453,95 @@ smp_rendezvous_action(void) } void +smp_rendezvous_action(void) +{ + cpumask_t mask; + int pending; + int count; + int cpu; + + pending = DPCPU_GET(smp_rv_count); + while (pending != 0) { + KASSERT(pending > 0, ("negative pending rendezvous count")); + mask = DPCPU_GET(smp_rv_senders); + if (mask == 0) { + cpu_spinwait(); + continue; + } + + atomic_clear_acq_int(DPCPU_PTR(smp_rv_senders), mask); + count = 0; + do { + count++; + cpu = ffs(mask) - 1; + mask &= ~(1 << cpu); + smp_rendezvous_action_body(cpu); + } while (mask != 0); + + pending = atomic_fetchadd_int(DPCPU_PTR(smp_rv_count), -count); + pending -= count; + } +} + +static void +smp_rendezvous_wait(void) +{ + volatile struct smp_rendezvous_data *rv; + int ncpus; + + rv = DPCPU_PTR(smp_rv_data); + ncpus = rv->smp_rv_ncpus; + + while (atomic_load_acq_int(&rv->smp_rv_waiters[1]) < ncpus) { + /* check for incoming events */ + if ((stopping_cpus & (1 << curcpu)) != 0) + cpustop_handler(); + else if (DPCPU_GET(smp_rv_senders) != 0) + smp_rendezvous_action(); + else + cpu_spinwait(); + } +} + +/* + * Execute the action_func on the targeted CPUs. + * + * setup_func: + * - if a function pointer is given, then first execute the function; + * only after the function is executed on all targeted can they proceed + * to the next step; + * - if NULL is given, this is equivalent to specifying a pointer to an + * empty function; as such there is no actual setup function, but all + * targeted CPUs proceed to the next step at about the same time; + * - smp_no_rendevous_barrier is a special value that signifies that there + * is no setup function nor the targeted CPUs should wait for anything + * before proceeding to the next step. + * + * action_func: + * - a function to be executed on the targeted CPUs; + * NULL is equivalent to specifying a pointer to an empty function. + * + * teardown_func: + * - if a function pointer is given, then first wait for all targeted CPUs + * to complete execution of action_func, then execute this function; + * - if NULL is given, this is equivalent to specifying a pointer to an + * empty function; as such there is no actual teardown action, but all + * targeted CPUs wait for each other to complete execution of action_func; + * - smp_no_rendevous_barrier is a special value that signifies that there + * is no teardown function nor the targeted CPUs should wait for anything + * after completing action_func. + */ +void smp_rendezvous_cpus(cpumask_t map, void (* setup_func)(void *), void (* action_func)(void *), void (* teardown_func)(void *), void *arg) { - int i, ncpus = 0; + volatile struct smp_rendezvous_data *rv; + cpumask_t tmp; + int ncpus; + int cpu; if (!smp_started) { if (setup_func != NULL) @@ -456,39 +553,66 @@ smp_rendezvous_cpus(cpumask_t map, return; } - CPU_FOREACH(i) { - if (((1 << i) & map) != 0) - ncpus++; + map &= all_cpus; + tmp = map; + ncpus = 0; + while (tmp != 0) { + cpu = ffs(tmp) - 1; + tmp &= ~(1 << cpu); + ncpus++; } - if (ncpus == 0) - panic("ncpus is 0 with map=0x%x", map); - /* obtain rendezvous lock */ - mtx_lock_spin(&smp_ipi_mtx); + spinlock_enter(); + + /* + * First wait for an event previously posted by us to complete (if any), + * this is done in case the event was asynchronous. + * In the future we could have a queue of outgoing events instead + * of a single item. + */ + smp_rendezvous_wait(); /* set static function pointers */ - smp_rv_ncpus = ncpus; - smp_rv_setup_func = setup_func; - smp_rv_action_func = action_func; - smp_rv_teardown_func = teardown_func; - smp_rv_func_arg = arg; - smp_rv_waiters[1] = 0; - smp_rv_waiters[2] = 0; - atomic_store_rel_int(&smp_rv_waiters[0], 0); + rv = DPCPU_PTR(smp_rv_data); + rv->smp_rv_ncpus = ncpus; + rv->smp_rv_setup_func = setup_func; + rv->smp_rv_action_func = action_func; + rv->smp_rv_teardown_func = teardown_func; + rv->smp_rv_func_arg = arg; + rv->smp_rv_waiters[1] = 0; + atomic_store_rel_int(&rv->smp_rv_waiters[0], 0); + + /* signal other CPUs, which will enter the IPI with interrupts off */ + tmp = map; + while (tmp != 0) { + cpu = ffs(tmp) - 1; + tmp &= ~(1 << cpu); + + if (cpu == curcpu) + continue; + + KASSERT( + (DPCPU_ID_GET(cpu, smp_rv_senders) & (1 << curcpu)) == 0, + ("curcpu bit is set in target cpu's senders map")); + + /* if we are the first to send an event, then send an ipi */ + if (atomic_fetchadd_int(DPCPU_ID_PTR(cpu, smp_rv_count), 1) + == 0) + ipi_cpu(cpu, IPI_RENDEZVOUS); + else + coalesced_ipi_count++; - /* signal other processors, which will enter the IPI with interrupts off */ - ipi_selected(map & ~(1 << curcpu), IPI_RENDEZVOUS); + atomic_set_rel_int(DPCPU_ID_PTR(cpu, smp_rv_senders), + 1 << curcpu); + } /* Check if the current CPU is in the map */ if ((map & (1 << curcpu)) != 0) - smp_rendezvous_action(); - + smp_rendezvous_action_body(curcpu); if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + smp_rendezvous_wait(); - /* release lock */ - mtx_unlock_spin(&smp_ipi_mtx); + spinlock_exit(); } void From owner-svn-src-user@FreeBSD.ORG Mon May 9 07:15:15 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88B601065670; Mon, 9 May 2011 07:15:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B5BD8FC18; Mon, 9 May 2011 07:15:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p497FFUW081254; Mon, 9 May 2011 07:15:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p497FFJm081252; Mon, 9 May 2011 07:15:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105090715.p497FFJm081252@svn.freebsd.org> From: Andriy Gapon Date: Mon, 9 May 2011 07:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221689 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 07:15:15 -0000 Author: avg Date: Mon May 9 07:15:15 2011 New Revision: 221689 URL: http://svn.freebsd.org/changeset/base/221689 Log: some whitespace nits Modified: user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:14:16 2011 (r221688) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:15:15 2011 (r221689) @@ -533,7 +533,7 @@ smp_rendezvous_wait(void) */ void smp_rendezvous_cpus(cpumask_t map, - void (* setup_func)(void *), + void (* setup_func)(void *), void (* action_func)(void *), void (* teardown_func)(void *), void *arg) @@ -616,12 +616,13 @@ smp_rendezvous_cpus(cpumask_t map, } void -smp_rendezvous(void (* setup_func)(void *), +smp_rendezvous(void (* setup_func)(void *), void (* action_func)(void *), void (* teardown_func)(void *), void *arg) { - smp_rendezvous_cpus(all_cpus, setup_func, action_func, teardown_func, arg); + smp_rendezvous_cpus(all_cpus, setup_func, action_func, + teardown_func, arg); } static struct cpu_group group[MAXCPU]; From owner-svn-src-user@FreeBSD.ORG Mon May 9 19:40:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D046C1065675; Mon, 9 May 2011 19:40:36 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B690D8FC15; Mon, 9 May 2011 19:40:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49Jeav4010425; Mon, 9 May 2011 19:40:36 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49JeawY010423; Mon, 9 May 2011 19:40:36 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201105091940.p49JeawY010423@svn.freebsd.org> From: Doug Barton Date: Mon, 9 May 2011 19:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221711 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 19:40:36 -0000 Author: dougb Date: Mon May 9 19:40:36 2011 New Revision: 221711 URL: http://svn.freebsd.org/changeset/base/221711 Log: In shuffling around the updating of +REQUIRED_BY I forgot to delete empty grep_deps files. [1] While I'm looking at unlink'ing files, bring some sanity to the various places that it's done which haven't been reviewed in a while. * Fix the pm_unlink* functions to use the builtin test * Only/always call the function when we're not sure if the file exists * Just use /bin/unlink when we're sure it does Submitted by: olgeni [1] Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Mon May 9 18:53:13 2011 (r221710) +++ user/dougb/portmaster/portmaster Mon May 9 19:40:36 2011 (r221711) @@ -145,7 +145,7 @@ parent_exit () { pm_rmdir_s $pbu fi - for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do pm_unlink $f ; done + for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do /bin/unlink $f ; done [ -n "$PM_WRKDIRPREFIX" ] && find -d $PM_WRKDIRPREFIX -mindepth 1 -type d -empty -delete 2>/dev/null @@ -278,7 +278,7 @@ pm_make () { ( unset -v CUR_DEPS INSTA pm_make_b () { /usr/bin/make $PM_MAKE_ARGS BEFOREPORTMK=bpm $*; } pm_mktemp () { /usr/bin/mktemp -t f-${PM_PARENT_PID}-$1 || fail "mktemp for $1 failed"; } -pm_unlink () { /bin/test -e $1 && /bin/unlink $1; } +pm_unlink () { [ -e "$1" ] && /bin/unlink $1; } # Superuser versions for commands that need root privileges @@ -291,7 +291,7 @@ pm_mkdir_s () { $PM_SU_CMD /bin/m pm_pkg_delete_s () { $PM_SU_CMD /usr/sbin/pkg_delete $*; } pm_rm_s () { $PM_SU_CMD /bin/rm $*; } pm_rmdir_s () { $PM_SU_CMD /bin/rmdir $*; } -pm_unlink_s () { /bin/test -e $1 && $PM_SU_CMD /bin/unlink $1; } +pm_unlink_s () { [ -e "$1" ] && $PM_SU_CMD /bin/unlink $1; } pm_v () { [ -n "$PM_VERBOSE" ] && echo "$*"; } pm_sv () { [ -n "$PM_SU_VERBOSE" ] && echo "===>>> SU $*"; } @@ -913,6 +913,7 @@ check_dependency_files () { check_regular_file $pdb/$iport/+REQUIRED_BY $PM_SU_CMD truncate -s0 $pdb/$iport/+REQUIRED_BY fi + /bin/unlink $grep_deps fi } @@ -1044,7 +1045,7 @@ IFS=' done [ -n "$prev_line" ] && echo $prev_line >> $new_cont - cmp -s $contents $new_cont && { pm_unlink $new_cont ; return; } + cmp -s $contents $new_cont && { /bin/unlink $new_cont ; return; } check_regular_file $contents pm_v " ===>>> Installing the new +CONTENTS file" @@ -1142,9 +1143,9 @@ read_distinfos () { done # Tell safe_exit that we are done - [ -e "${DI_FILES}-e" ] && unlink ${DI_FILES}-e + pm_unlink ${DI_FILES}-e sed -i -e 1s/############/%%%%%%%%%%%%/ $DI_FILES - [ -e "${DI_FILES}-e" ] && unlink ${DI_FILES}-e + pm_unlink ${DI_FILES}-e } read_distinfos_all () { @@ -1179,9 +1180,9 @@ read_distinfos_all () { done # Tell safe_exit that we are done - [ -e "${DI_FILES}-e" ] && unlink ${DI_FILES}-e + pm_unlink ${DI_FILES}-e sed -i -e 1s/############/%%%%%%%%%%%%/ $DI_FILES - [ -e "${DI_FILES}-e" ] && unlink ${DI_FILES}-e + pm_unlink ${DI_FILES}-e } ports_by_category () { @@ -1266,7 +1267,7 @@ update_required_by () { pm_install_s $grep_deps $pdb/$1/+REQUIRED_BY fi - pm_unlink $grep_deps && unset grep_deps + /bin/unlink $grep_deps && unset grep_deps } #=============== End functions relevant to --features and main =============== @@ -1291,7 +1292,7 @@ if [ -n "$CLEAN_DISTFILES" ]; then get_answer_yn n " ===>>> Delete stale file: ${f}" case "$?" in 0) echo " Deleting $f" ; echo '' - pm_unlink $df ;; + /bin/unlink $df ;; *) continue ;; esac fi @@ -1919,7 +1920,7 @@ delete_all_distfiles () { [yY]) for f in $dist_list_files; do if [ -f "${DISTDIR}${f}" ]; then echo " Deleting ${DISTDIR}${f}" - pm_unlink ${DISTDIR}${f} + /bin/unlink ${DISTDIR}${f} fi done ;; esac @@ -3635,7 +3636,7 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" $PM_SU_CMD /etc/rc.d/ldconfig start > /dev/null fi - pm_unlink $ldconfig_out ; unset ldconfig_out temp file + /bin/unlink $ldconfig_out ; unset ldconfig_out temp file fi find_dl_distfiles $portdir @@ -3783,7 +3784,7 @@ if [ -n "$distfiles" ]; then pm_sv Installing $dist_list pm_install_s $dist_list_temp $dist_list - pm_unlink $dist_list_temp ; unset ds dist_list_temp + /bin/unlink $dist_list_temp ; unset ds dist_list_temp fi if [ -n "$use_package" ]; then From owner-svn-src-user@FreeBSD.ORG Tue May 10 01:31:42 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A46C106564A; Tue, 10 May 2011 01:31:42 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id F06738FC0C; Tue, 10 May 2011 01:31:41 +0000 (UTC) Received: from dhcp-192-168-2-44.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6]) (authenticated bits=0) by mail.xcllnt.net (8.14.4/8.14.4) with ESMTP id p4A1LALE055420 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 9 May 2011 18:21:14 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <201105090705.p49756Ff080416@svn.freebsd.org> Date: Mon, 9 May 2011 18:21:09 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <201105090705.p49756Ff080416@svn.freebsd.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1084) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r221677 - in user/avg/xcpu/sys: amd64/amd64 kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 01:31:42 -0000 On May 9, 2011, at 12:05 AM, Andriy Gapon wrote: > Author: avg > Date: Mon May 9 07:05:06 2011 > New Revision: 221677 > URL: http://svn.freebsd.org/changeset/base/221677 > > Log: > re-implement hard stopping of CPUs and use it enforce panic(9) context While you're here... I'd like to change the whole logic and turn it into a rendezvous. One CPU, the one panicing can proceed. But I'd like to add the ability from the debugger to switch onto a different CPU. Such makes it possible to implement commands that show control and status registers, perform function calls on specific CPUs, as well as dump on-chip TLB entries and cache line contents if the CPU/platform supports it. Thoughts? -- Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-user@FreeBSD.ORG Tue May 10 07:12:12 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB389106566C; Tue, 10 May 2011 07:12:11 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCEEA8FC16; Tue, 10 May 2011 07:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4A7CBsl031517; Tue, 10 May 2011 07:12:11 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4A7CBFI031515; Tue, 10 May 2011 07:12:11 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201105100712.p4A7CBFI031515@svn.freebsd.org> From: Doug Barton Date: Tue, 10 May 2011 07:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221725 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 07:12:12 -0000 Author: dougb Date: Tue May 10 07:12:11 2011 New Revision: 221725 URL: http://svn.freebsd.org/changeset/base/221725 Log: Small refinement for unlink'ing, in parent_exit the glob pattern in the for loop will return 'pattern-*' if there are no matches, so test for that specifically rather than returning to the conditional version. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue May 10 05:33:37 2011 (r221724) +++ user/dougb/portmaster/portmaster Tue May 10 07:12:11 2011 (r221725) @@ -145,7 +145,10 @@ parent_exit () { pm_rmdir_s $pbu fi - for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do /bin/unlink $f ; done + for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do + case "$f" in */f-${PM_PARENT_PID}-\*) continue ;; esac + /bin/unlink $f + done [ -n "$PM_WRKDIRPREFIX" ] && find -d $PM_WRKDIRPREFIX -mindepth 1 -type d -empty -delete 2>/dev/null From owner-svn-src-user@FreeBSD.ORG Tue May 10 12:11:30 2011 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91B931065670 for ; Tue, 10 May 2011 12:11:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D802B8FC1B for ; Tue, 10 May 2011 12:11:29 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id OAA13215; Tue, 10 May 2011 14:56:50 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4DC92802.6040906@FreeBSD.org> Date: Tue, 10 May 2011 14:56:50 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110504 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Marcel Moolenaar References: <201105090705.p49756Ff080416@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r221677 - in user/avg/xcpu/sys: amd64/amd64 kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 12:11:30 -0000 on 10/05/2011 04:21 Marcel Moolenaar said the following: > > On May 9, 2011, at 12:05 AM, Andriy Gapon wrote: > >> Author: avg >> Date: Mon May 9 07:05:06 2011 >> New Revision: 221677 >> URL: http://svn.freebsd.org/changeset/base/221677 >> >> Log: >> re-implement hard stopping of CPUs and use it enforce panic(9) context > > While you're here... > > I'd like to change the whole logic and turn it into a > rendezvous. One CPU, the one panicing can proceed. But > I'd like to add the ability from the debugger to switch > onto a different CPU. Such makes it possible to implement > commands that show control and status registers, perform > function calls on specific CPUs, as well as dump on-chip > TLB entries and cache line contents if the CPU/platform > supports it. > > Thoughts? I think that this is implemented in (Open)Solaris and it's quite a simple implementation. Slave CPUs just spin in a stop loop checking for commands from a master CPU. This could be called a form of a rendezvous, but I'd prefer to not mix these concepts (i.e. hardstop/kdb case with normal rendezvous mechanism). In fact, we already have this approach implemented in the simplest, most trivial form - currently supported commands are: (1) restart (exit the spin loop); (2) reset system (effective only on BSP). The commands are all broadcast at the moment. We could add other meaningful commands (e.g. become a new master) quite easily IMO and make the commands targeted (i.e. add an ability to specify a subset of CPUs that should execute a command). -- Andriy Gapon From owner-svn-src-user@FreeBSD.ORG Tue May 10 14:21:45 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10EF91065672; Tue, 10 May 2011 14:21:45 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB6308FC08; Tue, 10 May 2011 14:21:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4AELiLU047805; Tue, 10 May 2011 14:21:44 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4AELiiq047804; Tue, 10 May 2011 14:21:44 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201105101421.p4AELiiq047804@svn.freebsd.org> From: Takahashi Yoshihiro Date: Tue, 10 May 2011 14:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221739 - user/nyan/pc98 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 14:21:45 -0000 Author: nyan Date: Tue May 10 14:21:44 2011 New Revision: 221739 URL: http://svn.freebsd.org/changeset/base/221739 Log: Remove my repo. Deleted: user/nyan/pc98/ From owner-svn-src-user@FreeBSD.ORG Wed May 11 00:46:22 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807B61065670; Wed, 11 May 2011 00:46:22 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56A1F8FC0A; Wed, 11 May 2011 00:46:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B0kMnZ066659; Wed, 11 May 2011 00:46:22 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B0kMP9066656; Wed, 11 May 2011 00:46:22 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201105110046.p4B0kMP9066656@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 11 May 2011 00:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221751 - in user/gabor/tre-integration: contrib/tre/lib include X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 00:46:22 -0000 Author: gabor Date: Wed May 11 00:46:22 2011 New Revision: 221751 URL: http://svn.freebsd.org/changeset/base/221751 Log: - Implement the BSD-specific REG_STARTEND flag for regexec() Modified: user/gabor/tre-integration/contrib/tre/lib/regexec.c user/gabor/tre-integration/include/tre.h Modified: user/gabor/tre-integration/contrib/tre/lib/regexec.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regexec.c Tue May 10 21:18:45 2011 (r221750) +++ user/gabor/tre-integration/contrib/tre/lib/regexec.c Wed May 11 00:46:22 2011 (r221751) @@ -27,6 +27,7 @@ char *alloca (); #endif #endif /* TRE_USE_ALLOCA */ +#include #include #include #include @@ -206,7 +207,28 @@ tre_regnexec(const regex_t *preg, const tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD; tre_str_type_t type = (TRE_MB_CUR_MAX == 1) ? STR_BYTE : STR_MBS; - return tre_match(tnfa, str, len, type, nmatch, pmatch, eflags); + if (eflags & REG_STARTEND) + { + off_t s_off = pmatch[0].rm_so; + off_t e_off = pmatch[0].rm_eo; + size_t slen = e_off - s_off; + char *sstr = xmalloc(slen); + strncpy(sstr, &str[s_off], slen); + int ret = tre_match(tnfa, sstr, slen, type, nmatch, pmatch, eflags); + if (!(eflags & REG_NOSUB)) + { + for (unsigned i = 0; i < nmatch; i++) + { + pmatch[i].rm_so += slen; + pmatch[i].rm_eo += slen; + } + } + return ret; + } + else + { + return tre_match(tnfa, str, len, type, nmatch, pmatch, eflags); + } } int Modified: user/gabor/tre-integration/include/tre.h ============================================================================== --- user/gabor/tre-integration/include/tre.h Tue May 10 21:18:45 2011 (r221750) +++ user/gabor/tre-integration/include/tre.h Wed May 11 00:46:22 2011 (r221751) @@ -64,6 +64,7 @@ typedef enum { /* POSIX tre_regexec() flags. */ #define REG_NOTBOL 1 #define REG_NOTEOL (REG_NOTBOL << 1) +#define REG_STARTEND (REG_NOTEOL << 1) /* Extra tre_regexec() flags. */ #define REG_APPROX_MATCHER (REG_NOTEOL << 1) From owner-svn-src-user@FreeBSD.ORG Wed May 11 00:47:25 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9835F106566B; Wed, 11 May 2011 00:47:25 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 366E28FC0A; Wed, 11 May 2011 00:47:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B0lP4T066725; Wed, 11 May 2011 00:47:25 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B0lPlo066722; Wed, 11 May 2011 00:47:25 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201105110047.p4B0lPlo066722@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 11 May 2011 00:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221752 - in user/gabor/tre-integration/lib/libc/regex: . grot X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 00:47:25 -0000 Author: gabor Date: Wed May 11 00:47:24 2011 New Revision: 221752 URL: http://svn.freebsd.org/changeset/base/221752 Log: - Remove old regex code and build TRE instead Deleted: user/gabor/tre-integration/lib/libc/regex/COPYRIGHT user/gabor/tre-integration/lib/libc/regex/WHATSNEW user/gabor/tre-integration/lib/libc/regex/cname.h user/gabor/tre-integration/lib/libc/regex/engine.c user/gabor/tre-integration/lib/libc/regex/grot/ user/gabor/tre-integration/lib/libc/regex/regcomp.c user/gabor/tre-integration/lib/libc/regex/regerror.c user/gabor/tre-integration/lib/libc/regex/regex2.h user/gabor/tre-integration/lib/libc/regex/regexec.c user/gabor/tre-integration/lib/libc/regex/regfree.c user/gabor/tre-integration/lib/libc/regex/utils.h Modified: user/gabor/tre-integration/lib/libc/regex/Makefile.inc user/gabor/tre-integration/lib/libc/regex/Symbol.map Modified: user/gabor/tre-integration/lib/libc/regex/Makefile.inc ============================================================================== --- user/gabor/tre-integration/lib/libc/regex/Makefile.inc Wed May 11 00:46:22 2011 (r221751) +++ user/gabor/tre-integration/lib/libc/regex/Makefile.inc Wed May 11 00:47:24 2011 (r221752) @@ -1,17 +1,17 @@ # from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -# regex sources -.PATH: ${.CURDIR}/regex +.PATH: ${.CURDIR}/../../contrib/tre/lib ${.CURDIR}/regex -CFLAGS+=-DPOSIX_MISTAKE +CFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR}/../../contrib/tre -SRCS+= regcomp.c regerror.c regexec.c regfree.c +SRCS+= regcomp.c regerror.c regexec.c tre-ast.c tre-compile.c \ + tre-match-approx.c tre-match-backtrack.c tre-match-parallel.c \ + tre-mem.c tre-parse.c tre-stack.c xmalloc.c -SYM_MAPS+=${.CURDIR}/regex/Symbol.map +MAN+= regex.3 re_format.7 -MAN+= regex.3 -MAN+= re_format.7 +MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 \ + regexec.3 regfree.3 -MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 -MLINKS+=regexec.3 regfree.3 +SYM_MAPS+=${.CURDIR}/regex/Symbol.map Modified: user/gabor/tre-integration/lib/libc/regex/Symbol.map ============================================================================== --- user/gabor/tre-integration/lib/libc/regex/Symbol.map Wed May 11 00:46:22 2011 (r221751) +++ user/gabor/tre-integration/lib/libc/regex/Symbol.map Wed May 11 00:47:24 2011 (r221752) @@ -3,8 +3,20 @@ */ FBSD_1.0 { - regcomp; - regerror; - regexec; - regfree; + tre_regacomp; + tre_regaexec; + tre_regancomp; + tre_reganexec; + tre_regawncomp; + tre_regawnexec; + tre_regcomp; + tre_regerror; + tre_regexec; + tre_regfree; + tre_regncomp; + tre_regnexec; + tre_regwcomp; + tre_regwexec; + tre_regwncomp; + tre_regwnexec; }; From owner-svn-src-user@FreeBSD.ORG Thu May 12 02:21:51 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B47B1065675; Thu, 12 May 2011 02:21:51 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2166B8FC12; Thu, 12 May 2011 02:21:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C2LpAi015855; Thu, 12 May 2011 02:21:51 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C2Lpr4015854; Thu, 12 May 2011 02:21:51 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201105120221.p4C2Lpr4015854@svn.freebsd.org> From: Brooks Davis Date: Thu, 12 May 2011 02:21:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221798 - user/brooks X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 02:21:51 -0000 Author: brooks Date: Thu May 12 02:21:50 2011 New Revision: 221798 URL: http://svn.freebsd.org/changeset/base/221798 Log: make a work directory Added: user/brooks/ From owner-svn-src-user@FreeBSD.ORG Thu May 12 02:23:07 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C7D01065672; Thu, 12 May 2011 02:23:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 328458FC15; Thu, 12 May 2011 02:23:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C2N7RV015946; Thu, 12 May 2011 02:23:07 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C2N74q015945; Thu, 12 May 2011 02:23:07 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201105120223.p4C2N74q015945@svn.freebsd.org> From: Brooks Davis Date: Thu, 12 May 2011 02:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221799 - user/brooks/openssh-hpn X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 02:23:07 -0000 Author: brooks Date: Thu May 12 02:23:06 2011 New Revision: 221799 URL: http://svn.freebsd.org/changeset/base/221799 Log: copy the vendor import of openssh 5.8p2 to start an HPN branch Added: user/brooks/openssh-hpn/ - copied from r221798, vendor-crypto/openssh/dist/ From owner-svn-src-user@FreeBSD.ORG Thu May 12 03:37:04 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F835106566C; Thu, 12 May 2011 03:37:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FD7F8FC18; Thu, 12 May 2011 03:37:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C3b4vg018468; Thu, 12 May 2011 03:37:04 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C3b3U1018449; Thu, 12 May 2011 03:37:03 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201105120337.p4C3b3U1018449@svn.freebsd.org> From: Brooks Davis Date: Thu, 12 May 2011 03:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221802 - user/brooks/openssh-hpn X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 03:37:04 -0000 Author: brooks Date: Thu May 12 03:37:03 2011 New Revision: 221802 URL: http://svn.freebsd.org/changeset/base/221802 Log: Cleaned up, but untested version of openssh5.8-dynwindow_noneswitch.diff applied. Added: user/brooks/openssh-hpn/HPN-README Modified: user/brooks/openssh-hpn/auth2.c user/brooks/openssh-hpn/buffer.c user/brooks/openssh-hpn/buffer.h user/brooks/openssh-hpn/channels.c user/brooks/openssh-hpn/channels.h user/brooks/openssh-hpn/cipher.c user/brooks/openssh-hpn/clientloop.c user/brooks/openssh-hpn/compat.c user/brooks/openssh-hpn/compat.h user/brooks/openssh-hpn/kex.c user/brooks/openssh-hpn/kex.h user/brooks/openssh-hpn/myproposal.h user/brooks/openssh-hpn/packet.c user/brooks/openssh-hpn/packet.h user/brooks/openssh-hpn/progressmeter.c user/brooks/openssh-hpn/readconf.c user/brooks/openssh-hpn/readconf.h user/brooks/openssh-hpn/scp.c user/brooks/openssh-hpn/servconf.c user/brooks/openssh-hpn/servconf.h user/brooks/openssh-hpn/serverloop.c user/brooks/openssh-hpn/session.c user/brooks/openssh-hpn/sftp.1 user/brooks/openssh-hpn/sftp.c user/brooks/openssh-hpn/ssh.c user/brooks/openssh-hpn/sshconnect.c user/brooks/openssh-hpn/sshconnect2.c user/brooks/openssh-hpn/sshd.c user/brooks/openssh-hpn/sshd_config user/brooks/openssh-hpn/version.h Added: user/brooks/openssh-hpn/HPN-README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/brooks/openssh-hpn/HPN-README Thu May 12 03:37:03 2011 (r221802) @@ -0,0 +1,128 @@ +Notes: + +MULTI-THREADED CIPHER: +The AES cipher in CTR mode has been multithreaded (MTR-AES-CTR). This will allow ssh installations +on hosts with multiple cores to use more than one processing core during encryption. +Tests have show significant throughput performance increases when using MTR-AES-CTR up +to and including a full gigabit per second on quad core systems. It should be possible to +achieve full line rate on dual core systems but OS and data management overhead makes this +more difficult to achieve. The cipher stream from MTR-AES-CTR is entirely compatible with single +thread AES-CTR (ST-AES-CTR) implementations and should be 100% backward compatible. Optimal +performance requires the MTR-AES-CTR mode be enabled on both ends of the connection. +The MTR-AES-CTR replaces ST-AES-CTR and is used in exactly the same way with the same +nomenclature. +Use examples: ssh -caes128-ctr you@host.com + scp -oCipher=aes256-ctr file you@host.com:~/file + +NONE CIPHER: +To use the NONE option you must have the NoneEnabled switch set on the server and +you *must* have *both* NoneEnabled and NoneSwitch set to yes on the client. The NONE +feature works with ALL ssh subsystems (as far as we can tell) *AS LONG AS* a tty is not +spawned. If a user uses the -T switch to prevent a tty being created the NONE cipher will +be disabled. + +The performance increase will only be as good as the network and TCP stack tuning +on the reciever side of the connection allows. As a rule of thumb a user will need +at least 10Mb/s connection with a 100ms RTT to see a doubling of performance. The +HPN-SSH home page describes this in greater detail. + +http://www.psc.edu/networking/projects/hpn-ssh + +BUFFER SIZES: + +If HPN is disabled the receive buffer size will be set to the +OpenSSH default of 64K. + +If an HPN system connects to a nonHPN system the receive buffer will +be set to the HPNBufferSize value. The default is 2MB but user adjustable. + +If an HPN to HPN connection is established a number of different things might +happen based on the user options and conditions. + +Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set +HPN Buffer Size = up to 64MB +This is the default state. The HPN buffer size will grow to a maximum of 64MB +as the TCP receive buffer grows. The maximum HPN Buffer size of 64MB is +geared towards 10GigE transcontinental connections. + +Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set +HPN Buffer Size = TCP receive buffer value. +Users on non-autotuning systesm should disable TCPRcvBufPoll in the +ssh_cofig and sshd_config + +Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set +HPN Buffer Size = minmum of TCP receive buffer and HPNBufferSize. +This would be the system defined TCP receive buffer (RWIN). + +Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf SET +HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. +Generally there is no need to set both. + +Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set +HPN Buffer Size = grows to HPNBufferSize +The buffer will grow up to the maximum size specified here. + +Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf SET +HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. +Generally there is no need to set both of these, especially on autotuning +systems. However, if the users wishes to override the autotuning this would be +one way to do it. + +Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf SET +HPN Buffer Size = TCPRcvBuf. +This will override autotuning and set the TCP recieve buffer to the user defined +value. + + +HPN Specific Configuration options + +TcpRcvBuf=[int]KB client + set the TCP socket receive buffer to n Kilobytes. It can be set up to the +maximum socket size allowed by the system. This is useful in situations where +the tcp receive window is set low but the maximum buffer size is set +higher (as is typical). This works on a per TCP connection basis. You can also +use this to artifically limit the transfer rate of the connection. In these +cases the throughput will be no more than n/RTT. The minimum buffer size is 1KB. +Default is the current system wide tcp receive buffer size. + +TcpRcvBufPoll=[yes/no] client/server + enable of disable the polling of the tcp receive buffer through the life +of the connection. You would want to make sure that this option is enabled +for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista) +default is yes. + +NoneEnabled=[yes/no] client/server + enable or disable the use of the None cipher. Care must always be used +when enabling this as it will allow users to send data in the clear. However, +it is important to note that authentication information remains encrypted +even if this option is enabled. Set to no by default. + +NoneSwitch=[yes/no] client + Switch the encryption cipher being used to the None cipher after +authentication takes place. NoneEnabled must be enabled on both the client +and server side of the connection. When the connection switches to the NONE +cipher a warning is sent to STDERR. The connection attempt will fail with an +error if a client requests a NoneSwitch from the server that does not explicitly +have NoneEnabled set to yes. Note: The NONE cipher cannot be used in +interactive (shell) sessions and it will fail silently. Set to no by default. + +HPNDisabled=[yes/no] client/server + In some situations, such as transfers on a local area network, the impact +of the HPN code produces a net decrease in performance. In these cases it is +helpful to disable the HPN functionality. By default HPNDisabled is set to no. + +HPNBufferSize=[int]KB client/server + This is the default buffer size the HPN functionality uses when interacting +with nonHPN SSH installations. Conceptually this is similar to the TcpRcvBuf +option as applied to the internal SSH flow control. This value can range from +1KB to 64MB (1-65536). Use of oversized or undersized buffers can cause performance +problems depending on the length of the network path. The default size of this buffer +is 2MB. + + +Credits: This patch was conceived, designed, and led by Chris Rapier (rapier@psc.edu) + The majority of the actual coding for versions up to HPN12v1 was performed + by Michael Stevens (mstevens@andrew.cmu.edu). The MT-AES-CTR cipher was + implemented by Ben Bennet (ben@psc.edu). This work was financed, in part, + by Cisco System, Inc., the National Library of Medicine, + and the National Science Foundation. Modified: user/brooks/openssh-hpn/auth2.c ============================================================================== --- user/brooks/openssh-hpn/auth2.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/auth2.c Thu May 12 03:37:03 2011 (r221802) @@ -49,6 +49,7 @@ #include "dispatch.h" #include "pathnames.h" #include "buffer.h" +#include "canohost.h" #ifdef GSSAPI #include "ssh-gss.h" @@ -217,6 +218,7 @@ input_userauth_request(int type, u_int32 Authmethod *m = NULL; char *user, *service, *method, *style = NULL; int authenticated = 0; + static int log_flag = 0; if (authctxt == NULL) fatal("input_userauth_request: no authctxt"); @@ -225,6 +227,11 @@ input_userauth_request(int type, u_int32 service = packet_get_cstring(NULL); method = packet_get_cstring(NULL); debug("userauth-request for user %s service %s method %s", user, service, method); + if (!log_flag) { + logit("SSH: Server;Ltype: Authname;Remote: %s-%d;Name: %s", + get_remote_ipaddr(), get_remote_port(), user); + log_flag = 1; + } debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); if ((style = strchr(user, ':')) != NULL) Modified: user/brooks/openssh-hpn/buffer.c ============================================================================== --- user/brooks/openssh-hpn/buffer.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/buffer.c Thu May 12 03:37:03 2011 (r221802) @@ -127,7 +127,7 @@ restart: /* Increase the size of the buffer and retry. */ newlen = roundup(buffer->alloc + len, BUFFER_ALLOCSZ); - if (newlen > BUFFER_MAX_LEN) + if (newlen > BUFFER_MAX_LEN_HPN) fatal("buffer_append_space: alloc %u not supported", newlen); buffer->buf = xrealloc(buffer->buf, 1, newlen); Modified: user/brooks/openssh-hpn/buffer.h ============================================================================== --- user/brooks/openssh-hpn/buffer.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/buffer.h Thu May 12 03:37:03 2011 (r221802) @@ -16,6 +16,9 @@ #ifndef BUFFER_H #define BUFFER_H +/* move the following to a more appropriate place and name */ +#define BUFFER_MAX_LEN_HPN 0x4000000 /* 64MB */ + typedef struct { u_char *buf; /* Buffer for data. */ u_int alloc; /* Number of bytes allocated for data. */ Modified: user/brooks/openssh-hpn/channels.c ============================================================================== --- user/brooks/openssh-hpn/channels.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/channels.c Thu May 12 03:37:03 2011 (r221802) @@ -170,6 +170,9 @@ static void port_open_helper(Channel *c, static int connect_next(struct channel_connect *); static void channel_connect_ctx_free(struct channel_connect *); +static int hpn_disabled = 0; +static int hpn_buffer_size = 2 * 1024 * 1024; + /* -- channel core */ Channel * @@ -313,6 +316,7 @@ channel_new(char *ctype, int type, int r c->local_window_max = window; c->local_consumed = 0; c->local_maxpacket = maxpack; + c->dynamic_window = 0; c->remote_id = -1; c->remote_name = xstrdup(remote_name); c->remote_window = 0; @@ -808,11 +812,35 @@ channel_pre_open_13(Channel *c, fd_set * FD_SET(c->sock, writeset); } +int channel_tcpwinsz () { + u_int32_t tcpwinsz = 0; + socklen_t optsz = sizeof(tcpwinsz); + int ret = -1; + + /* if we aren't on a socket return 128KB*/ + if (!packet_connection_is_on_socket()) + return(128*1024); + ret = getsockopt(packet_get_connection_in(), + SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz); + /* return no more than 64MB */ + if ((ret == 0) && tcpwinsz > BUFFER_MAX_LEN_HPN) + tcpwinsz = BUFFER_MAX_LEN_HPN; + debug2("tcpwinsz: %d for connection: %d", tcpwinsz, + packet_get_connection_in()); + return(tcpwinsz); +} + static void channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset) { u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); + /* check buffer limits */ + if ((!c->tcpwinsz) || (c->dynamic_window > 0)) + c->tcpwinsz = channel_tcpwinsz(); + + limit = MIN(limit, 2 * c->tcpwinsz); + if (c->istate == CHAN_INPUT_OPEN && limit > 0 && buffer_len(&c->input) < limit && @@ -1789,14 +1817,24 @@ channel_check_window(Channel *c) c->local_maxpacket*3) || c->local_window < c->local_window_max/2) && c->local_consumed > 0) { + u_int addition = 0; + /* adjust max window size if we are in a dynamic environment */ + if (c->dynamic_window && (c->tcpwinsz > c->local_window_max)) { + /* + * Grow the window somewhat aggressively to + * maintain pressure. + */ + addition = 1.5*(c->tcpwinsz - c->local_window_max); + c->local_window_max += addition; + } packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); packet_put_int(c->remote_id); - packet_put_int(c->local_consumed); + packet_put_int(c->local_consumed + addition); packet_send(); debug2("channel %d: window %d sent adjust %d", c->self, c->local_window, c->local_consumed); - c->local_window += c->local_consumed; + c->local_window += c->local_consumed + addition; c->local_consumed = 0; } return 1; @@ -2128,11 +2166,12 @@ channel_after_select(fd_set *readset, fd /* If there is data to send to the connection, enqueue some of it now. */ -void +int channel_output_poll(void) { Channel *c; u_int i, len; + int packet_length = 0; for (i = 0; i < channels_alloc; i++) { c = channels[i]; @@ -2180,7 +2219,7 @@ channel_output_poll(void) packet_start(SSH2_MSG_CHANNEL_DATA); packet_put_int(c->remote_id); packet_put_string(data, dlen); - packet_send(); + packet_length = packet_send(); c->remote_window -= dlen + 4; xfree(data); } @@ -2210,7 +2249,7 @@ channel_output_poll(void) SSH2_MSG_CHANNEL_DATA : SSH_MSG_CHANNEL_DATA); packet_put_int(c->remote_id); packet_put_string(buffer_ptr(&c->input), len); - packet_send(); + packet_length = packet_send(); buffer_consume(&c->input, len); c->remote_window -= len; } @@ -2245,12 +2284,13 @@ channel_output_poll(void) packet_put_int(c->remote_id); packet_put_int(SSH2_EXTENDED_DATA_STDERR); packet_put_string(buffer_ptr(&c->extended), len); - packet_send(); + packet_length = packet_send(); buffer_consume(&c->extended, len); c->remote_window -= len; debug2("channel %d: sent ext data %d", c->self, len); } } + return (packet_length); } @@ -2634,6 +2674,14 @@ channel_set_af(int af) IPv4or6 = af; } +void +channel_set_hpn(int external_hpn_disabled, int external_hpn_buffer_size) +{ + hpn_disabled = external_hpn_disabled; + hpn_buffer_size = external_hpn_buffer_size; + debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled, hpn_buffer_size); +} + static int channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_port, int *allocated_listen_port, @@ -2787,9 +2835,16 @@ channel_setup_fwd_listener(int type, con } /* Allocate a channel number for the socket. */ - c = channel_new("port listener", type, sock, sock, -1, - CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, - 0, "port listener", 1); + /* explicitly test for hpn disabled option. if true use smaller window size */ + if (hpn_disabled) { + c = channel_new("port listener", type, sock, sock, -1, + CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, + 0, "port listener", 1); + } else { + c = channel_new("port listener", type, sock, sock, -1, + hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, + 0, "port listener", 1); + } c->path = xstrdup(host); c->host_port = port_to_connect; c->listening_port = listen_port; @@ -3334,10 +3389,18 @@ x11_create_display_inet(int x11_display_ *chanids = xcalloc(num_socks + 1, sizeof(**chanids)); for (n = 0; n < num_socks; n++) { sock = socks[n]; - nc = channel_new("x11 listener", - SSH_CHANNEL_X11_LISTENER, sock, sock, -1, - CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, - 0, "X11 inet listener", 1); + /* Is this really necassary? */ + if (hpn_disabled) { + nc = channel_new("x11 listener", + SSH_CHANNEL_X11_LISTENER, sock, sock, -1, + CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, + 0, "X11 inet listener", 1); + } else { + nc = channel_new("x11 listener", + SSH_CHANNEL_X11_LISTENER, sock, sock, -1, + hpn_buffer_size, CHAN_X11_PACKET_DEFAULT, + 0, "X11 inet listener", 1); + } nc->single_connection = single_connection; (*chanids)[n] = nc->self; } Modified: user/brooks/openssh-hpn/channels.h ============================================================================== --- user/brooks/openssh-hpn/channels.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/channels.h Thu May 12 03:37:03 2011 (r221802) @@ -125,8 +125,10 @@ struct Channel { u_int local_window_max; u_int local_consumed; u_int local_maxpacket; + int dynamic_window; int extended_usage; int single_connection; + u_int tcpwinsz; char *ctype; /* type */ @@ -161,9 +163,9 @@ struct Channel { /* default window/packet sizes for tcp/x11-fwd-channel */ #define CHAN_SES_PACKET_DEFAULT (32*1024) -#define CHAN_SES_WINDOW_DEFAULT (64*CHAN_SES_PACKET_DEFAULT) +#define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT) #define CHAN_TCP_PACKET_DEFAULT (32*1024) -#define CHAN_TCP_WINDOW_DEFAULT (64*CHAN_TCP_PACKET_DEFAULT) +#define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT) #define CHAN_X11_PACKET_DEFAULT (16*1024) #define CHAN_X11_WINDOW_DEFAULT (4*CHAN_X11_PACKET_DEFAULT) @@ -237,7 +239,7 @@ void channel_input_status_confirm(int, void channel_prepare_select(fd_set **, fd_set **, int *, u_int*, int); void channel_after_select(fd_set *, fd_set *); -void channel_output_poll(void); +int channel_output_poll(void); int channel_not_very_much_buffered_data(void); void channel_close_all(void); @@ -294,4 +296,7 @@ void chan_rcvd_ieof(Channel *); void chan_write_failed(Channel *); void chan_obuf_empty(Channel *); +/* hpn handler */ +void channel_set_hpn(int, int); + #endif Modified: user/brooks/openssh-hpn/cipher.c ============================================================================== --- user/brooks/openssh-hpn/cipher.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/cipher.c Thu May 12 03:37:03 2011 (r221802) @@ -163,7 +163,8 @@ ciphers_valid(const char *names) for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; (p = strsep(&cp, CIPHER_SEP))) { c = cipher_by_name(p); - if (c == NULL || c->number != SSH_CIPHER_SSH2) { + if (c == NULL || (c->number != SSH_CIPHER_SSH2 && + c->number != SSH_CIPHER_NONE)) { debug("bad cipher %s [%s]", p, names); xfree(cipher_list); return 0; @@ -337,6 +338,7 @@ cipher_get_keyiv(CipherContext *cc, u_ch int evplen; switch (c->number) { + case SSH_CIPHER_NONE: case SSH_CIPHER_SSH2: case SSH_CIPHER_DES: case SSH_CIPHER_BLOWFISH: @@ -371,6 +373,7 @@ cipher_set_keyiv(CipherContext *cc, u_ch int evplen = 0; switch (c->number) { + case SSH_CIPHER_NONE: case SSH_CIPHER_SSH2: case SSH_CIPHER_DES: case SSH_CIPHER_BLOWFISH: Modified: user/brooks/openssh-hpn/clientloop.c ============================================================================== --- user/brooks/openssh-hpn/clientloop.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/clientloop.c Thu May 12 03:37:03 2011 (r221802) @@ -1768,9 +1768,18 @@ client_request_x11(const char *request_t sock = x11_connect_display(); if (sock < 0) return NULL; - c = channel_new("x11", - SSH_CHANNEL_X11_OPEN, sock, sock, -1, - CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1); + /* again is this really necessary for X11? */ + if (options.hpn_disabled) { + c = channel_new("x11", + SSH_CHANNEL_X11_OPEN, sock, sock, -1, + CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, + 0, "x11", 1); + } else { + c = channel_new("x11", + SSH_CHANNEL_X11_OPEN, sock, sock, -1, + options.hpn_buffer_size, CHAN_X11_PACKET_DEFAULT, + 0, "x11", 1); + } c->force_drain = 1; return c; } @@ -1790,10 +1799,17 @@ client_request_agent(const char *request sock = ssh_get_authentication_socket(); if (sock < 0) return NULL; - c = channel_new("authentication agent connection", - SSH_CHANNEL_OPEN, sock, sock, -1, - CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, - "authentication agent connection", 1); + if (options.hpn_disabled) { + c = channel_new("authentication agent connection", + SSH_CHANNEL_OPEN, sock, sock, -1, + CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0, + "authentication agent connection", 1); + } else { + c = channel_new("authentication agent connection", + SSH_CHANNEL_OPEN, sock, sock, -1, + options.hpn_buffer_size, options.hpn_buffer_size, 0, + "authentication agent connection", 1); + } c->force_drain = 1; return c; } @@ -1820,8 +1836,15 @@ client_request_tun_fwd(int tun_mode, int return -1; } - c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, - CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); + if(options.hpn_disabled) { + c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, + CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, + 0, "tun", 1); + } else { + c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, + options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, + 0, "tun", 1); + } c->datagram = 1; #if defined(SSH_TUN_FILTER) Modified: user/brooks/openssh-hpn/compat.c ============================================================================== --- user/brooks/openssh-hpn/compat.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/compat.c Thu May 12 03:37:03 2011 (r221802) @@ -170,6 +170,17 @@ compat_datafellows(const char *version) strlen(check[i].pat), 0) == 1) { debug("match: %s pat %s", version, check[i].pat); datafellows = check[i].bugs; + /* + * Check to see if the remote side is OpenSSH and + * not HPN. + * XXX: Using the version to do this is bizzare. + */ + if(strstr(version,"OpenSSH") != NULL) { + if (strstr(version,"hpn") == NULL) { + datafellows |= SSH_BUG_LARGEWINDOW; + debug("Remote is NON-HPN aware"); + } + } return; } } Modified: user/brooks/openssh-hpn/compat.h ============================================================================== --- user/brooks/openssh-hpn/compat.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/compat.h Thu May 12 03:37:03 2011 (r221802) @@ -58,6 +58,7 @@ #define SSH_OLD_FORWARD_ADDR 0x01000000 #define SSH_BUG_RFWD_ADDR 0x02000000 #define SSH_NEW_OPENSSH 0x04000000 +#define SSH_BUG_LARGEWINDOW 0x08000000 void enable_compat13(void); void enable_compat20(void); Modified: user/brooks/openssh-hpn/kex.c ============================================================================== --- user/brooks/openssh-hpn/kex.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/kex.c Thu May 12 03:37:03 2011 (r221802) @@ -49,6 +49,7 @@ #include "dispatch.h" #include "monitor.h" #include "roaming.h" +#include "canohost.h" #if OPENSSL_VERSION_NUMBER >= 0x00907000L # if defined(HAVE_EVP_SHA256) @@ -91,7 +92,8 @@ kex_names_valid(const char *names) } /* put algorithm proposal into buffer */ -static void +/* used in sshconnect.c as well as kex.c */ +void kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) { u_int i; @@ -407,6 +409,13 @@ kex_choose_conf(Kex *kex) int nenc, nmac, ncomp; u_int mode, ctos, need; int first_kex_follows, type; + int log_flag = 0; + + int auth_flag; + + auth_flag = packet_authentication_state(); + + debug ("AUTH STATE IS %d", auth_flag); my = kex_buf2prop(&kex->my, NULL); peer = kex_buf2prop(&kex->peer, &first_kex_follows); @@ -441,11 +450,37 @@ kex_choose_conf(Kex *kex) choose_enc (&newkeys->enc, cprop[nenc], sprop[nenc]); choose_mac (&newkeys->mac, cprop[nmac], sprop[nmac]); choose_comp(&newkeys->comp, cprop[ncomp], sprop[ncomp]); + debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name); + if (strcmp(newkeys->enc.name, "none") == 0) { + debug("Requesting NONE. Authflag is %d", auth_flag); + if (auth_flag == 1) + debug("None requested post authentication."); + else + fatal("Pre-authentication none cipher " + "requests are not allowed."); + } debug("kex: %s %s %s %s", ctos ? "client->server" : "server->client", newkeys->enc.name, newkeys->mac.name, newkeys->comp.name); + /* + * client starts withctos = 0 && log flag = 0 and no log + * 2nd client pass ctos=1 and flag = 1 so no log + * server starts with ctos =1 && log_flag = 0 so log + * 2nd sever pass ctos = 1 && log flag = 1 so no log + * -cjr + */ + if (ctos && !log_flag) { + logit("SSH: Server;Ltype: Kex;Remote: %s-%d;" + "Enc: %s;MAC: %s;Comp: %s", + get_remote_ipaddr(), + get_remote_port(), + newkeys->enc.name, + newkeys->mac.name, + newkeys->comp.name); + } + log_flag = 1; } choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], sprop[PROPOSAL_KEX_ALGS]); choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS], Modified: user/brooks/openssh-hpn/kex.h ============================================================================== --- user/brooks/openssh-hpn/kex.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/kex.h Thu May 12 03:37:03 2011 (r221802) @@ -140,6 +140,8 @@ struct Kex { int kex_names_valid(const char *); +void kex_prop2buf(Buffer *, char *proposal[PROPOSAL_MAX]); + Kex *kex_setup(char *[PROPOSAL_MAX]); void kex_finish(Kex *); Modified: user/brooks/openssh-hpn/myproposal.h ============================================================================== --- user/brooks/openssh-hpn/myproposal.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/myproposal.h Thu May 12 03:37:03 2011 (r221802) @@ -75,6 +75,8 @@ "arcfour256,arcfour128," \ "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \ "aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se" +#define KEX_ENCRYPT_INCLUDE_NONE KEX_DEFAULT_ENCRYPT \ + ",none" #define KEX_DEFAULT_MAC \ "hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160," \ "hmac-ripemd160@openssh.com," \ Modified: user/brooks/openssh-hpn/packet.c ============================================================================== --- user/brooks/openssh-hpn/packet.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/packet.c Thu May 12 03:37:03 2011 (r221802) @@ -842,7 +842,7 @@ packet_enable_delayed_compress(void) /* * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) */ -static void +static int packet_send2_wrapped(void) { u_char type, *cp, *macbuf = NULL; @@ -961,11 +961,13 @@ packet_send2_wrapped(void) set_newkeys(MODE_OUT); else if (type == SSH2_MSG_USERAUTH_SUCCESS && active_state->server_side) packet_enable_delayed_compress(); + return(packet_length); } -static void +static int packet_send2(void) { + static int packet_length = 0; struct packet *p; u_char type, *cp; @@ -983,7 +985,7 @@ packet_send2(void) sizeof(Buffer)); buffer_init(&active_state->outgoing_packet); TAILQ_INSERT_TAIL(&active_state->outgoing, p, next); - return; + return(sizeof(Buffer)); } } @@ -991,7 +993,7 @@ packet_send2(void) if (type == SSH2_MSG_KEXINIT) active_state->rekeying = 1; - packet_send2_wrapped(); + packet_length = packet_send2_wrapped(); /* after a NEWKEYS message we can send the complete queue */ if (type == SSH2_MSG_NEWKEYS) { @@ -1004,19 +1006,22 @@ packet_send2(void) sizeof(Buffer)); TAILQ_REMOVE(&active_state->outgoing, p, next); xfree(p); - packet_send2_wrapped(); + packet_length += packet_send2_wrapped(); } } + return(packet_length); } -void +int packet_send(void) { + int packet_len = 0; if (compat20) - packet_send2(); + packet_len = packet_send2(); else packet_send1(); DBG(debug("packet_send done")); + return(packet_len); } /* @@ -1655,7 +1660,7 @@ packet_disconnect(const char *fmt,...) /* Checks if there is any buffered output, and tries to write some of the output. */ -void +int packet_write_poll(void) { int len = buffer_len(&active_state->output); @@ -1668,13 +1673,14 @@ packet_write_poll(void) if (len == -1) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) - return; + return(0); fatal("Write failed: %.100s", strerror(errno)); } if (len == 0 && !cont) fatal("Write connection closed"); buffer_consume(&active_state->output, len); } + return(len); } /* @@ -1861,12 +1867,23 @@ packet_send_ignore(int nbytes) } } +int rekey_requested = 0; +void +packet_request_rekeying(void) +{ + rekey_requested = 1; +} + #define MAX_PACKETS (1U<<31) int packet_need_rekeying(void) { if (datafellows & SSH_BUG_NOREKEY) return 0; + if (rekey_requested == 1) { + rekey_requested = 0; + return 1; + } return (active_state->p_send.packets > MAX_PACKETS) || (active_state->p_read.packets > MAX_PACKETS) || @@ -1958,3 +1975,9 @@ packet_restore_state(void) add_recv_bytes(len); } } + +int +packet_authentication_state(void) +{ + return(active_state->after_authentication); +} Modified: user/brooks/openssh-hpn/packet.h ============================================================================== --- user/brooks/openssh-hpn/packet.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/packet.h Thu May 12 03:37:03 2011 (r221802) @@ -23,6 +23,9 @@ #include #endif +void +packet_request_rekeying(void); + void packet_set_connection(int, int); void packet_set_timeout(int, int); void packet_set_nonblocking(void); @@ -38,6 +41,7 @@ void packet_set_interactive(int, int int packet_is_interactive(void); void packet_set_server(void); void packet_set_authenticated(void); +int packet_authentication_state(void); void packet_start(u_char); void packet_put_char(int ch); @@ -51,7 +55,7 @@ void packet_put_ecpoint(const EC_GRO void packet_put_string(const void *buf, u_int len); void packet_put_cstring(const char *str); void packet_put_raw(const void *buf, u_int len); -void packet_send(void); +int packet_send(void); int packet_read(void); void packet_read_expect(int type); @@ -86,7 +90,7 @@ int packet_get_ssh1_cipher(void); void packet_set_iv(int, u_char *); void *packet_get_newkeys(int); -void packet_write_poll(void); +int packet_write_poll(void); void packet_write_wait(void); int packet_have_data_to_write(void); int packet_not_very_much_data_to_write(void); Modified: user/brooks/openssh-hpn/progressmeter.c ============================================================================== --- user/brooks/openssh-hpn/progressmeter.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/progressmeter.c Thu May 12 03:37:03 2011 (r221802) @@ -68,6 +68,8 @@ static time_t last_update; /* last progr static char *file; /* name of the file being transferred */ static off_t end_pos; /* ending position of transfer */ static off_t cur_pos; /* transfer position as of last refresh */ +static off_t last_pos; +static off_t max_delta_pos = 0; static volatile off_t *counter; /* progress counter */ static long stalled; /* how long we have been stalled */ static int bytes_per_second; /* current speed in bytes per second */ @@ -128,12 +130,17 @@ refresh_progress_meter(void) int hours, minutes, seconds; int i, len; int file_len; + off_t delta_pos; transferred = *counter - cur_pos; cur_pos = *counter; now = time(NULL); bytes_left = end_pos - cur_pos; + delta_pos = cur_pos - last_pos; + if (delta_pos > max_delta_pos) + max_delta_pos = delta_pos; + if (bytes_left > 0) elapsed = now - last_update; else { @@ -158,7 +165,7 @@ refresh_progress_meter(void) /* filename */ buf[0] = '\0'; - file_len = win_size - 35; + file_len = win_size - 45; if (file_len > 0) { len = snprintf(buf, file_len + 1, "\r%s", file); if (len < 0) @@ -175,7 +182,7 @@ refresh_progress_meter(void) percent = ((float)cur_pos / end_pos) * 100; else percent = 100; - snprintf(buf + strlen(buf), win_size - strlen(buf), + snprintf(buf + strlen(buf), win_size - strlen(buf-8), " %3d%% ", percent); /* amount transferred */ @@ -188,6 +195,16 @@ refresh_progress_meter(void) (off_t)bytes_per_second); strlcat(buf, "/s ", win_size); + /* instantaneous rate */ + if (bytes_left > 0) { + format_rate(buf + strlen(buf), win_size - strlen(buf), + delta_pos); + } else { + format_rate(buf + strlen(buf), win_size - strlen(buf), + max_delta_pos); + } + strlcat(buf, "/s ", win_size); + /* ETA */ if (!transferred) stalled += elapsed; @@ -224,6 +241,7 @@ refresh_progress_meter(void) atomicio(vwrite, STDOUT_FILENO, buf, win_size - 1); last_update = now; + last_pos = cur_pos; } /*ARGSUSED*/ Modified: user/brooks/openssh-hpn/readconf.c ============================================================================== --- user/brooks/openssh-hpn/readconf.c Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/readconf.c Thu May 12 03:37:03 2011 (r221802) @@ -135,6 +135,8 @@ typedef enum { oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, oKexAlgorithms, oIPQoS, + oNoneEnabled, oNoneSwitch, + oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize, oDeprecated, oUnsupported } OpCodes; @@ -245,6 +247,12 @@ static struct { #endif { "kexalgorithms", oKexAlgorithms }, { "ipqos", oIPQoS }, + { "noneenabled", oNoneEnabled }, + { "noneswitch", oNoneSwitch }, + { "tcprcvbufpoll", oTcpRcvBufPoll }, + { "tcprcvbuf", oTcpRcvBuf }, + { "hpndisabled", oHPNDisabled }, + { "hpnbuffersize", oHPNBufferSize }, { NULL, oBadOption } }; @@ -491,6 +499,42 @@ parse_flag: intptr = &options->check_host_ip; goto parse_flag; + case oNoneEnabled: + intptr = &options->none_enabled; + goto parse_flag; + + /* + * We check to see if the command comes from the command line or + * not. If it does then enable it otherwise fail. NONE should + * never be a default configuration. + */ + case oNoneSwitch: + if(strcmp(filename,"command-line")==0) + { + intptr = &options->none_switch; + goto parse_flag; + } else { + error("NoneSwitch is found in %.200s.\n" + "You may only use this configuration option " + "from the command line", filename); + error("Continuing..."); + debug("NoneSwitch directive found in %.200s.", + filename); + return 0; + } + + case oHPNDisabled: + intptr = &options->hpn_disabled; + goto parse_flag; + + case oHPNBufferSize: + intptr = &options->hpn_buffer_size; + goto parse_int; + + case oTcpRcvBufPoll: + intptr = &options->tcp_rcv_buf_poll; + goto parse_flag; + case oVerifyHostKeyDNS: intptr = &options->verify_host_key_dns; goto parse_yesnoask; @@ -669,6 +713,10 @@ parse_int: intptr = &options->connection_attempts; goto parse_int; + case oTcpRcvBuf: + intptr = &options->tcp_rcv_buf; + goto parse_int; + case oCipher: intptr = &options->cipher; arg = strdelim(&s); @@ -1157,6 +1205,12 @@ initialize_options(Options * options) options->zero_knowledge_password_authentication = -1; options->ip_qos_interactive = -1; options->ip_qos_bulk = -1; + options->none_switch = -1; + options->none_enabled = -1; + options->hpn_disabled = -1; + options->hpn_buffer_size = -1; + options->tcp_rcv_buf_poll = -1; + options->tcp_rcv_buf = -1; } /* @@ -1289,6 +1343,28 @@ fill_default_options(Options * options) options->server_alive_interval = 0; if (options->server_alive_count_max == -1) options->server_alive_count_max = 3; + if (options->none_switch == -1) + options->none_switch = 0; + if (options->hpn_disabled == -1) + options->hpn_disabled = 0; + if (options->hpn_buffer_size > -1) { + /* if a user tries to set the size to 0 set it to 1KB */ + if (options->hpn_buffer_size == 0) + options->hpn_buffer_size = 1024; + /* XXX: BUFFER_SIZE */ + if (options->hpn_buffer_size > 65536) { + options->hpn_buffer_size = 65536*1024; + debug("User requested buffer larger than 64MB. " + "Request reverted to 64MB"); + } + debug("hpn_buffer_size set to %d", options->hpn_buffer_size); + } + if (options->tcp_rcv_buf == 0) + options->tcp_rcv_buf = 1; + if (options->tcp_rcv_buf > -1) + options->tcp_rcv_buf *=1024; + if (options->tcp_rcv_buf_poll == -1) + options->tcp_rcv_buf_poll = 1; if (options->control_master == -1) options->control_master = 0; if (options->control_persist == -1) { Modified: user/brooks/openssh-hpn/readconf.h ============================================================================== --- user/brooks/openssh-hpn/readconf.h Thu May 12 03:25:24 2011 (r221801) +++ user/brooks/openssh-hpn/readconf.h Thu May 12 03:37:03 2011 (r221802) @@ -59,6 +59,11 @@ typedef struct { int compression_level; /* Compression level 1 (fast) to 9 * (best). */ int tcp_keep_alive; /* Set SO_KEEPALIVE. */ + int tcp_rcv_buf; /* user switch to set tcp recv buffer */ + int tcp_rcv_buf_poll; /* Option to poll recv buf every + * window transfer. */ + int hpn_disabled; /* Switch to disable HPN buffer management */ + int hpn_buffer_size; /* User definable size for HPN buffer window */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu May 12 09:24:50 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFB2B106566B; Thu, 12 May 2011 09:24:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5D2F8FC0A; Thu, 12 May 2011 09:24:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C9OoEI028830; Thu, 12 May 2011 09:24:50 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C9Oo4H028828; Thu, 12 May 2011 09:24:50 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201105120924.p4C9Oo4H028828@svn.freebsd.org> From: Andriy Gapon Date: Thu, 12 May 2011 09:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221804 - user/avg/xcpu/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 09:24:51 -0000 Author: avg Date: Thu May 12 09:24:50 2011 New Revision: 221804 URL: http://svn.freebsd.org/changeset/base/221804 Log: (re-)add another rendezvous counter The problem was that if a master cpu calls rendezvous in rapid succession then the rendezvous object could be re-used while some slave cpus were still spinning on the dual-function teardown/exit counter if a teardown function was actually specified. To fix this problem use separate counters, one for teardown entry and the other for signaling full rendezvous completion. Modified: user/avg/xcpu/sys/kern/subr_smp.c Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Thu May 12 07:44:41 2011 (r221803) +++ user/avg/xcpu/sys/kern/subr_smp.c Thu May 12 09:24:50 2011 (r221804) @@ -118,7 +118,7 @@ struct smp_rendezvous_data { void (*smp_rv_action_func)(void *arg); void (*smp_rv_teardown_func)(void *arg); void *smp_rv_func_arg; - volatile int smp_rv_waiters[2]; + volatile int smp_rv_waiters[3]; int smp_rv_ncpus; }; @@ -439,17 +439,19 @@ smp_rendezvous_action_body(int cpu) if (local_action_func != NULL) local_action_func(local_func_arg); - atomic_add_int(&rv->smp_rv_waiters[1], 1); - if (local_teardown_func == smp_no_rendevous_barrier) - return; + if (local_teardown_func != smp_no_rendevous_barrier) { + /* spin on exit rendezvous */ + atomic_add_int(&rv->smp_rv_waiters[1], 1); + while (rv->smp_rv_waiters[1] < ncpus) + cpu_spinwait(); - /* spin on exit rendezvous */ - while (rv->smp_rv_waiters[1] < ncpus) - cpu_spinwait(); + atomic_add_int(&rv->smp_rv_waiters[2], 1); - /* teardown function */ - if (local_teardown_func != NULL) - local_teardown_func(local_func_arg); + /* teardown function */ + if (local_teardown_func != NULL) + local_teardown_func(local_func_arg); + } else + atomic_add_int(&rv->smp_rv_waiters[2], 1); } void @@ -492,7 +494,7 @@ smp_rendezvous_wait(void) rv = DPCPU_PTR(smp_rv_data); ncpus = rv->smp_rv_ncpus; - while (atomic_load_acq_int(&rv->smp_rv_waiters[1]) < ncpus) { + while (atomic_load_acq_int(&rv->smp_rv_waiters[2]) < ncpus) { /* check for incoming events */ if ((stopping_cpus & (1 << curcpu)) != 0) cpustop_handler(); @@ -580,6 +582,7 @@ smp_rendezvous_cpus(cpumask_t map, rv->smp_rv_teardown_func = teardown_func; rv->smp_rv_func_arg = arg; rv->smp_rv_waiters[1] = 0; + rv->smp_rv_waiters[2] = 0; atomic_store_rel_int(&rv->smp_rv_waiters[0], 0); /* signal other CPUs, which will enter the IPI with interrupts off */ From owner-svn-src-user@FreeBSD.ORG Sat May 14 00:28:10 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A484106566B; Sat, 14 May 2011 00:28:10 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 324018FC0C; Sat, 14 May 2011 00:28:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E0SAkR086563; Sat, 14 May 2011 00:28:10 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E0SAnU086561; Sat, 14 May 2011 00:28:10 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201105140028.p4E0SAnU086561@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 14 May 2011 00:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221863 - user/gabor/tre-integration/lib/libc/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 00:28:10 -0000 Author: gabor Date: Sat May 14 00:28:09 2011 New Revision: 221863 URL: http://svn.freebsd.org/changeset/base/221863 Log: - fix namespace Spotted by: trasz Modified: user/gabor/tre-integration/lib/libc/regex/Symbol.map Modified: user/gabor/tre-integration/lib/libc/regex/Symbol.map ============================================================================== --- user/gabor/tre-integration/lib/libc/regex/Symbol.map Fri May 13 23:10:55 2011 (r221862) +++ user/gabor/tre-integration/lib/libc/regex/Symbol.map Sat May 14 00:28:09 2011 (r221863) @@ -2,7 +2,7 @@ * $FreeBSD$ */ -FBSD_1.0 { +FBSD_1.2 { tre_regacomp; tre_regaexec; tre_regancomp;