From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 19 11:21:32 2014 Return-Path: Delivered-To: svn-src-stable-10@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24A40A25; Sun, 19 Jan 2014 11:21:32 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id A27AC14E7; Sun, 19 Jan 2014 11:21:27 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id NAA17062; Sun, 19 Jan 2014 13:21:18 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1W4qRK-0008Ij-0O; Sun, 19 Jan 2014 13:21:18 +0200 Message-ID: <52DBB4F4.2080303@FreeBSD.org> Date: Sun, 19 Jan 2014 13:20:20 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Sergey Kandaurov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org Subject: Re: svn commit: r260864 - stable/10/sys/net References: <201401182157.s0ILvcqX059828@svn.freebsd.org> In-Reply-To: <201401182157.s0ILvcqX059828@svn.freebsd.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jan 2014 11:21:32 -0000 on 18/01/2014 23:57 Sergey Kandaurov said the following: > Author: pluknet > Date: Sat Jan 18 21:57:38 2014 > New Revision: 260864 > URL: http://svnweb.freebsd.org/changeset/base/260864 > > Log: > MFC r258675: Fix build. Thank you very much! I have completely forgotten about this thing that I originally overlooked and about Gleb's fix for it. This is what I get for delaying my MFCs for too long. > Modified: > stable/10/sys/net/vnet.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/net/vnet.c > ============================================================================== > --- stable/10/sys/net/vnet.c Sat Jan 18 21:47:12 2014 (r260863) > +++ stable/10/sys/net/vnet.c Sat Jan 18 21:57:38 2014 (r260864) > @@ -217,7 +217,7 @@ SDT_PROBE_DEFINE2(vnet, functions, vnet_ > "int", "struct vnet *"); > SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, > "int", "struct vnet *"); > -SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, entry, > +SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, > "int"); > > #ifdef DDB > -- Andriy Gapon From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 05:44:46 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A1546D2; Mon, 20 Jan 2014 05:44:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4BD0112B9; Mon, 20 Jan 2014 05:44:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0K5ikC2000250; Mon, 20 Jan 2014 05:44:46 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0K5ikEV000249; Mon, 20 Jan 2014 05:44:46 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201401200544.s0K5ikEV000249@svn.freebsd.org> From: Hiroki Sato Date: Mon, 20 Jan 2014 05:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260901 - stable/10/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 05:44:46 -0000 Author: hrs Date: Mon Jan 20 05:44:45 2014 New Revision: 260901 URL: http://svnweb.freebsd.org/changeset/base/260901 Log: - Fix a bxe(4) entry. This issue is not related to NFSv4, and poor performance is caused by disabling TSO, not the issue itself. - s/&os;-STABLE/&os; &release.current;/ Modified: stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Mon Jan 20 03:39:08 2014 (r260900) +++ stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Mon Jan 20 05:44:45 2014 (r260901) @@ -193,16 +193,19 @@ boot means interactive. A workaround of this would be to use -SIGINT instead. This bug has been fixed on &os;-CURRENT and will be fixed - in &os;-STABLE. + in &os; &release.current;. - In some NFSv4 environments, &man.bxe.4; with - tso enabled may experience issues with - packet corruption, resulting in poor performance. In some - cases, turning off tso will resolve the - issue. See &man.ifconfig.8; for more information about the - -tso flag. + The &man.bxe.4; driver can cause packet corruption when + TSO (TCP Segmentation Offload) feature is enabled. This + feature is enabled by default and can be disabled by using a + parameter of &man.ifconfig.8;. It can + be specified in &man.rc.conf.5; like the following: + + ifconfig_bxe0="DHCP -tso" + + This bug has been fixed on &os; &release.current;. @@ -220,7 +223,7 @@ boot A regression in &man.pw.8; does not remove a user from groups not specified in the provided group list when the -G flag is used. This is expected to be - corrected in &os;-CURRENT and &os;-STABLE. + corrected in &os;-CURRENT and &os; &release.current;. From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 05:57:58 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A474888; Mon, 20 Jan 2014 05:57:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 85C06135B; Mon, 20 Jan 2014 05:57:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0K5vwKO004312; Mon, 20 Jan 2014 05:57:58 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0K5vwXs004311; Mon, 20 Jan 2014 05:57:58 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201401200557.s0K5vwXs004311@svn.freebsd.org> From: Hiroki Sato Date: Mon, 20 Jan 2014 05:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260902 - stable/10/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 05:57:58 -0000 Author: hrs Date: Mon Jan 20 05:57:58 2014 New Revision: 260902 URL: http://svnweb.freebsd.org/changeset/base/260902 Log: Document an ipfw fwd issue. Suggested by: jmg Modified: stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Mon Jan 20 05:44:45 2014 (r260901) +++ stable/10/release/doc/en_US.ISO8859-1/errata/article.xml Mon Jan 20 05:57:58 2014 (r260902) @@ -225,6 +225,14 @@ boot -G flag is used. This is expected to be corrected in &os;-CURRENT and &os; &release.current;. + + + &man.ipfw.8; fwd action can send + packets to the correct interface with a wrong link-layer + address when the route is updated. This bug has been fixed + on &os;-CURRENT and will be fixed in &os; + &release.current;. + From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 14:37:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C59CD410; Mon, 20 Jan 2014 14:37:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9658F1678; Mon, 20 Jan 2014 14:37:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KEb3wF014299; Mon, 20 Jan 2014 14:37:03 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KEb3Ae014297; Mon, 20 Jan 2014 14:37:03 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401201437.s0KEb3Ae014297@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 20 Jan 2014 14:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260906 - in stable/10: sbin/kldload share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 14:37:03 -0000 Author: bapt Date: Mon Jan 20 14:37:02 2014 New Revision: 260906 URL: http://svnweb.freebsd.org/changeset/base/260906 Log: MFH: r260483, r260484, r260594, r260595, r260596, r260597 Improve error message shown to the user when trying to load a module that is already loaded or compiled withing the kernel Point the user to dmesg(1) to get informations about why loading a module did fail instead of printing the cryptic "Exec format error" Update the BUGS section of kld(4) according the recent changes in kldload(8) Modified: stable/10/sbin/kldload/kldload.c stable/10/share/man/man4/kld.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/kldload/kldload.c ============================================================================== --- stable/10/sbin/kldload/kldload.c Mon Jan 20 12:11:47 2014 (r260905) +++ stable/10/sbin/kldload/kldload.c Mon Jan 20 14:37:02 2014 (r260906) @@ -181,7 +181,22 @@ main(int argc, char** argv) printf("%s is already " "loaded\n", argv[0]); } else { - warn("can't load %s", argv[0]); + switch (errno) { + case EEXIST: + warnx("can't load %s: module " + "already loaded or " + "in kernel", argv[0]); + break; + case ENOEXEC: + warnx("an error occurred while " + "loading the module. " + "Please check dmesg(8) for " + "more details."); + break; + default: + warn("can't load %s", argv[0]); + break; + } errors++; } } else { Modified: stable/10/share/man/man4/kld.4 ============================================================================== --- stable/10/share/man/man4/kld.4 Mon Jan 20 12:11:47 2014 (r260905) +++ stable/10/share/man/man4/kld.4 Mon Jan 20 14:37:02 2014 (r260906) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 1998 +.Dd January 13, 2014 .Dt KLD 4 .Os .Sh NAME @@ -166,8 +166,8 @@ binary, then fails to execute the entry point. .Pp .Xr kldload 8 -returns the cryptic message -.Sq Li "ENOEXEC (Exec format error)" +points the user to read +.Xr dmesg 8 for any error encountered while loading a module. .Pp When system internal interfaces change, old modules often cannot From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 19:37:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E348F81; Mon, 20 Jan 2014 19:37:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 85A3812EE; Mon, 20 Jan 2014 19:37:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KJbgS4036907; Mon, 20 Jan 2014 19:37:42 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KJbcoM036886; Mon, 20 Jan 2014 19:37:38 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401201937.s0KJbcoM036886@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 20 Jan 2014 19:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260918 - in stable/10/contrib/gcc: . cp doc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 19:37:42 -0000 Author: pfg Date: Mon Jan 20 19:37:38 2014 New Revision: 260918 URL: http://svnweb.freebsd.org/changeset/base/260918 Log: MFC r260014, r260099: gcc: Add support for label attributes and "unavailable" attribute. Apple GCC has extensions to support for both label attributes and an "unavailable" attribute. These are critical for objc but are also useful in regular C/C++. Obtained from: Apple GCC 4.2 - 5531 Added: stable/10/contrib/gcc/ChangeLog.apple - copied unchanged from r260014, head/contrib/gcc/ChangeLog.apple stable/10/contrib/gcc/cp/ChangeLog.apple - copied unchanged from r260014, head/contrib/gcc/cp/ChangeLog.apple Modified: stable/10/contrib/gcc/c-common.c stable/10/contrib/gcc/c-decl.c stable/10/contrib/gcc/c-parser.c stable/10/contrib/gcc/c-tree.h stable/10/contrib/gcc/c-typeck.c stable/10/contrib/gcc/cp/cp-gimplify.c stable/10/contrib/gcc/cp/cp-tree.def stable/10/contrib/gcc/cp/cp-tree.h stable/10/contrib/gcc/cp/decl.c stable/10/contrib/gcc/cp/dump.c stable/10/contrib/gcc/cp/init.c stable/10/contrib/gcc/cp/parser.c stable/10/contrib/gcc/cp/pt.c stable/10/contrib/gcc/cp/semantics.c stable/10/contrib/gcc/doc/extend.texi stable/10/contrib/gcc/dwarf2out.c stable/10/contrib/gcc/emit-rtl.c stable/10/contrib/gcc/final.c stable/10/contrib/gcc/print-rtl.c stable/10/contrib/gcc/print-tree.c stable/10/contrib/gcc/rtl.def stable/10/contrib/gcc/rtl.h stable/10/contrib/gcc/stmt.c stable/10/contrib/gcc/toplev.c stable/10/contrib/gcc/toplev.h stable/10/contrib/gcc/tree-cfg.c stable/10/contrib/gcc/tree.h Directory Properties: stable/10/ (props changed) Copied: stable/10/contrib/gcc/ChangeLog.apple (from r260014, head/contrib/gcc/ChangeLog.apple) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/gcc/ChangeLog.apple Mon Jan 20 19:37:38 2014 (r260918, copy of r260014, head/contrib/gcc/ChangeLog.apple) @@ -0,0 +1,51 @@ +006-02-15 Fariborz Jahanian + + Radar 4445586 + * c-common.def (DO_STMT): Takes an extra argument. + +/* APPLE LOCAL merge marger */ +/* Stuff under is in fsf mainline, but not in the 4.2 branch */ + +2007-08-02 Geoffrey Keating + + Radar 3274130, 5295549 + * c-parser.c (c_parser_while_statement): Handle attributes. + (c_parser_do_statement): Handle attributes. + (c_parser_for_statement): Handle attributes. + * c-common.c (handle_unused_attribute): Warn if a statement + is marked as unused. + * c-tree.h (c_finish_loop): Add extra parameter. + * c-typeck.c (c_finish_loop): Handle attributes. + * doc/extend.texi (Attribute Syntax): Document statement attributes. + (Label Attributes): Explain how they apply to statements. + * tree-cfg.c (cleanup_dead_labels): Preserve labels with + user-specified alignment or attributes. + * stmt.c (expand_label): Update and correct documentation. + + * c-common.c (handle_aligned_attribute): Handle LABEL_DECL. + * rtl.def (CODE_LABEL): Add 8th operand. + * rtl.h (LABEL_ALIGN_LOG): New. + (LABEL_MAX_SKIP): New. + (SET_LABEL_ALIGN): New. + * emit-rtl.c (gen_label_rtx): Adjust. + * print-rtl.c (print_rtx): Print LABEL_ALIGN_LOG. + * stmt.c (label_rtx): Set CODE_LABEL's alignment from DECL_ALIGN. + (expand_label): Update documentation. + * final.c (struct label_alignment): Delete. + (label_align): Delete. + (min_labelno): Delete. + (max_labelno): Delete. + (LABEL_TO_ALIGNMENT): Delete. + (LABEL_TO_MAX_SKIP): Delete. + (label_to_alignment): Adjust for LABEL_ALIGN_LOG. + (align_fuzz): Likewise. + (compute_alignments): Likewise. + (shorten_branches): Remove code to set up label_align. + Adjust for LABEL_ALIGN_LOG. + (final_scan_insn): Adjust for LABEL_ALIGN_LOG. + * doc/extend.texi (C Extensions): Add 'Label Attributes' to menu. + (Attribute Syntax): Move label content to Label Attributes. + (Function Attributes): Mention label attributes. + (Variable Attributes): Mention label attributes. + (Type Attributes): Mention label attributes. + (Label Attributes): New. Modified: stable/10/contrib/gcc/c-common.c ============================================================================== --- stable/10/contrib/gcc/c-common.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/c-common.c Mon Jan 20 19:37:38 2014 (r260918) @@ -541,6 +541,9 @@ static tree handle_pure_attribute (tree static tree handle_novops_attribute (tree *, tree, tree, int, bool *); static tree handle_deprecated_attribute (tree *, tree, tree, int, bool *); +/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ +static tree handle_unavailable_attribute (tree *, tree, tree, int, bool *); +/* APPLE LOCAL end "unavailable" attribute --ilr */ static tree handle_vector_size_attribute (tree *, tree, tree, int, bool *); static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); @@ -626,6 +629,10 @@ const struct attribute_spec c_common_att handle_novops_attribute }, { "deprecated", 0, 0, false, false, false, handle_deprecated_attribute }, + /* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ + { "unavailable", 0, 0, false, false, false, + handle_unavailable_attribute }, + /* APPLE LOCAL end "unavailable" attribute --ilr */ { "vector_size", 1, 1, false, true, false, handle_vector_size_attribute }, { "visibility", 1, 1, false, false, false, @@ -4394,7 +4401,10 @@ handle_unused_attribute (tree *node, tre if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == LABEL_DECL +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + || (TREE_CODE (decl) == LABEL_DECL + && ! DECL_ARTIFICIAL (decl)) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ || TREE_CODE (decl) == TYPE_DECL) TREE_USED (decl) = 1; else @@ -4842,7 +4852,10 @@ handle_aligned_attribute (tree *node, tr TYPE_USER_ALIGN (*type) = 1; } else if (! VAR_OR_FUNCTION_DECL_P (decl) - && TREE_CODE (decl) != FIELD_DECL) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + && TREE_CODE (decl) != FIELD_DECL + && TREE_CODE (decl) != LABEL_DECL) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { error ("alignment may not be specified for %q+D", decl); *no_add_attrs = true; @@ -5345,6 +5358,69 @@ handle_deprecated_attribute (tree *node, return NULL_TREE; } +/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ +/* Handle a "unavailable" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_unavailable_attribute (tree *node, tree name, + tree args ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) +{ + tree type = NULL_TREE; + int warn = 0; + const char *what = NULL; + + if (DECL_P (*node)) + { + tree decl = *node; + type = TREE_TYPE (decl); + + if (TREE_CODE (decl) == TYPE_DECL + || TREE_CODE (decl) == PARM_DECL + || TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == FIELD_DECL) + /* Removed radar 3803157 - objc attribute */ + { + TREE_UNAVAILABLE (decl) = 1; + } + else + warn = 1; + } + else if (TYPE_P (*node)) + { + if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) + *node = build_variant_type_copy (*node); + TREE_UNAVAILABLE (*node) = 1; + type = *node; + } + else + warn = 1; + + if (warn) + { + *no_add_attrs = true; + if (type && TYPE_NAME (type)) + { + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) + what = IDENTIFIER_POINTER (TYPE_NAME (*node)); + else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_NAME (TYPE_NAME (type))) + what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); + } + if (what) + warning (0, "`%s' attribute ignored for `%s'", + IDENTIFIER_POINTER (name), what); + else + warning (0, "`%s' attribute ignored", IDENTIFIER_POINTER (name)); + } + + return NULL_TREE; +} +/* APPLE LOCAL end "unavailable" attribute --ilr */ + /* Handle a "vector_size" attribute; arguments as in struct attribute_spec.handler. */ Modified: stable/10/contrib/gcc/c-decl.c ============================================================================== --- stable/10/contrib/gcc/c-decl.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/c-decl.c Mon Jan 20 19:37:38 2014 (r260918) @@ -453,10 +453,17 @@ add_stmt (tree t) with __attribute__((deprecated)). An object declared as __attribute__((deprecated)) suppresses warnings of uses of other deprecated items. */ +/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ +/* Also add an __attribute__((unavailable)). An object declared as + __attribute__((unavailable)) suppresses any reports of being + declared with unavailable or deprecated items. */ +/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ enum deprecated_states { DEPRECATED_NORMAL, DEPRECATED_SUPPRESS + /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ + , DEPRECATED_UNAVAILABLE_SUPPRESS }; static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; @@ -1709,6 +1716,12 @@ merge_decls (tree newdecl, tree olddecl, if (TREE_DEPRECATED (newdecl)) TREE_DEPRECATED (olddecl) = 1; + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + /* Merge unavailableness. */ + if (TREE_UNAVAILABLE (newdecl)) + TREE_UNAVAILABLE (olddecl) = 1; + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ + /* Keep source location of definition rather than declaration and of prototype rather than non-prototype unless that prototype is built-in. */ @@ -3222,8 +3235,36 @@ start_decl (struct c_declarator *declara /* An object declared as __attribute__((deprecated)) suppresses warnings of uses of other deprecated items. */ + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + /* An object declared as __attribute__((unavailable)) suppresses + any reports of being declared with unavailable or deprecated + items. An object declared as __attribute__((deprecated)) + suppresses warnings of uses of other deprecated items. */ +#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */ if (lookup_attribute ("deprecated", attributes)) deprecated_state = DEPRECATED_SUPPRESS; + else if (lookup_attribute ("unavailable", attributes)) + deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; +#else /* a more efficient way doing what lookup_attribute would do */ + tree a; + + for (a = attributes; a; a = TREE_CHAIN (a)) + { + tree name = TREE_PURPOSE (a); + if (TREE_CODE (name) == IDENTIFIER_NODE) + if (is_attribute_p ("deprecated", name)) + { + deprecated_state = DEPRECATED_SUPPRESS; + break; + } + if (is_attribute_p ("unavailable", name)) + { + deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; + break; + } + } +#endif + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, NULL); @@ -4087,6 +4128,11 @@ grokdeclarator (const struct c_declarato /* If this looks like a function definition, make it one, even if it occurs where parms are expected. Then store_parm_decls will reject it and not use it as a parm. */ + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + if (declspecs->unavailable_p) + error_unavailable_use (declspecs->type); + else + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ if (decl_context == NORMAL && !funcdef_flag && current_scope->parm_flag) decl_context = PARM; @@ -7267,6 +7313,8 @@ build_null_declspecs (void) ret->tag_defined_p = false; ret->explicit_signed_p = false; ret->deprecated_p = false; + /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ + ret->unavailable_p = false; ret->default_int_p = false; ret->long_p = false; ret->long_long_p = false; @@ -7330,6 +7378,11 @@ declspecs_add_type (struct c_declspecs * if (TREE_DEPRECATED (type)) specs->deprecated_p = true; + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + if (TREE_UNAVAILABLE (type)) + specs->unavailable_p = true; + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ + /* Handle type specifier keywords. */ if (TREE_CODE (type) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (type)) { Modified: stable/10/contrib/gcc/c-parser.c ============================================================================== --- stable/10/contrib/gcc/c-parser.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/c-parser.c Mon Jan 20 19:37:38 2014 (r260918) @@ -3940,16 +3940,25 @@ c_parser_switch_statement (c_parser *par /* Parse a while statement (C90 6.6.5, C99 6.8.5). while-statement: - while (expression) statement + APPLE LOCAL begin for-fsf-4_4 3274130 5295549 + while attributes (expression) statement + + The use of attributes is a GNU extension. + APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ static void c_parser_while_statement (c_parser *parser) { - tree block, cond, body, save_break, save_cont; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree block, cond, body, save_break, save_cont, attrs; +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ location_t loc; gcc_assert (c_parser_next_token_is_keyword (parser, RID_WHILE)); c_parser_consume_token (parser); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + attrs = c_parser_attributes (parser); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ block = c_begin_compound_stmt (flag_isoc99); loc = c_parser_peek_token (parser)->location; cond = c_parser_paren_condition (parser); @@ -3958,7 +3967,10 @@ c_parser_while_statement (c_parser *pars save_cont = c_cont_label; c_cont_label = NULL_TREE; body = c_parser_c99_block_statement (parser); - c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, attrs, + true); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ add_stmt (c_end_compound_stmt (block, flag_isoc99)); c_break_label = save_break; c_cont_label = save_cont; @@ -3967,16 +3979,25 @@ c_parser_while_statement (c_parser *pars /* Parse a do statement (C90 6.6.5, C99 6.8.5). do-statement: - do statement while ( expression ) ; + APPLE LOCAL begin for-fsf-4_4 3274130 5295549 + do attributes statement while ( expression ) ; + + The use of attributes is a GNU extension. + APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ static void c_parser_do_statement (c_parser *parser) { - tree block, cond, body, save_break, save_cont, new_break, new_cont; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree block, cond, body, save_break, save_cont, new_break, new_cont, attrs; +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ location_t loc; gcc_assert (c_parser_next_token_is_keyword (parser, RID_DO)); c_parser_consume_token (parser); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + attrs = c_parser_attributes (parser); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ block = c_begin_compound_stmt (flag_isoc99); loc = c_parser_peek_token (parser)->location; save_break = c_break_label; @@ -3992,18 +4013,26 @@ c_parser_do_statement (c_parser *parser) cond = c_parser_paren_condition (parser); if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>")) c_parser_skip_to_end_of_block_or_statement (parser); - c_finish_loop (loc, cond, NULL, body, new_break, new_cont, false); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + c_finish_loop (loc, cond, NULL, body, new_break, new_cont, attrs, false); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ add_stmt (c_end_compound_stmt (block, flag_isoc99)); } /* Parse a for statement (C90 6.6.5, C99 6.8.5). for-statement: - for ( expression[opt] ; expression[opt] ; expression[opt] ) statement - for ( nested-declaration expression[opt] ; expression[opt] ) statement + APPLE LOCAL begin for-fsf-4_4 3274130 5295549 + for attributes ( expression[opt] ; expression[opt] ; expression[opt] ) \ + statement + for attributes ( nested-declaration expression[opt] ; expression[opt] ) \ + statement The form with a declaration is new in C99. + The use of attributes is a GNU extension. + + APPLE LOCAL end for-fsf-4_4 3274130 5295549 ??? In accordance with the old parser, the declaration may be a nested function, which is then rejected in check_for_loop_decls, but does it make any sense for this to be included in the grammar? @@ -4015,11 +4044,16 @@ c_parser_do_statement (c_parser *parser) static void c_parser_for_statement (c_parser *parser) { - tree block, cond, incr, save_break, save_cont, body; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree block, cond, incr, save_break, save_cont, body, attrs; +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ location_t loc; gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR)); loc = c_parser_peek_token (parser)->location; c_parser_consume_token (parser); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + attrs = c_parser_attributes (parser); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ block = c_begin_compound_stmt (flag_isoc99); if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>")) { @@ -4094,7 +4128,10 @@ c_parser_for_statement (c_parser *parser save_cont = c_cont_label; c_cont_label = NULL_TREE; body = c_parser_c99_block_statement (parser); - c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, attrs, + true); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ add_stmt (c_end_compound_stmt (block, flag_isoc99)); c_break_label = save_break; c_cont_label = save_cont; Modified: stable/10/contrib/gcc/c-tree.h ============================================================================== --- stable/10/contrib/gcc/c-tree.h Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/c-tree.h Mon Jan 20 19:37:38 2014 (r260918) @@ -257,6 +257,10 @@ struct c_declspecs { BOOL_BITFIELD explicit_signed_p : 1; /* Whether the specifiers include a deprecated typedef. */ BOOL_BITFIELD deprecated_p : 1; + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + /* Whether the specifiers include a unavailable typedef. */ + BOOL_BITFIELD unavailable_p : 1; + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ /* Whether the type defaulted to "int" because there were no type specifiers. */ BOOL_BITFIELD default_int_p; @@ -573,7 +577,10 @@ extern int c_types_compatible_p (tree, t extern tree c_begin_compound_stmt (bool); extern tree c_end_compound_stmt (tree, bool); extern void c_finish_if_stmt (location_t, tree, tree, tree, bool); -extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, tree, + bool); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ extern tree c_begin_stmt_expr (void); extern tree c_finish_stmt_expr (tree); extern tree c_process_expr_stmt (tree); Modified: stable/10/contrib/gcc/c-typeck.c ============================================================================== --- stable/10/contrib/gcc/c-typeck.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/c-typeck.c Mon Jan 20 19:37:38 2014 (r260918) @@ -1849,6 +1849,11 @@ build_component_ref (tree datum, tree co if (TREE_DEPRECATED (subdatum)) warn_deprecated_use (subdatum); + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + if (TREE_UNAVAILABLE (subdatum)) + error_unavailable_use (subdatum); + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ + datum = ref; field = TREE_CHAIN (field); @@ -2090,6 +2095,11 @@ build_external_ref (tree id, int fun, lo if (TREE_DEPRECATED (ref)) warn_deprecated_use (ref); + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + if (TREE_UNAVAILABLE (ref)) + error_unavailable_use (ref); + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ + if (!skip_evaluation) assemble_external (ref); TREE_USED (ref) = 1; @@ -7247,15 +7257,22 @@ c_finish_if_stmt (location_t if_locus, t add_stmt (stmt); } -/* Emit a general-purpose loop construct. START_LOCUS is the location of - the beginning of the loop. COND is the loop condition. COND_IS_FIRST - is false for DO loops. INCR is the FOR increment expression. BODY is - the statement controlled by the loop. BLAB is the break label. CLAB is - the continue label. Everything is allowed to be NULL. */ +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +/* Emit a general-purpose loop construct. START_LOCUS is the location + of the beginning of the loop. COND is the loop condition. + COND_IS_FIRST is false for DO loops. INCR is the FOR increment + expression. BODY is the statement controlled by the loop. BLAB is + the break label. CLAB is the continue label. ATTRS is the + attributes associated with the loop, which at present are + associated with the topmost label. Everything is allowed to be + NULL. */ +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ void c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, - tree blab, tree clab, bool cond_is_first) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree blab, tree clab, tree attrs, bool cond_is_first) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { tree entry = NULL, exit = NULL, t; Copied: stable/10/contrib/gcc/cp/ChangeLog.apple (from r260014, head/contrib/gcc/cp/ChangeLog.apple) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/gcc/cp/ChangeLog.apple Mon Jan 20 19:37:38 2014 (r260918, copy of r260014, head/contrib/gcc/cp/ChangeLog.apple) @@ -0,0 +1,31 @@ +2006-02-15 Fariborz Jahanian + + Radar 4445586 + * semantics.c (begin_do_stmt): DO_STMT nodes take an + extra argument to build. + + # APPLE LOCAL begin for-fsf-4_4 3274130 5295549 +2007-08-03 Geoffrey Keating + + Radar 5295549 + * parser.c (cp_parser_iteration_statement): Handle attributes. + * semantics.c (begin_for_stmt): Put attributes in built tree. + (begin_while_stmt): Put attributes in built tree. + (begin_do_stmt): Put attributes in built tree. + * pt.c (tsubst_expr): Handle attributes for FOR_STMT, WHILE_STMT, + DO_STMT. + * cp-gimplify.c (gimplify_cp_loop): Handle attributes. + (gimplify_for_stmt): Pass attributes to gimplify_cp_loop. + (gimplify_while_stmt): Pass attributes to gimplify_cp_loop. + (gimplify_do_stmt): Pass attributes to gimplify_cp_loop. + * dump.c (cp_dump_tree): Dump attributes for FOR_STMT, WHILE_STMT, + DO_STMT. + * cp-tree.h (begin_while_stmt): Update prototype. + (begin_do_stmt): Likewise. + (begin_for_stmt): Likewise. + * cp-tree.def (FOR_STMT): Add extra parameter. + (WHILE_STMT): Likewise. + (DO_STMT): Likewise. + * init.c (build_vec_init): Update for change to begin_for_stmt. + + # APPLE LOCAL end for-fsf-4_4 3274130 5295549 Modified: stable/10/contrib/gcc/cp/cp-gimplify.c ============================================================================== --- stable/10/contrib/gcc/cp/cp-gimplify.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/cp-gimplify.c Mon Jan 20 19:37:38 2014 (r260918) @@ -188,7 +188,10 @@ gimplify_if_stmt (tree *stmt_p) loop body as in do-while loops. */ static tree -gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs, + bool cond_is_first, tree inner_foreach) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { tree top, entry, exit, cont_block, break_block, stmt_list, t; location_t stmt_locus; @@ -223,6 +226,12 @@ gimplify_cp_loop (tree cond, tree body, out of the loop, or to the top of it. If there's no exit condition, then we just build a jump back to the top. */ exit = build_and_jump (&LABEL_EXPR_LABEL (top)); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + + /* Add the attributes to the 'top' label. */ + decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0); + +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ if (cond && !integer_nonzerop (cond)) { t = build_bc_goto (bc_break); @@ -270,8 +279,11 @@ gimplify_for_stmt (tree *stmt_p, tree *p if (FOR_INIT_STMT (stmt)) gimplify_and_add (FOR_INIT_STMT (stmt), pre_p); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt), - FOR_EXPR (stmt), 1); + FOR_EXPR (stmt), FOR_ATTRIBUTES (stmt), 1, + NULL_TREE); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ } /* Gimplify a WHILE_STMT node. */ @@ -280,8 +292,11 @@ static void gimplify_while_stmt (tree *stmt_p) { tree stmt = *stmt_p; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt), - NULL_TREE, 1); + NULL_TREE, WHILE_ATTRIBUTES (stmt), 1, + NULL_TREE); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ } /* Gimplify a DO_STMT node. */ @@ -290,8 +305,11 @@ static void gimplify_do_stmt (tree *stmt_p) { tree stmt = *stmt_p; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt), - NULL_TREE, 0); + NULL_TREE, DO_ATTRIBUTES (stmt), 0, + DO_FOREACH (stmt)); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ } /* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */ Modified: stable/10/contrib/gcc/cp/cp-tree.def ============================================================================== --- stable/10/contrib/gcc/cp/cp-tree.def Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/cp-tree.def Mon Jan 20 19:37:38 2014 (r260918) @@ -281,18 +281,23 @@ DEFTREECODE (CLEANUP_STMT, "cleanup_stmt and COND_EXPR for the benefit of templates. */ DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ /* Used to represent a `for' statement. The operands are - FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively. */ -DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 4) + FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY and FOR_ATTRIBUTES + respectively. */ +DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 5) /* Used to represent a 'while' statement. The operands are WHILE_COND - and WHILE_BODY, respectively. */ -DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 2) + WHILE_BODY, and WHILE_ATTRIBUTES respectively. */ +DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 3) -/* Used to represent a 'do' statement. The operands are DO_BODY and - DO_COND, respectively. */ -DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 2) +/* APPLE LOCAL begin radar 4445586 */ +/* Used to represent a 'do' statement. The operands are DO_BODY, + DO_COND, DO_ATTRIBUTES, and DO_FOREACH respectively. */ +DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 4) +/* APPLE LOCAL end radar 4445586 */ +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* Used to represent a 'break' statement. */ DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0) Modified: stable/10/contrib/gcc/cp/cp-tree.h ============================================================================== --- stable/10/contrib/gcc/cp/cp-tree.h Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/cp-tree.h Mon Jan 20 19:37:38 2014 (r260918) @@ -3080,12 +3080,24 @@ extern void decl_shadowed_for_var_insert while statement and the body of the while statement, respectively. */ #define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) #define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +#define WHILE_ATTRIBUTES(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* DO_STMT accessors. These give access to the condition of the do statement and the body of the do statement, respectively. */ #define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0) #define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +#define DO_ATTRIBUTES(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 2) +/* APPLE LOCAL begin C* language */ +/* Used as a flag to indicate synthesized inner do-while loop of a + foreach statement. Used for generation of break/continue statement + of the loop. */ +#define DO_FOREACH(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 3) +/* APPLE LOCAL end C* language */ +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* FOR_STMT accessors. These give access to the init statement, condition, update expression, and body of the for statement, respectively. */ @@ -3093,7 +3105,10 @@ extern void decl_shadowed_for_var_insert #define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1) #define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2) #define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +#define FOR_ATTRIBUTES(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ #define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0) #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) @@ -4258,14 +4273,20 @@ extern tree finish_then_clause (tree); extern void begin_else_clause (tree); extern void finish_else_clause (tree); extern void finish_if_stmt (tree); -extern tree begin_while_stmt (void); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +extern tree begin_while_stmt (tree); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ extern void finish_while_stmt_cond (tree, tree); extern void finish_while_stmt (tree); -extern tree begin_do_stmt (void); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +extern tree begin_do_stmt (tree); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ extern void finish_do_body (tree); extern void finish_do_stmt (tree, tree); extern tree finish_return_stmt (tree); -extern tree begin_for_stmt (void); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +extern tree begin_for_stmt (tree); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ extern void finish_for_init_stmt (tree); extern void finish_for_cond (tree, tree); extern void finish_for_expr (tree, tree); Modified: stable/10/contrib/gcc/cp/decl.c ============================================================================== --- stable/10/contrib/gcc/cp/decl.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/decl.c Mon Jan 20 19:37:38 2014 (r260918) @@ -232,10 +232,17 @@ int function_depth; with __attribute__((deprecated)). An object declared as __attribute__((deprecated)) suppresses warnings of uses of other deprecated items. */ +/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ +/* An object declared as __attribute__((unavailable)) suppresses + any reports of being declared with unavailable or deprecated + items. */ +/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ enum deprecated_states { DEPRECATED_NORMAL, DEPRECATED_SUPPRESS + /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ + , DEPRECATED_UNAVAILABLE_SUPPRESS }; static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; @@ -3836,14 +3843,40 @@ start_decl (const cp_declarator *declara tree decl; tree type, tem; tree context; + /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ + tree a; bool was_public; *pushed_scope_p = NULL_TREE; - /* An object declared as __attribute__((deprecated)) suppresses - warnings of uses of other deprecated items. */ + /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ + /* An object declared as __attribute__((unavailable)) suppresses + any reports of being declared with unavailable or deprecated + items. An object declared as __attribute__((deprecated)) + suppresses warnings of uses of other deprecated items. */ +#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */ if (lookup_attribute ("deprecated", attributes)) deprecated_state = DEPRECATED_SUPPRESS; + else if (lookup_attribute ("unavailable", attributes)) + deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; +#else /* a more efficient way doing what lookup_attribute would do */ + for (a = attributes; a; a = TREE_CHAIN (a)) + { + tree name = TREE_PURPOSE (a); + if (TREE_CODE (name) == IDENTIFIER_NODE) + if (is_attribute_p ("deprecated", name)) + { + deprecated_state = DEPRECATED_SUPPRESS; + break; + } + if (is_attribute_p ("unavailable", name)) + { + deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; + break; + } + } +#endif + /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ attributes = chainon (attributes, prefix_attributes); @@ -7274,6 +7307,19 @@ grokdeclarator (const cp_declarator *dec type = NULL_TREE; type_was_error_mark_node = true; } + + /* APPLE LOCAL begin unavailable attribute (radar 2809697) --bowdidge */ + /* If the entire declaration is itself tagged as unavailable then + suppress reports of unavailable/deprecated items. If the + entire declaration is tagged as only deprecated we still + report unavailable uses. */ + if (type && TREE_DEPRECATED (type) && TREE_UNAVAILABLE (type)) + { + if (deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS) + warn_deprecated_use (type); + } + else + /* APPLE LOCAL end unavailable attribute (radar 2809697) --bowdidge */ /* If the entire declaration is itself tagged as deprecated then suppress reports of deprecated items. */ if (type && TREE_DEPRECATED (type) Modified: stable/10/contrib/gcc/cp/dump.c ============================================================================== --- stable/10/contrib/gcc/cp/dump.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/dump.c Mon Jan 20 19:37:38 2014 (r260918) @@ -433,6 +433,9 @@ cp_dump_tree (void* dump_info, tree t) dump_stmt (di, t); dump_child ("body", DO_BODY (t)); dump_child ("cond", DO_COND (t)); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + dump_child ("attrs", DO_ATTRIBUTES (t)); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ break; case FOR_STMT: @@ -441,6 +444,9 @@ cp_dump_tree (void* dump_info, tree t) dump_child ("cond", FOR_COND (t)); dump_child ("expr", FOR_EXPR (t)); dump_child ("body", FOR_BODY (t)); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + dump_child ("attrs", FOR_ATTRIBUTES (t)); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ break; case SWITCH_STMT: @@ -453,6 +459,9 @@ cp_dump_tree (void* dump_info, tree t) dump_stmt (di, t); dump_child ("cond", WHILE_COND (t)); dump_child ("body", WHILE_BODY (t)); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + dump_child ("attrs", WHILE_ATTRIBUTES (t)); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ break; case STMT_EXPR: Modified: stable/10/contrib/gcc/cp/init.c ============================================================================== --- stable/10/contrib/gcc/cp/init.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/init.c Mon Jan 20 19:37:38 2014 (r260918) @@ -2563,7 +2563,9 @@ build_vec_init (tree base, tree maxindex tree elt_init; tree to; - for_stmt = begin_for_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + for_stmt = begin_for_stmt (NULL_TREE); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ finish_for_init_stmt (for_stmt); finish_for_cond (build2 (NE_EXPR, boolean_type_node, iterator, build_int_cst (TREE_TYPE (iterator), -1)), Modified: stable/10/contrib/gcc/cp/parser.c ============================================================================== --- stable/10/contrib/gcc/cp/parser.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/parser.c Mon Jan 20 19:37:38 2014 (r260918) @@ -6787,6 +6787,16 @@ cp_parser_condition (cp_parser* parser) for ( for-init-statement condition [opt] ; expression [opt] ) statement + APPLE LOCAL begin for-fsf-4_4 3274130 5295549 + GNU extension: + + while attributes [opt] ( condition ) statement + do attributes [opt] statement while ( expression ) ; + for attributes [opt] + ( for-init-statement condition [opt] ; expression [opt] ) + statement + + APPLE LOCAL end for-fsf-4_4 3274130 5295549 Returns the new WHILE_STMT, DO_STMT, or FOR_STMT. */ static tree @@ -6794,10 +6804,14 @@ cp_parser_iteration_statement (cp_parser { cp_token *token; enum rid keyword; - tree statement; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree statement, attributes; +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ unsigned char in_statement; - /* Peek at the next token. */ +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + /* Get the keyword at the start of the loop. */ +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement"); if (!token) return error_mark_node; @@ -6806,6 +6820,11 @@ cp_parser_iteration_statement (cp_parser statement. */ in_statement = parser->in_statement; +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + /* Parse the attributes, if any. */ + attributes = cp_parser_attributes_opt (parser); + +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* See what kind of keyword it is. */ keyword = token->keyword; switch (keyword) @@ -6815,7 +6834,9 @@ cp_parser_iteration_statement (cp_parser tree condition; /* Begin the while-statement. */ - statement = begin_while_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + statement = begin_while_stmt (attributes); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* Look for the `('. */ cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); /* Parse the condition. */ @@ -6837,7 +6858,9 @@ cp_parser_iteration_statement (cp_parser tree expression; /* Begin the do-statement. */ - statement = begin_do_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + statement = begin_do_stmt (attributes); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* Parse the body of the do-statement. */ parser->in_statement = IN_ITERATION_STMT; cp_parser_implicitly_scoped_statement (parser, NULL); @@ -6864,7 +6887,9 @@ cp_parser_iteration_statement (cp_parser tree expression = NULL_TREE; /* Begin the for-statement. */ - statement = begin_for_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + statement = begin_for_stmt (attributes); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ /* Look for the `('. */ cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); /* Parse the initialization. */ Modified: stable/10/contrib/gcc/cp/pt.c ============================================================================== --- stable/10/contrib/gcc/cp/pt.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/pt.c Mon Jan 20 19:37:38 2014 (r260918) @@ -8593,8 +8593,11 @@ tsubst_expr (tree t, tree args, tsubst_f } case FOR_STMT: - stmt = begin_for_stmt (); - RECUR (FOR_INIT_STMT (t)); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tmp = RECUR (FOR_ATTRIBUTES (t)); + stmt = begin_for_stmt (tmp); + RECUR (FOR_INIT_STMT (t)); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ finish_for_init_stmt (stmt); tmp = RECUR (FOR_COND (t)); finish_for_cond (tmp, stmt); @@ -8605,7 +8608,10 @@ tsubst_expr (tree t, tree args, tsubst_f break; case WHILE_STMT: - stmt = begin_while_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tmp = RECUR (WHILE_ATTRIBUTES (t)); + stmt = begin_while_stmt (tmp); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ tmp = RECUR (WHILE_COND (t)); finish_while_stmt_cond (tmp, stmt); RECUR (WHILE_BODY (t)); @@ -8613,7 +8619,10 @@ tsubst_expr (tree t, tree args, tsubst_f break; case DO_STMT: - stmt = begin_do_stmt (); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tmp = RECUR (DO_ATTRIBUTES (t)); + stmt = begin_do_stmt (tmp); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ RECUR (DO_BODY (t)); finish_do_body (stmt); tmp = RECUR (DO_COND (t)); Modified: stable/10/contrib/gcc/cp/semantics.c ============================================================================== --- stable/10/contrib/gcc/cp/semantics.c Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/cp/semantics.c Mon Jan 20 19:37:38 2014 (r260918) @@ -704,10 +704,14 @@ finish_if_stmt (tree if_stmt) appropriate. */ tree -begin_while_stmt (void) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +begin_while_stmt (tree attribs) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { tree r; - r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE, attribs); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ add_stmt (r); WHILE_BODY (r) = do_pushlevel (sk_block); begin_cond (&WHILE_COND (r)); @@ -737,9 +741,14 @@ finish_while_stmt (tree while_stmt) appropriate. */ tree -begin_do_stmt (void) -{ - tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +begin_do_stmt (tree attribs) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ +{ + /* APPLE LOCAL radar 4445586 */ +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE, attribs, NULL_TREE); +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ add_stmt (r); DO_BODY (r) = push_stmt_list (); return r; @@ -803,12 +812,17 @@ finish_return_stmt (tree expr) /* Begin a for-statement. Returns a new FOR_STMT if appropriate. */ tree -begin_for_stmt (void) +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ +begin_for_stmt (tree attribs) +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { tree r; r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE, - NULL_TREE, NULL_TREE); +/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ + NULL_TREE, NULL_TREE, attribs); + +/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ if (flag_new_for_scope > 0) TREE_CHAIN (r) = do_pushlevel (sk_for); Modified: stable/10/contrib/gcc/doc/extend.texi ============================================================================== --- stable/10/contrib/gcc/doc/extend.texi Mon Jan 20 18:59:07 2014 (r260917) +++ stable/10/contrib/gcc/doc/extend.texi Mon Jan 20 19:37:38 2014 (r260918) @@ -58,6 +58,9 @@ extensions, accepted by GCC in C89 mode * Character Escapes:: @samp{\e} stands for the character @key{ESC}. * Variable Attributes:: Specifying attributes of variables. * Type Attributes:: Specifying attributes of types. +@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549 +* Label Attributes:: Specifying attributes of labels and statements. +@c APPLE LOCAL end for-fsf-4_4 3274130 5295549 * Alignment:: Inquiring about the alignment of a type or variable. * Inline:: Defining inline functions (as fast as macros). * Extended Asm:: Assembler instructions with C expressions as operands. @@ -1587,8 +1590,11 @@ attributes are currently defined for fun @code{gnu_inline} and @code{externally_visible}. Several other attributes are defined for functions on particular target systems. Other *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 20:33:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76234E64; Mon, 20 Jan 2014 20:33:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 61BC0180B; Mon, 20 Jan 2014 20:33:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KKXf3r060789; Mon, 20 Jan 2014 20:33:41 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KKXf3E060788; Mon, 20 Jan 2014 20:33:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201401202033.s0KKXf3E060788@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 20 Jan 2014 20:33:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260924 - stable/10/usr.bin/script X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 20:33:41 -0000 Author: trociny Date: Mon Jan 20 20:33:40 2014 New Revision: 260924 URL: http://svnweb.freebsd.org/changeset/base/260924 Log: MFC r260833: Bring back r226403, the fix for bin/161526, which was (accidentally?) reverted in r238896. PR: bin/161526 Reported by: Karli.Sjoberg slu.se Modified: stable/10/usr.bin/script/script.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/script/script.c ============================================================================== --- stable/10/usr.bin/script/script.c Mon Jan 20 20:28:04 2014 (r260923) +++ stable/10/usr.bin/script/script.c Mon Jan 20 20:33:40 2014 (r260924) @@ -235,12 +235,15 @@ main(int argc, char *argv[]) FD_SET(master, &rfd); if (readstdin) FD_SET(STDIN_FILENO, &rfd); - if ((!readstdin && ttyflg) || flushtime > 0) { - tv.tv_sec = !readstdin && ttyflg ? 1 : - flushtime - (tvec - start); + if (!readstdin && ttyflg) { + tv.tv_sec = 1; tv.tv_usec = 0; tvp = &tv; readstdin = 1; + } else if (flushtime > 0) { + tv.tv_sec = flushtime - (tvec - start); + tv.tv_usec = 0; + tvp = &tv; } else { tvp = NULL; } From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 21:50:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97825A21; Mon, 20 Jan 2014 21:50:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8C41F1E; Mon, 20 Jan 2014 21:50:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KLoWRu002288; Mon, 20 Jan 2014 21:50:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KLoVjp002282; Mon, 20 Jan 2014 21:50:31 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401202150.s0KLoVjp002282@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 20 Jan 2014 21:50:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260932 - stable/10/contrib/gcc/cp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 21:50:32 -0000 Author: pfg Date: Mon Jan 20 21:50:31 2014 New Revision: 260932 URL: http://svnweb.freebsd.org/changeset/base/260932 Log: MFC r260332; gcc: backport some fixes from llvm-gcc llvm-gcc backported some patches from gcc trunk: http://gcc.gnu.org/ml/gcc-cvs/2007-05/msg00662.html http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00019.html http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00240.html http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00493.html The first two were always GPL2. The last two were added after the GPL3 transition, but were written by aaw@google.com and Rafael Espíndola got permission to relicense them under the GPL2 for inclusion in llvm-gcc. This fixes GCC-PR c++/31749 Obtained from: llvm-gcc (rev. 75463; GPLv2) Modified: stable/10/contrib/gcc/cp/ChangeLog.gcc43 stable/10/contrib/gcc/cp/decl.c stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/parser.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/cp/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/cp/ChangeLog.gcc43 Mon Jan 20 21:50:06 2014 (r260931) +++ stable/10/contrib/gcc/cp/ChangeLog.gcc43 Mon Jan 20 21:50:31 2014 (r260932) @@ -7,6 +7,17 @@ * typeck.c (cxx_alignof_expr): When alignof is used on a plain FUNCTION_DECL, return its alignment. +2007-07-01 Ollie Wild (r126177) + + * name-lookup.c (ambiguous_decl): Fix case when new->value is hidden. + (select_decl): Remove function. + (unqualified_namespace_lookup): Populate binding by calling + ambiguous_decl. Remove select_decl call. + (lookup_qualified_name): Remove select_decl call. + * decl.c (lookup_and_check_tag): Check for ambiguous references. + * parser.c (cp_parser_elaborated_type_specifier): Skip redundant error + generation when name lookup is ambiguous. + 2007-06-28 Geoffrey Keating (r126088) * decl2.c (determine_visibility): Implement @@ -29,6 +40,11 @@ * typeck.c (build_binary_op): Include types in error. +2007-05-22 Ollie Wild (r124963) + + * name-lookup.c (ambiguous_decl): Adds check for hidden types. + (unqualified_namespace_lookup): Adds check for hidden types. + 2007-05-18 Geoffrey Keating (r124839) * mangle.c (write_real_cst): Use 'unsigned long' for %lx. Modified: stable/10/contrib/gcc/cp/decl.c ============================================================================== --- stable/10/contrib/gcc/cp/decl.c Mon Jan 20 21:50:06 2014 (r260931) +++ stable/10/contrib/gcc/cp/decl.c Mon Jan 20 21:50:31 2014 (r260932) @@ -9784,6 +9784,12 @@ lookup_and_check_tag (enum tag_types tag | DECL_SELF_REFERENCE_P (decl)); return t; } + else if (decl && TREE_CODE (decl) == TREE_LIST) + { + error ("reference to %qD is ambiguous", name); + print_candidates (decl); + return error_mark_node; + } else return NULL_TREE; } Modified: stable/10/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/10/contrib/gcc/cp/name-lookup.c Mon Jan 20 21:50:06 2014 (r260931) +++ stable/10/contrib/gcc/cp/name-lookup.c Mon Jan 20 21:50:31 2014 (r260932) @@ -42,7 +42,6 @@ struct scope_binding { #define EMPTY_SCOPE_BINDING { NULL_TREE, NULL_TREE } static cxx_scope *innermost_nonclass_level (void); -static tree select_decl (const struct scope_binding *, int); static cxx_binding *binding_for_name (cxx_scope *, tree); static tree lookup_name_innermost_nonclass_level (tree); static tree push_overloaded_decl (tree, int, bool); @@ -2100,6 +2099,22 @@ do_nonmember_using_decl (tree scope, tre return; } + /* LLVM LOCAL begin mainline */ + /* Shift the old and new bindings around so we're comparing class and + enumeration names to each other. */ + if (oldval && DECL_IMPLICIT_TYPEDEF_P (oldval)) + { + oldtype = oldval; + oldval = NULL_TREE; + } + + if (decls.value && DECL_IMPLICIT_TYPEDEF_P (decls.value)) + { + decls.type = decls.value; + decls.value = NULL_TREE; + } + /* LLVM LOCAL end mainline */ + /* It is impossible to overload a built-in function; any explicit declaration eliminates the built-in declaration. So, if OLDVAL is a built-in, then we can just pretend it isn't there. */ @@ -2109,95 +2124,112 @@ do_nonmember_using_decl (tree scope, tre && !DECL_HIDDEN_FRIEND_P (oldval)) oldval = NULL_TREE; - /* Check for using functions. */ - if (decls.value && is_overloaded_fn (decls.value)) + /* LLVM LOCAL begin mainline */ + if (decls.value) { - tree tmp, tmp1; - - if (oldval && !is_overloaded_fn (oldval)) - { - if (!DECL_IMPLICIT_TYPEDEF_P (oldval)) - error ("%qD is already declared in this scope", name); - oldval = NULL_TREE; - } - - *newval = oldval; - for (tmp = decls.value; tmp; tmp = OVL_NEXT (tmp)) + /* Check for using functions. */ + if (is_overloaded_fn (decls.value)) { - tree new_fn = OVL_CURRENT (tmp); + tree tmp, tmp1; - /* [namespace.udecl] + if (oldval && !is_overloaded_fn (oldval)) + { + error ("%qD is already declared in this scope", name); + oldval = NULL_TREE; + } - If a function declaration in namespace scope or block - scope has the same name and the same parameter types as a - function introduced by a using declaration the program is - ill-formed. */ - for (tmp1 = oldval; tmp1; tmp1 = OVL_NEXT (tmp1)) + *newval = oldval; + for (tmp = decls.value; tmp; tmp = OVL_NEXT (tmp)) { - tree old_fn = OVL_CURRENT (tmp1); + tree new_fn = OVL_CURRENT (tmp); - if (new_fn == old_fn) - /* The function already exists in the current namespace. */ - break; - else if (OVL_USED (tmp1)) - continue; /* this is a using decl */ - else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), - TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) + /* [namespace.udecl] + + If a function declaration in namespace scope or block + scope has the same name and the same parameter types as a + function introduced by a using declaration the program is + ill-formed. */ + for (tmp1 = oldval; tmp1; tmp1 = OVL_NEXT (tmp1)) { - gcc_assert (!DECL_ANTICIPATED (old_fn) - || DECL_HIDDEN_FRIEND_P (old_fn)); + tree old_fn = OVL_CURRENT (tmp1); - /* There was already a non-using declaration in - this scope with the same parameter types. If both - are the same extern "C" functions, that's ok. */ - if (decls_match (new_fn, old_fn)) + if (new_fn == old_fn) + /* The function already exists in the current namespace. */ break; - else + else if (OVL_USED (tmp1)) + continue; /* this is a using decl */ + else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), + TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) { - error ("%qD is already declared in this scope", name); - break; + gcc_assert (!DECL_ANTICIPATED (old_fn) + || DECL_HIDDEN_FRIEND_P (old_fn)); + + /* There was already a non-using declaration in + this scope with the same parameter types. If both + are the same extern "C" functions, that's ok. */ + if (decls_match (new_fn, old_fn)) + break; + else + { + error ("%qD is already declared in this scope", name); + break; + } } } - } - /* If we broke out of the loop, there's no reason to add - this function to the using declarations for this - scope. */ - if (tmp1) - continue; - - /* If we are adding to an existing OVERLOAD, then we no - longer know the type of the set of functions. */ - if (*newval && TREE_CODE (*newval) == OVERLOAD) - TREE_TYPE (*newval) = unknown_type_node; - /* Add this new function to the set. */ - *newval = build_overload (OVL_CURRENT (tmp), *newval); - /* If there is only one function, then we use its type. (A - using-declaration naming a single function can be used in - contexts where overload resolution cannot be - performed.) */ - if (TREE_CODE (*newval) != OVERLOAD) - { - *newval = ovl_cons (*newval, NULL_TREE); - TREE_TYPE (*newval) = TREE_TYPE (OVL_CURRENT (tmp)); + /* If we broke out of the loop, there's no reason to add + this function to the using declarations for this + scope. */ + if (tmp1) + continue; + + /* If we are adding to an existing OVERLOAD, then we no + longer know the type of the set of functions. */ + if (*newval && TREE_CODE (*newval) == OVERLOAD) + TREE_TYPE (*newval) = unknown_type_node; + /* Add this new function to the set. */ + *newval = build_overload (OVL_CURRENT (tmp), *newval); + /* If there is only one function, then we use its type. (A + using-declaration naming a single function can be used in + contexts where overload resolution cannot be + performed.) */ + if (TREE_CODE (*newval) != OVERLOAD) + { + *newval = ovl_cons (*newval, NULL_TREE); + TREE_TYPE (*newval) = TREE_TYPE (OVL_CURRENT (tmp)); + } + OVL_USED (*newval) = 1; } - OVL_USED (*newval) = 1; + } + else + { + *newval = decls.value; + if (oldval && !decls_match (*newval, oldval)) + error ("%qD is already declared in this scope", name); } } else + *newval = oldval; + + if (decls.type && TREE_CODE (decls.type) == TREE_LIST) { - *newval = decls.value; - if (oldval && !decls_match (*newval, oldval)) - error ("%qD is already declared in this scope", name); + error ("reference to %qD is ambiguous", name); + print_candidates (decls.type); } - - *newtype = decls.type; - if (oldtype && *newtype && !same_type_p (oldtype, *newtype)) + else { - error ("using declaration %qD introduced ambiguous type %qT", - name, oldtype); - return; + *newtype = decls.type; + if (oldtype && *newtype && !decls_match (oldtype, *newtype)) + error ("%qD is already declared in this scope", name); } + + /* If *newval is empty, shift any class or enumeration name down. */ + if (!*newval) + { + *newval = *newtype; + *newtype = NULL_TREE; + } + /* LLVM LOCAL end mainline */ } /* Process a using-declaration at function scope. */ @@ -3491,43 +3523,63 @@ merge_functions (tree s1, tree s2) XXX In what way should I treat extern declarations? XXX I don't want to repeat the entire duplicate_decls here */ +/* LLVM LOCAL begin mainline */ static void -ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new, - int flags) +ambiguous_decl (struct scope_binding *old, cxx_binding *new, int flags) { tree val, type; gcc_assert (old != NULL); + + /* Copy the type. */ + type = new->type; + if (LOOKUP_NAMESPACES_ONLY (flags) + || (type && hidden_name_p (type) && !(flags & LOOKUP_HIDDEN))) + type = NULL_TREE; + /* Copy the value. */ val = new->value; if (val) - switch (TREE_CODE (val)) - { - case TEMPLATE_DECL: - /* If we expect types or namespaces, and not templates, - or this is not a template class. */ - if ((LOOKUP_QUALIFIERS_ONLY (flags) - && !DECL_CLASS_TEMPLATE_P (val)) - || hidden_name_p (val)) - val = NULL_TREE; - break; - case TYPE_DECL: - if (LOOKUP_NAMESPACES_ONLY (flags) || hidden_name_p (val)) - val = NULL_TREE; - break; - case NAMESPACE_DECL: - if (LOOKUP_TYPES_ONLY (flags)) - val = NULL_TREE; - break; - case FUNCTION_DECL: - /* Ignore built-in functions that are still anticipated. */ - if (LOOKUP_QUALIFIERS_ONLY (flags) || hidden_name_p (val)) - val = NULL_TREE; - break; - default: - if (LOOKUP_QUALIFIERS_ONLY (flags)) - val = NULL_TREE; - } + { + if (hidden_name_p (val) && !(flags & LOOKUP_HIDDEN)) + val = NULL_TREE; + else + switch (TREE_CODE (val)) + { + case TEMPLATE_DECL: + /* If we expect types or namespaces, and not templates, + or this is not a template class. */ + if ((LOOKUP_QUALIFIERS_ONLY (flags) + && !DECL_CLASS_TEMPLATE_P (val))) + val = NULL_TREE; + break; + case TYPE_DECL: + if (LOOKUP_NAMESPACES_ONLY (flags) + || (type && (flags & LOOKUP_PREFER_TYPES))) + val = NULL_TREE; + break; + case NAMESPACE_DECL: + if (LOOKUP_TYPES_ONLY (flags)) + val = NULL_TREE; + break; + case FUNCTION_DECL: + /* Ignore built-in functions that are still anticipated. */ + if (LOOKUP_QUALIFIERS_ONLY (flags)) + val = NULL_TREE; + break; + default: + if (LOOKUP_QUALIFIERS_ONLY (flags)) + val = NULL_TREE; + } + } + + /* If val is hidden, shift down any class or enumeration name. */ + if (!val) + { + val = type; + type = NULL_TREE; + } +/* LLVM LOCAL end mainline */ if (!old->value) old->value = val; else if (val && val != old->value) @@ -3537,25 +3589,21 @@ ambiguous_decl (tree name, struct scope_ else { old->value = tree_cons (NULL_TREE, old->value, - build_tree_list (NULL_TREE, new->value)); + build_tree_list (NULL_TREE, val)); TREE_TYPE (old->value) = error_mark_node; } } - /* ... and copy the type. */ - type = new->type; - if (LOOKUP_NAMESPACES_ONLY (flags)) - type = NULL_TREE; + + /* LLVM LOCAL begin mainline */ if (!old->type) old->type = type; else if (type && old->type != type) { - if (flags & LOOKUP_COMPLAIN) - { - error ("%qD denotes an ambiguous type",name); - error ("%J first type here", TYPE_MAIN_DECL (old->type)); - error ("%J other type here", TYPE_MAIN_DECL (type)); - } + old->type = tree_cons (NULL_TREE, old->type, + build_tree_list (NULL_TREE, type)); + TREE_TYPE (old->type) = error_mark_node; } + /* LLVM LOCAL end mainline */ } /* Return the declarations that are members of the namespace NS. */ @@ -3644,36 +3692,6 @@ remove_hidden_names (tree fns) return fns; } -/* Select the right _DECL from multiple choices. */ - -static tree -select_decl (const struct scope_binding *binding, int flags) -{ - tree val; - val = binding->value; - - timevar_push (TV_NAME_LOOKUP); - if (LOOKUP_NAMESPACES_ONLY (flags)) - { - /* We are not interested in types. */ - if (val && (TREE_CODE (val) == NAMESPACE_DECL - || TREE_CODE (val) == TREE_LIST)) - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); - } - - /* If looking for a type, or if there is no non-type binding, select - the value binding. */ - if (binding->type && (!val || (flags & LOOKUP_PREFER_TYPES))) - val = binding->type; - /* Don't return non-types if we really prefer types. */ - else if (val && LOOKUP_TYPES_ONLY (flags) - && ! DECL_DECLARES_TYPE_P (val)) - val = NULL_TREE; - - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val); -} - /* Unscoped lookup of a global: iterate over current namespaces, considering using-directives. */ @@ -3685,22 +3703,18 @@ unqualified_namespace_lookup (tree name, tree siter; struct cp_binding_level *level; tree val = NULL_TREE; - struct scope_binding binding = EMPTY_SCOPE_BINDING; timevar_push (TV_NAME_LOOKUP); for (; !val; scope = CP_DECL_CONTEXT (scope)) { + struct scope_binding binding = EMPTY_SCOPE_BINDING; cxx_binding *b = cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name); if (b) - { - if (b->value - && ((flags & LOOKUP_HIDDEN) || !hidden_name_p (b->value))) - binding.value = b->value; - binding.type = b->type; - } + /* LLVM LOCAL mainline */ + ambiguous_decl (&binding, b, flags); /* Add all _DECLs seen through local using-directives. */ for (level = current_binding_level; @@ -3725,7 +3739,7 @@ unqualified_namespace_lookup (tree name, siter = CP_DECL_CONTEXT (siter); } - val = select_decl (&binding, flags); + val = binding.value; if (scope == global_namespace) break; } @@ -3755,7 +3769,7 @@ lookup_qualified_name (tree scope, tree if (is_type_p) flags |= LOOKUP_PREFER_TYPES; if (qualified_lookup_using_namespace (name, scope, &binding, flags)) - t = select_decl (&binding, flags); + t = binding.value; } else if (is_aggr_type (scope, complain)) t = lookup_member (scope, name, 2, is_type_p); @@ -3788,7 +3802,8 @@ lookup_using_namespace (tree name, struc cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (used), name); /* Resolve ambiguities. */ if (val1) - ambiguous_decl (name, val, val1, flags); + /* LLVM LOCAL mainline */ + ambiguous_decl (val, val1, flags); } POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val->value != error_mark_node); } @@ -3817,7 +3832,8 @@ qualified_lookup_using_namespace (tree n cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name); seen = tree_cons (scope, NULL_TREE, seen); if (binding) - ambiguous_decl (name, result, binding, flags); + /* LLVM LOCAL mainline */ + ambiguous_decl (result, binding, flags); /* Consider strong using directives always, and non-strong ones if we haven't found a binding yet. ??? Shouldn't we consider Modified: stable/10/contrib/gcc/cp/parser.c ============================================================================== --- stable/10/contrib/gcc/cp/parser.c Mon Jan 20 21:50:06 2014 (r260931) +++ stable/10/contrib/gcc/cp/parser.c Mon Jan 20 21:50:31 2014 (r260932) @@ -10337,13 +10337,19 @@ cp_parser_elaborated_type_specifier (cp_ if (parser->scope) { tree decl; + tree ambiguous_decls; decl = cp_parser_lookup_name (parser, identifier, tag_type, /*is_template=*/false, /*is_namespace=*/false, /*check_dependency=*/true, - /*ambiguous_decls=*/NULL); + &ambiguous_decls); + + /* If the lookup was ambiguous, an error will already have been + issued. */ + if (ambiguous_decls) + return error_mark_node; /* If we are parsing friend declaration, DECL may be a TEMPLATE_DECL tree node here. However, we need to check From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 21:58:20 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4443EE6; Mon, 20 Jan 2014 21:58:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AF7FA1FC1; Mon, 20 Jan 2014 21:58:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KLwKBm004716; Mon, 20 Jan 2014 21:58:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KLwKTc004715; Mon, 20 Jan 2014 21:58:20 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401202158.s0KLwKTc004715@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 20 Jan 2014 21:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260935 - stable/10/contrib/gcc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 21:58:20 -0000 Author: pfg Date: Mon Jan 20 21:58:20 2014 New Revision: 260935 URL: http://svnweb.freebsd.org/changeset/base/260935 Log: MFC r259531; gcc: point to our address for bug reports. As recommended by the FSF in gcc/version.c : "If you distribute a modified version of GCC, please change this to refer to a document giving instructions for reporting bugs to you, not us." Modified: stable/10/contrib/gcc/version.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/version.c ============================================================================== --- stable/10/contrib/gcc/version.c Mon Jan 20 21:54:05 2014 (r260934) +++ stable/10/contrib/gcc/version.c Mon Jan 20 21:58:20 2014 (r260935) @@ -18,7 +18,7 @@ forward us bugs reported to you, if you determine that they are not bugs in your modifications.) */ -const char bug_report_url[] = ""; +const char bug_report_url[] = ""; /* The complete version string, assembled from several pieces. BASEVER, DATESTAMP, and DEVPHASE are defined by the Makefile. */ From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 22:32:24 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36CE9B23; Mon, 20 Jan 2014 22:32:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 225A11287; Mon, 20 Jan 2014 22:32:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KMWOtI019900; Mon, 20 Jan 2014 22:32:24 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KMWNXC019899; Mon, 20 Jan 2014 22:32:23 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201401202232.s0KMWNXC019899@svn.freebsd.org> From: Glen Barber Date: Mon, 20 Jan 2014 22:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260940 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 22:32:24 -0000 Author: gjb Date: Mon Jan 20 22:32:23 2014 New Revision: 260940 URL: http://svnweb.freebsd.org/changeset/base/260940 Log: Add UPDATING entry for 10.0-RELEASE. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Mon Jan 20 22:25:50 2014 (r260939) +++ stable/10/UPDATING Mon Jan 20 22:32:23 2014 (r260940) @@ -16,6 +16,9 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20140120: + 10.0-RELEASE. + 20131216: The behavior of gss_pseudo_random() for the krb5 mechanism has changed, for applications requesting a longer random string From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 23:23:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D8C9513; Mon, 20 Jan 2014 23:23:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2971716B9; Mon, 20 Jan 2014 23:23:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KNNUSj040352; Mon, 20 Jan 2014 23:23:30 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KNNU0g040351; Mon, 20 Jan 2014 23:23:30 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201401202323.s0KNNU0g040351@svn.freebsd.org> From: Warren Block Date: Mon, 20 Jan 2014 23:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260947 - stable/10/bin/df X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 23:23:30 -0000 Author: wblock (doc committer) Date: Mon Jan 20 23:23:29 2014 New Revision: 260947 URL: http://svnweb.freebsd.org/changeset/base/260947 Log: MFC r260782: -h and -H options backwards in manual page. Modified: stable/10/bin/df/df.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/df/df.1 ============================================================================== --- stable/10/bin/df/df.1 Mon Jan 20 23:12:12 2014 (r260946) +++ stable/10/bin/df/df.1 Mon Jan 20 23:23:29 2014 (r260947) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd January 24, 2013 +.Dd January 16, 2014 .Dt DF 1 .Os .Sh NAME @@ -83,13 +83,13 @@ Use 1073741824 byte (1 Gibibyte) blocks This overrides any .Ev BLOCKSIZE specification from the environment. -.It Fl H +.It Fl h .Dq Human-readable output. Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to reduce the number of digits to four or fewer. -.It Fl h +.It Fl H .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, From owner-svn-src-stable-10@FreeBSD.ORG Mon Jan 20 23:56:49 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B35B1338; Mon, 20 Jan 2014 23:56:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9BD1986; Mon, 20 Jan 2014 23:56:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KNun2Q053213; Mon, 20 Jan 2014 23:56:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0KNunlP053212; Mon, 20 Jan 2014 23:56:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401202356.s0KNunlP053212@svn.freebsd.org> From: Alexander Motin Date: Mon, 20 Jan 2014 23:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260958 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 23:56:49 -0000 Author: mav Date: Mon Jan 20 23:56:49 2014 New Revision: 260958 URL: http://svnweb.freebsd.org/changeset/base/260958 Log: MFC r260407: Allow delete_method sysctl to be set to "DISABLE". Modified: stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Mon Jan 20 23:52:28 2014 (r260957) +++ stable/10/sys/cam/scsi/scsi_da.c Mon Jan 20 23:56:49 2014 (r260958) @@ -1959,7 +1959,7 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS char buf[16]; const char *p; struct da_softc *softc; - int i, error, value; + int i, error, methods, value; softc = (struct da_softc *)arg1; @@ -1972,8 +1972,9 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) return (error); + methods = softc->delete_available | (1 << DA_DELETE_DISABLE); for (i = 0; i <= DA_DELETE_MAX; i++) { - if (!(softc->delete_available & (1 << i)) || + if (!(methods & (1 << i)) || strcmp(buf, da_delete_method_names[i]) != 0) continue; dadeletemethodset(softc, i); From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 21 09:19:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31C33D10; Tue, 21 Jan 2014 09:19:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1C92416B9; Tue, 21 Jan 2014 09:19:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0L9JTdw079363; Tue, 21 Jan 2014 09:19:29 GMT (envelope-from marck@svn.freebsd.org) Received: (from marck@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0L9JT9l079358; Tue, 21 Jan 2014 09:19:29 GMT (envelope-from marck@svn.freebsd.org) Message-Id: <201401210919.s0L9JT9l079358@svn.freebsd.org> From: Dmitry Morozovsky Date: Tue, 21 Jan 2014 09:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260980 - in stable/10/sys: geom/part sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 09:19:30 -0000 Author: marck (doc committer) Date: Tue Jan 21 09:19:28 2014 New Revision: 260980 URL: http://svnweb.freebsd.org/changeset/base/260980 Log: MFC r259925-259926: Add GPT UUID for VMware vSAN meta-data partition. Approved by: ae Modified: stable/10/sys/geom/part/g_part.c stable/10/sys/geom/part/g_part.h stable/10/sys/geom/part/g_part_gpt.c stable/10/sys/sys/gpt.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/part/g_part.c ============================================================================== --- stable/10/sys/geom/part/g_part.c Tue Jan 21 09:01:08 2014 (r260979) +++ stable/10/sys/geom/part/g_part.c Tue Jan 21 09:19:28 2014 (r260980) @@ -107,6 +107,7 @@ struct g_part_alias_list { { "vmware-vmfs", G_PART_ALIAS_VMFS }, { "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG }, { "vmware-reserved", G_PART_ALIAS_VMRESERVED }, + { "vmware-vsanhdr", G_PART_ALIAS_VMVSANHDR }, }; SYSCTL_DECL(_kern_geom); Modified: stable/10/sys/geom/part/g_part.h ============================================================================== --- stable/10/sys/geom/part/g_part.h Tue Jan 21 09:01:08 2014 (r260979) +++ stable/10/sys/geom/part/g_part.h Tue Jan 21 09:19:28 2014 (r260980) @@ -74,6 +74,7 @@ enum g_part_alias { G_PART_ALIAS_VMFS, /* A VMware VMFS partition entry */ G_PART_ALIAS_VMKDIAG, /* A VMware vmkDiagnostic partition entry */ G_PART_ALIAS_VMRESERVED, /* A VMware reserved partition entry */ + G_PART_ALIAS_VMVSANHDR, /* A VMware vSAN header partition entry */ /* Keep the following last */ G_PART_ALIAS_COUNT }; Modified: stable/10/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/10/sys/geom/part/g_part_gpt.c Tue Jan 21 09:01:08 2014 (r260979) +++ stable/10/sys/geom/part/g_part_gpt.c Tue Jan 21 09:19:28 2014 (r260980) @@ -167,6 +167,7 @@ static struct uuid gpt_uuid_linux_swap = static struct uuid gpt_uuid_vmfs = GPT_ENT_TYPE_VMFS; static struct uuid gpt_uuid_vmkdiag = GPT_ENT_TYPE_VMKDIAG; static struct uuid gpt_uuid_vmreserved = GPT_ENT_TYPE_VMRESERVED; +static struct uuid gpt_uuid_vmvsanhdr = GPT_ENT_TYPE_VMVSANHDR; static struct uuid gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; static struct uuid gpt_uuid_ms_reserved = GPT_ENT_TYPE_MS_RESERVED; static struct uuid gpt_uuid_ms_ldm_data = GPT_ENT_TYPE_MS_LDM_DATA; @@ -208,6 +209,7 @@ static struct g_part_uuid_alias { { &gpt_uuid_vmfs, G_PART_ALIAS_VMFS, 0 }, { &gpt_uuid_vmkdiag, G_PART_ALIAS_VMKDIAG, 0 }, { &gpt_uuid_vmreserved, G_PART_ALIAS_VMRESERVED, 0 }, + { &gpt_uuid_vmvsanhdr, G_PART_ALIAS_VMVSANHDR, 0 }, { &gpt_uuid_mbr, G_PART_ALIAS_MBR, 0 }, { &gpt_uuid_ms_basic_data, G_PART_ALIAS_MS_BASIC_DATA, 0x0b }, { &gpt_uuid_ms_ldm_data, G_PART_ALIAS_MS_LDM_DATA, 0 }, Modified: stable/10/sys/sys/gpt.h ============================================================================== --- stable/10/sys/sys/gpt.h Tue Jan 21 09:01:08 2014 (r260979) +++ stable/10/sys/sys/gpt.h Tue Jan 21 09:19:28 2014 (r260980) @@ -128,6 +128,8 @@ struct gpt_ent { {0x9d275380,0x40ad,0x11db,0xbf,0x97,{0x00,0x0c,0x29,0x11,0xd1,0xb8}} #define GPT_ENT_TYPE_VMRESERVED \ {0x9198effc,0x31c0,0x11db,0x8f,0x78,{0x00,0x0c,0x29,0x11,0xd1,0xb8}} +#define GPT_ENT_TYPE_VMVSANHDR \ + {0x381cfccc,0x7288,0x11e0,0x92,0xee,{0x00,0x0c,0x29,0x11,0xd0,0xb2}} #define GPT_ENT_TYPE_APPLE_BOOT \ {0x426F6F74,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 21 15:58:00 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1EFF1C15; Tue, 21 Jan 2014 15:58:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0A4461B6C; Tue, 21 Jan 2014 15:58:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0LFvxm8034875; Tue, 21 Jan 2014 15:57:59 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0LFvxSa034874; Tue, 21 Jan 2014 15:57:59 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201401211557.s0LFvxSa034874@svn.freebsd.org> From: Glen Barber Date: Tue, 21 Jan 2014 15:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260984 - stable/10/sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 15:58:00 -0000 Author: gjb Date: Tue Jan 21 15:57:59 2014 New Revision: 260984 URL: http://svnweb.freebsd.org/changeset/base/260984 Log: 10.0-RELEASE is out, so call stable/10 -STABLE again. Reminded by: David Wolfskill Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Tue Jan 21 13:23:18 2014 (r260983) +++ stable/10/sys/conf/newvers.sh Tue Jan 21 15:57:59 2014 (r260984) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.0" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 01:35:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DDF1E14; Wed, 22 Jan 2014 01:35:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 193E71E64; Wed, 22 Jan 2014 01:35:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0M1ZUZr077613; Wed, 22 Jan 2014 01:35:30 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0M1ZUUY077612; Wed, 22 Jan 2014 01:35:30 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401220135.s0M1ZUUY077612@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 22 Jan 2014 01:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260998 - stable/10/gnu/lib/libgcc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 01:35:31 -0000 Author: pfg Date: Wed Jan 22 01:35:30 2014 New Revision: 260998 URL: http://svnweb.freebsd.org/changeset/base/260998 Log: MFC r260874: gcc: fix libgcc by adding the bswap builtins for all platforms. This change was missing from r258428 which attempted to add the bswap builtins to gcc. The change is also missing from the patch in gnu/155309. Found by: marcel Modified: stable/10/gnu/lib/libgcc/Makefile Modified: stable/10/gnu/lib/libgcc/Makefile ============================================================================== --- stable/10/gnu/lib/libgcc/Makefile Tue Jan 21 23:45:31 2014 (r260997) +++ stable/10/gnu/lib/libgcc/Makefile Wed Jan 22 01:35:30 2014 (r260998) @@ -34,9 +34,9 @@ OBJS= # added to below in various ways #--------------------------------------------------------------------------- # -# When upgrading GCC, get the following defintions straight from Makefile.in -# # Library members defined in libgcc2.c. +# When upgrading GCC, obtain the following list from mklibgcc.in +# LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \ _cmpdi2 _ucmpdi2 \ _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \ @@ -44,7 +44,7 @@ LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ash _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \ _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \ _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \ - _divxc3 _divtc3 + _divxc3 _divtc3 _bswapsi2 _bswapdi2 .if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm" LIB2FUNCS+= _clear_cache .endif From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 06:27:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11704FC; Wed, 22 Jan 2014 06:27:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F097D1330; Wed, 22 Jan 2014 06:27:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0M6R2jl088826; Wed, 22 Jan 2014 06:27:02 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0M6R2d0088825; Wed, 22 Jan 2014 06:27:02 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201401220627.s0M6R2d0088825@svn.freebsd.org> From: Justin Hibbits Date: Wed, 22 Jan 2014 06:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261002 - stable/10/usr.bin/elfdump X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 06:27:03 -0000 Author: jhibbits Date: Wed Jan 22 06:27:02 2014 New Revision: 261002 URL: http://svnweb.freebsd.org/changeset/base/261002 Log: MFC r260621 Add missing EM_PPC64 to e_machine header display. Modified: stable/10/usr.bin/elfdump/elfdump.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/elfdump/elfdump.c ============================================================================== --- stable/10/usr.bin/elfdump/elfdump.c Wed Jan 22 04:03:11 2014 (r261001) +++ stable/10/usr.bin/elfdump/elfdump.c Wed Jan 22 06:27:02 2014 (r261002) @@ -255,6 +255,7 @@ e_machines(u_int mach) case EM_860: return "EM_860"; case EM_MIPS: return "EM_MIPS"; case EM_PPC: return "EM_PPC"; + case EM_PPC64: return "EM_PPC64"; case EM_ARM: return "EM_ARM"; case EM_ALPHA: return "EM_ALPHA (legacy)"; case EM_SPARCV9:return "EM_SPARCV9"; From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 09:22:39 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD09D10E; Wed, 22 Jan 2014 09:22:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C867E1275; Wed, 22 Jan 2014 09:22:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0M9MdJW058925; Wed, 22 Jan 2014 09:22:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0M9MdK8058924; Wed, 22 Jan 2014 09:22:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401220922.s0M9MdK8058924@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 09:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261009 - stable/10/sys/netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 09:22:40 -0000 Author: glebius Date: Wed Jan 22 09:22:39 2014 New Revision: 261009 URL: http://svnweb.freebsd.org/changeset/base/261009 Log: Merge 260225: Fix circular math macro. PR: 146082 Modified: stable/10/sys/netgraph/ng_l2tp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netgraph/ng_l2tp.c ============================================================================== --- stable/10/sys/netgraph/ng_l2tp.c Wed Jan 22 08:33:32 2014 (r261008) +++ stable/10/sys/netgraph/ng_l2tp.c Wed Jan 22 09:22:39 2014 (r261009) @@ -98,7 +98,7 @@ static MALLOC_DEFINE(M_NETGRAPH_L2TP, "n #define L2TP_ENABLE_DSEQ 1 /* enable data seq # */ /* Compare sequence numbers using circular math */ -#define L2TP_SEQ_DIFF(x, y) ((int)((int16_t)(x) - (int16_t)(y))) +#define L2TP_SEQ_DIFF(x, y) ((int16_t)((x) - (y))) #define SESSHASHSIZE 0x0020 #define SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 09:59:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43A03EC4; Wed, 22 Jan 2014 09:59:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E9AE157B; Wed, 22 Jan 2014 09:59:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0M9xohq071199; Wed, 22 Jan 2014 09:59:50 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0M9xoux071198; Wed, 22 Jan 2014 09:59:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401220959.s0M9xoux071198@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 09:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261015 - stable/10/share/man/man3 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 09:59:50 -0000 Author: glebius Date: Wed Jan 22 09:59:49 2014 New Revision: 261015 URL: http://svnweb.freebsd.org/changeset/base/261015 Log: Merge 257643: Document RB_FOREACH_SAFE() and RB_FOREACH_REVERSE_SAFE(). Modified: stable/10/share/man/man3/tree.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man3/tree.3 ============================================================================== --- stable/10/share/man/man3/tree.3 Wed Jan 22 09:57:26 2014 (r261014) +++ stable/10/share/man/man3/tree.3 Wed Jan 22 09:59:49 2014 (r261015) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2007 +.Dd November 4, 2013 .Dt TREE 3 .Os .Sh NAME @@ -70,7 +70,9 @@ .Nm RB_RIGHT , .Nm RB_PARENT , .Nm RB_FOREACH , +.Nm RB_FOREACH_SAFE , .Nm RB_FOREACH_REVERSE , +.Nm RB_FOREACH_REVERSE_SAFE , .Nm RB_INIT , .Nm RB_INSERT , .Nm RB_REMOVE @@ -135,7 +137,9 @@ .Ft "struct TYPE *" .Fn RB_PARENT "struct TYPE *elm" "RB_ENTRY NAME" .Fn RB_FOREACH VARNAME NAME "RB_HEAD *head" +.Fn RB_FOREACH_SAFE "VARNAME" "NAME" "RB_HEAD *head" "TEMP_VARNAME" .Fn RB_FOREACH_REVERSE VARNAME NAME "RB_HEAD *head" +.Fn RB_FOREACH_REVERSE_SAFE "VARNAME" "NAME" "RB_HEAD *head" "TEMP_VARNAME" .Ft void .Fn RB_INIT "RB_HEAD *head" .Ft "struct TYPE *" @@ -454,6 +458,18 @@ macro: .Fn RB_FOREACH np NAME head .Ed .Pp +The macros +.Fn RB_FOREACH_SAFE +and +.Fn RB_FOREACH_REVERSE_SAFE +traverse the tree referenced by head +in a forward or reverse direction respectively, +assigning each element in turn to np. +However, unlike their unsafe counterparts, +they permit both the removal of np +as well as freeing it from within the loop safely +without interfering with the traversal. +.Pp The .Fn RB_EMPTY macro should be used to check whether a red-black tree is empty. From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:01:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CCED26B; Wed, 22 Jan 2014 10:01:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B914C158D; Wed, 22 Jan 2014 10:01:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MA1Dtv072108; Wed, 22 Jan 2014 10:01:13 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MA1DY3072107; Wed, 22 Jan 2014 10:01:13 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221001.s0MA1DY3072107@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:01:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261016 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:01:13 -0000 Author: glebius Date: Wed Jan 22 10:01:13 2014 New Revision: 261016 URL: http://svnweb.freebsd.org/changeset/base/261016 Log: Merge r257686: Add required kernel option. Modified: stable/10/share/man/man4/natm.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/natm.4 ============================================================================== --- stable/10/share/man/man4/natm.4 Wed Jan 22 09:59:49 2014 (r261015) +++ stable/10/share/man/man4/natm.4 Wed Jan 22 10:01:13 2014 (r261016) @@ -14,6 +14,7 @@ ATM software comes with a which provides socket level access to AAL0 and AAL5 virtual circuits. To enable this protocol layer, add .Dl options NATM +.Dl device atm to your kernel configuration file and re-make the kernel (do not forget to do .Dq make clean ) . From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:08:34 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 54CEB366; Wed, 22 Jan 2014 10:08:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 26DF81627; Wed, 22 Jan 2014 10:08:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MA8Ykj075482; Wed, 22 Jan 2014 10:08:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MA8XJ6075479; Wed, 22 Jan 2014 10:08:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221008.s0MA8XJ6075479@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261017 - in stable/10: share/man/man4 sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:08:34 -0000 Author: glebius Date: Wed Jan 22 10:08:33 2014 New Revision: 261017 URL: http://svnweb.freebsd.org/changeset/base/261017 Log: Merge r257846: Make TCP_KEEP* socket options readable. At least PostgreSQL wants to read the values. Modified: stable/10/share/man/man4/tcp.4 stable/10/sys/netinet/tcp_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/tcp.4 ============================================================================== --- stable/10/share/man/man4/tcp.4 Wed Jan 22 10:01:13 2014 (r261016) +++ stable/10/share/man/man4/tcp.4 Wed Jan 22 10:08:33 2014 (r261017) @@ -38,7 +38,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd March 7, 2012 +.Dd November 8, 2013 .Dt TCP 4 .Os .Sh NAME @@ -48,6 +48,7 @@ .In sys/types.h .In sys/socket.h .In netinet/in.h +.In netinet/tcp.h .Ft int .Fn socket AF_INET SOCK_STREAM 0 .Sh DESCRIPTION @@ -147,7 +148,7 @@ See .Xr mod_cc 4 for details. .It Dv TCP_KEEPINIT -This write-only +This .Xr setsockopt 2 option accepts a per-socket timeout argument of .Vt "u_int" @@ -160,7 +161,7 @@ in the .Sx MIB Variables section further down. .It Dv TCP_KEEPIDLE -This write-only +This .Xr setsockopt 2 option accepts an argument of .Vt "u_int" @@ -176,7 +177,7 @@ in the .Sx MIB Variables section further down. .It Dv TCP_KEEPINTVL -This write-only +This .Xr setsockopt 2 option accepts an argument of .Vt "u_int" @@ -191,7 +192,7 @@ in the .Sx MIB Variables section further down. .It Dv TCP_KEEPCNT -This write-only +This .Xr setsockopt 2 option accepts an argument of .Vt "u_int" Modified: stable/10/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/10/sys/netinet/tcp_usrreq.c Wed Jan 22 10:01:13 2014 (r261016) +++ stable/10/sys/netinet/tcp_usrreq.c Wed Jan 22 10:08:33 2014 (r261017) @@ -1584,6 +1584,27 @@ unlock_and_done: INP_WUNLOCK(inp); error = sooptcopyout(sopt, buf, TCP_CA_NAME_MAX); break; + case TCP_KEEPIDLE: + case TCP_KEEPINTVL: + case TCP_KEEPINIT: + case TCP_KEEPCNT: + switch (sopt->sopt_name) { + case TCP_KEEPIDLE: + ui = tp->t_keepidle / hz; + break; + case TCP_KEEPINTVL: + ui = tp->t_keepintvl / hz; + break; + case TCP_KEEPINIT: + ui = tp->t_keepinit / hz; + break; + case TCP_KEEPCNT: + ui = tp->t_keepcnt; + break; + } + INP_WUNLOCK(inp); + error = sooptcopyout(sopt, &ui, sizeof(ui)); + break; default: INP_WUNLOCK(inp); error = ENOPROTOOPT; From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:18:26 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD7CE7DB; Wed, 22 Jan 2014 10:18:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BC7F11715; Wed, 22 Jan 2014 10:18:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MAIQ10079496; Wed, 22 Jan 2014 10:18:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MAIQPh079493; Wed, 22 Jan 2014 10:18:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221018.s0MAIQPh079493@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:18:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261018 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:18:26 -0000 Author: glebius Date: Wed Jan 22 10:18:25 2014 New Revision: 261018 URL: http://svnweb.freebsd.org/changeset/base/261018 Log: Merge several fixlets from head: r257619: Remove unused PFTM_UNTIL_PACKET const. r257620: Code logic of handling PFTM_PURGE into pf_find_state(). r258475: Don't compare unsigned <= 0. r258477: Fix off by ones when scanning source nodes hash. Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Wed Jan 22 10:08:33 2014 (r261017) +++ stable/10/sys/net/pfvar.h Wed Jan 22 10:18:25 2014 (r261018) @@ -78,8 +78,7 @@ enum { PFTM_TCP_FIRST_PACKET, PFTM_TCP_O PFTM_OTHER_FIRST_PACKET, PFTM_OTHER_SINGLE, PFTM_OTHER_MULTIPLE, PFTM_FRAG, PFTM_INTERVAL, PFTM_ADAPTIVE_START, PFTM_ADAPTIVE_END, PFTM_SRC_NODE, - PFTM_TS_DIFF, PFTM_MAX, PFTM_PURGE, PFTM_UNLINKED, - PFTM_UNTIL_PACKET }; + PFTM_TS_DIFF, PFTM_MAX, PFTM_PURGE, PFTM_UNLINKED }; /* PFTM default values */ #define PFTM_TCP_FIRST_PACKET_VAL 120 /* First TCP packet */ Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Wed Jan 22 10:08:33 2014 (r261017) +++ stable/10/sys/netpfil/pf/pf.c Wed Jan 22 10:18:25 2014 (r261018) @@ -310,7 +310,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[P #define STATE_LOOKUP(i, k, d, s, pd) \ do { \ (s) = pf_find_state((i), (k), (d)); \ - if ((s) == NULL || (s)->timeout == PFTM_PURGE) \ + if ((s) == NULL) \ return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ @@ -1222,11 +1222,11 @@ pf_find_state(struct pfi_kif *kif, struc if (s->kif == V_pfi_all || s->kif == kif) { PF_STATE_LOCK(s); PF_HASHROW_UNLOCK(kh); - if (s->timeout == PFTM_UNLINKED) { + if (s->timeout >= PFTM_MAX) { /* - * State is being processed - * by pf_unlink_state() in - * an other thread. + * State is either being processed by + * pf_unlink_state() in an other thread, or + * is scheduled for immediate expiry. */ PF_STATE_UNLOCK(s); return (NULL); @@ -1427,8 +1427,6 @@ pf_state_expires(const struct pf_state * /* handle all PFTM_* > PFTM_MAX here */ if (state->timeout == PFTM_PURGE) return (time_uptime); - if (state->timeout == PFTM_UNTIL_PACKET) - return (0); KASSERT(state->timeout != PFTM_UNLINKED, ("pf_state_expires: timeout == PFTM_UNLINKED")); KASSERT((state->timeout < PFTM_MAX), @@ -1465,7 +1463,7 @@ pf_purge_expired_src_nodes() for (i = 0, sh = V_pf_srchash; i <= V_pf_srchashmask; i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next) - if (cur->states <= 0 && cur->expire <= time_uptime) { + if (cur->states == 0 && cur->expire <= time_uptime) { if (cur->rule.ptr != NULL) cur->rule.ptr->src_nodes--; LIST_REMOVE(cur, entry); @@ -1486,7 +1484,7 @@ pf_src_tree_remove_state(struct pf_state if (s->src_node != NULL) { if (s->src.tcp_est) --s->src_node->conn; - if (--s->src_node->states <= 0) { + if (--s->src_node->states == 0) { timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; if (!timeout) timeout = @@ -1495,7 +1493,7 @@ pf_src_tree_remove_state(struct pf_state } } if (s->nat_src_node != s->src_node && s->nat_src_node != NULL) { - if (--s->nat_src_node->states <= 0) { + if (--s->nat_src_node->states == 0) { timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; if (!timeout) timeout = Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Wed Jan 22 10:08:33 2014 (r261017) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Wed Jan 22 10:18:25 2014 (r261018) @@ -1682,8 +1682,7 @@ relock_DIOCKILLSTATES: struct pfioc_state *ps = (struct pfioc_state *)addr; struct pfsync_state *sp = &ps->state; - if (sp->timeout >= PFTM_MAX && - sp->timeout != PFTM_UNTIL_PACKET) { + if (sp->timeout >= PFTM_MAX) { error = EINVAL; break; } @@ -3078,7 +3077,7 @@ DIOCCHANGEADDR_error: uint32_t i, nr = 0; if (psn->psn_len == 0) { - for (i = 0, sh = V_pf_srchash; i < V_pf_srchashmask; + for (i = 0, sh = V_pf_srchash; i <= V_pf_srchashmask; i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH(n, &sh->nodes, entry) @@ -3090,7 +3089,7 @@ DIOCCHANGEADDR_error: } p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK); - for (i = 0, sh = V_pf_srchash; i < V_pf_srchashmask; + for (i = 0, sh = V_pf_srchash; i <= V_pf_srchashmask; i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH(n, &sh->nodes, entry) { @@ -3382,7 +3381,7 @@ pf_clear_srcnodes(struct pf_src_node *n) if (n == NULL) { struct pf_srchash *sh; - for (i = 0, sh = V_pf_srchash; i < V_pf_srchashmask; + for (i = 0, sh = V_pf_srchash; i <= V_pf_srchashmask; i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH(n, &sh->nodes, entry) { From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:29:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D9BFEB90; Wed, 22 Jan 2014 10:29:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BB8BE181D; Wed, 22 Jan 2014 10:29:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MATGoq083356; Wed, 22 Jan 2014 10:29:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MATGjn083352; Wed, 22 Jan 2014 10:29:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221029.s0MATGjn083352@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261019 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:29:16 -0000 Author: glebius Date: Wed Jan 22 10:29:15 2014 New Revision: 261019 URL: http://svnweb.freebsd.org/changeset/base/261019 Log: Merge r258478, r258479, r258480, r259719: fixes related to mass source nodes removal. PR: 176763 Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Wed Jan 22 10:18:25 2014 (r261018) +++ stable/10/sys/net/pfvar.h Wed Jan 22 10:29:15 2014 (r261019) @@ -1643,8 +1643,9 @@ struct pf_ifspeed { #define DIOCGIFSPEED _IOWR('D', 92, struct pf_ifspeed) #ifdef _KERNEL +LIST_HEAD(pf_src_node_list, pf_src_node); struct pf_srchash { - LIST_HEAD(, pf_src_node) nodes; + struct pf_src_node_list nodes; struct mtx lock; }; @@ -1750,8 +1751,11 @@ pf_release_state(struct pf_state *s) extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); -struct pf_src_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, - sa_family_t, int); +extern struct pf_src_node *pf_find_src_node(struct pf_addr *, + struct pf_rule *, sa_family_t, int); +extern void pf_unlink_src_node(struct pf_src_node *); +extern void pf_unlink_src_node_locked(struct pf_src_node *); +extern u_int pf_free_src_nodes(struct pf_src_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Wed Jan 22 10:18:25 2014 (r261018) +++ stable/10/sys/netpfil/pf/pf.c Wed Jan 22 10:29:15 2014 (r261019) @@ -673,20 +673,53 @@ pf_insert_src_node(struct pf_src_node ** return (0); } -static void -pf_remove_src_node(struct pf_src_node *src) +void +pf_unlink_src_node_locked(struct pf_src_node *src) { +#ifdef INVARIANTS struct pf_srchash *sh; sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_LOCK(sh); + PF_HASHROW_ASSERT(sh); +#endif LIST_REMOVE(src, entry); - PF_HASHROW_UNLOCK(sh); - + if (src->rule.ptr) + src->rule.ptr->src_nodes--; V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; V_pf_status.src_nodes--; +} - uma_zfree(V_pf_sources_z, src); +void +pf_unlink_src_node(struct pf_src_node *src) +{ + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; + PF_HASHROW_LOCK(sh); + pf_unlink_src_node_locked(src); + PF_HASHROW_UNLOCK(sh); +} + +static void +pf_free_src_node(struct pf_src_node *sn) +{ + + KASSERT(sn->states == 0, ("%s: %p has refs", __func__, sn)); + uma_zfree(V_pf_sources_z, sn); +} + +u_int +pf_free_src_nodes(struct pf_src_node_list *head) +{ + struct pf_src_node *sn, *tmp; + u_int count = 0; + + LIST_FOREACH_SAFE(sn, head, entry, tmp) { + pf_free_src_node(sn); + count++; + } + + return (count); } /* Data storage structures initialization. */ @@ -1456,24 +1489,24 @@ pf_state_expires(const struct pf_state * void pf_purge_expired_src_nodes() { + struct pf_src_node_list freelist; struct pf_srchash *sh; struct pf_src_node *cur, *next; int i; + LIST_INIT(&freelist); for (i = 0, sh = V_pf_srchash; i <= V_pf_srchashmask; i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next) if (cur->states == 0 && cur->expire <= time_uptime) { - if (cur->rule.ptr != NULL) - cur->rule.ptr->src_nodes--; - LIST_REMOVE(cur, entry); - V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++; - V_pf_status.src_nodes--; - uma_zfree(V_pf_sources_z, cur); + pf_unlink_src_node_locked(cur); + LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) cur->rule.ptr->rule_flag |= PFRULE_REFS; PF_HASHROW_UNLOCK(sh); } + + pf_free_src_nodes(&freelist); } static void @@ -3609,11 +3642,15 @@ csfailed: if (nk != NULL) uma_zfree(V_pf_state_key_z, nk); - if (sn != NULL && sn->states == 0 && sn->expire == 0) - pf_remove_src_node(sn); + if (sn != NULL && sn->states == 0 && sn->expire == 0) { + pf_unlink_src_node(sn); + pf_free_src_node(sn); + } - if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) - pf_remove_src_node(nsn); + if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { + pf_unlink_src_node(nsn); + pf_free_src_node(nsn); + } return (PF_DROP); } Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Wed Jan 22 10:18:25 2014 (r261018) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Wed Jan 22 10:29:15 2014 (r261019) @@ -151,6 +151,7 @@ struct cdev *pf_dev; static void pf_clear_states(void); static int pf_clear_tables(void); static void pf_clear_srcnodes(struct pf_src_node *); +static void pf_kill_srcnodes(struct pfioc_src_node_kill *); static void pf_tbladdr_copyout(struct pf_addr_wrap *); /* @@ -3139,45 +3140,9 @@ DIOCCHANGEADDR_error: break; } - case DIOCKILLSRCNODES: { - struct pfioc_src_node_kill *psnk = - (struct pfioc_src_node_kill *)addr; - struct pf_srchash *sh; - struct pf_src_node *sn; - u_int i, killed = 0; - - for (i = 0, sh = V_pf_srchash; i < V_pf_srchashmask; - i++, sh++) { - /* - * XXXGL: we don't ever acquire sources hash lock - * but if we ever do, the below call to pf_clear_srcnodes() - * would lead to a LOR. - */ - PF_HASHROW_LOCK(sh); - LIST_FOREACH(sn, &sh->nodes, entry) - if (PF_MATCHA(psnk->psnk_src.neg, - &psnk->psnk_src.addr.v.a.addr, - &psnk->psnk_src.addr.v.a.mask, - &sn->addr, sn->af) && - PF_MATCHA(psnk->psnk_dst.neg, - &psnk->psnk_dst.addr.v.a.addr, - &psnk->psnk_dst.addr.v.a.mask, - &sn->raddr, sn->af)) { - /* Handle state to src_node linkage */ - if (sn->states != 0) - pf_clear_srcnodes(sn); - sn->expire = 1; - killed++; - } - PF_HASHROW_UNLOCK(sh); - } - - if (killed > 0) - pf_purge_expired_src_nodes(); - - psnk->psnk_killed = killed; + case DIOCKILLSRCNODES: + pf_kill_srcnodes((struct pfioc_src_node_kill *)addr); break; - } case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; @@ -3396,6 +3361,59 @@ pf_clear_srcnodes(struct pf_src_node *n) n->states = 0; } } + +static void +pf_kill_srcnodes(struct pfioc_src_node_kill *psnk) +{ + struct pf_src_node_list kill; + + LIST_INIT(&kill); + for (int i = 0; i <= V_pf_srchashmask; i++) { + struct pf_srchash *sh = &V_pf_srchash[i]; + struct pf_src_node *sn, *tmp; + + PF_HASHROW_LOCK(sh); + LIST_FOREACH_SAFE(sn, &sh->nodes, entry, tmp) + if (PF_MATCHA(psnk->psnk_src.neg, + &psnk->psnk_src.addr.v.a.addr, + &psnk->psnk_src.addr.v.a.mask, + &sn->addr, sn->af) && + PF_MATCHA(psnk->psnk_dst.neg, + &psnk->psnk_dst.addr.v.a.addr, + &psnk->psnk_dst.addr.v.a.mask, + &sn->raddr, sn->af)) { + pf_unlink_src_node_locked(sn); + LIST_INSERT_HEAD(&kill, sn, entry); + sn->expire = 1; + } + PF_HASHROW_UNLOCK(sh); + } + + for (int i = 0; i <= V_pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + struct pf_state *s; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->src_node && s->src_node->expire == 1) { +#ifdef INVARIANTS + s->src_node->states--; +#endif + s->src_node = NULL; + } + if (s->nat_src_node && s->nat_src_node->expire == 1) { +#ifdef INVARIANTS + s->nat_src_node->states--; +#endif + s->nat_src_node = NULL; + } + } + PF_HASHROW_UNLOCK(ih); + } + + psnk->psnk_killed = pf_free_src_nodes(&kill); +} + /* * XXX - Check for version missmatch!!! */ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:31:57 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D666DB2; Wed, 22 Jan 2014 10:31:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 280F8189F; Wed, 22 Jan 2014 10:31:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MAVvAa086322; Wed, 22 Jan 2014 10:31:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MAVugn086320; Wed, 22 Jan 2014 10:31:56 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221031.s0MAVugn086320@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261020 - in stable/10: lib/libnetgraph share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:31:57 -0000 Author: glebius Date: Wed Jan 22 10:31:56 2014 New Revision: 261020 URL: http://svnweb.freebsd.org/changeset/base/261020 Log: Merge r258702: Fix some misinformation in netgraph manual pages. Modified: stable/10/lib/libnetgraph/netgraph.3 stable/10/share/man/man4/netgraph.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libnetgraph/netgraph.3 ============================================================================== --- stable/10/lib/libnetgraph/netgraph.3 Wed Jan 22 10:29:15 2014 (r261019) +++ stable/10/lib/libnetgraph/netgraph.3 Wed Jan 22 10:31:56 2014 (r261020) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: netgraph.3,v 1.7 1999/01/25 07:14:06 archie Exp $ .\" -.Dd January 27, 2004 +.Dd November 25, 2013 .Dt NETGRAPH 3 .Os .Sh NAME @@ -57,7 +57,7 @@ .Sh LIBRARY .Lb libnetgraph .Sh SYNOPSIS -.In netgraph.h +.In netgraph/netgraph.h .Ft int .Fn NgMkSockNode "const char *name" "int *csp" "int *dsp" .Ft int Modified: stable/10/share/man/man4/netgraph.4 ============================================================================== --- stable/10/share/man/man4/netgraph.4 Wed Jan 22 10:29:15 2014 (r261019) +++ stable/10/share/man/man4/netgraph.4 Wed Jan 22 10:31:56 2014 (r261020) @@ -36,7 +36,7 @@ .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $ .\" $FreeBSD$ .\" -.Dd May 25, 2008 +.Dd November 25, 2013 .Dt NETGRAPH 4 .Os .Sh NAME @@ -292,7 +292,7 @@ unless specifically declared to be a rea (See .Dv NGM_READONLY in -.In ng_message.h . ) +.In netgraph/ng_message.h . ) .Pp While this mode of operation results in good performance, it has a few implications for node @@ -840,26 +840,27 @@ and should be used as a starting point f .Ss Netgraph Message Structure Control messages have the following structure: .Bd -literal -#define NG_CMDSTRSIZ 32 /* Max command string (including nul) */ +#define NG_CMDSTRSIZ 32 /* Max command string (including null) */ struct ng_mesg { struct ng_msghdr { u_char version; /* Must equal NG_VERSION */ - u_char spare; /* Pad to 2 bytes */ - u_short arglen; /* Length of cmd/resp data */ - u_long flags; /* Message status flags */ - u_long token; /* Reply should have the same token */ - u_long typecookie; /* Node type understanding this message */ - u_long cmd; /* Command identifier */ - u_char cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */ + u_char spare; /* Pad to 4 bytes */ + uint16_t spare2; + uint32_t arglen; /* Length of cmd/resp data */ + uint32_t cmd; /* Command identifier */ + uint32_t flags; /* Message status flags */ + uint32_t token; /* Reply should have the same token */ + uint32_t typecookie; /* Node type understanding this message */ + u_char cmdstr[NG_CMDSTRSIZ]; /* cmd string + \0 */ } header; - char data[0]; /* Start of cmd/resp data */ + char data[]; /* placeholder for actual data */ }; -#define NG_ABI_VERSION 5 /* Netgraph kernel ABI version */ -#define NG_VERSION 4 /* Netgraph message version */ -#define NGF_ORIG 0x0000 /* Command */ -#define NGF_RESP 0x0001 /* Response */ +#define NG_ABI_VERSION 12 /* Netgraph kernel ABI version */ +#define NG_VERSION 8 /* Netgraph message version */ +#define NGF_ORIG 0x00000000 /* The msg is the original request */ +#define NGF_RESP 0x00000001 /* The message is a response */ .Ed .Pp Control messages have the fixed header shown above, followed by a @@ -1296,7 +1297,7 @@ Used in conjunction with either .Xr ppp 8 or the -.Pa net/mpd +.Pa net/mpd5 port. .It BRIDGE This node, together with the Ethernet nodes, allows a very flexible From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:35:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F34F11A; Wed, 22 Jan 2014 10:35:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 19A0B18E5; Wed, 22 Jan 2014 10:35:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MAZUmB086816; Wed, 22 Jan 2014 10:35:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MAZUCh086815; Wed, 22 Jan 2014 10:35:30 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221035.s0MAZUCh086815@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261021 - stable/10/usr.sbin/ndiscvt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:35:31 -0000 Author: glebius Date: Wed Jan 22 10:35:30 2014 New Revision: 261021 URL: http://svnweb.freebsd.org/changeset/base/261021 Log: Merge r259855: We have in base iconv. PR: 185135 Modified: stable/10/usr.sbin/ndiscvt/ndisgen.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ndiscvt/ndisgen.sh ============================================================================== --- stable/10/usr.sbin/ndiscvt/ndisgen.sh Wed Jan 22 10:31:56 2014 (r261020) +++ stable/10/usr.sbin/ndiscvt/ndisgen.sh Wed Jan 22 10:35:30 2014 (r261021) @@ -493,7 +493,7 @@ convert_driver () { return } -ICONVPATH=/usr/local/bin/iconv +ICONVPATH=/usr/bin/iconv NDISCVT=/usr/sbin/ndiscvt STUBPATH=/usr/share/misc STUBFILE=windrv_stub.c From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:38:01 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC4C1481; Wed, 22 Jan 2014 10:38:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B7731191F; Wed, 22 Jan 2014 10:38:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MAc16K087111; Wed, 22 Jan 2014 10:38:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MAc1lf087110; Wed, 22 Jan 2014 10:38:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221038.s0MAc1lf087110@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:38:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261022 - stable/10/sys/netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:38:01 -0000 Author: glebius Date: Wed Jan 22 10:38:01 2014 New Revision: 261022 URL: http://svnweb.freebsd.org/changeset/base/261022 Log: Merge r260046: Fix the parse type for NGM_LISTTYPES. Modified: stable/10/sys/netgraph/ng_base.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netgraph/ng_base.c ============================================================================== --- stable/10/sys/netgraph/ng_base.c Wed Jan 22 10:35:30 2014 (r261021) +++ stable/10/sys/netgraph/ng_base.c Wed Jan 22 10:38:01 2014 (r261022) @@ -468,7 +468,7 @@ static const struct ng_parse_type ng_gen &ng_generic_linkinfo_array_type_info }; -DEFINE_PARSE_STRUCT_TYPE(typelist, TYPELIST, (&ng_generic_nodeinfoarray_type)); +DEFINE_PARSE_STRUCT_TYPE(typelist, TYPELIST, (&ng_generic_typeinfoarray_type)); DEFINE_PARSE_STRUCT_TYPE(hooklist, HOOKLIST, (&ng_generic_nodeinfo_type, &ng_generic_linkinfo_array_type)); DEFINE_PARSE_STRUCT_TYPE(listnodes, LISTNODES, @@ -544,7 +544,7 @@ static const struct ng_cmdlist ng_generi NGM_LISTTYPES, "listtypes", NULL, - &ng_generic_typeinfo_type + &ng_generic_typelist_type }, { NGM_GENERIC_COOKIE, From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 10:45:17 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 291FC8D5; Wed, 22 Jan 2014 10:45:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14BC619F2; Wed, 22 Jan 2014 10:45:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MAjGR1090587; Wed, 22 Jan 2014 10:45:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MAjG9w090586; Wed, 22 Jan 2014 10:45:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401221045.s0MAjG9w090586@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 22 Jan 2014 10:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261023 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 10:45:17 -0000 Author: glebius Date: Wed Jan 22 10:45:16 2014 New Revision: 261023 URL: http://svnweb.freebsd.org/changeset/base/261023 Log: Merge r260377: fix panic on pf_get_translation() failure. PR: 182557 Modified: stable/10/sys/netpfil/pf/pf_lb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_lb.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_lb.c Wed Jan 22 10:38:01 2014 (r261022) +++ stable/10/sys/netpfil/pf/pf_lb.c Wed Jan 22 10:45:16 2014 (r261023) @@ -663,6 +663,7 @@ notrans: uma_zfree(V_pf_state_key_z, *nkp); uma_zfree(V_pf_state_key_z, *skp); *skp = *nkp = NULL; + *sn = NULL; return (NULL); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:42:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0C5FB661; Wed, 22 Jan 2014 23:42:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D292910E1; Wed, 22 Jan 2014 23:42:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNgUn4024729; Wed, 22 Jan 2014 23:42:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNgUvK024728; Wed, 22 Jan 2014 23:42:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222342.s0MNgUvK024728@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261045 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:42:31 -0000 Author: mav Date: Wed Jan 22 23:42:30 2014 New Revision: 261045 URL: http://svnweb.freebsd.org/changeset/base/261045 Log: MFC r258132: Some minor tuning to rpc/svc.c: - close cosmetic race in svc_exit(); - do not set wait timeout for idle threads if we have no use for wakeups; - create new requested thread sooner, not only after some another thread wakeup, that may happen later under constant load. Modified: stable/10/sys/rpc/svc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Wed Jan 22 23:00:29 2014 (r261044) +++ stable/10/sys/rpc/svc.c Wed Jan 22 23:42:30 2014 (r261045) @@ -1011,6 +1011,18 @@ svc_run_internal(SVCPOOL *pool, bool_t i while (pool->sp_state != SVCPOOL_CLOSING) { /* + * Create new thread if requested. + */ + if (pool->sp_state == SVCPOOL_THREADWANTED) { + pool->sp_state = SVCPOOL_THREADSTARTING; + pool->sp_lastcreatetime = time_uptime; + mtx_unlock(&pool->sp_lock); + svc_new_thread(pool); + mtx_lock(&pool->sp_lock); + continue; + } + + /* * Check for idle transports once per second. */ if (time_uptime > pool->sp_lastidlecheck) { @@ -1046,8 +1058,13 @@ svc_run_internal(SVCPOOL *pool, bool_t i continue; LIST_INSERT_HEAD(&pool->sp_idlethreads, st, st_ilink); - error = cv_timedwait_sig(&st->st_cond, &pool->sp_lock, - 5 * hz); + if (ismaster || (!ismaster && + pool->sp_threadcount > pool->sp_minthreads)) + error = cv_timedwait_sig(&st->st_cond, + &pool->sp_lock, 5 * hz); + else + error = cv_wait_sig(&st->st_cond, + &pool->sp_lock); LIST_REMOVE(st, st_ilink); /* @@ -1060,24 +1077,11 @@ svc_run_internal(SVCPOOL *pool, bool_t i && !st->st_xprt && STAILQ_EMPTY(&st->st_reqs)) break; - } - if (error == EWOULDBLOCK) - continue; - if (error) { - if (pool->sp_state != SVCPOOL_CLOSING) { - mtx_unlock(&pool->sp_lock); - svc_exit(pool); - mtx_lock(&pool->sp_lock); - } - break; - } - - if (pool->sp_state == SVCPOOL_THREADWANTED) { - pool->sp_state = SVCPOOL_THREADSTARTING; - pool->sp_lastcreatetime = time_uptime; + } else if (error) { mtx_unlock(&pool->sp_lock); - svc_new_thread(pool); + svc_exit(pool); mtx_lock(&pool->sp_lock); + break; } continue; } @@ -1245,9 +1249,11 @@ svc_exit(SVCPOOL *pool) mtx_lock(&pool->sp_lock); - pool->sp_state = SVCPOOL_CLOSING; - LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) - cv_signal(&st->st_cond); + if (pool->sp_state != SVCPOOL_CLOSING) { + pool->sp_state = SVCPOOL_CLOSING; + LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) + cv_signal(&st->st_cond); + } mtx_unlock(&pool->sp_lock); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:45:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A4EA7BE; Wed, 22 Jan 2014 23:45:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 730D510FD; Wed, 22 Jan 2014 23:45:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNjVQb025171; Wed, 22 Jan 2014 23:45:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNjSGs025150; Wed, 22 Jan 2014 23:45:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222345.s0MNjSGs025150@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261046 - in stable/10: include/rpc lib/libc/rpc sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:45:31 -0000 Author: mav Date: Wed Jan 22 23:45:27 2014 New Revision: 261046 URL: http://svnweb.freebsd.org/changeset/base/261046 Log: MFC r258578, r258580, r258581 (by hrs): Replace Sun RPC license in TI-RPC library with a 3-clause BSD license with the explicit permissions. Modified: stable/10/include/rpc/auth.h stable/10/include/rpc/auth_des.h stable/10/include/rpc/auth_kerb.h stable/10/include/rpc/auth_unix.h stable/10/include/rpc/clnt.h stable/10/include/rpc/clnt_soc.h stable/10/include/rpc/des.h stable/10/include/rpc/des_crypt.h stable/10/include/rpc/nettype.h stable/10/include/rpc/pmap_clnt.h stable/10/include/rpc/pmap_prot.h stable/10/include/rpc/pmap_rmt.h stable/10/include/rpc/raw.h stable/10/include/rpc/rpc.h stable/10/include/rpc/rpc_com.h stable/10/include/rpc/rpc_msg.h stable/10/include/rpc/rpcb_clnt.h stable/10/include/rpc/rpcb_prot.x stable/10/include/rpc/rpcent.h stable/10/include/rpc/svc.h stable/10/include/rpc/svc_auth.h stable/10/include/rpc/svc_dg.h stable/10/include/rpc/svc_soc.h stable/10/include/rpc/xdr.h stable/10/lib/libc/rpc/DISCLAIMER stable/10/lib/libc/rpc/auth_des.c stable/10/lib/libc/rpc/auth_none.c stable/10/lib/libc/rpc/auth_unix.c stable/10/lib/libc/rpc/authdes_prot.c stable/10/lib/libc/rpc/authunix_prot.c stable/10/lib/libc/rpc/bindresvport.c stable/10/lib/libc/rpc/clnt_bcast.c stable/10/lib/libc/rpc/clnt_dg.c stable/10/lib/libc/rpc/clnt_generic.c stable/10/lib/libc/rpc/clnt_perror.c stable/10/lib/libc/rpc/clnt_raw.c stable/10/lib/libc/rpc/clnt_simple.c stable/10/lib/libc/rpc/clnt_vc.c stable/10/lib/libc/rpc/des_crypt.c stable/10/lib/libc/rpc/des_soft.c stable/10/lib/libc/rpc/getnetconfig.c stable/10/lib/libc/rpc/getnetpath.c stable/10/lib/libc/rpc/getpublickey.c stable/10/lib/libc/rpc/getrpcent.c stable/10/lib/libc/rpc/getrpcport.c stable/10/lib/libc/rpc/key_call.c stable/10/lib/libc/rpc/key_prot_xdr.c stable/10/lib/libc/rpc/netname.c stable/10/lib/libc/rpc/netnamer.c stable/10/lib/libc/rpc/pmap_clnt.c stable/10/lib/libc/rpc/pmap_getmaps.c stable/10/lib/libc/rpc/pmap_getport.c stable/10/lib/libc/rpc/pmap_prot.c stable/10/lib/libc/rpc/pmap_prot2.c stable/10/lib/libc/rpc/pmap_rmt.c stable/10/lib/libc/rpc/rpc_callmsg.c stable/10/lib/libc/rpc/rpc_com.h stable/10/lib/libc/rpc/rpc_commondata.c stable/10/lib/libc/rpc/rpc_dtablesize.c stable/10/lib/libc/rpc/rpc_generic.c stable/10/lib/libc/rpc/rpc_prot.c stable/10/lib/libc/rpc/rpc_soc.c stable/10/lib/libc/rpc/rpcb_clnt.c stable/10/lib/libc/rpc/rpcb_prot.c stable/10/lib/libc/rpc/rpcb_st_xdr.c stable/10/lib/libc/rpc/rpcdname.c stable/10/lib/libc/rpc/rtime.c stable/10/lib/libc/rpc/svc.c stable/10/lib/libc/rpc/svc_auth.c stable/10/lib/libc/rpc/svc_auth_des.c stable/10/lib/libc/rpc/svc_auth_unix.c stable/10/lib/libc/rpc/svc_dg.c stable/10/lib/libc/rpc/svc_generic.c stable/10/lib/libc/rpc/svc_raw.c stable/10/lib/libc/rpc/svc_run.c stable/10/lib/libc/rpc/svc_simple.c stable/10/lib/libc/rpc/svc_vc.c stable/10/sys/rpc/auth.h stable/10/sys/rpc/auth_none.c stable/10/sys/rpc/auth_unix.c stable/10/sys/rpc/authunix_prot.c stable/10/sys/rpc/clnt.h stable/10/sys/rpc/clnt_dg.c stable/10/sys/rpc/clnt_vc.c stable/10/sys/rpc/krpc.h stable/10/sys/rpc/nettype.h stable/10/sys/rpc/pmap_prot.h stable/10/sys/rpc/rpc.h stable/10/sys/rpc/rpc_callmsg.c stable/10/sys/rpc/rpc_com.h stable/10/sys/rpc/rpc_generic.c stable/10/sys/rpc/rpc_msg.h stable/10/sys/rpc/rpc_prot.c stable/10/sys/rpc/rpcb_clnt.c stable/10/sys/rpc/rpcb_clnt.h stable/10/sys/rpc/rpcb_prot.c stable/10/sys/rpc/rpcb_prot.h stable/10/sys/rpc/svc.c stable/10/sys/rpc/svc.h stable/10/sys/rpc/svc_auth.c stable/10/sys/rpc/svc_auth.h stable/10/sys/rpc/svc_auth_unix.c stable/10/sys/rpc/svc_dg.c stable/10/sys/rpc/svc_generic.c stable/10/sys/rpc/svc_vc.c stable/10/sys/rpc/types.h stable/10/sys/rpc/xdr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/include/rpc/auth.h ============================================================================== --- stable/10/include/rpc/auth.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/auth.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)auth.h 1.17 88/02/08 SMI * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC Modified: stable/10/include/rpc/auth_des.h ============================================================================== --- stable/10/include/rpc/auth_des.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/auth_des.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC * from: @(#)auth_des.h 1.14 94/04/25 SMI Modified: stable/10/include/rpc/auth_kerb.h ============================================================================== --- stable/10/include/rpc/auth_kerb.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/auth_kerb.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,31 +1,30 @@ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * auth_kerb.h, Protocol for Kerberos style authentication for RPC Modified: stable/10/include/rpc/auth_unix.h ============================================================================== --- stable/10/include/rpc/auth_unix.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/auth_unix.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,30 +1,29 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)auth_unix.h 1.8 88/02/08 SMI * from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC Modified: stable/10/include/rpc/clnt.h ============================================================================== --- stable/10/include/rpc/clnt.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/clnt.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,49 +1,31 @@ /* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */ -/* - * The contents of this file are subject to the Sun Standards - * License Version 1.0 the (the "License";) You may not use - * this file except in compliance with the License. You may - * obtain a copy of the License at lib/libc/rpc/LICENSE - * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is Copyright 1998 by Sun Microsystems, Inc - * - * The Initial Developer of the Original Code is: Sun - * Microsystems, Inc. - * - * All Rights Reserved. - * - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. +/*- + * Copyright (c) 2010, Oracle America, Inc. + * All rights reserved. * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)clnt.h 1.31 94/04/29 SMI * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC @@ -52,9 +34,6 @@ /* * clnt.h - Client side remote procedure call interface. - * - * Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc. - * All rights reserved. */ #ifndef _RPC_CLNT_H_ Modified: stable/10/include/rpc/clnt_soc.h ============================================================================== --- stable/10/include/rpc/clnt_soc.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/clnt_soc.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,33 +1,32 @@ /* $NetBSD: clnt_soc.h,v 1.1 2000/06/02 22:57:55 fvdl Exp $ */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. Modified: stable/10/include/rpc/des.h ============================================================================== --- stable/10/include/rpc/des.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/des.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Generic DES driver interface Modified: stable/10/include/rpc/des_crypt.h ============================================================================== --- stable/10/include/rpc/des_crypt.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/des_crypt.h Wed Jan 22 23:45:27 2014 (r261046) @@ -5,33 +5,32 @@ * des_crypt.h, des library routine interface * Copyright (C) 1986, Sun Microsystems, Inc. */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. Modified: stable/10/include/rpc/nettype.h ============================================================================== --- stable/10/include/rpc/nettype.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/nettype.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,33 +1,32 @@ /* $NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $ */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. Modified: stable/10/include/rpc/pmap_clnt.h ============================================================================== --- stable/10/include/rpc/pmap_clnt.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/pmap_clnt.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: pmap_clnt.h,v 1.9 2000/06/02 22:57:55 fvdl Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)pmap_clnt.h 1.11 88/02/08 SMI * from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC Modified: stable/10/include/rpc/pmap_prot.h ============================================================================== --- stable/10/include/rpc/pmap_prot.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/pmap_prot.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: pmap_prot.h,v 1.8 2000/06/02 22:57:55 fvdl Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)pmap_prot.h 1.14 88/02/08 SMI * from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC Modified: stable/10/include/rpc/pmap_rmt.h ============================================================================== --- stable/10/include/rpc/pmap_rmt.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/pmap_rmt.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)pmap_rmt.h 1.2 88/02/08 SMI * from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC Modified: stable/10/include/rpc/raw.h ============================================================================== --- stable/10/include/rpc/raw.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/raw.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,33 +1,32 @@ /* $NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. Modified: stable/10/include/rpc/rpc.h ============================================================================== --- stable/10/include/rpc/rpc.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/rpc.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: rpc.h,v 1.13 2000/06/02 22:57:56 fvdl Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. * * from: @(#)rpc.h 1.9 88/02/08 SMI * from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC Modified: stable/10/include/rpc/rpc_com.h ============================================================================== --- stable/10/include/rpc/rpc_com.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/rpc_com.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,33 +1,32 @@ /* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ /* $FreeBSD$ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. Modified: stable/10/include/rpc/rpc_msg.h ============================================================================== --- stable/10/include/rpc/rpc_msg.h Wed Jan 22 23:42:30 2014 (r261045) +++ stable/10/include/rpc/rpc_msg.h Wed Jan 22 23:45:27 2014 (r261046) @@ -1,32 +1,31 @@ /* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 +/*- + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:46:20 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DEA6917; Wed, 22 Jan 2014 23:46:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E23D81104; Wed, 22 Jan 2014 23:46:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNkJ5i025308; Wed, 22 Jan 2014 23:46:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNkJFF025307; Wed, 22 Jan 2014 23:46:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222346.s0MNkJFF025307@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261047 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:46:20 -0000 Author: mav Date: Wed Jan 22 23:46:19 2014 New Revision: 261047 URL: http://svnweb.freebsd.org/changeset/base/261047 Log: MFC r259632: Rework flow control for connection-oriented (TCP) RPC server. When processing receive buffer, write the amount of data, expected in present request record, into socket's so_rcv.sb_lowat to make stack aware about our needs. When processing following upcalls, ignore them until socket collect enough data to be read and processed in one turn. This change reduces number of context switches and other operations in RPC stack during large NFS writes (especially via non-Jumbo networks) by order of magnitude. After precessing current packet, take another look into the pending buffer to find out whether the next packet had been already received. If not, deactivate this port right there without making RPC code to push this port to another thread just to find that there is nothing. If the next packet is received partially, also deactivate the port, but also update socket's so_rcv.sb_lowat to not be woken up prematurely. This change additionally reduces number of context switches per NFS request about in half. Modified: stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc_vc.c ============================================================================== --- stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:45:27 2014 (r261046) +++ stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:46:19 2014 (r261047) @@ -381,15 +381,11 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st * We must re-test for new connections after taking * the lock to protect us in the case where a new * connection arrives after our call to accept fails - * with EWOULDBLOCK. The pool lock protects us from - * racing the upcall after our TAILQ_EMPTY() call - * returns false. + * with EWOULDBLOCK. */ ACCEPT_LOCK(); - mtx_lock(&xprt->xp_pool->sp_lock); if (TAILQ_EMPTY(&xprt->xp_socket->so_comp)) - xprt_inactive_locked(xprt); - mtx_unlock(&xprt->xp_pool->sp_lock); + xprt_inactive(xprt); ACCEPT_UNLOCK(); sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -526,35 +522,14 @@ static enum xprt_stat svc_vc_stat(SVCXPRT *xprt) { struct cf_conn *cd; - struct mbuf *m; - size_t n; cd = (struct cf_conn *)(xprt->xp_p1); if (cd->strm_stat == XPRT_DIED) return (XPRT_DIED); - /* - * Return XPRT_MOREREQS if we have buffered data and we are - * mid-record or if we have enough data for a record - * marker. Since this is only a hint, we read mpending and - * resid outside the lock. We do need to take the lock if we - * have to traverse the mbuf chain. - */ - if (cd->mpending) { - if (cd->resid) - return (XPRT_MOREREQS); - n = 0; - sx_xlock(&xprt->xp_lock); - m = cd->mpending; - while (m && n < sizeof(uint32_t)) { - n += m->m_len; - m = m->m_next; - } - sx_xunlock(&xprt->xp_lock); - if (n >= sizeof(uint32_t)) - return (XPRT_MOREREQS); - } + if (cd->mreq != NULL && cd->resid == 0 && cd->eor) + return (XPRT_MOREREQS); if (soreadable(xprt->xp_socket)) return (XPRT_MOREREQS); @@ -575,6 +550,78 @@ svc_vc_backchannel_stat(SVCXPRT *xprt) return (XPRT_IDLE); } +/* + * If we have an mbuf chain in cd->mpending, try to parse a record from it, + * leaving the result in cd->mreq. If we don't have a complete record, leave + * the partial result in cd->mreq and try to read more from the socket. + */ +static void +svc_vc_process_pending(SVCXPRT *xprt) +{ + struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1; + struct socket *so = xprt->xp_socket; + struct mbuf *m; + + /* + * If cd->resid is non-zero, we have part of the + * record already, otherwise we are expecting a record + * marker. + */ + if (!cd->resid && cd->mpending) { + /* + * See if there is enough data buffered to + * make up a record marker. Make sure we can + * handle the case where the record marker is + * split across more than one mbuf. + */ + size_t n = 0; + uint32_t header; + + m = cd->mpending; + while (n < sizeof(uint32_t) && m) { + n += m->m_len; + m = m->m_next; + } + if (n < sizeof(uint32_t)) { + so->so_rcv.sb_lowat = sizeof(uint32_t) - n; + return; + } + m_copydata(cd->mpending, 0, sizeof(header), + (char *)&header); + header = ntohl(header); + cd->eor = (header & 0x80000000) != 0; + cd->resid = header & 0x7fffffff; + m_adj(cd->mpending, sizeof(uint32_t)); + } + + /* + * Start pulling off mbufs from cd->mpending + * until we either have a complete record or + * we run out of data. We use m_split to pull + * data - it will pull as much as possible and + * split the last mbuf if necessary. + */ + while (cd->mpending && cd->resid) { + m = cd->mpending; + if (cd->mpending->m_next + || cd->mpending->m_len > cd->resid) + cd->mpending = m_split(cd->mpending, + cd->resid, M_WAITOK); + else + cd->mpending = NULL; + if (cd->mreq) + m_last(cd->mreq)->m_next = m; + else + cd->mreq = m; + while (m) { + cd->resid -= m->m_len; + m = m->m_next; + } + } + + so->so_rcv.sb_lowat = imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); +} + static bool_t svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg, struct sockaddr **addrp, struct mbuf **mp) @@ -582,6 +629,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1; struct uio uio; struct mbuf *m; + struct socket* so = xprt->xp_socket; XDR xdrs; int error, rcvflag; @@ -592,99 +640,40 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms sx_xlock(&xprt->xp_lock); for (;;) { - /* - * If we have an mbuf chain in cd->mpending, try to parse a - * record from it, leaving the result in cd->mreq. If we don't - * have a complete record, leave the partial result in - * cd->mreq and try to read more from the socket. - */ - if (cd->mpending) { - /* - * If cd->resid is non-zero, we have part of the - * record already, otherwise we are expecting a record - * marker. - */ - if (!cd->resid) { - /* - * See if there is enough data buffered to - * make up a record marker. Make sure we can - * handle the case where the record marker is - * split across more than one mbuf. - */ - size_t n = 0; - uint32_t header; - - m = cd->mpending; - while (n < sizeof(uint32_t) && m) { - n += m->m_len; - m = m->m_next; - } - if (n < sizeof(uint32_t)) - goto readmore; - m_copydata(cd->mpending, 0, sizeof(header), - (char *)&header); - header = ntohl(header); - cd->eor = (header & 0x80000000) != 0; - cd->resid = header & 0x7fffffff; - m_adj(cd->mpending, sizeof(uint32_t)); - } - - /* - * Start pulling off mbufs from cd->mpending - * until we either have a complete record or - * we run out of data. We use m_split to pull - * data - it will pull as much as possible and - * split the last mbuf if necessary. - */ - while (cd->mpending && cd->resid) { - m = cd->mpending; - if (cd->mpending->m_next - || cd->mpending->m_len > cd->resid) - cd->mpending = m_split(cd->mpending, - cd->resid, M_WAITOK); - else - cd->mpending = NULL; - if (cd->mreq) - m_last(cd->mreq)->m_next = m; - else - cd->mreq = m; - while (m) { - cd->resid -= m->m_len; - m = m->m_next; - } + /* If we have no request ready, check pending queue. */ + while (cd->mpending && + (cd->mreq == NULL || cd->resid != 0 || !cd->eor)) + svc_vc_process_pending(xprt); + + /* Process and return complete request in cd->mreq. */ + if (cd->mreq != NULL && cd->resid == 0 && cd->eor) { + + xdrmbuf_create(&xdrs, cd->mreq, XDR_DECODE); + cd->mreq = NULL; + + /* Check for next request in a pending queue. */ + svc_vc_process_pending(xprt); + if (cd->mreq == NULL || cd->resid != 0) { + SOCKBUF_LOCK(&so->so_rcv); + if (!soreadable(so)) + xprt_inactive(xprt); + SOCKBUF_UNLOCK(&so->so_rcv); } - /* - * If cd->resid is zero now, we have managed to - * receive a record fragment from the stream. Check - * for the end-of-record mark to see if we need more. - */ - if (cd->resid == 0) { - if (!cd->eor) - continue; - - /* - * Success - we have a complete record in - * cd->mreq. - */ - xdrmbuf_create(&xdrs, cd->mreq, XDR_DECODE); - cd->mreq = NULL; - sx_xunlock(&xprt->xp_lock); - - if (! xdr_callmsg(&xdrs, msg)) { - XDR_DESTROY(&xdrs); - return (FALSE); - } + sx_xunlock(&xprt->xp_lock); - *addrp = NULL; - *mp = xdrmbuf_getall(&xdrs); + if (! xdr_callmsg(&xdrs, msg)) { XDR_DESTROY(&xdrs); - - return (TRUE); + return (FALSE); } + + *addrp = NULL; + *mp = xdrmbuf_getall(&xdrs); + XDR_DESTROY(&xdrs); + + return (TRUE); } - readmore: /* * The socket upcall calls xprt_active() which will eventually * cause the server to call us here. We attempt to @@ -697,8 +686,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms uio.uio_td = curthread; m = NULL; rcvflag = MSG_DONTWAIT; - error = soreceive(xprt->xp_socket, NULL, &uio, &m, NULL, - &rcvflag); + error = soreceive(so, NULL, &uio, &m, NULL, &rcvflag); if (error == EWOULDBLOCK) { /* @@ -706,25 +694,23 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms * taking the lock to protect us in the case * where a new packet arrives on the socket * after our call to soreceive fails with - * EWOULDBLOCK. The pool lock protects us from - * racing the upcall after our soreadable() - * call returns false. + * EWOULDBLOCK. */ - mtx_lock(&xprt->xp_pool->sp_lock); - if (!soreadable(xprt->xp_socket)) - xprt_inactive_locked(xprt); - mtx_unlock(&xprt->xp_pool->sp_lock); + SOCKBUF_LOCK(&so->so_rcv); + if (!soreadable(so)) + xprt_inactive(xprt); + SOCKBUF_UNLOCK(&so->so_rcv); sx_xunlock(&xprt->xp_lock); return (FALSE); } if (error) { - SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); + SOCKBUF_LOCK(&so->so_rcv); if (xprt->xp_upcallset) { xprt->xp_upcallset = 0; - soupcall_clear(xprt->xp_socket, SO_RCV); + soupcall_clear(so, SO_RCV); } - SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); + SOCKBUF_UNLOCK(&so->so_rcv); xprt_inactive(xprt); cd->strm_stat = XPRT_DIED; sx_xunlock(&xprt->xp_lock); @@ -908,7 +894,8 @@ svc_vc_soupcall(struct socket *so, void { SVCXPRT *xprt = (SVCXPRT *) arg; - xprt_active(xprt); + if (soreadable(xprt->xp_socket)) + xprt_active(xprt); return (SU_OK); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:47:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5CC8EA4A; Wed, 22 Jan 2014 23:47:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3D10F110B; Wed, 22 Jan 2014 23:47:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNlU6q025477; Wed, 22 Jan 2014 23:47:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNlTce025474; Wed, 22 Jan 2014 23:47:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222347.s0MNlTce025474@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261048 - in stable/10/sys: nfs rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:47:30 -0000 Author: mav Date: Wed Jan 22 23:47:29 2014 New Revision: 261048 URL: http://svnweb.freebsd.org/changeset/base/261048 Log: MFC r259659, r259662: Remove several linear list traversals per request from RPC server code. Do not insert active ports into pool->sp_active list if they are success- fully assigned to some thread. This makes that list include only ports that really require attention, and so traversal can be reduced to simple taking the first one. Remove idle thread from pool->sp_idlethreads list when assigning some work (port of requests) to it. That again makes possible to replace list traversals with simple taking the first element. Modified: stable/10/sys/nfs/nfs_fha.c stable/10/sys/rpc/svc.c stable/10/sys/rpc/svc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/nfs/nfs_fha.c ============================================================================== --- stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:46:19 2014 (r261047) +++ stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:47:29 2014 (r261048) @@ -289,19 +289,6 @@ fha_hash_entry_add_op(struct fha_hash_en fhe->num_rw += count; } -static SVCTHREAD * -get_idle_thread(SVCPOOL *pool) -{ - SVCTHREAD *st; - - LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) { - if (st->st_xprt == NULL && STAILQ_EMPTY(&st->st_reqs)) - return (st); - } - return (NULL); -} - - /* * Get the service thread currently associated with the fhe that is * appropriate to handle this operation. @@ -386,7 +373,7 @@ fha_hash_entry_choose_thread(struct fha_ ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, "fha: %p(%d)t", thread, thread->st_reqcount); #endif - } else if ((thread = get_idle_thread(pool))) { + } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) { #if 0 ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, "fha: %p(%d)i", thread, thread->st_reqcount); @@ -418,7 +405,6 @@ SVCTHREAD * fha_assign(SVCTHREAD *this_thread, struct svc_req *req, struct fha_params *softc) { - SVCPOOL *pool; SVCTHREAD *thread; struct fha_info i; struct fha_hash_entry *fhe; @@ -439,7 +425,6 @@ fha_assign(SVCTHREAD *this_thread, struc if (req->rq_vers != 2 && req->rq_vers != 3) return (this_thread); - pool = req->rq_xprt->xp_pool; fha_extract_info(req, &i, cb); /* Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Wed Jan 22 23:46:19 2014 (r261047) +++ stable/10/sys/rpc/svc.c Wed Jan 22 23:47:29 2014 (r261048) @@ -293,12 +293,10 @@ xprt_unregister_locked(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; + mtx_assert(&pool->sp_lock, MA_OWNED); KASSERT(xprt->xp_registered == TRUE, ("xprt_unregister_locked: not registered")); - if (xprt->xp_active) { - TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); - xprt->xp_active = FALSE; - } + xprt_inactive_locked(xprt); TAILQ_REMOVE(&pool->sp_xlist, xprt, xp_link); xprt->xp_registered = FALSE; } @@ -320,25 +318,25 @@ xprt_unregister(SVCXPRT *xprt) SVC_RELEASE(xprt); } -static void +/* + * Attempt to assign a service thread to this transport. + */ +static int xprt_assignthread(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; SVCTHREAD *st; - /* - * Attempt to assign a service thread to this - * transport. - */ - LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) { - if (st->st_xprt == NULL && STAILQ_EMPTY(&st->st_reqs)) - break; - } + mtx_assert(&pool->sp_lock, MA_OWNED); + st = LIST_FIRST(&pool->sp_idlethreads); if (st) { + LIST_REMOVE(st, st_ilink); + st->st_idle = FALSE; SVC_ACQUIRE(xprt); xprt->xp_thread = st; st->st_xprt = xprt; cv_signal(&st->st_cond); + return (TRUE); } else { /* * See if we can create a new thread. The @@ -354,6 +352,7 @@ xprt_assignthread(SVCXPRT *xprt) pool->sp_state = SVCPOOL_THREADWANTED; } } + return (FALSE); } void @@ -372,9 +371,12 @@ xprt_active(SVCXPRT *xprt) } if (!xprt->xp_active) { - TAILQ_INSERT_TAIL(&pool->sp_active, xprt, xp_alink); xprt->xp_active = TRUE; - xprt_assignthread(xprt); + if (xprt->xp_thread == NULL) { + if (!xprt_assignthread(xprt)) + TAILQ_INSERT_TAIL(&pool->sp_active, xprt, + xp_alink); + } } mtx_unlock(&pool->sp_lock); @@ -385,8 +387,10 @@ xprt_inactive_locked(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; + mtx_assert(&pool->sp_lock, MA_OWNED); if (xprt->xp_active) { - TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); + if (xprt->xp_thread == NULL) + TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); xprt->xp_active = FALSE; } } @@ -948,10 +952,11 @@ svc_assign_waiting_sockets(SVCPOOL *pool { SVCXPRT *xprt; - TAILQ_FOREACH(xprt, &pool->sp_active, xp_alink) { - if (!xprt->xp_thread) { - xprt_assignthread(xprt); - } + while ((xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { + if (xprt_assignthread(xprt)) + TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); + else + break; } } @@ -1042,21 +1047,17 @@ svc_run_internal(SVCPOOL *pool, bool_t i * active transport which isn't being serviced * by a thread. */ - if (svc_request_space_available(pool)) { - TAILQ_FOREACH(xprt, &pool->sp_active, - xp_alink) { - if (!xprt->xp_thread) { - SVC_ACQUIRE(xprt); - xprt->xp_thread = st; - st->st_xprt = xprt; - break; - } - } - } - if (st->st_xprt) + if (svc_request_space_available(pool) && + (xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { + TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); + SVC_ACQUIRE(xprt); + xprt->xp_thread = st; + st->st_xprt = xprt; continue; + } LIST_INSERT_HEAD(&pool->sp_idlethreads, st, st_ilink); + st->st_idle = TRUE; if (ismaster || (!ismaster && pool->sp_threadcount > pool->sp_minthreads)) error = cv_timedwait_sig(&st->st_cond, @@ -1064,7 +1065,10 @@ svc_run_internal(SVCPOOL *pool, bool_t i else error = cv_wait_sig(&st->st_cond, &pool->sp_lock); - LIST_REMOVE(st, st_ilink); + if (st->st_idle) { + LIST_REMOVE(st, st_ilink); + st->st_idle = FALSE; + } /* * Reduce worker thread count when idle. @@ -1132,11 +1136,12 @@ svc_run_internal(SVCPOOL *pool, bool_t i * execute the request * immediately. */ - if (stpref != st) { - cv_signal(&stpref->st_cond); - continue; - } else { + if (stpref == st) break; + if (stpref->st_idle) { + LIST_REMOVE(stpref, st_ilink); + stpref->st_idle = FALSE; + cv_signal(&stpref->st_cond); } } } while (stat == XPRT_MOREREQS @@ -1153,10 +1158,9 @@ svc_run_internal(SVCPOOL *pool, bool_t i xprt->xp_thread = NULL; st->st_xprt = NULL; if (xprt->xp_active) { - xprt_assignthread(xprt); - TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); - TAILQ_INSERT_TAIL(&pool->sp_active, xprt, - xp_alink); + if (!xprt_assignthread(xprt)) + TAILQ_INSERT_TAIL(&pool->sp_active, + xprt, xp_alink); } mtx_unlock(&pool->sp_lock); SVC_RELEASE(xprt); Modified: stable/10/sys/rpc/svc.h ============================================================================== --- stable/10/sys/rpc/svc.h Wed Jan 22 23:46:19 2014 (r261047) +++ stable/10/sys/rpc/svc.h Wed Jan 22 23:47:29 2014 (r261048) @@ -278,6 +278,7 @@ typedef struct __rpc_svcthread { SVCXPRT *st_xprt; /* transport we are processing */ struct svc_reqlist st_reqs; /* RPC requests to execute */ int st_reqcount; /* number of queued reqs */ + int st_idle; /* thread is on idle list */ struct cv st_cond; /* sleeping for work */ LIST_ENTRY(__rpc_svcthread) st_link; /* all threads list */ LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:48:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8354B7A; Wed, 22 Jan 2014 23:48:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A80441110; Wed, 22 Jan 2014 23:48:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNmGil025618; Wed, 22 Jan 2014 23:48:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNmFE9025614; Wed, 22 Jan 2014 23:48:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222348.s0MNmFE9025614@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261049 - in stable/10/sys: fs/nfsserver nfs nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:48:17 -0000 Author: mav Date: Wed Jan 22 23:48:15 2014 New Revision: 261049 URL: http://svnweb.freebsd.org/changeset/base/261049 Log: MFC r259765: Fix RPC server threads file handle affinity to work better with ZFS. Instead of taking 8 specific bytes of file handle to identify file during RPC thread affitinity handling, use trivial hash of the full file handle. ZFS's struct zfid_short does not have padding field after the length field, as result, originally picked 8 bytes are loosing lower 16 bits of object ID, causing many false matches and unneeded requests affinity to same thread. This fix substantially improves NFS server latency and scalability in SPEC NFS benchmark by more flexible use of multiple NFS threads. Modified: stable/10/sys/fs/nfsserver/nfs_fha_new.c stable/10/sys/nfs/nfs_fha.c stable/10/sys/nfs/nfs_fha.h stable/10/sys/nfsserver/nfs_fha_old.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_fha_new.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_fha_new.c Wed Jan 22 23:47:29 2014 (r261048) +++ stable/10/sys/fs/nfsserver/nfs_fha_new.c Wed Jan 22 23:48:15 2014 (r261049) @@ -41,7 +41,7 @@ static void fhanew_init(void *foo); static void fhanew_uninit(void *foo); rpcproc_t fhanew_get_procnum(rpcproc_t procnum); int fhanew_realign(struct mbuf **mb, int malloc_flags); -int fhanew_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); +int fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos); int fhanew_is_read(rpcproc_t procnum); int fhanew_is_write(rpcproc_t procnum); int fhanew_get_offset(struct mbuf **md, caddr_t *dpos, int v3, @@ -128,11 +128,13 @@ fhanew_realign(struct mbuf **mb, int mal } int -fhanew_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos) +fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos) { struct nfsrv_descript lnd, *nd; uint32_t *tl; - int error, len; + uint8_t *buf; + uint64_t t; + int error, len, i; error = 0; len = 0; @@ -151,11 +153,13 @@ fhanew_get_fh(fhandle_t *fh, int v3, str len = NFSX_V2FH; } + t = 0; if (len != 0) { - NFSM_DISSECT_NONBLOCK(tl, uint32_t *, len); - bcopy(tl, fh, len); - } else - bzero(fh, sizeof(*fh)); + NFSM_DISSECT_NONBLOCK(buf, uint8_t *, len); + for (i = 0; i < len; i++) + t ^= ((uint64_t)buf[i] << (i & 7) * 8); + } + *fh = t; nfsmout: *md = nd->nd_md; Modified: stable/10/sys/nfs/nfs_fha.c ============================================================================== --- stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:47:29 2014 (r261048) +++ stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:48:15 2014 (r261049) @@ -130,7 +130,6 @@ fha_extract_info(struct svc_req *req, st struct fha_callbacks *cb) { struct mbuf *md; - fhandle_t fh; caddr_t dpos; static u_int64_t random_fh = 0; int error; @@ -177,12 +176,10 @@ fha_extract_info(struct svc_req *req, st dpos = mtod(md, caddr_t); /* Grab the filehandle. */ - error = cb->get_fh(&fh, v3, &md, &dpos); + error = cb->get_fh(&i->fh, v3, &md, &dpos); if (error) goto out; - bcopy(fh.fh_fid.fid_data, &i->fh, sizeof(i->fh)); - /* Content ourselves with zero offset for all but reads. */ if (cb->is_read(procnum) || cb->is_write(procnum)) cb->get_offset(&md, &dpos, v3, i); Modified: stable/10/sys/nfs/nfs_fha.h ============================================================================== --- stable/10/sys/nfs/nfs_fha.h Wed Jan 22 23:47:29 2014 (r261048) +++ stable/10/sys/nfs/nfs_fha.h Wed Jan 22 23:48:15 2014 (r261049) @@ -82,7 +82,7 @@ struct fha_info { struct fha_callbacks { rpcproc_t (*get_procnum)(rpcproc_t procnum); int (*realign)(struct mbuf **mb, int malloc_flags); - int (*get_fh)(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); + int (*get_fh)(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos); int (*is_read)(rpcproc_t procnum); int (*is_write)(rpcproc_t procnum); int (*get_offset)(struct mbuf **md, caddr_t *dpos, int v3, struct Modified: stable/10/sys/nfsserver/nfs_fha_old.c ============================================================================== --- stable/10/sys/nfsserver/nfs_fha_old.c Wed Jan 22 23:47:29 2014 (r261048) +++ stable/10/sys/nfsserver/nfs_fha_old.c Wed Jan 22 23:48:15 2014 (r261049) @@ -49,7 +49,7 @@ static void fhaold_init(void *foo); static void fhaold_uninit(void *foo); rpcproc_t fhaold_get_procnum(rpcproc_t procnum); int fhaold_realign(struct mbuf **mb, int malloc_flags); -int fhaold_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos); +int fhaold_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos); int fhaold_is_read(rpcproc_t procnum); int fhaold_is_write(rpcproc_t procnum); int fhaold_get_offset(struct mbuf **md, caddr_t *dpos, int v3, @@ -135,9 +135,33 @@ fhaold_realign(struct mbuf **mb, int mal } int -fhaold_get_fh(fhandle_t *fh, int v3, struct mbuf **md, caddr_t *dpos) +fhaold_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos) { - return (nfsm_srvmtofh_xx(fh, v3, md, dpos)); + u_int32_t *tl; + uint8_t *buf; + uint64_t t; + int fhlen, i; + + if (v3) { + tl = nfsm_dissect_xx_nonblock(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) + return EBADRPC; + fhlen = fxdr_unsigned(int, *tl); + if (fhlen != 0 && fhlen != NFSX_V3FH) + return EBADRPC; + } else { + fhlen = NFSX_V2FH; + } + t = 0; + if (fhlen != 0) { + buf = nfsm_dissect_xx_nonblock(fhlen, md, dpos); + if (buf == NULL) + return EBADRPC; + for (i = 0; i < fhlen; i++) + t ^= ((uint64_t)buf[i] << (i & 7) * 8); + } + *fh = t; + return 0; } int From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:48:55 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45759CAA; Wed, 22 Jan 2014 23:48:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 313CD1115; Wed, 22 Jan 2014 23:48:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNmtdl025721; Wed, 22 Jan 2014 23:48:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNmtpU025720; Wed, 22 Jan 2014 23:48:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222348.s0MNmtpU025720@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261050 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:48:55 -0000 Author: mav Date: Wed Jan 22 23:48:54 2014 New Revision: 261050 URL: http://svnweb.freebsd.org/changeset/base/261050 Log: MFC r259828: Fix a bug introduced at r259632, triggering infinite loop in some cases. Modified: stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc_vc.c ============================================================================== --- stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:48:15 2014 (r261049) +++ stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:48:54 2014 (r261050) @@ -555,7 +555,7 @@ svc_vc_backchannel_stat(SVCXPRT *xprt) * leaving the result in cd->mreq. If we don't have a complete record, leave * the partial result in cd->mreq and try to read more from the socket. */ -static void +static int svc_vc_process_pending(SVCXPRT *xprt) { struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1; @@ -584,7 +584,7 @@ svc_vc_process_pending(SVCXPRT *xprt) } if (n < sizeof(uint32_t)) { so->so_rcv.sb_lowat = sizeof(uint32_t) - n; - return; + return (FALSE); } m_copydata(cd->mpending, 0, sizeof(header), (char *)&header); @@ -620,6 +620,7 @@ svc_vc_process_pending(SVCXPRT *xprt) } so->so_rcv.sb_lowat = imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); + return (TRUE); } static bool_t @@ -642,8 +643,10 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms for (;;) { /* If we have no request ready, check pending queue. */ while (cd->mpending && - (cd->mreq == NULL || cd->resid != 0 || !cd->eor)) - svc_vc_process_pending(xprt); + (cd->mreq == NULL || cd->resid != 0 || !cd->eor)) { + if (!svc_vc_process_pending(xprt)) + break; + } /* Process and return complete request in cd->mreq. */ if (cd->mreq != NULL && cd->resid == 0 && cd->eor) { From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:49:38 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBFE7DF2; Wed, 22 Jan 2014 23:49:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BC8EA1123; Wed, 22 Jan 2014 23:49:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNnbkS025848; Wed, 22 Jan 2014 23:49:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNnbhk025847; Wed, 22 Jan 2014 23:49:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222349.s0MNnbhk025847@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261051 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:49:38 -0000 Author: mav Date: Wed Jan 22 23:49:37 2014 New Revision: 261051 URL: http://svnweb.freebsd.org/changeset/base/261051 Log: MFC r259877: Slightly simplify expiration logic introduced in r254337. - Do not update the histogram for items we are any way deleting from cache. - Do not update the histogram if nfsrc_tcphighwater is not set. - Remove some extra math operations. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Wed Jan 22 23:48:54 2014 (r261050) +++ stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Wed Jan 22 23:49:37 2014 (r261051) @@ -832,6 +832,7 @@ nfsrvd_cleancache(void) nfsrc_tcpsavedreplies = 0; } +#define HISTSIZE 16 /* * The basic rule is to get rid of entries that are expired. */ @@ -839,7 +840,7 @@ static void nfsrc_trimcache(u_int64_t sockref, struct socket *so) { struct nfsrvcache *rp, *nextrp; - int i, j, k, time_histo[10]; + int i, j, k, tto, time_histo[HISTSIZE]; time_t thisstamp; static time_t udp_lasttrim = 0, tcp_lasttrim = 0; static int onethread = 0; @@ -863,8 +864,9 @@ nfsrc_trimcache(u_int64_t sockref, struc } if (NFSD_MONOSEC != tcp_lasttrim || nfsrc_tcpsavedreplies >= nfsrc_tcphighwater) { - for (i = 0; i < 10; i++) + for (i = 0; i < HISTSIZE; i++) time_histo[i] = 0; + tto = nfsrc_tcptimeout; for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { mtx_lock(&nfsrchash_table[i].mtx); if (i == 0) @@ -874,6 +876,15 @@ nfsrc_trimcache(u_int64_t sockref, struc if (!(rp->rc_flag & (RC_INPROG|RC_LOCKED|RC_WANTED)) && rp->rc_refcnt == 0) { + if ((rp->rc_flag & RC_REFCNT) || + tcp_lasttrim > rp->rc_timestamp || + nfsrc_activesocket(rp, sockref, so)) { + nfsrc_freecache(rp); + continue; + } + + if (nfsrc_tcphighwater == 0) + continue; /* * The timestamps range from roughly the * present (tcp_lasttrim) to the present @@ -881,16 +892,13 @@ nfsrc_trimcache(u_int64_t sockref, struc * histogram of where the timeouts fall. */ j = rp->rc_timestamp - tcp_lasttrim; - if (j >= nfsrc_tcptimeout) - j = nfsrc_tcptimeout - 1; - if (j < 0) + if (j >= tto) + j = HISTSIZE - 1; + else if (j < 0) j = 0; - j = (j * 10 / nfsrc_tcptimeout) % 10; + else + j = j * HISTSIZE / tto; time_histo[j]++; - if ((rp->rc_flag & RC_REFCNT) || - tcp_lasttrim > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, so)) - nfsrc_freecache(rp); } } mtx_unlock(&nfsrchash_table[i].mtx); @@ -903,12 +911,12 @@ nfsrc_trimcache(u_int64_t sockref, struc * 80% of the nfsrc_tcphighwater. */ k = 0; - for (i = 0; i < 8; i++) { + for (i = 0; i < (HISTSIZE - 2); i++) { k += time_histo[i]; if (k > j) break; } - k = nfsrc_tcptimeout * (i + 1) / 10; + k = tto * (i + 1) / HISTSIZE; if (k < 1) k = 1; thisstamp = tcp_lasttrim + k; From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:50:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CCF9FB5; Wed, 22 Jan 2014 23:50:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 893E01135; Wed, 22 Jan 2014 23:50:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNoDAE026298; Wed, 22 Jan 2014 23:50:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNoDmp026297; Wed, 22 Jan 2014 23:50:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222350.s0MNoDmp026297@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261052 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:50:13 -0000 Author: mav Date: Wed Jan 22 23:50:13 2014 New Revision: 261052 URL: http://svnweb.freebsd.org/changeset/base/261052 Log: MFC r260031: In addition to r259632 completely block receive upcalls if we have more data than we need. This reduces lock pressure from xprt_active() side. Modified: stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc_vc.c ============================================================================== --- stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:49:37 2014 (r261051) +++ stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:50:13 2014 (r261052) @@ -619,7 +619,15 @@ svc_vc_process_pending(SVCXPRT *xprt) } } - so->so_rcv.sb_lowat = imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); + /* + * Block receive upcalls if we have more data pending, + * otherwise report our need. + */ + if (cd->mpending) + so->so_rcv.sb_lowat = INT_MAX; + else + so->so_rcv.sb_lowat = + imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); return (TRUE); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:51:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 206CE24F; Wed, 22 Jan 2014 23:51:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 017AD11AA; Wed, 22 Jan 2014 23:51:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNpDKV027178; Wed, 22 Jan 2014 23:51:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNpDCH027174; Wed, 22 Jan 2014 23:51:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222351.s0MNpDCH027174@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:51:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261053 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:51:14 -0000 Author: mav Date: Wed Jan 22 23:51:12 2014 New Revision: 261053 URL: http://svnweb.freebsd.org/changeset/base/261053 Log: MFC r260036: Introduce xprt_inactive_self() -- variant for use when sure that port is assigned to thread. For example, withing receive handlers. In that case the function reduces to single assignment and can avoid locking. Modified: stable/10/sys/rpc/svc.c stable/10/sys/rpc/svc.h stable/10/sys/rpc/svc_dg.c stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Wed Jan 22 23:50:13 2014 (r261052) +++ stable/10/sys/rpc/svc.c Wed Jan 22 23:51:12 2014 (r261053) @@ -406,6 +406,19 @@ xprt_inactive(SVCXPRT *xprt) } /* + * Variant of xprt_inactive() for use only when sure that port is + * assigned to thread. For example, withing receive handlers. + */ +void +xprt_inactive_self(SVCXPRT *xprt) +{ + + KASSERT(xprt->xp_thread != NULL, + ("xprt_inactive_self(%p) with NULL xp_thread", xprt)); + xprt->xp_active = FALSE; +} + +/* * Add a service program to the callout list. * The dispatch routine will be called when a rpc request for this * program number comes in. Modified: stable/10/sys/rpc/svc.h ============================================================================== --- stable/10/sys/rpc/svc.h Wed Jan 22 23:50:13 2014 (r261052) +++ stable/10/sys/rpc/svc.h Wed Jan 22 23:51:12 2014 (r261053) @@ -523,6 +523,7 @@ __BEGIN_DECLS extern void xprt_active(SVCXPRT *); extern void xprt_inactive(SVCXPRT *); extern void xprt_inactive_locked(SVCXPRT *); +extern void xprt_inactive_self(SVCXPRT *); __END_DECLS #endif Modified: stable/10/sys/rpc/svc_dg.c ============================================================================== --- stable/10/sys/rpc/svc_dg.c Wed Jan 22 23:50:13 2014 (r261052) +++ stable/10/sys/rpc/svc_dg.c Wed Jan 22 23:51:12 2014 (r261053) @@ -196,10 +196,10 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms * from racing the upcall after our soreadable() call * returns false. */ - mtx_lock(&xprt->xp_pool->sp_lock); + SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); if (!soreadable(xprt->xp_socket)) - xprt_inactive_locked(xprt); - mtx_unlock(&xprt->xp_pool->sp_lock); + xprt_inactive_self(xprt); + SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -208,7 +208,7 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); soupcall_clear(xprt->xp_socket, SO_RCV); SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); sx_xunlock(&xprt->xp_lock); return (FALSE); } Modified: stable/10/sys/rpc/svc_vc.c ============================================================================== --- stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:50:13 2014 (r261052) +++ stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:51:12 2014 (r261053) @@ -385,7 +385,7 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st */ ACCEPT_LOCK(); if (TAILQ_EMPTY(&xprt->xp_socket->so_comp)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); ACCEPT_UNLOCK(); sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -398,7 +398,7 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st soupcall_clear(xprt->xp_socket, SO_RCV); } SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -667,7 +667,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms if (cd->mreq == NULL || cd->resid != 0) { SOCKBUF_LOCK(&so->so_rcv); if (!soreadable(so)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); SOCKBUF_UNLOCK(&so->so_rcv); } @@ -709,7 +709,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms */ SOCKBUF_LOCK(&so->so_rcv); if (!soreadable(so)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); SOCKBUF_UNLOCK(&so->so_rcv); sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -722,7 +722,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms soupcall_clear(so, SO_RCV); } SOCKBUF_UNLOCK(&so->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); cd->strm_stat = XPRT_DIED; sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -732,7 +732,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms /* * EOF - the other end has closed the socket. */ - xprt_inactive(xprt); + xprt_inactive_self(xprt); cd->strm_stat = XPRT_DIED; sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -763,7 +763,7 @@ svc_vc_backchannel_recv(SVCXPRT *xprt, s mtx_lock(&ct->ct_lock); m = cd->mreq; if (m == NULL) { - xprt_inactive(xprt); + xprt_inactive_self(xprt); mtx_unlock(&ct->ct_lock); sx_xunlock(&xprt->xp_lock); return (FALSE); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:52:21 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6312550F; Wed, 22 Jan 2014 23:52:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4DB0411BF; Wed, 22 Jan 2014 23:52:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNqLTq028961; Wed, 22 Jan 2014 23:52:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNqKTY028954; Wed, 22 Jan 2014 23:52:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222352.s0MNqKTY028954@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261054 - in stable/10/sys: nfs rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:52:21 -0000 Author: mav Date: Wed Jan 22 23:52:20 2014 New Revision: 261054 URL: http://svnweb.freebsd.org/changeset/base/261054 Log: MFC r260097: Move most of NFS file handle affinity code out of the heavily congested global RPC thread pool lock and protect it with own set of locks. On synthetic benchmarks this improves peak NFS request rate by 40%. Modified: stable/10/sys/nfs/nfs_fha.c stable/10/sys/nfs/nfs_fha.h stable/10/sys/rpc/svc.c stable/10/sys/rpc/svc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/nfs/nfs_fha.c ============================================================================== --- stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:51:12 2014 (r261053) +++ stable/10/sys/nfs/nfs_fha.c Wed Jan 22 23:52:20 2014 (r261054) @@ -52,13 +52,10 @@ void fha_init(struct fha_params *softc) { char tmpstr[128]; + int i; - /* - * A small hash table to map filehandles to fha_hash_entry - * structures. - */ - softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, - &softc->g_fha.hashmask); + for (i = 0; i < FHA_HASH_SIZE; i++) + mtx_init(&softc->fha_hash[i].mtx, "fhalock", NULL, MTX_DEF); /* * Set the default tuning parameters. @@ -117,8 +114,11 @@ fha_init(struct fha_params *softc) void fha_uninit(struct fha_params *softc) { + int i; + sysctl_ctx_free(&softc->sysctl_ctx); - hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); + for (i = 0; i < FHA_HASH_SIZE; i++) + mtx_destroy(&softc->fha_hash[i].mtx); } /* @@ -207,8 +207,13 @@ static void fha_hash_entry_destroy(struct fha_hash_entry *e) { - if (e->num_rw + e->num_exclusive) - panic("nonempty fhe"); + mtx_assert(e->mtx, MA_OWNED); + KASSERT(e->num_rw == 0, + ("%d reqs on destroyed fhe %p", e->num_rw, e)); + KASSERT(e->num_exclusive == 0, + ("%d exclusive reqs on destroyed fhe %p", e->num_exclusive, e)); + KASSERT(e->num_threads == 0, + ("%d threads on destroyed fhe %p", e->num_threads, e)); free(e, M_NFS_FHA); } @@ -216,6 +221,7 @@ static void fha_hash_entry_remove(struct fha_hash_entry *e) { + mtx_assert(e->mtx, MA_OWNED); LIST_REMOVE(e, link); fha_hash_entry_destroy(e); } @@ -224,36 +230,22 @@ static struct fha_hash_entry * fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) { SVCPOOL *pool; - - pool = *softc->pool; - + struct fha_hash_slot *fhs; struct fha_hash_entry *fhe, *new_fhe; - LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], - link) + pool = *softc->pool; + fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; + new_fhe = fha_hash_entry_new(fh); + new_fhe->mtx = &fhs->mtx; + mtx_lock(&fhs->mtx); + LIST_FOREACH(fhe, &fhs->list, link) if (fhe->fh == fh) break; - if (!fhe) { - /* Allocate a new entry. */ - mtx_unlock(&pool->sp_lock); - new_fhe = fha_hash_entry_new(fh); - mtx_lock(&pool->sp_lock); - - /* Double-check to make sure we still need the new entry. */ - LIST_FOREACH(fhe, - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) - if (fhe->fh == fh) - break; - if (!fhe) { - fhe = new_fhe; - LIST_INSERT_HEAD( - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], - fhe, link); - } else - fha_hash_entry_destroy(new_fhe); - } - + fhe = new_fhe; + LIST_INSERT_HEAD(&fhs->list, fhe, link); + } else + fha_hash_entry_destroy(new_fhe); return (fhe); } @@ -261,6 +253,8 @@ static void fha_hash_entry_add_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) { + mtx_assert(fhe->mtx, MA_OWNED); + thread->st_p2 = 0; LIST_INSERT_HEAD(&fhe->threads, thread, st_alink); fhe->num_threads++; } @@ -269,6 +263,9 @@ static void fha_hash_entry_remove_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) { + mtx_assert(fhe->mtx, MA_OWNED); + KASSERT(thread->st_p2 == 0, + ("%d reqs on removed thread %p", thread->st_p2, thread)); LIST_REMOVE(thread, st_alink); fhe->num_threads--; } @@ -280,6 +277,7 @@ static void fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count) { + mtx_assert(fhe->mtx, MA_OWNED); if (LK_EXCLUSIVE == locktype) fhe->num_exclusive += count; else @@ -306,7 +304,7 @@ fha_hash_entry_choose_thread(struct fha_ pool = *softc->pool; LIST_FOREACH(thread, &fhe->threads, st_alink) { - req_count = thread->st_reqcount; + req_count = thread->st_p2; /* If there are any writes in progress, use the first thread. */ if (fhe->num_exclusive) { @@ -322,7 +320,7 @@ fha_hash_entry_choose_thread(struct fha_ * exceed our per-thread load limit in the process. */ offset1 = i->offset; - offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; + offset2 = thread->st_p3; if (((offset1 >= offset2) && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) @@ -360,28 +358,11 @@ fha_hash_entry_choose_thread(struct fha_ */ if ((softc->ctls.max_nfsds_per_fh == 0) || (fhe->num_threads < softc->ctls.max_nfsds_per_fh)) { - /* - * We can add a new thread, so try for an idle thread - * first, and fall back to this_thread if none are idle. - */ - if (STAILQ_EMPTY(&this_thread->st_reqs)) { - thread = this_thread; + thread = this_thread; #if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)t", thread, thread->st_reqcount); -#endif - } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) { -#if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)i", thread, thread->st_reqcount); -#endif - } else { - thread = this_thread; -#if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)b", thread, thread->st_reqcount); + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)t", thread, thread->st_p2); #endif - } fha_hash_entry_add_thread(fhe, thread); } else { /* @@ -411,16 +392,16 @@ fha_assign(SVCTHREAD *this_thread, struc /* Check to see whether we're enabled. */ if (softc->ctls.enable == 0) - return (this_thread); + goto thist; /* * Only do placement if this is an NFS request. */ if (req->rq_prog != NFS_PROG) - return (this_thread); + goto thist; if (req->rq_vers != 2 && req->rq_vers != 3) - return (this_thread); + goto thist; fha_extract_info(req, &i, cb); @@ -440,8 +421,21 @@ fha_assign(SVCTHREAD *this_thread, struc thread = fha_hash_entry_choose_thread(softc, fhe, &i, this_thread); KASSERT(thread, ("fha_assign: NULL thread!")); fha_hash_entry_add_op(fhe, i.locktype, 1); + thread->st_p2++; + thread->st_p3 = i.offset; + + /* + * Grab the pool lock here to not let chosen thread go away before + * the new request inserted to its queue while we drop fhe lock. + */ + mtx_lock(&(*softc->pool)->sp_lock); + mtx_unlock(fhe->mtx); return (thread); +thist: + req->rq_p1 = NULL; + mtx_lock(&(*softc->pool)->sp_lock); + return (this_thread); } /* @@ -452,6 +446,7 @@ void fha_nd_complete(SVCTHREAD *thread, struct svc_req *req) { struct fha_hash_entry *fhe = req->rq_p1; + struct mtx *mtx; /* * This may be called for reqs that didn't go through @@ -460,13 +455,18 @@ fha_nd_complete(SVCTHREAD *thread, struc if (!fhe) return; + mtx = fhe->mtx; + mtx_lock(mtx); fha_hash_entry_add_op(fhe, req->rq_p2, -1); - - if (thread->st_reqcount == 0) { + thread->st_p2--; + KASSERT(thread->st_p2 >= 0, ("Negative request count %d on %p", + thread->st_p2, thread)); + if (thread->st_p2 == 0) { fha_hash_entry_remove_thread(fhe, thread); if (0 == fhe->num_rw + fhe->num_exclusive) fha_hash_entry_remove(fhe); } + mtx_unlock(mtx); } int @@ -489,10 +489,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st } pool = *softc->pool; - mtx_lock(&pool->sp_lock); count = 0; - for (i = 0; i <= softc->g_fha.hashmask; i++) - if (!LIST_EMPTY(&softc->g_fha.hashtable[i])) + for (i = 0; i < FHA_HASH_SIZE; i++) + if (!LIST_EMPTY(&softc->fha_hash[i].list)) count++; if (count == 0) { @@ -500,8 +499,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st goto out; } - for (i = 0; i <= softc->g_fha.hashmask; i++) { - LIST_FOREACH(fhe, &softc->g_fha.hashtable[i], link) { + for (i = 0; i < FHA_HASH_SIZE; i++) { + mtx_lock(&softc->fha_hash[i].mtx); + LIST_FOREACH(fhe, &softc->fha_hash[i].list, link) { sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); @@ -512,8 +512,7 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st LIST_FOREACH(thread, &fhe->threads, st_alink) { sbuf_printf(&sb, " thread %p offset %ju " "(count %d)\n", thread, - STAILQ_FIRST(&thread->st_reqs)->rq_p3, - thread->st_reqcount); + thread->st_p3, thread->st_p2); } sbuf_printf(&sb, "}"); @@ -525,11 +524,10 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st break; } } + mtx_unlock(&softc->fha_hash[i].mtx); } out: - if (pool) - mtx_unlock(&pool->sp_lock); sbuf_trim(&sb); sbuf_finish(&sb); error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); Modified: stable/10/sys/nfs/nfs_fha.h ============================================================================== --- stable/10/sys/nfs/nfs_fha.h Wed Jan 22 23:51:12 2014 (r261053) +++ stable/10/sys/nfs/nfs_fha.h Wed Jan 22 23:52:20 2014 (r261054) @@ -35,11 +35,7 @@ #define FHA_DEF_MAX_NFSDS_PER_FH 8 #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ -/* This is the global structure that represents the state of the fha system. */ -struct fha_global { - struct fha_hash_entry_list *hashtable; - u_long hashmask; -}; +#define FHA_HASH_SIZE 251 struct fha_ctls { int enable; @@ -62,6 +58,7 @@ struct fha_ctls { * avoid contention between threads over single files. */ struct fha_hash_entry { + struct mtx *mtx; LIST_ENTRY(fha_hash_entry) link; u_int64_t fh; u_int32_t num_rw; @@ -72,6 +69,11 @@ struct fha_hash_entry { LIST_HEAD(fha_hash_entry_list, fha_hash_entry); +struct fha_hash_slot { + struct fha_hash_entry_list list; + struct mtx mtx; +}; + /* A structure used for passing around data internally. */ struct fha_info { u_int64_t fh; @@ -93,7 +95,7 @@ struct fha_callbacks { }; struct fha_params { - struct fha_global g_fha; + struct fha_hash_slot fha_hash[FHA_HASH_SIZE]; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct fha_ctls ctls; Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Wed Jan 22 23:51:12 2014 (r261053) +++ stable/10/sys/rpc/svc.c Wed Jan 22 23:52:20 2014 (r261054) @@ -71,6 +71,8 @@ static struct svc_callout *svc_find(SVCP char *); static void svc_new_thread(SVCPOOL *pool); static void xprt_unregister_locked(SVCXPRT *xprt); +static void svc_change_space_used(SVCPOOL *pool, int delta); +static bool_t svc_request_space_available(SVCPOOL *pool); /* *************** SVCXPRT related stuff **************** */ @@ -373,7 +375,8 @@ xprt_active(SVCXPRT *xprt) if (!xprt->xp_active) { xprt->xp_active = TRUE; if (xprt->xp_thread == NULL) { - if (!xprt_assignthread(xprt)) + if (!svc_request_space_available(pool) || + !xprt_assignthread(xprt)) TAILQ_INSERT_TAIL(&pool->sp_active, xprt, xp_alink); } @@ -965,56 +968,63 @@ svc_assign_waiting_sockets(SVCPOOL *pool { SVCXPRT *xprt; + mtx_lock(&pool->sp_lock); while ((xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { if (xprt_assignthread(xprt)) TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); else break; } + mtx_unlock(&pool->sp_lock); } -static bool_t -svc_request_space_available(SVCPOOL *pool) +static void +svc_change_space_used(SVCPOOL *pool, int delta) { + unsigned int value; - mtx_assert(&pool->sp_lock, MA_OWNED); - - if (pool->sp_space_throttled) { - /* - * Below the low-water yet? If so, assign any waiting sockets. - */ - if (pool->sp_space_used < pool->sp_space_low) { - pool->sp_space_throttled = FALSE; - svc_assign_waiting_sockets(pool); - return TRUE; - } - - return FALSE; - } else { - if (pool->sp_space_used - >= pool->sp_space_high) { + value = atomic_fetchadd_int(&pool->sp_space_used, delta) + delta; + if (delta > 0) { + if (value >= pool->sp_space_high && !pool->sp_space_throttled) { pool->sp_space_throttled = TRUE; pool->sp_space_throttle_count++; - return FALSE; } - - return TRUE; + if (value > pool->sp_space_used_highest) + pool->sp_space_used_highest = value; + } else { + if (value < pool->sp_space_low && pool->sp_space_throttled) { + pool->sp_space_throttled = FALSE; + svc_assign_waiting_sockets(pool); + } } } +static bool_t +svc_request_space_available(SVCPOOL *pool) +{ + + if (pool->sp_space_throttled) + return (FALSE); + return (TRUE); +} + static void svc_run_internal(SVCPOOL *pool, bool_t ismaster) { + struct svc_reqlist reqs; SVCTHREAD *st, *stpref; SVCXPRT *xprt; enum xprt_stat stat; struct svc_req *rqstp; + size_t sz; int error; st = mem_alloc(sizeof(*st)); + st->st_pool = pool; st->st_xprt = NULL; STAILQ_INIT(&st->st_reqs); cv_init(&st->st_cond, "rpcsvc"); + STAILQ_INIT(&reqs); mtx_lock(&pool->sp_lock); LIST_INSERT_HEAD(&pool->sp_threads, st, st_link); @@ -1108,15 +1118,14 @@ svc_run_internal(SVCPOOL *pool, bool_t i * RPCs. */ xprt->xp_lastactive = time_uptime; - stat = XPRT_IDLE; do { + mtx_unlock(&pool->sp_lock); if (!svc_request_space_available(pool)) break; rqstp = NULL; - mtx_unlock(&pool->sp_lock); stat = svc_getreq(xprt, &rqstp); - mtx_lock(&pool->sp_lock); if (rqstp) { + svc_change_space_used(pool, rqstp->rq_size); /* * See if the application has * a preference for some other @@ -1126,17 +1135,12 @@ svc_run_internal(SVCPOOL *pool, bool_t i if (pool->sp_assign) stpref = pool->sp_assign(st, rqstp); + else + mtx_lock(&pool->sp_lock); - pool->sp_space_used += - rqstp->rq_size; - if (pool->sp_space_used - > pool->sp_space_used_highest) - pool->sp_space_used_highest = - pool->sp_space_used; rqstp->rq_thread = stpref; STAILQ_INSERT_TAIL(&stpref->st_reqs, rqstp, rq_link); - stpref->st_reqcount++; /* * If we assigned the request @@ -1156,7 +1160,8 @@ svc_run_internal(SVCPOOL *pool, bool_t i stpref->st_idle = FALSE; cv_signal(&stpref->st_cond); } - } + } else + mtx_lock(&pool->sp_lock); } while (stat == XPRT_MOREREQS && pool->sp_state != SVCPOOL_CLOSING); @@ -1171,25 +1176,30 @@ svc_run_internal(SVCPOOL *pool, bool_t i xprt->xp_thread = NULL; st->st_xprt = NULL; if (xprt->xp_active) { - if (!xprt_assignthread(xprt)) + if (!svc_request_space_available(pool) || + !xprt_assignthread(xprt)) TAILQ_INSERT_TAIL(&pool->sp_active, xprt, xp_alink); } + STAILQ_CONCAT(&reqs, &st->st_reqs); mtx_unlock(&pool->sp_lock); SVC_RELEASE(xprt); - mtx_lock(&pool->sp_lock); + } else { + STAILQ_CONCAT(&reqs, &st->st_reqs); + mtx_unlock(&pool->sp_lock); } /* * Execute what we have queued. */ - while ((rqstp = STAILQ_FIRST(&st->st_reqs)) != NULL) { - size_t sz = rqstp->rq_size; - mtx_unlock(&pool->sp_lock); + sz = 0; + while ((rqstp = STAILQ_FIRST(&reqs)) != NULL) { + STAILQ_REMOVE_HEAD(&reqs, rq_link); + sz += rqstp->rq_size; svc_executereq(rqstp); - mtx_lock(&pool->sp_lock); - pool->sp_space_used -= sz; } + svc_change_space_used(pool, -sz); + mtx_lock(&pool->sp_lock); } if (st->st_xprt) { @@ -1309,24 +1319,13 @@ void svc_freereq(struct svc_req *rqstp) { SVCTHREAD *st; - SVCXPRT *xprt; SVCPOOL *pool; st = rqstp->rq_thread; - xprt = rqstp->rq_xprt; - if (xprt) - pool = xprt->xp_pool; - else - pool = NULL; if (st) { - mtx_lock(&pool->sp_lock); - KASSERT(rqstp == STAILQ_FIRST(&st->st_reqs), - ("Freeing request out of order")); - STAILQ_REMOVE_HEAD(&st->st_reqs, rq_link); - st->st_reqcount--; + pool = st->st_pool; if (pool->sp_done) pool->sp_done(st, rqstp); - mtx_unlock(&pool->sp_lock); } if (rqstp->rq_auth.svc_ah_ops) Modified: stable/10/sys/rpc/svc.h ============================================================================== --- stable/10/sys/rpc/svc.h Wed Jan 22 23:51:12 2014 (r261053) +++ stable/10/sys/rpc/svc.h Wed Jan 22 23:52:20 2014 (r261054) @@ -275,14 +275,16 @@ STAILQ_HEAD(svc_reqlist, svc_req); * thread to read and execute pending RPCs. */ typedef struct __rpc_svcthread { + struct __rpc_svcpool *st_pool; SVCXPRT *st_xprt; /* transport we are processing */ struct svc_reqlist st_reqs; /* RPC requests to execute */ - int st_reqcount; /* number of queued reqs */ int st_idle; /* thread is on idle list */ struct cv st_cond; /* sleeping for work */ LIST_ENTRY(__rpc_svcthread) st_link; /* all threads list */ LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */ LIST_ENTRY(__rpc_svcthread) st_alink; /* application thread list */ + int st_p2; /* application workspace */ + uint64_t st_p3; /* application workspace */ } SVCTHREAD; LIST_HEAD(svcthread_list, __rpc_svcthread); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 22 23:55:27 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D82567F; Wed, 22 Jan 2014 23:55:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 77B4711DC; Wed, 22 Jan 2014 23:55:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0MNtREA029381; Wed, 22 Jan 2014 23:55:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0MNtPqU029370; Wed, 22 Jan 2014 23:55:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401222355.s0MNtPqU029370@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Jan 2014 23:55:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261055 - in stable/10/sys: fs/nfs fs/nfsserver rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2014 23:55:27 -0000 Author: mav Date: Wed Jan 22 23:55:25 2014 New Revision: 261055 URL: http://svnweb.freebsd.org/changeset/base/261055 Log: MFC r260229, r260258, r260367, r260390, r260459, r260648: Rework NFS Duplicate Request Cache cleanup logic. - Introduce additional hash to group requests by hash of sockref. This allows to process TCP acknowledgements without looping though all the cache, and as result allows to do it every time. - Indroduce additional callbacks to notify application layer about sockets disconnection. Without this last few requests processed just before socket disconnection never processed their ACKs and stuck in cache for many hours. - Implement transport-specific method for tracking reply acknowledgements. New implementation does not cross multiple stack layers to get the data and does not have race conditions that previously made some requests stuck in cache. This could be done more efficiently at sockbuf layer, but that would broke some KBIs, while I don't know other consumers for it aside NFS. - Instead of traversing all DRC twice per request, run cleaning only once per request, and except in some conditions traverse only single hash slot at a time. Together this limits NFS DRC growth only to situations of real connectivity problems. If network is working well, and so all replies are acknowledged, cache remains almost empty even after hours of heavy load. Without this change on the same test cache was growing to many thousand requests even with perfectly working local network. As another result this reduces CPU time spent on the DRC handling during SPEC NFS benchmark from about 10% to 0.5%. Sponsored by: iXsystems, Inc. Modified: stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfs/nfsrvcache.h stable/10/sys/fs/nfsserver/nfs_nfsdcache.c stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c stable/10/sys/rpc/svc.c stable/10/sys/rpc/svc.h stable/10/sys/rpc/svc_dg.c stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfs/nfs_var.h Wed Jan 22 23:55:25 2014 (r261055) @@ -218,14 +218,14 @@ void nfsrvd_dorpc(struct nfsrv_descript /* nfs_nfsdcache.c */ void nfsrvd_initcache(void); -int nfsrvd_getcache(struct nfsrv_descript *, struct socket *); -struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *, - struct socket *); -void nfsrvd_sentcache(struct nfsrvcache *, struct socket *, int); +int nfsrvd_getcache(struct nfsrv_descript *); +struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *); +void nfsrvd_sentcache(struct nfsrvcache *, int, uint32_t); void nfsrvd_cleancache(void); void nfsrvd_refcache(struct nfsrvcache *); void nfsrvd_derefcache(struct nfsrvcache *); void nfsrvd_delcache(struct nfsrvcache *); +void nfsrc_trimcache(uint64_t, uint32_t, int); /* nfs_commonsubs.c */ void newnfs_init(void); @@ -327,9 +327,6 @@ int nfsd_checkrootexp(struct nfsrv_descr void nfscl_retopts(struct nfsmount *, char *, size_t); /* nfs_commonport.c */ -int nfsrv_checksockseqnum(struct socket *, tcp_seq); -int nfsrv_getsockseqnum(struct socket *, tcp_seq *); -int nfsrv_getsocksndseq(struct socket *, tcp_seq *, tcp_seq *); int nfsrv_lookupfilename(struct nameidata *, char *, NFSPROC_T *); void nfsrv_object_create(vnode_t, NFSPROC_T *); int nfsrv_mallocmget_limit(void); Modified: stable/10/sys/fs/nfs/nfsrvcache.h ============================================================================== --- stable/10/sys/fs/nfs/nfsrvcache.h Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfs/nfsrvcache.h Wed Jan 22 23:55:25 2014 (r261055) @@ -46,6 +46,7 @@ /* Cache table entry. */ struct nfsrvcache { LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */ + LIST_ENTRY(nfsrvcache) rc_ahash; /* ACK hash chain */ TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */ u_int32_t rc_xid; /* rpc id number */ time_t rc_timestamp; /* Time done */ @@ -64,6 +65,7 @@ struct nfsrvcache { int16_t refcnt; u_int16_t cksum; time_t cachetime; + int acked; } ot; } rc_un2; u_int16_t rc_proc; /* rpc proc number */ @@ -81,6 +83,13 @@ struct nfsrvcache { #define rc_reqlen rc_un2.ot.len #define rc_cksum rc_un2.ot.cksum #define rc_cachetime rc_un2.ot.cachetime +#define rc_acked rc_un2.ot.acked + +/* TCP ACK values */ +#define RC_NO_SEQ 0 +#define RC_NO_ACK 1 +#define RC_ACK 2 +#define RC_NACK 3 /* Return values */ #define RC_DROPIT 0 @@ -95,7 +104,6 @@ struct nfsrvcache { #define RC_UDP 0x0010 #define RC_INETIPV6 0x0020 #define RC_INPROG 0x0040 -#define RC_TCPSEQ 0x0080 #define RC_NFSV2 0x0100 #define RC_NFSV3 0x0200 #define RC_NFSV4 0x0400 Modified: stable/10/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Wed Jan 22 23:55:25 2014 (r261055) @@ -162,6 +162,7 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; extern struct mtx nfsrc_udpmtx; extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; +extern struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE]; int nfsrc_floodlevel = NFSRVCACHE_FLOODLEVEL, nfsrc_tcpsavedreplies = 0; #endif /* !APPLEKEXT */ @@ -238,6 +239,7 @@ static int newnfsv2_procid[NFS_V3NPROCS] (&nfsrvudphashtbl[nfsrc_hash(xid)]) #define NFSRCHASH(xid) \ (&nfsrchash_table[nfsrc_hash(xid)].tbl) +#define NFSRCAHASH(xid) (&nfsrcahash_table[nfsrc_hash(xid)]) #define TRUE 1 #define FALSE 0 #define NFSRVCACHE_CHECKLEN 100 @@ -281,9 +283,6 @@ static void nfsrc_lock(struct nfsrvcache static void nfsrc_unlock(struct nfsrvcache *rp); static void nfsrc_wanted(struct nfsrvcache *rp); static void nfsrc_freecache(struct nfsrvcache *rp); -static void nfsrc_trimcache(u_int64_t, struct socket *); -static int nfsrc_activesocket(struct nfsrvcache *rp, u_int64_t, - struct socket *); static int nfsrc_getlenandcksum(mbuf_t m1, u_int16_t *cksum); static void nfsrc_marksametcpconn(u_int64_t); @@ -314,6 +313,7 @@ nfsrvd_initcache(void) for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { LIST_INIT(&nfsrvudphashtbl[i]); LIST_INIT(&nfsrchash_table[i].tbl); + LIST_INIT(&nfsrcahash_table[i].tbl); } TAILQ_INIT(&nfsrvudplru); nfsrc_tcpsavedreplies = 0; @@ -325,10 +325,9 @@ nfsrvd_initcache(void) /* * Get a cache entry for this request. Basically just malloc a new one * and then call nfsrc_getudp() or nfsrc_gettcp() to do the rest. - * Call nfsrc_trimcache() to clean up the cache before returning. */ APPLESTATIC int -nfsrvd_getcache(struct nfsrv_descript *nd, struct socket *so) +nfsrvd_getcache(struct nfsrv_descript *nd) { struct nfsrvcache *newrp; int ret; @@ -356,7 +355,6 @@ nfsrvd_getcache(struct nfsrv_descript *n } else { ret = nfsrc_gettcp(nd, newrp); } - nfsrc_trimcache(nd->nd_sockref, so); NFSEXITCODE2(0, nd); return (ret); } @@ -456,7 +454,7 @@ out: * Update a request cache entry after the rpc has been done */ APPLESTATIC struct nfsrvcache * -nfsrvd_updatecache(struct nfsrv_descript *nd, struct socket *so) +nfsrvd_updatecache(struct nfsrv_descript *nd) { struct nfsrvcache *rp; struct nfsrvcache *retrp = NULL; @@ -549,7 +547,6 @@ nfsrvd_updatecache(struct nfsrv_descript } out: - nfsrc_trimcache(nd->nd_sockref, so); NFSEXITCODE2(0, nd); return (retrp); } @@ -575,29 +572,23 @@ nfsrvd_delcache(struct nfsrvcache *rp) /* * Called after nfsrvd_updatecache() once the reply is sent, to update - * the entry for nfsrc_activesocket() and unlock it. The argument is + * the entry's sequence number and unlock it. The argument is * the pointer returned by nfsrvd_updatecache(). */ APPLESTATIC void -nfsrvd_sentcache(struct nfsrvcache *rp, struct socket *so, int err) +nfsrvd_sentcache(struct nfsrvcache *rp, int have_seq, uint32_t seq) { - tcp_seq tmp_seq; - struct mtx *mutex; + struct nfsrchash_bucket *hbp; - mutex = nfsrc_cachemutex(rp); - if (!(rp->rc_flag & RC_LOCKED)) - panic("nfsrvd_sentcache not locked"); - if (!err) { - if ((so->so_proto->pr_domain->dom_family != AF_INET && - so->so_proto->pr_domain->dom_family != AF_INET6) || - so->so_proto->pr_protocol != IPPROTO_TCP) - panic("nfs sent cache"); - if (nfsrv_getsockseqnum(so, &tmp_seq)) { - mtx_lock(mutex); - rp->rc_tcpseq = tmp_seq; - rp->rc_flag |= RC_TCPSEQ; - mtx_unlock(mutex); - } + KASSERT(rp->rc_flag & RC_LOCKED, ("nfsrvd_sentcache not locked")); + if (have_seq) { + hbp = NFSRCAHASH(rp->rc_sockref); + mtx_lock(&hbp->mtx); + rp->rc_tcpseq = seq; + if (rp->rc_acked != RC_NO_ACK) + LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash); + rp->rc_acked = RC_NO_ACK; + mtx_unlock(&hbp->mtx); } nfsrc_unlock(rp); } @@ -790,11 +781,18 @@ nfsrc_wanted(struct nfsrvcache *rp) static void nfsrc_freecache(struct nfsrvcache *rp) { + struct nfsrchash_bucket *hbp; LIST_REMOVE(rp, rc_hash); if (rp->rc_flag & RC_UDP) { TAILQ_REMOVE(&nfsrvudplru, rp, rc_lru); nfsrc_udpcachesize--; + } else if (rp->rc_acked != RC_NO_SEQ) { + hbp = NFSRCAHASH(rp->rc_sockref); + mtx_lock(&hbp->mtx); + if (rp->rc_acked == RC_NO_ACK) + LIST_REMOVE(rp, rc_ahash); + mtx_unlock(&hbp->mtx); } nfsrc_wanted(rp); if (rp->rc_flag & RC_REPMBUF) { @@ -836,14 +834,32 @@ nfsrvd_cleancache(void) /* * The basic rule is to get rid of entries that are expired. */ -static void -nfsrc_trimcache(u_int64_t sockref, struct socket *so) +void +nfsrc_trimcache(u_int64_t sockref, uint32_t snd_una, int final) { + struct nfsrchash_bucket *hbp; struct nfsrvcache *rp, *nextrp; - int i, j, k, tto, time_histo[HISTSIZE]; + int force, lastslot, i, j, k, tto, time_histo[HISTSIZE]; time_t thisstamp; static time_t udp_lasttrim = 0, tcp_lasttrim = 0; - static int onethread = 0; + static int onethread = 0, oneslot = 0; + + if (sockref != 0) { + hbp = NFSRCAHASH(sockref); + mtx_lock(&hbp->mtx); + LIST_FOREACH_SAFE(rp, &hbp->tbl, rc_ahash, nextrp) { + if (sockref == rp->rc_sockref) { + if (SEQ_GEQ(snd_una, rp->rc_tcpseq)) { + rp->rc_acked = RC_ACK; + LIST_REMOVE(rp, rc_ahash); + } else if (final) { + rp->rc_acked = RC_NACK; + LIST_REMOVE(rp, rc_ahash); + } + } + } + mtx_unlock(&hbp->mtx); + } if (atomic_cmpset_acq_int(&onethread, 0, 1) == 0) return; @@ -864,13 +880,28 @@ nfsrc_trimcache(u_int64_t sockref, struc } if (NFSD_MONOSEC != tcp_lasttrim || nfsrc_tcpsavedreplies >= nfsrc_tcphighwater) { - for (i = 0; i < HISTSIZE; i++) - time_histo[i] = 0; + force = nfsrc_tcphighwater / 4; + if (force > 0 && + nfsrc_tcpsavedreplies + force >= nfsrc_tcphighwater) { + for (i = 0; i < HISTSIZE; i++) + time_histo[i] = 0; + i = 0; + lastslot = NFSRVCACHE_HASHSIZE - 1; + } else { + force = 0; + if (NFSD_MONOSEC != tcp_lasttrim) { + i = 0; + lastslot = NFSRVCACHE_HASHSIZE - 1; + } else { + lastslot = i = oneslot; + if (++oneslot >= NFSRVCACHE_HASHSIZE) + oneslot = 0; + } + } tto = nfsrc_tcptimeout; - for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { + tcp_lasttrim = NFSD_MONOSEC; + for (; i <= lastslot; i++) { mtx_lock(&nfsrchash_table[i].mtx); - if (i == 0) - tcp_lasttrim = NFSD_MONOSEC; LIST_FOREACH_SAFE(rp, &nfsrchash_table[i].tbl, rc_hash, nextrp) { if (!(rp->rc_flag & @@ -878,12 +909,12 @@ nfsrc_trimcache(u_int64_t sockref, struc && rp->rc_refcnt == 0) { if ((rp->rc_flag & RC_REFCNT) || tcp_lasttrim > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, so)) { + rp->rc_acked == RC_ACK) { nfsrc_freecache(rp); continue; } - if (nfsrc_tcphighwater == 0) + if (force == 0) continue; /* * The timestamps range from roughly the @@ -903,8 +934,7 @@ nfsrc_trimcache(u_int64_t sockref, struc } mtx_unlock(&nfsrchash_table[i].mtx); } - j = nfsrc_tcphighwater / 5; /* 20% of it */ - if (j > 0 && (nfsrc_tcpsavedreplies + j) > nfsrc_tcphighwater) { + if (force) { /* * Trim some more with a smaller timeout of as little * as 20% of nfsrc_tcptimeout to try and get below @@ -913,7 +943,7 @@ nfsrc_trimcache(u_int64_t sockref, struc k = 0; for (i = 0; i < (HISTSIZE - 2); i++) { k += time_histo[i]; - if (k > j) + if (k > force) break; } k = tto * (i + 1) / HISTSIZE; @@ -929,8 +959,7 @@ nfsrc_trimcache(u_int64_t sockref, struc && rp->rc_refcnt == 0 && ((rp->rc_flag & RC_REFCNT) || thisstamp > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, - so))) + rp->rc_acked == RC_ACK)) nfsrc_freecache(rp); } mtx_unlock(&nfsrchash_table[i].mtx); @@ -975,28 +1004,6 @@ nfsrvd_derefcache(struct nfsrvcache *rp) } /* - * Check to see if the socket is active. - * Return 1 if the reply has been received/acknowledged by the client, - * 0 otherwise. - * XXX - Uses tcp internals. - */ -static int -nfsrc_activesocket(struct nfsrvcache *rp, u_int64_t cur_sockref, - struct socket *cur_so) -{ - int ret = 0; - - if (!(rp->rc_flag & RC_TCPSEQ)) - return (ret); - /* - * If the sockref is the same, it is the same TCP connection. - */ - if (cur_sockref == rp->rc_sockref) - ret = nfsrv_checksockseqnum(cur_so, rp->rc_tcpseq); - return (ret); -} - -/* * Calculate the length of the mbuf list and a checksum on the first up to * NFSRVCACHE_CHECKLEN bytes. */ Modified: stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Jan 22 23:55:25 2014 (r261055) @@ -97,8 +97,8 @@ static int nfs_maxvers = NFS_VER4; SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, &nfs_maxvers, 0, "The highest version of NFS handled by the server"); -static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, - u_int64_t, struct nfsrvcache **); +static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt, + struct nfsrvcache **); extern u_long sb_max_adj; extern int newnfs_numnfsd; @@ -251,8 +251,7 @@ nfssvc_program(struct svc_req *rqst, SVC } } - cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, - xprt->xp_sockref, &rp); + cacherep = nfs_proc(&nd, rqst->rq_xid, xprt, &rp); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsd_suspend_lock); NFSUNLOCKV4ROOTMUTEX(); @@ -287,8 +286,10 @@ nfssvc_program(struct svc_req *rqst, SVC } else if (!svc_sendreply_mbuf(rqst, nd.nd_mreq)) { svcerr_systemerr(rqst); } - if (rp != NULL) - nfsrvd_sentcache(rp, xprt->xp_socket, 0); + if (rp != NULL) { + nfsrvd_sentcache(rp, (rqst->rq_reply_seq != 0 || + SVC_ACK(xprt, NULL)), rqst->rq_reply_seq); + } svc_freereq(rqst); out: @@ -300,11 +301,12 @@ out: * Return the appropriate cache response. */ static int -nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, struct socket *so, - u_int64_t sockref, struct nfsrvcache **rpp) +nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVCXPRT *xprt, + struct nfsrvcache **rpp) { struct thread *td = curthread; int cacherep = RC_DOIT, isdgram; + uint32_t ack; *rpp = NULL; if (nd->nd_nam2 == NULL) { @@ -336,8 +338,11 @@ nfs_proc(struct nfsrv_descript *nd, u_in nd->nd_flag |= ND_SAMETCPCONN; nd->nd_retxid = xid; nd->nd_tcpconntime = NFSD_MONOSEC; - nd->nd_sockref = sockref; - cacherep = nfsrvd_getcache(nd, so); + nd->nd_sockref = xprt->xp_sockref; + cacherep = nfsrvd_getcache(nd); + ack = 0; + SVC_ACK(xprt, &ack); + nfsrc_trimcache(xprt->xp_sockref, ack, 0); } /* @@ -352,13 +357,23 @@ nfs_proc(struct nfsrv_descript *nd, u_in cacherep = RC_DROPIT; else cacherep = RC_REPLY; - *rpp = nfsrvd_updatecache(nd, so); + *rpp = nfsrvd_updatecache(nd); } NFSEXITCODE2(0, nd); return (cacherep); } +static void +nfssvc_loss(SVCXPRT *xprt) +{ + uint32_t ack; + + ack = 0; + SVC_ACK(xprt, &ack); + nfsrc_trimcache(xprt->xp_sockref, ack, 1); +} + /* * Adds a socket to the list for servicing by nfsds. */ @@ -399,6 +414,8 @@ nfsrvd_addsock(struct file *fp) if (nfs_maxvers >= NFS_VER4) svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); + if (so->so_type == SOCK_STREAM) + svc_loss_reg(xprt, nfssvc_loss); SVC_RELEASE(xprt); } Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Wed Jan 22 23:55:25 2014 (r261055) @@ -61,6 +61,7 @@ extern struct nfsv4lock nfsd_suspend_loc struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; +struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE]; struct mtx nfsrc_udpmtx; struct mtx nfs_v4root_mutex; struct nfsrvfh nfs_rootfh, nfs_pubfh; @@ -2881,40 +2882,6 @@ out: } /* - * Get the tcp socket sequence numbers we need. - * (Maybe this should be moved to the tcp sources?) - */ -int -nfsrv_getsocksndseq(struct socket *so, tcp_seq *maxp, tcp_seq *unap) -{ - struct inpcb *inp; - struct tcpcb *tp; - int error = 0; - - inp = sotoinpcb(so); - KASSERT(inp != NULL, ("nfsrv_getsocksndseq: inp == NULL")); - INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { - INP_RUNLOCK(inp); - error = EPIPE; - goto out; - } - tp = intotcpcb(inp); - if (tp->t_state != TCPS_ESTABLISHED) { - INP_RUNLOCK(inp); - error = EPIPE; - goto out; - } - *maxp = tp->snd_max; - *unap = tp->snd_una; - INP_RUNLOCK(inp); - -out: - NFSEXITCODE(error); - return (error); -} - -/* * This function needs to test to see if the system is near its limit * for memory allocation via malloc() or mget() and return True iff * either of these resources are near their limit. @@ -3340,6 +3307,11 @@ nfsd_modevent(module_t mod, int type, vo i); mtx_init(&nfsrchash_table[i].mtx, nfsrchash_table[i].lock_name, NULL, MTX_DEF); + snprintf(nfsrcahash_table[i].lock_name, + sizeof(nfsrcahash_table[i].lock_name), "nfsrc_tcpa%d", + i); + mtx_init(&nfsrcahash_table[i].mtx, + nfsrcahash_table[i].lock_name, NULL, MTX_DEF); } mtx_init(&nfsrc_udpmtx, "nfs_udpcache_mutex", NULL, MTX_DEF); mtx_init(&nfs_v4root_mutex, "nfs_v4root_mutex", NULL, MTX_DEF); @@ -3385,8 +3357,10 @@ nfsd_modevent(module_t mod, int type, vo svcpool_destroy(nfsrvd_pool); /* and get rid of the locks */ - for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { mtx_destroy(&nfsrchash_table[i].mtx); + mtx_destroy(&nfsrcahash_table[i].mtx); + } mtx_destroy(&nfsrc_udpmtx); mtx_destroy(&nfs_v4root_mutex); mtx_destroy(&nfsv4root_mnt.mnt_mtx); Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c Wed Jan 22 23:55:25 2014 (r261055) @@ -1987,47 +1987,6 @@ nfsmout: return (error); } -/* - * Check the tcp socket sequence number has been acknowledged. - */ -int -nfsrv_checksockseqnum(struct socket *so, tcp_seq tcpseqval) -{ - tcp_seq maxseq, unaseq; - int error, ret; - - error = nfsrv_getsocksndseq(so, &maxseq, &unaseq); - if (error) - return (0); - ret = SEQ_GEQ(unaseq, tcpseqval); - return (ret); -} - -/* - * Get the tcp sequence number to be acknowledged. - */ -int -nfsrv_getsockseqnum(struct socket *so, tcp_seq *tcpseqp) -{ - tcp_seq maxseq, unaseq; - u_int sbcc; - int error; - - sbcc = so->so_snd.sb_cc; - error = nfsrv_getsocksndseq(so, &maxseq, &unaseq); - if (error) - return (0); - /* - * Set the seq# to a value that will - * be at least the end of the reply. - * When this sequence# is acknowledged - * by the client, the client has received - * the reply. - */ - *tcpseqp = sbcc + maxseq; - return (1); -} - void nfsd_init(void) { Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/rpc/svc.c Wed Jan 22 23:55:25 2014 (r261055) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -93,6 +94,7 @@ svcpool_create(const char *name, struct TAILQ_INIT(&pool->sp_xlist); TAILQ_INIT(&pool->sp_active); TAILQ_INIT(&pool->sp_callouts); + TAILQ_INIT(&pool->sp_lcallouts); LIST_INIT(&pool->sp_threads); LIST_INIT(&pool->sp_idlethreads); pool->sp_minthreads = 1; @@ -158,6 +160,7 @@ svcpool_destroy(SVCPOOL *pool) { SVCXPRT *xprt, *nxprt; struct svc_callout *s; + struct svc_loss_callout *sl; struct svcxprt_list cleanup; TAILQ_INIT(&cleanup); @@ -169,12 +172,16 @@ svcpool_destroy(SVCPOOL *pool) TAILQ_INSERT_TAIL(&cleanup, xprt, xp_link); } - while (TAILQ_FIRST(&pool->sp_callouts)) { - s = TAILQ_FIRST(&pool->sp_callouts); + while ((s = TAILQ_FIRST(&pool->sp_callouts)) != NULL) { mtx_unlock(&pool->sp_lock); svc_unreg(pool, s->sc_prog, s->sc_vers); mtx_lock(&pool->sp_lock); } + while ((sl = TAILQ_FIRST(&pool->sp_lcallouts)) != NULL) { + mtx_unlock(&pool->sp_lock); + svc_loss_unreg(pool, sl->slc_dispatch); + mtx_lock(&pool->sp_lock); + } mtx_unlock(&pool->sp_lock); TAILQ_FOREACH_SAFE(xprt, &cleanup, xp_link, nxprt) { @@ -511,6 +518,55 @@ svc_unreg(SVCPOOL *pool, const rpcprog_t mtx_unlock(&pool->sp_lock); } +/* + * Add a service connection loss program to the callout list. + * The dispatch routine will be called when some port in ths pool die. + */ +bool_t +svc_loss_reg(SVCXPRT *xprt, void (*dispatch)(SVCXPRT *)) +{ + SVCPOOL *pool = xprt->xp_pool; + struct svc_loss_callout *s; + + mtx_lock(&pool->sp_lock); + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) { + if (s->slc_dispatch == dispatch) + break; + } + if (s != NULL) { + mtx_unlock(&pool->sp_lock); + return (TRUE); + } + s = malloc(sizeof (struct svc_callout), M_RPC, M_NOWAIT); + if (s == NULL) { + mtx_unlock(&pool->sp_lock); + return (FALSE); + } + s->slc_dispatch = dispatch; + TAILQ_INSERT_TAIL(&pool->sp_lcallouts, s, slc_link); + mtx_unlock(&pool->sp_lock); + return (TRUE); +} + +/* + * Remove a service connection loss program from the callout list. + */ +void +svc_loss_unreg(SVCPOOL *pool, void (*dispatch)(SVCXPRT *)) +{ + struct svc_loss_callout *s; + + mtx_lock(&pool->sp_lock); + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) { + if (s->slc_dispatch == dispatch) { + TAILQ_REMOVE(&pool->sp_lcallouts, s, slc_link); + free(s, M_RPC); + break; + } + } + mtx_unlock(&pool->sp_lock); +} + /* ********************** CALLOUT list related stuff ************* */ /* @@ -554,7 +610,7 @@ svc_sendreply_common(struct svc_req *rqs if (!SVCAUTH_WRAP(&rqstp->rq_auth, &body)) return (FALSE); - ok = SVC_REPLY(xprt, rply, rqstp->rq_addr, body); + ok = SVC_REPLY(xprt, rply, rqstp->rq_addr, body, &rqstp->rq_reply_seq); if (rqstp->rq_addr) { free(rqstp->rq_addr, M_SONAME); rqstp->rq_addr = NULL; @@ -803,6 +859,7 @@ svc_getreq(SVCXPRT *xprt, struct svc_req struct svc_req *r; struct rpc_msg msg; struct mbuf *args; + struct svc_loss_callout *s; enum xprt_stat stat; /* now receive msgs from xprtprt (support batch calls) */ @@ -831,7 +888,7 @@ svc_getreq(SVCXPRT *xprt, struct svc_req break; case RS_DONE: SVC_REPLY(xprt, &repmsg, r->rq_addr, - repbody); + repbody, &r->rq_reply_seq); if (r->rq_addr) { free(r->rq_addr, M_SONAME); r->rq_addr = NULL; @@ -881,6 +938,8 @@ call_done: r = NULL; } if ((stat = SVC_STAT(xprt)) == XPRT_DIED) { + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) + (*s->slc_dispatch)(xprt); xprt_unregister(xprt); } Modified: stable/10/sys/rpc/svc.h ============================================================================== --- stable/10/sys/rpc/svc.h Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/rpc/svc.h Wed Jan 22 23:55:25 2014 (r261055) @@ -103,9 +103,11 @@ struct xp_ops { struct sockaddr **, struct mbuf **); /* get transport status */ enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *); + /* get transport acknowledge sequence */ + bool_t (*xp_ack)(struct __rpc_svcxprt *, uint32_t *); /* send reply */ bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); /* destroy this struct */ void (*xp_destroy)(struct __rpc_svcxprt *); /* catch-all function */ @@ -166,6 +168,8 @@ typedef struct __rpc_svcxprt { time_t xp_lastactive; /* time of last RPC */ u_int64_t xp_sockref; /* set by nfsv4 to identify socket */ int xp_upcallset; /* socket upcall is set up */ + uint32_t xp_snd_cnt; /* # of bytes to send to socket */ + uint32_t xp_snt_cnt; /* # of bytes sent to socket */ #else int xp_fd; u_short xp_port; /* associated port number */ @@ -230,6 +234,17 @@ struct svc_callout { }; TAILQ_HEAD(svc_callout_list, svc_callout); +/* + * The services connection loss list + * The dispatch routine takes request structs and runs the + * apropriate procedure. + */ +struct svc_loss_callout { + TAILQ_ENTRY(svc_loss_callout) slc_link; + void (*slc_dispatch)(SVCXPRT *); +}; +TAILQ_HEAD(svc_loss_callout_list, svc_loss_callout); + struct __rpc_svcthread; /* @@ -253,6 +268,7 @@ struct svc_req { void *rq_p1; /* application workspace */ int rq_p2; /* application workspace */ uint64_t rq_p3; /* application workspace */ + uint32_t rq_reply_seq; /* reply socket sequence # */ char rq_credarea[3*MAX_AUTH_BYTES]; }; STAILQ_HEAD(svc_reqlist, svc_req); @@ -311,13 +327,14 @@ enum svcpool_state { typedef SVCTHREAD *pool_assign_fn(SVCTHREAD *, struct svc_req *); typedef void pool_done_fn(SVCTHREAD *, struct svc_req *); typedef struct __rpc_svcpool { - struct mtx sp_lock; /* protect the transport lists */ + struct mtx_padalign sp_lock; /* protect the transport lists */ const char *sp_name; /* pool name (e.g. "nfsd", "NLM" */ enum svcpool_state sp_state; /* current pool state */ struct proc *sp_proc; /* process which is in svc_run */ struct svcxprt_list sp_xlist; /* all transports in the pool */ struct svcxprt_list sp_active; /* transports needing service */ struct svc_callout_list sp_callouts; /* (prog,vers)->dispatch list */ + struct svc_loss_callout_list sp_lcallouts; /* loss->dispatch list */ struct svcthread_list sp_threads; /* service threads */ struct svcthread_list sp_idlethreads; /* idle service threads */ int sp_minthreads; /* minimum service thread count */ @@ -393,8 +410,12 @@ struct svc_req { #define SVC_STAT(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) -#define SVC_REPLY(xprt, msg, addr, m) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg), (addr), (m)) +#define SVC_ACK(xprt, ack) \ + ((xprt)->xp_ops->xp_ack == NULL ? FALSE : \ + ((ack) == NULL ? TRUE : (*(xprt)->xp_ops->xp_ack)((xprt), (ack)))) + +#define SVC_REPLY(xprt, msg, addr, m, seq) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg), (addr), (m), (seq)) #define SVC_DESTROY(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) @@ -495,6 +516,32 @@ extern void svc_unreg(const rpcprog_t, c #endif __END_DECLS +#ifdef _KERNEL +/* + * Service connection loss registration + * + * svc_loss_reg(xprt, dispatch) + * const SVCXPRT *xprt; + * const void (*dispatch)(); + */ + +__BEGIN_DECLS +extern bool_t svc_loss_reg(SVCXPRT *, void (*)(SVCXPRT *)); +__END_DECLS + +/* + * Service connection loss un-registration + * + * svc_loss_unreg(xprt, dispatch) + * const SVCXPRT *xprt; + * const void (*dispatch)(); + */ + +__BEGIN_DECLS +extern void svc_loss_unreg(SVCPOOL *, void (*)(SVCXPRT *)); +__END_DECLS +#endif + /* * Transport registration. * Modified: stable/10/sys/rpc/svc_dg.c ============================================================================== --- stable/10/sys/rpc/svc_dg.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/rpc/svc_dg.c Wed Jan 22 23:55:25 2014 (r261055) @@ -66,7 +66,7 @@ static enum xprt_stat svc_dg_stat(SVCXPR static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); static void svc_dg_destroy(SVCXPRT *); static bool_t svc_dg_control(SVCXPRT *, const u_int, void *); static int svc_dg_soupcall(struct socket *so, void *arg, int waitflag); @@ -230,7 +230,7 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms static bool_t svc_dg_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { XDR xdrs; struct mbuf *mrep; Modified: stable/10/sys/rpc/svc_vc.c ============================================================================== --- stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:52:20 2014 (r261054) +++ stable/10/sys/rpc/svc_vc.c Wed Jan 22 23:55:25 2014 (r261055) @@ -76,10 +76,11 @@ static void svc_vc_rendezvous_destroy(SV static bool_t svc_vc_null(void); static void svc_vc_destroy(SVCXPRT *); static enum xprt_stat svc_vc_stat(SVCXPRT *); +static bool_t svc_vc_ack(SVCXPRT *, uint32_t *); static bool_t svc_vc_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *seq); static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in); static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq, void *in); @@ -88,7 +89,7 @@ static enum xprt_stat svc_vc_backchannel static bool_t svc_vc_backchannel_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_vc_backchannel_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); static bool_t svc_vc_backchannel_control(SVCXPRT *xprt, const u_int rq, void *in); static SVCXPRT *svc_vc_create_conn(SVCPOOL *pool, struct socket *so, @@ -100,7 +101,7 @@ static struct xp_ops svc_vc_rendezvous_o .xp_recv = svc_vc_rendezvous_recv, .xp_stat = svc_vc_rendezvous_stat, .xp_reply = (bool_t (*)(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *))svc_vc_null, + struct sockaddr *, struct mbuf *, uint32_t *))svc_vc_null, .xp_destroy = svc_vc_rendezvous_destroy, .xp_control = svc_vc_rendezvous_control }; @@ -108,6 +109,7 @@ static struct xp_ops svc_vc_rendezvous_o static struct xp_ops svc_vc_ops = { .xp_recv = svc_vc_recv, .xp_stat = svc_vc_stat, + .xp_ack = svc_vc_ack, .xp_reply = svc_vc_reply, .xp_destroy = svc_vc_destroy, .xp_control = svc_vc_control @@ -184,8 +186,10 @@ svc_vc_create(SVCPOOL *pool, struct sock return (xprt); cleanup_svc_vc_create: - if (xprt) + if (xprt) { + sx_destroy(&xprt->xp_lock); svc_xprt_free(xprt); + } return (NULL); } @@ -270,7 +274,8 @@ svc_vc_create_conn(SVCPOOL *pool, struct return (xprt); cleanup_svc_vc_create: if (xprt) { - mem_free(xprt, sizeof(*xprt)); + sx_destroy(&xprt->xp_lock); + svc_xprt_free(xprt); } if (cd) mem_free(cd, sizeof(*cd)); @@ -451,7 +456,6 @@ svc_vc_destroy_common(SVCXPRT *xprt) } SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - sx_destroy(&xprt->xp_lock); if (xprt->xp_socket) (void)soclose(xprt->xp_socket); @@ -537,6 +541,15 @@ svc_vc_stat(SVCXPRT *xprt) return (XPRT_IDLE); } +static bool_t +svc_vc_ack(SVCXPRT *xprt, uint32_t *ack) +{ + + *ack = atomic_load_acq_32(&xprt->xp_snt_cnt); + *ack -= xprt->xp_socket->so_snd.sb_cc; + return (TRUE); +} + static enum xprt_stat svc_vc_backchannel_stat(SVCXPRT *xprt) { @@ -785,12 +798,12 @@ svc_vc_backchannel_recv(SVCXPRT *xprt, s static bool_t svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { XDR xdrs; struct mbuf *mrep; bool_t stat = TRUE; - int error; + int error, len; /* * Leave space for record mark. @@ -817,14 +830,19 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m * Prepend a record marker containing the reply length. */ M_PREPEND(mrep, sizeof(uint32_t), M_WAITOK); + len = mrep->m_pkthdr.len; *mtod(mrep, uint32_t *) = - htonl(0x80000000 | (mrep->m_pkthdr.len - - sizeof(uint32_t))); + htonl(0x80000000 | (len - sizeof(uint32_t))); + atomic_add_acq_32(&xprt->xp_snd_cnt, len); error = sosend(xprt->xp_socket, NULL, NULL, mrep, NULL, 0, curthread); if (!error) { + atomic_add_rel_32(&xprt->xp_snt_cnt, len); + if (seq) + *seq = xprt->xp_snd_cnt; stat = TRUE; - } + } else + atomic_subtract_32(&xprt->xp_snd_cnt, len); } else { m_freem(mrep); } @@ -837,7 +855,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m static bool_t svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { struct ct_data *ct; XDR xdrs; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 23 12:02:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36C09B33; Thu, 23 Jan 2014 12:02:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2064615C4; Thu, 23 Jan 2014 12:02:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0NC25Dp015926; Thu, 23 Jan 2014 12:02:05 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0NC24NB015916; Thu, 23 Jan 2014 12:02:04 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201401231202.s0NC24NB015916@svn.freebsd.org> From: Luiz Otavio O Souza Date: Thu, 23 Jan 2014 12:02:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261077 - in stable/10/sys: arm/broadcom/bcm2835 arm/lpc boot/uboot/lib dev/cesa dev/fdt powerpc/mpc85xx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jan 2014 12:02:06 -0000 Author: loos Date: Thu Jan 23 12:02:04 2014 New Revision: 261077 URL: http://svnweb.freebsd.org/changeset/base/261077 Log: MFC r257127: Remove all the instances of '#undef DEBUG' from kernel. Suggested by: rpaulo Approved by: adrian (mentor) Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c stable/10/sys/arm/lpc/if_lpe.c stable/10/sys/arm/lpc/lpc_mmc.c stable/10/sys/boot/uboot/lib/disk.c stable/10/sys/boot/uboot/lib/glue.c stable/10/sys/dev/cesa/cesa.c stable/10/sys/dev/fdt/fdt_slicer.c stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Thu Jan 23 12:02:04 2014 (r261077) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" -#undef DEBUG - #ifdef DEBUG #define dprintf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) Modified: stable/10/sys/arm/lpc/if_lpe.c ============================================================================== --- stable/10/sys/arm/lpc/if_lpe.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/arm/lpc/if_lpe.c Thu Jan 23 12:02:04 2014 (r261077) @@ -65,9 +65,6 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" -#define DEBUG -#undef DEBUG - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) Modified: stable/10/sys/arm/lpc/lpc_mmc.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_mmc.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/arm/lpc/lpc_mmc.c Thu Jan 23 12:02:04 2014 (r261077) @@ -64,9 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define DEBUG -#undef DEBUG - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) Modified: stable/10/sys/boot/uboot/lib/disk.c ============================================================================== --- stable/10/sys/boot/uboot/lib/disk.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/boot/uboot/lib/disk.c Thu Jan 23 12:02:04 2014 (r261077) @@ -45,9 +45,6 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #include "libuboot.h" -#define DEBUG -#undef DEBUG - #define stor_printf(fmt, args...) do { \ printf("%s%d: ", dev->d_dev->dv_name, dev->d_unit); \ printf(fmt, ##args); \ Modified: stable/10/sys/boot/uboot/lib/glue.c ============================================================================== --- stable/10/sys/boot/uboot/lib/glue.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/boot/uboot/lib/glue.c Thu Jan 23 12:02:04 2014 (r261077) @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); #include "api_public.h" #include "glue.h" -#define DEBUG -#undef DEBUG - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt,##args); } while (0) #else Modified: stable/10/sys/dev/cesa/cesa.c ============================================================================== --- stable/10/sys/dev/cesa/cesa.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/dev/cesa/cesa.c Thu Jan 23 12:02:04 2014 (r261077) @@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include "cesa.h" -#undef DEBUG - static int cesa_probe(device_t); static int cesa_attach(device_t); static int cesa_detach(device_t); Modified: stable/10/sys/dev/fdt/fdt_slicer.c ============================================================================== --- stable/10/sys/dev/fdt/fdt_slicer.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/dev/fdt/fdt_slicer.c Thu Jan 23 12:02:04 2014 (r261077) @@ -35,9 +35,6 @@ __FBSDID("$FreeBSD$"); #include -#define DEBUG -#undef DEBUG - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) Modified: stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c ============================================================================== --- stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c Thu Jan 23 10:18:28 2014 (r261076) +++ stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c Thu Jan 23 12:02:04 2014 (r261077) @@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$"); #include "fsl_sdhc.h" -#define DEBUG -#undef DEBUG #ifdef DEBUG #define DPRINTF(fmt, arg...) printf("DEBUG %s(): " fmt, __FUNCTION__, ##arg) #else From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 23 12:32:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6E54373; Thu, 23 Jan 2014 12:32:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C0950186C; Thu, 23 Jan 2014 12:32:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0NCWWVa027574; Thu, 23 Jan 2014 12:32:32 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0NCWV8L027563; Thu, 23 Jan 2014 12:32:31 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201401231232.s0NCWV8L027563@svn.freebsd.org> From: Luiz Otavio O Souza Date: Thu, 23 Jan 2014 12:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261078 - in stable/10/sys: arm/broadcom/bcm2835 arm/conf boot/fdt/dts conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jan 2014 12:32:32 -0000 Author: loos Date: Thu Jan 23 12:32:30 2014 New Revision: 261078 URL: http://svnweb.freebsd.org/changeset/base/261078 Log: MFC r256959: Add the Raspberry Pi BSC (I2C compliant) controller driver. Reviewed by: rpaulo MFC r256961: Enable the build of OFW I2C bus for FDT systems. MFC r258045: As all the IIC controllers on system uses the same 'iichb' prefix we cannot rely only on checking the device unit to indentify the BSC unit we are attaching to. Make use of the device base address to identify our BSC unit. MFC r259127: Bring the RPi I2C driver in line with ti_i2c. Make it treat any slave address as a 7-bit address. Approved by: adrian (mentor) Added: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c - copied, changed from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h - copied unchanged from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h - copied, changed from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Modified: stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 stable/10/sys/arm/conf/RPI-B stable/10/sys/boot/fdt/dts/bcm2835.dtsi stable/10/sys/conf/files Directory Properties: stable/10/ (props changed) Copied and modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c (from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c) ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Oct 23 12:29:39 2013 (r256959, copy source) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Thu Jan 23 12:32:30 2014 (r261078) @@ -234,31 +234,13 @@ static int bcm_bsc_attach(device_t dev) { struct bcm_bsc_softc *sc; + unsigned long start; device_t gpio; - int rid; - - if (device_get_unit(dev) > 1) { - device_printf(dev, "only bsc0 and bsc1 are supported\n"); - return (ENXIO); - } + int i, rid; sc = device_get_softc(dev); sc->sc_dev = dev; - /* - * Configure the GPIO pins to ALT0 function to enable BSC control - * over the pins. - */ - gpio = devclass_get_device(devclass_find("gpio"), 0); - if (!gpio) { - device_printf(dev, "cannot find gpio0\n"); - return (ENXIO); - } - bcm_gpio_set_alternate(gpio, bcm_bsc_pins[device_get_unit(dev)].sda, - BCM_GPIO_ALT0); - bcm_gpio_set_alternate(gpio, bcm_bsc_pins[device_get_unit(dev)].scl, - BCM_GPIO_ALT0); - rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -270,6 +252,29 @@ bcm_bsc_attach(device_t dev) sc->sc_bst = rman_get_bustag(sc->sc_mem_res); sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + /* Check the unit we are attaching by its base address. */ + start = rman_get_start(sc->sc_mem_res); + for (i = 0; i < nitems(bcm_bsc_pins); i++) { + if (bcm_bsc_pins[i].start == start) + break; + } + if (i == nitems(bcm_bsc_pins)) { + device_printf(dev, "only bsc0 and bsc1 are supported\n"); + return (ENXIO); + } + + /* + * Configure the GPIO pins to ALT0 function to enable BSC control + * over the pins. + */ + gpio = devclass_get_device(devclass_find("gpio"), 0); + if (!gpio) { + device_printf(dev, "cannot find gpio0\n"); + return (ENXIO); + } + bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].sda, BCM_GPIO_ALT0); + bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].scl, BCM_GPIO_ALT0); + rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); @@ -399,7 +404,7 @@ bcm_bsc_transfer(device_t dev, struct ii for (i = 0; i < nmsgs; i++) { /* Write the slave address. */ - BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, (msgs[i].slave >> 1) & 0x7f); + BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, msgs[i].slave); /* Write the data length. */ BCM_BSC_WRITE(sc, BCM_BSC_DLEN, msgs[i].len); Copied: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h (from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h Thu Jan 23 12:32:30 2014 (r261078, copy of r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BCM2835_BSCREG_H_ +#define _BCM2835_BSCREG_H_ + +#define BCM_BSC_CORE_CLK 150000000U +#define BCM_BSC_CTRL 0x00 +#define BCM_BSC_CTRL_I2CEN (1 << 15) +#define BCM_BSC_CTRL_INTR (1 << 10) +#define BCM_BSC_CTRL_INTT (1 << 9) +#define BCM_BSC_CTRL_INTD (1 << 8) +#define BCM_BSC_CTRL_ST (1 << 7) +#define BCM_BSC_CTRL_CLEAR1 (1 << 5) +#define BCM_BSC_CTRL_CLEAR0 (1 << 4) +#define BCM_BSC_CTRL_READ (1 << 0) +#define BCM_BSC_STATUS 0x04 +#define BCM_BSC_STATUS_CLKT (1 << 9) +#define BCM_BSC_STATUS_ERR (1 << 8) +#define BCM_BSC_STATUS_RXF (1 << 7) +#define BCM_BSC_STATUS_TXE (1 << 6) +#define BCM_BSC_STATUS_RXD (1 << 5) +#define BCM_BSC_STATUS_TXD (1 << 4) +#define BCM_BSC_STATUS_RXR (1 << 3) +#define BCM_BSC_STATUS_TXW (1 << 2) +#define BCM_BSC_STATUS_DONE (1 << 1) +#define BCM_BSC_STATUS_TA (1 << 0) +#define BCM_BSC_DLEN 0x08 +#define BCM_BSC_SLAVE 0x0c +#define BCM_BSC_DATA 0x10 +#define BCM_BSC_CLOCK 0x14 +#define BCM_BSC_DELAY 0x18 +#define BCM_BSC_CLKT 0x1c + +#endif /* _BCM2835_BSCREG_H_ */ Copied and modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h (from r256959, head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h) ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Wed Oct 23 12:29:39 2013 (r256959, copy source) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Thu Jan 23 12:32:30 2014 (r261078) @@ -33,9 +33,10 @@ struct { uint32_t sda; uint32_t scl; + unsigned long start; } bcm_bsc_pins[] = { - { 0, 1 }, /* BSC0 GPIO pins. */ - { 2, 3 } /* BSC1 GPIO pins. */ + { 0, 1, 0x20205000 }, /* BSC0 GPIO pins and base address. */ + { 2, 3, 0x20804000 } /* BSC1 GPIO pins and base address. */ }; struct bcm_bsc_softc { Modified: stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 Thu Jan 23 12:02:04 2014 (r261077) +++ stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 Thu Jan 23 12:32:30 2014 (r261078) @@ -1,5 +1,6 @@ # $FreeBSD$ +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc arm/broadcom/bcm2835/bcm2835_dma.c standard arm/broadcom/bcm2835/bcm2835_fb.c optional sc arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio Modified: stable/10/sys/arm/conf/RPI-B ============================================================================== --- stable/10/sys/arm/conf/RPI-B Thu Jan 23 12:02:04 2014 (r261077) +++ stable/10/sys/arm/conf/RPI-B Thu Jan 23 12:32:30 2014 (r261078) @@ -79,6 +79,11 @@ device mmcsd device gpio device gpioled +# I2C +device iic +device iicbus +device bcm2835_bsc + options KDB options DDB #Enable the kernel debugger options INVARIANTS #Enable calls of extra sanity checking Modified: stable/10/sys/boot/fdt/dts/bcm2835.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/bcm2835.dtsi Thu Jan 23 12:02:04 2014 (r261077) +++ stable/10/sys/boot/fdt/dts/bcm2835.dtsi Thu Jan 23 12:32:30 2014 (r261078) @@ -396,6 +396,22 @@ }; }; + bsc0 { + compatible = "broadcom,bcm2835-bsc", + "broadcom,bcm2708-bsc"; + reg = <0x205000 0x20>; + interrupts = <61>; + interrupt-parent = <&intc>; + }; + + bsc1 { + compatible = "broadcom,bcm2835-bsc", + "broadcom,bcm2708-bsc"; + reg = <0x804000 0x20>; + interrupts = <61>; + interrupt-parent = <&intc>; + }; + spi0 { compatible = "broadcom,bcm2835-spi", "broadcom,bcm2708-spi"; Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Jan 23 12:02:04 2014 (r261077) +++ stable/10/sys/conf/files Thu Jan 23 12:32:30 2014 (r261078) @@ -1914,6 +1914,7 @@ dev/ofw/ofw_bus_if.m optional fdt dev/ofw/ofw_bus_subr.c optional fdt dev/ofw/ofw_fdt.c optional fdt dev/ofw/ofw_if.m optional fdt +dev/ofw/ofw_iicbus.c optional fdt iicbus dev/ofw/openfirm.c optional fdt dev/ofw/openfirmio.c optional fdt dev/patm/if_patm.c optional patm pci From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 23 20:21:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1383ACD; Thu, 23 Jan 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA31E16CD; Thu, 23 Jan 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0NKLfEJ012769; Thu, 23 Jan 2014 20:21:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0NKLdCg012757; Thu, 23 Jan 2014 20:21:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201401232021.s0NKLdCg012757@svn.freebsd.org> From: John Baldwin Date: Thu, 23 Jan 2014 20:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261088 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jan 2014 20:21:41 -0000 Author: jhb Date: Thu Jan 23 20:21:39 2014 New Revision: 261088 URL: http://svnweb.freebsd.org/changeset/base/261088 Log: MFC 257422,257661,258075,258476,258494,258579,258609,258699: Several enhancements to the I/O APIC support in bhyve including: - Move the I/O APIC device model from userspace into vmm.ko and add ioctls to assert and deassert I/O APIC pins. - Add HPET device emulation including a single timer block with 8 timers. - Remove the 'vdev' abstraction. Approved by: neel Added: stable/10/sys/amd64/vmm/io/vhpet.c - copied, changed from r258579, head/sys/amd64/vmm/io/vhpet.c stable/10/sys/amd64/vmm/io/vhpet.h - copied unchanged from r258579, head/sys/amd64/vmm/io/vhpet.h stable/10/sys/amd64/vmm/io/vioapic.c - copied, changed from r258075, head/sys/amd64/vmm/io/vioapic.c stable/10/sys/amd64/vmm/io/vioapic.h - copied, changed from r258075, head/sys/amd64/vmm/io/vioapic.h Deleted: stable/10/sys/amd64/vmm/io/vdev.c stable/10/sys/amd64/vmm/io/vdev.h stable/10/usr.sbin/bhyve/ioapic.c stable/10/usr.sbin/bhyve/ioapic.h Modified: stable/10/lib/libvmmapi/vmmapi.c stable/10/lib/libvmmapi/vmmapi.h stable/10/sys/amd64/include/vmm.h stable/10/sys/amd64/include/vmm_dev.h stable/10/sys/amd64/vmm/intel/vmx.c stable/10/sys/amd64/vmm/io/ppt.c stable/10/sys/amd64/vmm/io/vlapic.c stable/10/sys/amd64/vmm/io/vlapic.h stable/10/sys/amd64/vmm/vmm.c stable/10/sys/amd64/vmm/vmm_dev.c stable/10/sys/amd64/vmm/vmm_ktr.h stable/10/sys/amd64/vmm/vmm_lapic.c stable/10/sys/amd64/vmm/vmm_lapic.h stable/10/sys/modules/vmm/Makefile stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/acpi.c stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/mptbl.c stable/10/usr.sbin/bhyve/pci_emul.c stable/10/usr.sbin/bhyve/pci_emul.h stable/10/usr.sbin/bhyve/pci_lpc.c stable/10/usr.sbin/bhyve/pit_8254.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.c Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/lib/libvmmapi/vmmapi.c Thu Jan 23 20:21:39 2014 (r261088) @@ -397,6 +397,39 @@ vm_lapic_irq(struct vmctx *ctx, int vcpu } int +vm_ioapic_assert_irq(struct vmctx *ctx, int irq) +{ + struct vm_ioapic_irq ioapic_irq; + + bzero(&ioapic_irq, sizeof(struct vm_ioapic_irq)); + ioapic_irq.irq = irq; + + return (ioctl(ctx->fd, VM_IOAPIC_ASSERT_IRQ, &ioapic_irq)); +} + +int +vm_ioapic_deassert_irq(struct vmctx *ctx, int irq) +{ + struct vm_ioapic_irq ioapic_irq; + + bzero(&ioapic_irq, sizeof(struct vm_ioapic_irq)); + ioapic_irq.irq = irq; + + return (ioctl(ctx->fd, VM_IOAPIC_DEASSERT_IRQ, &ioapic_irq)); +} + +int +vm_ioapic_pulse_irq(struct vmctx *ctx, int irq) +{ + struct vm_ioapic_irq ioapic_irq; + + bzero(&ioapic_irq, sizeof(struct vm_ioapic_irq)); + ioapic_irq.irq = irq; + + return (ioctl(ctx->fd, VM_IOAPIC_PULSE_IRQ, &ioapic_irq)); +} + +int vm_inject_nmi(struct vmctx *ctx, int vcpu) { struct vm_nmi vmnmi; @@ -792,3 +825,16 @@ vm_get_gpa_pmap(struct vmctx *ctx, uint6 return (error); } + +int +vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities) +{ + int error; + struct vm_hpet_cap cap; + + bzero(&cap, sizeof(struct vm_hpet_cap)); + error = ioctl(ctx->fd, VM_GET_HPET_CAPABILITIES, &cap); + if (capabilities != NULL) + *capabilities = cap.capabilities; + return (error); +} Modified: stable/10/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/10/lib/libvmmapi/vmmapi.h Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/lib/libvmmapi/vmmapi.h Thu Jan 23 20:21:39 2014 (r261088) @@ -67,6 +67,9 @@ int vm_inject_event(struct vmctx *ctx, i int vm_inject_event2(struct vmctx *ctx, int vcpu, enum vm_event_type type, int vector, int error_code); int vm_lapic_irq(struct vmctx *ctx, int vcpu, int vector); +int vm_ioapic_assert_irq(struct vmctx *ctx, int irq); +int vm_ioapic_deassert_irq(struct vmctx *ctx, int irq); +int vm_ioapic_pulse_irq(struct vmctx *ctx, int irq); int vm_inject_nmi(struct vmctx *ctx, int vcpu); int vm_capability_name2type(const char *capname); const char *vm_capability_type2name(int type); @@ -93,6 +96,8 @@ const char *vm_get_stat_desc(struct vmct int vm_get_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state *s); int vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state s); +int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities); + /* Reset vcpu register state */ int vcpu_reset(struct vmctx *ctx, int vcpu); Modified: stable/10/sys/amd64/include/vmm.h ============================================================================== --- stable/10/sys/amd64/include/vmm.h Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/sys/amd64/include/vmm.h Thu Jan 23 20:21:39 2014 (r261088) @@ -38,6 +38,8 @@ struct vm_memory_segment; struct seg_desc; struct vm_exit; struct vm_run; +struct vhpet; +struct vioapic; struct vlapic; struct vmspace; struct vm_object; @@ -116,10 +118,13 @@ int vm_nmi_pending(struct vm *vm, int vc void vm_nmi_clear(struct vm *vm, int vcpuid); uint64_t *vm_guest_msrs(struct vm *vm, int cpu); struct vlapic *vm_lapic(struct vm *vm, int cpu); +struct vioapic *vm_ioapic(struct vm *vm); +struct vhpet *vm_hpet(struct vm *vm); int vm_get_capability(struct vm *vm, int vcpu, int type, int *val); int vm_set_capability(struct vm *vm, int vcpu, int type, int val); int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state); int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state); +int vm_apicid2vcpuid(struct vm *vm, int apicid); void vm_activate_cpu(struct vm *vm, int vcpu); cpuset_t vm_active_cpus(struct vm *vm); struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); Modified: stable/10/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/10/sys/amd64/include/vmm_dev.h Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/sys/amd64/include/vmm_dev.h Thu Jan 23 20:21:39 2014 (r261088) @@ -71,6 +71,10 @@ struct vm_lapic_irq { int vector; }; +struct vm_ioapic_irq { + int irq; +}; + struct vm_capability { int cpuid; enum vm_cap_type captype; @@ -142,6 +146,10 @@ struct vm_gpa_pte { int ptenum; }; +struct vm_hpet_cap { + uint32_t capabilities; /* lower 32 bits of HPET capabilities */ +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -164,6 +172,9 @@ enum { IOCNUM_INJECT_EVENT = 30, IOCNUM_LAPIC_IRQ = 31, IOCNUM_INJECT_NMI = 32, + IOCNUM_IOAPIC_ASSERT_IRQ = 33, + IOCNUM_IOAPIC_DEASSERT_IRQ = 34, + IOCNUM_IOAPIC_PULSE_IRQ = 35, /* PCI pass-thru */ IOCNUM_BIND_PPTDEV = 40, @@ -179,6 +190,7 @@ enum { /* kernel device state */ IOCNUM_SET_X2APIC_STATE = 60, IOCNUM_GET_X2APIC_STATE = 61, + IOCNUM_GET_HPET_CAPABILITIES = 62, }; #define VM_RUN \ @@ -199,6 +211,12 @@ enum { _IOW('v', IOCNUM_INJECT_EVENT, struct vm_event) #define VM_LAPIC_IRQ \ _IOW('v', IOCNUM_LAPIC_IRQ, struct vm_lapic_irq) +#define VM_IOAPIC_ASSERT_IRQ \ + _IOW('v', IOCNUM_IOAPIC_ASSERT_IRQ, struct vm_ioapic_irq) +#define VM_IOAPIC_DEASSERT_IRQ \ + _IOW('v', IOCNUM_IOAPIC_DEASSERT_IRQ, struct vm_ioapic_irq) +#define VM_IOAPIC_PULSE_IRQ \ + _IOW('v', IOCNUM_IOAPIC_PULSE_IRQ, struct vm_ioapic_irq) #define VM_SET_CAPABILITY \ _IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) #define VM_GET_CAPABILITY \ @@ -223,6 +241,8 @@ enum { _IOW('v', IOCNUM_SET_X2APIC_STATE, struct vm_x2apic) #define VM_GET_X2APIC_STATE \ _IOWR('v', IOCNUM_GET_X2APIC_STATE, struct vm_x2apic) +#define VM_GET_HPET_CAPABILITIES \ + _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) #endif Modified: stable/10/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.c Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/sys/amd64/vmm/intel/vmx.c Thu Jan 23 20:21:39 2014 (r261088) @@ -308,8 +308,8 @@ vmx_setjmp_rc2str(int rc) } } -#define SETJMP_TRACE(vmx, vcpu, vmxctx, regname) \ - VMM_CTR1((vmx)->vm, (vcpu), "setjmp trace " #regname " 0x%016lx", \ +#define SETJMP_TRACE(vmx, vcpu, vmxctx, regname) \ + VCPU_CTR1((vmx)->vm, (vcpu), "setjmp trace " #regname " 0x%016lx", \ (vmxctx)->regname) static void @@ -321,14 +321,14 @@ vmx_setjmp_trace(struct vmx *vmx, int vc panic("vmx_setjmp_trace: invalid vmxctx %p; should be %p", vmxctx, &vmx->ctx[vcpu]); - VMM_CTR1((vmx)->vm, (vcpu), "vmxctx = %p", vmxctx); - VMM_CTR2((vmx)->vm, (vcpu), "setjmp return code %s(%d)", + VCPU_CTR1((vmx)->vm, (vcpu), "vmxctx = %p", vmxctx); + VCPU_CTR2((vmx)->vm, (vcpu), "setjmp return code %s(%d)", vmx_setjmp_rc2str(rc), rc); host_rsp = host_rip = ~0; vmread(VMCS_HOST_RIP, &host_rip); vmread(VMCS_HOST_RSP, &host_rsp); - VMM_CTR2((vmx)->vm, (vcpu), "vmcs host_rip 0x%016lx, host_rsp 0x%016lx", + VCPU_CTR2((vmx)->vm, (vcpu), "vmcs host_rip 0x%016lx, host_rsp %#lx", host_rip, host_rsp); SETJMP_TRACE(vmx, vcpu, vmxctx, host_r15); @@ -887,7 +887,7 @@ static __inline void vmx_run_trace(struct vmx *vmx, int vcpu) { #ifdef KTR - VMM_CTR1(vmx->vm, vcpu, "Resume execution at 0x%0lx", vmcs_guest_rip()); + VCPU_CTR1(vmx->vm, vcpu, "Resume execution at %#lx", vmcs_guest_rip()); #endif } @@ -896,7 +896,7 @@ vmx_exit_trace(struct vmx *vmx, int vcpu int handled) { #ifdef KTR - VMM_CTR3(vmx->vm, vcpu, "%s %s vmexit at 0x%0lx", + VCPU_CTR3(vmx->vm, vcpu, "%s %s vmexit at 0x%0lx", handled ? "handled" : "unhandled", exit_reason_to_str(exit_reason), rip); #endif @@ -906,7 +906,7 @@ static __inline void vmx_astpending_trace(struct vmx *vmx, int vcpu, uint64_t rip) { #ifdef KTR - VMM_CTR1(vmx->vm, vcpu, "astpending vmexit at 0x%0lx", rip); + VCPU_CTR1(vmx->vm, vcpu, "astpending vmexit at 0x%0lx", rip); #endif } @@ -1055,7 +1055,7 @@ vmx_inject_nmi(struct vmx *vmx, int vcpu if (error) panic("vmx_inject_nmi: vmwrite(intrinfo) %d", error); - VMM_CTR0(vmx->vm, vcpu, "Injecting vNMI"); + VCPU_CTR0(vmx->vm, vcpu, "Injecting vNMI"); /* Clear the request */ vm_nmi_clear(vmx->vm, vcpu); @@ -1068,7 +1068,7 @@ nmiblocked: */ vmx_set_nmi_window_exiting(vmx, vcpu); - VMM_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting"); + VCPU_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting"); return (1); } @@ -1134,7 +1134,7 @@ vmx_inject_interrupts(struct vmx *vmx, i /* Update the Local APIC ISR */ lapic_intr_accepted(vmx->vm, vcpu, vector); - VMM_CTR1(vmx->vm, vcpu, "Injecting hwintr at vector %d", vector); + VCPU_CTR1(vmx->vm, vcpu, "Injecting hwintr at vector %d", vector); return; @@ -1145,7 +1145,7 @@ cantinject: */ vmx_set_int_window_exiting(vmx, vcpu); - VMM_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting"); + VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting"); } static int @@ -1435,7 +1435,7 @@ vmx_exit_process(struct vmx *vmx, int vc case EXIT_REASON_INTR_WINDOW: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INTR_WINDOW, 1); vmx_clear_int_window_exiting(vmx, vcpu); - VMM_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting"); + VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting"); return (1); case EXIT_REASON_EXT_INTR: /* @@ -1458,7 +1458,7 @@ vmx_exit_process(struct vmx *vmx, int vc /* Exit to allow the pending virtual NMI to be injected */ vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NMI_WINDOW, 1); vmx_clear_nmi_window_exiting(vmx, vcpu); - VMM_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting"); + VCPU_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting"); return (1); case EXIT_REASON_INOUT: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INOUT, 1); @@ -1659,7 +1659,7 @@ vmx_run(void *arg, int vcpu, register_t if (!handled) vmm_stat_incr(vmx->vm, vcpu, VMEXIT_USERSPACE, 1); - VMM_CTR1(vmx->vm, vcpu, "goto userland: exitcode %d",vmexit->exitcode); + VCPU_CTR1(vmx->vm, vcpu, "goto userland: exitcode %d",vmexit->exitcode); /* * XXX Modified: stable/10/sys/amd64/vmm/io/ppt.c ============================================================================== --- stable/10/sys/amd64/vmm/io/ppt.c Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/sys/amd64/vmm/io/ppt.c Thu Jan 23 20:21:39 2014 (r261088) @@ -421,7 +421,7 @@ pptintr(void *arg) vec = pptarg->vec; if (ppt->vm != NULL) - (void) lapic_set_intr(ppt->vm, pptarg->vcpu, vec); + lapic_intr_edge(ppt->vm, pptarg->vcpu, vec); else { /* * XXX Copied and modified: stable/10/sys/amd64/vmm/io/vhpet.c (from r258579, head/sys/amd64/vmm/io/vhpet.c) ============================================================================== --- head/sys/amd64/vmm/io/vhpet.c Mon Nov 25 19:04:51 2013 (r258579, copy source) +++ stable/10/sys/amd64/vmm/io/vhpet.c Thu Jan 23 20:21:39 2014 (r261088) @@ -266,14 +266,14 @@ vhpet_timer_interrupt(struct vhpet *vhpe if (apicid != 0xff) { /* unicast */ vcpuid = vm_apicid2vcpuid(vhpet->vm, apicid); - lapic_set_intr(vhpet->vm, vcpuid, vector); + lapic_intr_edge(vhpet->vm, vcpuid, vector); } else { /* broadcast */ dmask = vm_active_cpus(vhpet->vm); while ((vcpuid = CPU_FFS(&dmask)) != 0) { vcpuid--; CPU_CLR(vcpuid, &dmask); - lapic_set_intr(vhpet->vm, vcpuid, vector); + lapic_intr_edge(vhpet->vm, vcpuid, vector); } } return; @@ -725,8 +725,9 @@ done: struct vhpet * vhpet_init(struct vm *vm) { - int i; + int i, pincount; struct vhpet *vhpet; + uint64_t allowed_irqs; struct vhpet_callout_arg *arg; struct bintime bt; @@ -737,12 +738,20 @@ vhpet_init(struct vm *vm) FREQ2BT(HPET_FREQ, &bt); vhpet->freq_sbt = bttosbt(bt); + pincount = vioapic_pincount(vm); + if (pincount >= 24) + allowed_irqs = 0x00f00000; /* irqs 20, 21, 22 and 23 */ + else + allowed_irqs = 0; + /* * Initialize HPET timer hardware state. */ for (i = 0; i < VHPET_NUM_TIMERS; i++) { - vhpet->timer[i].cap_config = 0UL << 32 | - HPET_TCAP_FSB_INT_DEL | HPET_TCAP_PER_INT; + vhpet->timer[i].cap_config = allowed_irqs << 32; + vhpet->timer[i].cap_config |= HPET_TCAP_PER_INT; + vhpet->timer[i].cap_config |= HPET_TCAP_FSB_INT_DEL; + vhpet->timer[i].compval = 0xffffffff; callout_init(&vhpet->timer[i].callout, 1); Copied: stable/10/sys/amd64/vmm/io/vhpet.h (from r258579, head/sys/amd64/vmm/io/vhpet.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/amd64/vmm/io/vhpet.h Thu Jan 23 20:21:39 2014 (r261088, copy of r258579, head/sys/amd64/vmm/io/vhpet.h) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2013 Tycho Nightingale + * Copyright (c) 2013 Neel Natu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VHPET_H_ +#define _VHPET_H_ + +#define VHPET_BASE 0xfed00000 +#define VHPET_SIZE 1024 + +struct vhpet *vhpet_init(struct vm *vm); +void vhpet_cleanup(struct vhpet *vhpet); +int vhpet_mmio_write(void *vm, int vcpuid, uint64_t gpa, uint64_t val, + int size, void *arg); +int vhpet_mmio_read(void *vm, int vcpuid, uint64_t gpa, uint64_t *val, + int size, void *arg); +int vhpet_getcap(struct vm_hpet_cap *cap); + +#endif /* _VHPET_H_ */ Copied and modified: stable/10/sys/amd64/vmm/io/vioapic.c (from r258075, head/sys/amd64/vmm/io/vioapic.c) ============================================================================== --- head/sys/amd64/vmm/io/vioapic.c Tue Nov 12 22:51:03 2013 (r258075, copy source) +++ stable/10/sys/amd64/vmm/io/vioapic.c Thu Jan 23 20:21:39 2014 (r261088) @@ -49,8 +49,8 @@ __FBSDID("$FreeBSD$"); #define IOREGSEL 0x00 #define IOWIN 0x10 -#define REDIR_ENTRIES 16 -#define INTR_ASSERTED(vioapic, pin) ((vioapic)->rtbl[(pin)].pinstate == true) +#define REDIR_ENTRIES 24 +#define RTBL_RO_BITS ((uint64_t)(IOART_REM_IRR | IOART_DELIVS)) struct vioapic { struct vm *vm; @@ -59,8 +59,7 @@ struct vioapic { uint32_t ioregsel; struct { uint64_t reg; - bool pinstate; - bool pending; + int acnt; /* sum of pin asserts (+1) and deasserts (-1) */ } rtbl[REDIR_ENTRIES]; }; @@ -79,6 +78,9 @@ static MALLOC_DEFINE(M_VIOAPIC, "vioapic #define VIOAPIC_CTR3(vioapic, fmt, a1, a2, a3) \ VM_CTR3((vioapic)->vm, fmt, a1, a2, a3) +#define VIOAPIC_CTR4(vioapic, fmt, a1, a2, a3, a4) \ + VM_CTR4((vioapic)->vm, fmt, a1, a2, a3, a4) + #ifdef KTR static const char * pinstate_str(bool asserted) @@ -89,14 +91,25 @@ pinstate_str(bool asserted) else return ("deasserted"); } + +static const char * +trigger_str(bool level) +{ + + if (level) + return ("level"); + else + return ("edge"); +} #endif static void -vioapic_set_pinstate(struct vioapic *vioapic, int pin, bool newstate) +vioapic_send_intr(struct vioapic *vioapic, int pin) { int vector, apicid, vcpuid; uint32_t low, high; cpuset_t dmask; + bool level; KASSERT(pin >= 0 && pin < REDIR_ENTRIES, ("vioapic_set_pinstate: invalid pin number %d", pin)); @@ -104,64 +117,104 @@ vioapic_set_pinstate(struct vioapic *vio KASSERT(VIOAPIC_LOCKED(vioapic), ("vioapic_set_pinstate: vioapic is not locked")); - VIOAPIC_CTR2(vioapic, "ioapic pin%d %s", pin, pinstate_str(newstate)); + low = vioapic->rtbl[pin].reg; + high = vioapic->rtbl[pin].reg >> 32; - /* Nothing to do if interrupt pin has not changed state */ - if (vioapic->rtbl[pin].pinstate == newstate) + /* + * XXX We only deal with: + * - physical destination + * - fixed delivery mode + */ + if ((low & IOART_DESTMOD) != IOART_DESTPHY) { + VIOAPIC_CTR2(vioapic, "ioapic pin%d: unsupported dest mode " + "0x%08x", pin, low); return; + } - vioapic->rtbl[pin].pinstate = newstate; /* record it */ + if ((low & IOART_DELMOD) != IOART_DELFIXED) { + VIOAPIC_CTR2(vioapic, "ioapic pin%d: unsupported delivery mode " + "0x%08x", pin, low); + return; + } - /* Nothing to do if interrupt pin is deasserted */ - if (!INTR_ASSERTED(vioapic, pin)) + if ((low & IOART_INTMASK) == IOART_INTMSET) { + VIOAPIC_CTR1(vioapic, "ioapic pin%d: masked", pin); return; + } - /* - * XXX - * We only deal with: - * - edge triggered interrupts - * - fixed delivery mode - * Level-triggered sources will work so long as there is no sharing. - */ - low = vioapic->rtbl[pin].reg; - high = vioapic->rtbl[pin].reg >> 32; - if ((low & IOART_INTMASK) == IOART_INTMCLR && - (low & IOART_DESTMOD) == IOART_DESTPHY && - (low & IOART_DELMOD) == IOART_DELFIXED) { - vector = low & IOART_INTVEC; - apicid = high >> APIC_ID_SHIFT; - if (apicid != 0xff) { - /* unicast */ - vcpuid = vm_apicid2vcpuid(vioapic->vm, apicid); - VIOAPIC_CTR3(vioapic, "ioapic pin%d triggering " - "intr vector %d on vcpuid %d", pin, vector, vcpuid); - lapic_set_intr(vioapic->vm, vcpuid, vector); - } else { - /* broadcast */ - VIOAPIC_CTR2(vioapic, "ioapic pin%d triggering intr " - "vector %d on all vcpus", pin, vector); - dmask = vm_active_cpus(vioapic->vm); - while ((vcpuid = CPU_FFS(&dmask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &dmask); - lapic_set_intr(vioapic->vm, vcpuid, vector); - } + level = low & IOART_TRGRLVL ? true : false; + if (level) + vioapic->rtbl[pin].reg |= IOART_REM_IRR; + + vector = low & IOART_INTVEC; + apicid = high >> APIC_ID_SHIFT; + if (apicid != 0xff) { + /* unicast */ + vcpuid = vm_apicid2vcpuid(vioapic->vm, apicid); + VIOAPIC_CTR4(vioapic, "ioapic pin%d: %s triggered intr " + "vector %d on vcpuid %d", pin, trigger_str(level), + vector, vcpuid); + lapic_set_intr(vioapic->vm, vcpuid, vector, level); + } else { + /* broadcast */ + VIOAPIC_CTR3(vioapic, "ioapic pin%d: %s triggered intr " + "vector %d on all vcpus", pin, trigger_str(level), vector); + dmask = vm_active_cpus(vioapic->vm); + while ((vcpuid = CPU_FFS(&dmask)) != 0) { + vcpuid--; + CPU_CLR(vcpuid, &dmask); + lapic_set_intr(vioapic->vm, vcpuid, vector, level); } - } else if ((low & IOART_INTMASK) != IOART_INTMCLR && - (low & IOART_TRGRLVL) != 0) { - /* - * For level-triggered interrupts that have been - * masked, set the pending bit so that an interrupt - * will be generated on unmask and if the level is - * still asserted - */ - VIOAPIC_CTR1(vioapic, "ioapic pin%d interrupt pending", pin); - vioapic->rtbl[pin].pending = true; } } +static void +vioapic_set_pinstate(struct vioapic *vioapic, int pin, bool newstate) +{ + int oldcnt, newcnt; + bool needintr; + + KASSERT(pin >= 0 && pin < REDIR_ENTRIES, + ("vioapic_set_pinstate: invalid pin number %d", pin)); + + KASSERT(VIOAPIC_LOCKED(vioapic), + ("vioapic_set_pinstate: vioapic is not locked")); + + oldcnt = vioapic->rtbl[pin].acnt; + if (newstate) + vioapic->rtbl[pin].acnt++; + else + vioapic->rtbl[pin].acnt--; + newcnt = vioapic->rtbl[pin].acnt; + + if (newcnt < 0) { + VIOAPIC_CTR2(vioapic, "ioapic pin%d: bad acnt %d", + pin, newcnt); + } + + needintr = false; + if (oldcnt == 0 && newcnt == 1) { + needintr = true; + VIOAPIC_CTR1(vioapic, "ioapic pin%d: asserted", pin); + } else if (oldcnt == 1 && newcnt == 0) { + VIOAPIC_CTR1(vioapic, "ioapic pin%d: deasserted", pin); + } else { + VIOAPIC_CTR3(vioapic, "ioapic pin%d: %s, ignored, acnt %d", + pin, pinstate_str(newstate), newcnt); + } + + if (needintr) + vioapic_send_intr(vioapic, pin); +} + +enum irqstate { + IRQSTATE_ASSERT, + IRQSTATE_DEASSERT, + IRQSTATE_PULSE +}; + static int -vioapic_set_irqstate(struct vm *vm, int irq, bool state) +vioapic_set_irqstate(struct vm *vm, int irq, enum irqstate irqstate) { struct vioapic *vioapic; @@ -171,7 +224,20 @@ vioapic_set_irqstate(struct vm *vm, int vioapic = vm_ioapic(vm); VIOAPIC_LOCK(vioapic); - vioapic_set_pinstate(vioapic, irq, state); + switch (irqstate) { + case IRQSTATE_ASSERT: + vioapic_set_pinstate(vioapic, irq, true); + break; + case IRQSTATE_DEASSERT: + vioapic_set_pinstate(vioapic, irq, false); + break; + case IRQSTATE_PULSE: + vioapic_set_pinstate(vioapic, irq, true); + vioapic_set_pinstate(vioapic, irq, false); + break; + default: + panic("vioapic_set_irqstate: invalid irqstate %d", irqstate); + } VIOAPIC_UNLOCK(vioapic); return (0); @@ -181,14 +247,21 @@ int vioapic_assert_irq(struct vm *vm, int irq) { - return (vioapic_set_irqstate(vm, irq, true)); + return (vioapic_set_irqstate(vm, irq, IRQSTATE_ASSERT)); } int vioapic_deassert_irq(struct vm *vm, int irq) { - return (vioapic_set_irqstate(vm, irq, false)); + return (vioapic_set_irqstate(vm, irq, IRQSTATE_DEASSERT)); +} + +int +vioapic_pulse_irq(struct vm *vm, int irq) +{ + + return (vioapic_set_irqstate(vm, irq, IRQSTATE_PULSE)); } static uint32_t @@ -202,7 +275,7 @@ vioapic_read(struct vioapic *vioapic, ui return (vioapic->id); break; case IOAPIC_VER: - return ((REDIR_ENTRIES << MAXREDIRSHIFT) | 0x11); + return (((REDIR_ENTRIES - 1) << MAXREDIRSHIFT) | 0x11); break; case IOAPIC_ARB: return (vioapic->id); @@ -229,6 +302,7 @@ vioapic_read(struct vioapic *vioapic, ui static void vioapic_write(struct vioapic *vioapic, uint32_t addr, uint32_t data) { + uint64_t data64, mask64; int regnum, pin, lshift; regnum = addr & 0xff; @@ -253,30 +327,26 @@ vioapic_write(struct vioapic *vioapic, u else lshift = 0; - vioapic->rtbl[pin].reg &= ~((uint64_t)0xffffffff << lshift); - vioapic->rtbl[pin].reg |= ((uint64_t)data << lshift); + data64 = (uint64_t)data << lshift; + mask64 = (uint64_t)0xffffffff << lshift; + vioapic->rtbl[pin].reg &= ~mask64 | RTBL_RO_BITS; + vioapic->rtbl[pin].reg |= data64 & ~RTBL_RO_BITS; - VIOAPIC_CTR2(vioapic, "ioapic pin%d redir table entry %#lx", + VIOAPIC_CTR2(vioapic, "ioapic pin%d: redir table entry %#lx", pin, vioapic->rtbl[pin].reg); - if (vioapic->rtbl[pin].pending && - ((vioapic->rtbl[pin].reg & IOART_INTMASK) == - IOART_INTMCLR)) { - vioapic->rtbl[pin].pending = false; - /* - * Inject the deferred level-triggered int if it is - * still asserted. Simulate by toggling the pin - * off and then on. - */ - if (vioapic->rtbl[pin].pinstate == true) { - VIOAPIC_CTR1(vioapic, "ioapic pin%d pending " - "interrupt delivered", pin); - vioapic_set_pinstate(vioapic, pin, false); - vioapic_set_pinstate(vioapic, pin, true); - } else { - VIOAPIC_CTR1(vioapic, "ioapic pin%d pending " - "interrupt dismissed", pin); - } + /* + * Generate an interrupt if the following conditions are met: + * - pin is not masked + * - previous interrupt has been EOIed + * - pin level is asserted + */ + if ((vioapic->rtbl[pin].reg & IOART_INTMASK) == IOART_INTMCLR && + (vioapic->rtbl[pin].reg & IOART_REM_IRR) == 0 && + (vioapic->rtbl[pin].acnt > 0)) { + VIOAPIC_CTR2(vioapic, "ioapic pin%d: asserted at rtbl " + "write, acnt %d", pin, vioapic->rtbl[pin].acnt); + vioapic_send_intr(vioapic, pin); } } } @@ -340,6 +410,38 @@ vioapic_mmio_write(void *vm, int vcpuid, return (error); } +void +vioapic_process_eoi(struct vm *vm, int vcpuid, int vector) +{ + struct vioapic *vioapic; + int pin; + + KASSERT(vector >= 0 && vector < 256, + ("vioapic_process_eoi: invalid vector %d", vector)); + + vioapic = vm_ioapic(vm); + VIOAPIC_CTR1(vioapic, "ioapic processing eoi for vector %d", vector); + + /* + * XXX keep track of the pins associated with this vector instead + * of iterating on every single pin each time. + */ + VIOAPIC_LOCK(vioapic); + for (pin = 0; pin < REDIR_ENTRIES; pin++) { + if ((vioapic->rtbl[pin].reg & IOART_REM_IRR) == 0) + continue; + if ((vioapic->rtbl[pin].reg & IOART_INTVEC) != vector) + continue; + vioapic->rtbl[pin].reg &= ~IOART_REM_IRR; + if (vioapic->rtbl[pin].acnt > 0) { + VIOAPIC_CTR2(vioapic, "ioapic pin%d: asserted at eoi, " + "acnt %d", pin, vioapic->rtbl[pin].acnt); + vioapic_send_intr(vioapic, pin); + } + } + VIOAPIC_UNLOCK(vioapic); +} + struct vioapic * vioapic_init(struct vm *vm) { @@ -364,3 +466,10 @@ vioapic_cleanup(struct vioapic *vioapic) free(vioapic, M_VIOAPIC); } + +int +vioapic_pincount(struct vm *vm) +{ + + return (REDIR_ENTRIES); +} Copied and modified: stable/10/sys/amd64/vmm/io/vioapic.h (from r258075, head/sys/amd64/vmm/io/vioapic.h) ============================================================================== --- head/sys/amd64/vmm/io/vioapic.h Tue Nov 12 22:51:03 2013 (r258075, copy source) +++ stable/10/sys/amd64/vmm/io/vioapic.h Thu Jan 23 20:21:39 2014 (r261088) @@ -30,9 +30,6 @@ #ifndef _VIOAPIC_H_ #define _VIOAPIC_H_ -struct vm; -struct vioapic; - #define VIOAPIC_BASE 0xFEC00000 #define VIOAPIC_SIZE 4096 @@ -41,9 +38,13 @@ void vioapic_cleanup(struct vioapic *vio int vioapic_assert_irq(struct vm *vm, int irq); int vioapic_deassert_irq(struct vm *vm, int irq); +int vioapic_pulse_irq(struct vm *vm, int irq); int vioapic_mmio_write(void *vm, int vcpuid, uint64_t gpa, uint64_t wval, int size, void *arg); int vioapic_mmio_read(void *vm, int vcpuid, uint64_t gpa, uint64_t *rval, int size, void *arg); + +int vioapic_pincount(struct vm *vm); +void vioapic_process_eoi(struct vm *vm, int vcpuid, int vector); #endif Modified: stable/10/sys/amd64/vmm/io/vlapic.c ============================================================================== --- stable/10/sys/amd64/vmm/io/vlapic.c Thu Jan 23 20:10:22 2014 (r261087) +++ stable/10/sys/amd64/vmm/io/vlapic.c Thu Jan 23 20:21:39 2014 (r261088) @@ -44,14 +44,14 @@ __FBSDID("$FreeBSD$"); #include "vmm_stat.h" #include "vmm_lapic.h" #include "vmm_ktr.h" -#include "vdev.h" #include "vlapic.h" +#include "vioapic.h" #define VLAPIC_CTR0(vlapic, format) \ - VMM_CTR0((vlapic)->vm, (vlapic)->vcpuid, format) + VCPU_CTR0((vlapic)->vm, (vlapic)->vcpuid, format) #define VLAPIC_CTR1(vlapic, format, p1) \ - VMM_CTR1((vlapic)->vm, (vlapic)->vcpuid, format, p1) + VCPU_CTR1((vlapic)->vm, (vlapic)->vcpuid, format, p1) #define VLAPIC_CTR_IRR(vlapic, msg) \ do { \ @@ -100,8 +100,6 @@ struct vlapic { struct vm *vm; int vcpuid; - struct io_region *mmio; - struct vdev_ops *ops; struct LAPIC apic; int esr_update; @@ -195,9 +193,8 @@ vlapic_init_ipi(struct vlapic *vlapic) } static int -vlapic_op_reset(void* dev) +vlapic_reset(struct vlapic *vlapic) { - struct vlapic *vlapic = (struct vlapic*)dev; struct LAPIC *lapic = &vlapic->apic; memset(lapic, 0, sizeof(*lapic)); @@ -214,36 +211,33 @@ vlapic_op_reset(void* dev) } -static int -vlapic_op_init(void* dev) -{ - struct vlapic *vlapic = (struct vlapic*)dev; - vdev_register_region(vlapic->ops, vlapic, vlapic->mmio); - return vlapic_op_reset(dev); -} - -static int -vlapic_op_halt(void* dev) -{ - struct vlapic *vlapic = (struct vlapic*)dev; - vdev_unregister_region(vlapic, vlapic->mmio); - return 0; - -} - void -vlapic_set_intr_ready(struct vlapic *vlapic, int vector) +vlapic_set_intr_ready(struct vlapic *vlapic, int vector, bool level) { struct LAPIC *lapic = &vlapic->apic; - uint32_t *irrptr; + uint32_t *irrptr, *tmrptr, mask; int idx; if (vector < 0 || vector >= 256) panic("vlapic_set_intr_ready: invalid vector %d\n", vector); idx = (vector / 32) * 4; + mask = 1 << (vector % 32); + irrptr = &lapic->irr0; - atomic_set_int(&irrptr[idx], 1 << (vector % 32)); + atomic_set_int(&irrptr[idx], mask); + + /* + * Upon acceptance of an interrupt into the IRR the corresponding + * TMR bit is cleared for edge-triggered interrupts and set for + * level-triggered interrupts. + */ + tmrptr = &lapic->tmr0; + if (level) + atomic_set_int(&tmrptr[idx], mask); + else + atomic_clear_int(&tmrptr[idx], mask); + VLAPIC_CTR_IRR(vlapic, "vlapic_set_intr_ready"); } @@ -371,10 +365,11 @@ static void vlapic_process_eoi(struct vlapic *vlapic) { struct LAPIC *lapic = &vlapic->apic; - uint32_t *isrptr; - int i, idx, bitpos; + uint32_t *isrptr, *tmrptr; + int i, idx, bitpos, vector; isrptr = &lapic->isr0; + tmrptr = &lapic->tmr0; /* * The x86 architecture reserves the the first 32 vectors for use @@ -383,15 +378,20 @@ vlapic_process_eoi(struct vlapic *vlapic for (i = 7; i > 0; i--) { idx = i * 4; bitpos = fls(isrptr[idx]); - if (bitpos != 0) { + if (bitpos-- != 0) { if (vlapic->isrvec_stk_top <= 0) { panic("invalid vlapic isrvec_stk_top %d", vlapic->isrvec_stk_top); } - isrptr[idx] &= ~(1 << (bitpos - 1)); + isrptr[idx] &= ~(1 << bitpos); VLAPIC_CTR_ISR(vlapic, "vlapic_process_eoi"); vlapic->isrvec_stk_top--; vlapic_update_ppr(vlapic); + if ((tmrptr[idx] & (1 << bitpos)) != 0) { + vector = i * 32 + bitpos; + vioapic_process_eoi(vlapic->vm, vlapic->vcpuid, + vector); + } return; } } @@ -426,7 +426,7 @@ vlapic_fire_timer(struct vlapic *vlapic) if (!vlapic_get_lvt_field(lvt, APIC_LVTT_M)) { vmm_stat_incr(vlapic->vm, vlapic->vcpuid, VLAPIC_INTR_TIMER, 1); vector = vlapic_get_lvt_field(lvt,APIC_LVTT_VECTOR); - vlapic_set_intr_ready(vlapic, vector); + vlapic_set_intr_ready(vlapic, vector, false); } } @@ -472,7 +472,7 @@ lapic_process_icr(struct vlapic *vlapic, i--; CPU_CLR(i, &dmask); if (mode == APIC_DELMODE_FIXED) { - lapic_set_intr(vlapic->vm, i, vec); + lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, IPIS_SENT, i, 1); } else @@ -594,11 +594,9 @@ vlapic_intr_accepted(struct vlapic *vlap } int -vlapic_op_mem_read(void* dev, uint64_t gpa, opsize_t size, uint64_t *data) +vlapic_read(struct vlapic *vlapic, uint64_t offset, uint64_t *data) { - struct vlapic *vlapic = (struct vlapic*)dev; struct LAPIC *lapic = &vlapic->apic; - uint64_t offset = gpa & ~(PAGE_SIZE); uint32_t *reg; int i; @@ -686,11 +684,9 @@ vlapic_op_mem_read(void* dev, uint64_t g } int -vlapic_op_mem_write(void* dev, uint64_t gpa, opsize_t size, uint64_t data) +vlapic_write(struct vlapic *vlapic, uint64_t offset, uint64_t data) { - struct vlapic *vlapic = (struct vlapic*)dev; struct LAPIC *lapic = &vlapic->apic; - uint64_t offset = gpa & ~(PAGE_SIZE); uint32_t *reg; int retval; @@ -832,16 +828,6 @@ restart: return (0); } -struct vdev_ops vlapic_dev_ops = { - .name = "vlapic", - .init = vlapic_op_init, - .reset = vlapic_op_reset, - .halt = vlapic_op_halt, - .memread = vlapic_op_mem_read, - .memwrite = vlapic_op_mem_write, -}; -static struct io_region vlapic_mmio[VM_MAXCPU]; - struct vlapic * vlapic_init(struct vm *vm, int vcpuid) { @@ -856,17 +842,7 @@ vlapic_init(struct vm *vm, int vcpuid) if (vcpuid == 0) vlapic->msr_apicbase |= APICBASE_BSP; - vlapic->ops = &vlapic_dev_ops; - - vlapic->mmio = vlapic_mmio + vcpuid; - vlapic->mmio->base = DEFAULT_APIC_BASE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 23 20:35:35 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28F42762; Thu, 23 Jan 2014 20:35:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 092F4182B; Thu, 23 Jan 2014 20:35:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0NKZYbJ017124; Thu, 23 Jan 2014 20:35:34 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0NKZXG7017114; Thu, 23 Jan 2014 20:35:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201401232035.s0NKZXG7017114@svn.freebsd.org> From: John Baldwin Date: Thu, 23 Jan 2014 20:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261090 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jan 2014 20:35:35 -0000 Author: jhb Date: Thu Jan 23 20:35:32 2014 New Revision: 261090 URL: http://svnweb.freebsd.org/changeset/base/261090 Log: MFC 259826,259997,259998: Support soft power-off via the ACPI S5 state for bhyve guests and wire up a virtual power button to SIGTERM: - Implement the PM1_EVT and PM1_CTL registers required by ACPI. - Emulate the Reset Control register at I/O port 0xcf9. - Advertise an _S5 package. - Implement an SMI_CMD register with commands to enable and disable ACPI. Currently the only change when ACPI is enabled is to enable the virtual power button via SIGTERM. - Implement a fixed-feature power button when ACPI is enabled by asserting PWRBTN_STS in PM1_EVT when SIGTERM is received. - Add support for EVFILT_SIGNAL events to mevent. - Implement support for the ACPI system command interrupt (SCI) and assert it when needed based on the values in PM1_EVT. Mark the SCI as active-low and level triggered in the MADT and MP Table. Added: stable/10/usr.sbin/bhyve/pm.c - copied, changed from r259826, head/usr.sbin/bhyve/pm.c Modified: stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/acpi.c stable/10/usr.sbin/bhyve/acpi.h stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/inout.h stable/10/usr.sbin/bhyve/mevent.c stable/10/usr.sbin/bhyve/mevent.h stable/10/usr.sbin/bhyve/mptbl.c stable/10/usr.sbin/bhyve/pmtmr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/Makefile Thu Jan 23 20:35:32 2014 (r261090) @@ -10,7 +10,7 @@ MAN= bhyve.8 SRCS= acpi.c atpic.c bhyverun.c block_if.c consport.c dbgport.c elcr.c SRCS+= inout.c legacy_irq.c mem.c mevent.c mptbl.c pci_ahci.c SRCS+= pci_emul.c pci_hostbridge.c pci_lpc.c pci_passthru.c pci_virtio_block.c -SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c pmtmr.c post.c rtc.c +SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c pm.c pmtmr.c post.c rtc.c SRCS+= uart_emul.c virtio.c xmsr.c spinup_ap.c .PATH: ${.CURDIR}/../../sys/amd64/vmm Modified: stable/10/usr.sbin/bhyve/acpi.c ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.c Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/acpi.c Thu Jan 23 20:35:32 2014 (r261090) @@ -85,8 +85,6 @@ __FBSDID("$FreeBSD$"); #define BHYVE_ASL_SUFFIX ".aml" #define BHYVE_ASL_COMPILER "/usr/sbin/iasl" -#define BHYVE_PM_TIMER_ADDR 0x408 - static int basl_keep_temps; static int basl_verbose_iasl; static int basl_ncpu; @@ -283,11 +281,11 @@ basl_fwrite_madt(FILE *fp) EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); EFPRINTF(fp, "[0001]\t\tBus : 00\n"); - EFPRINTF(fp, "[0001]\t\tSource : 09\n"); - EFPRINTF(fp, "[0004]\t\tInterrupt : 00000009\n"); + EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT); + EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT); EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0000\n"); - EFPRINTF(fp, "\t\t\tPolarity : 0\n"); - EFPRINTF(fp, "\t\t\tTrigger Mode : 0\n"); + EFPRINTF(fp, "\t\t\tPolarity : 3\n"); + EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n"); EFPRINTF(fp, "\n"); EFFLUSH(fp); @@ -324,21 +322,27 @@ basl_fwrite_fadt(FILE *fp) basl_acpi_base + FACS_OFFSET); EFPRINTF(fp, "[0004]\t\tDSDT Address : %08X\n", basl_acpi_base + DSDT_OFFSET); - EFPRINTF(fp, "[0001]\t\tModel : 00\n"); + EFPRINTF(fp, "[0001]\t\tModel : 01\n"); EFPRINTF(fp, "[0001]\t\tPM Profile : 00 [Unspecified]\n"); - EFPRINTF(fp, "[0002]\t\tSCI Interrupt : 0009\n"); - EFPRINTF(fp, "[0004]\t\tSMI Command Port : 00000000\n"); - EFPRINTF(fp, "[0001]\t\tACPI Enable Value : 00\n"); - EFPRINTF(fp, "[0001]\t\tACPI Disable Value : 00\n"); + EFPRINTF(fp, "[0002]\t\tSCI Interrupt : %04X\n", + SCI_INT); + EFPRINTF(fp, "[0004]\t\tSMI Command Port : %08X\n", + SMI_CMD); + EFPRINTF(fp, "[0001]\t\tACPI Enable Value : %02X\n", + BHYVE_ACPI_ENABLE); + EFPRINTF(fp, "[0001]\t\tACPI Disable Value : %02X\n", + BHYVE_ACPI_DISABLE); EFPRINTF(fp, "[0001]\t\tS4BIOS Command : 00\n"); EFPRINTF(fp, "[0001]\t\tP-State Control : 00\n"); - EFPRINTF(fp, "[0004]\t\tPM1A Event Block Address : 00000000\n"); + EFPRINTF(fp, "[0004]\t\tPM1A Event Block Address : %08X\n", + PM1A_EVT_ADDR); EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n"); - EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : 00000000\n"); + EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n", + PM1A_CNT_ADDR); EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n"); EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n"); EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n", - BHYVE_PM_TIMER_ADDR); + IO_PMTMR); EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : 00000000\n"); EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n"); EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n"); @@ -369,15 +373,15 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000000\n"); EFPRINTF(fp, "\t\t\tWBINVD instruction is operational (V1) : 1\n"); EFPRINTF(fp, "\t\t\tWBINVD flushes all caches (V1) : 0\n"); - EFPRINTF(fp, "\t\t\tAll CPUs support C1 (V1) : 0\n"); + EFPRINTF(fp, "\t\t\tAll CPUs support C1 (V1) : 1\n"); EFPRINTF(fp, "\t\t\tC2 works on MP system (V1) : 0\n"); - EFPRINTF(fp, "\t\t\tControl Method Power Button (V1) : 1\n"); + EFPRINTF(fp, "\t\t\tControl Method Power Button (V1) : 0\n"); EFPRINTF(fp, "\t\t\tControl Method Sleep Button (V1) : 1\n"); EFPRINTF(fp, "\t\t\tRTC wake not in fixed reg space (V1) : 0\n"); EFPRINTF(fp, "\t\t\tRTC can wake system from S4 (V1) : 0\n"); EFPRINTF(fp, "\t\t\t32-bit PM Timer (V1) : 1\n"); EFPRINTF(fp, "\t\t\tDocking Supported (V1) : 0\n"); - EFPRINTF(fp, "\t\t\tReset Register Supported (V2) : 0\n"); + EFPRINTF(fp, "\t\t\tReset Register Supported (V2) : 1\n"); EFPRINTF(fp, "\t\t\tSealed Case (V3) : 0\n"); EFPRINTF(fp, "\t\t\tHeadless - No Video (V3) : 1\n"); EFPRINTF(fp, "\t\t\tUse native instr after SLP_TYPx (V3) : 0\n"); @@ -397,10 +401,10 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0001]\t\tBit Width : 08\n"); EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n"); - EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000001\n"); + EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000CF9\n"); EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0001]\t\tValue to cause reset : 00\n"); + EFPRINTF(fp, "[0001]\t\tValue to cause reset : 06\n"); EFPRINTF(fp, "[0003]\t\tReserved : 000000\n"); EFPRINTF(fp, "[0008]\t\tFACS Address : 00000000%08X\n", basl_acpi_base + FACS_OFFSET); @@ -412,7 +416,8 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0001]\t\tBit Width : 20\n"); EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 02 [Word Access:16]\n"); - EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000001\n"); + EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n", + PM1A_EVT_ADDR); EFPRINTF(fp, "\n"); EFPRINTF(fp, @@ -431,7 +436,8 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0001]\t\tBit Width : 10\n"); EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 02 [Word Access:16]\n"); - EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000001\n"); + EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n", + PM1A_CNT_ADDR); EFPRINTF(fp, "\n"); EFPRINTF(fp, @@ -463,7 +469,7 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n"); EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n", - BHYVE_PM_TIMER_ADDR); + IO_PMTMR); EFPRINTF(fp, "\n"); EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n"); @@ -603,6 +609,11 @@ basl_fwrite_dsdt(FILE *fp) EFPRINTF(fp, "DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2," "\"BHYVE \", \"BVDSDT \", 0x00000001)\n"); EFPRINTF(fp, "{\n"); + EFPRINTF(fp, " Name (_S5, Package (0x02)\n"); + EFPRINTF(fp, " {\n"); + EFPRINTF(fp, " 0x05,\n"); + EFPRINTF(fp, " Zero,\n"); + EFPRINTF(fp, " })\n"); EFPRINTF(fp, " Scope (_SB)\n"); EFPRINTF(fp, " {\n"); EFPRINTF(fp, " Device (PCI0)\n"); Modified: stable/10/usr.sbin/bhyve/acpi.h ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.h Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/acpi.h Thu Jan 23 20:35:32 2014 (r261090) @@ -29,6 +29,19 @@ #ifndef _ACPI_H_ #define _ACPI_H_ +#define SCI_INT 9 + +#define SMI_CMD 0xb2 +#define BHYVE_ACPI_ENABLE 0xa0 +#define BHYVE_ACPI_DISABLE 0xa1 + +#define PM1A_EVT_ADDR 0x400 +#define PM1A_CNT_ADDR 0x404 + +#define IO_PMTMR 0x408 /* 4-byte i/o port for the timer */ + +struct vmctx; + int acpi_build(struct vmctx *ctx, int ncpu); #endif /* _ACPI_H_ */ Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/bhyverun.c Thu Jan 23 20:35:32 2014 (r261090) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #define VMEXIT_RESTART 2 /* restart current instruction */ #define VMEXIT_ABORT 3 /* abort the vm run loop */ #define VMEXIT_RESET 4 /* guest machine has reset */ +#define VMEXIT_POWEROFF 5 /* guest machine has powered off */ #define MB (1024UL * 1024) #define GB (1024UL * MB) @@ -282,12 +283,17 @@ vmexit_inout(struct vmctx *ctx, struct v return (vmexit_handle_notify(ctx, vme, pvcpu, eax)); error = emulate_inout(ctx, vcpu, in, port, bytes, &eax, strictio); - if (error == 0 && in) + if (error == INOUT_OK && in) error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RAX, eax); - if (error == 0) + switch (error) { + case INOUT_OK: return (VMEXIT_CONTINUE); - else { + case INOUT_RESET: + return (VMEXIT_RESET); + case INOUT_POWEROFF: + return (VMEXIT_POWEROFF); + default: fprintf(stderr, "Unhandled %s%c 0x%04x\n", in ? "in" : "out", bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port); Modified: stable/10/usr.sbin/bhyve/inout.h ============================================================================== --- stable/10/usr.sbin/bhyve/inout.h Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/inout.h Thu Jan 23 20:35:32 2014 (r261090) @@ -33,6 +33,12 @@ struct vmctx; +/* Handler return values. */ +#define INOUT_ERROR -1 +#define INOUT_OK 0 +#define INOUT_RESET 1 +#define INOUT_POWEROFF 2 + typedef int (*inout_func_t)(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg); Modified: stable/10/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/10/usr.sbin/bhyve/mevent.c Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/mevent.c Thu Jan 23 20:35:32 2014 (r261090) @@ -135,6 +135,9 @@ mevent_kq_filter(struct mevent *mevp) if (mevp->me_type == EVF_TIMER) retval = EVFILT_TIMER; + if (mevp->me_type == EVF_SIGNAL) + retval = EVFILT_SIGNAL; + return (retval); } @@ -437,7 +440,7 @@ mevent_dispatch(void) * Block awaiting events */ ret = kevent(mfd, NULL, 0, eventlist, MEVENT_MAX, NULL); - if (ret == -1) { + if (ret == -1 && errno != EINTR) { perror("Error return from kevent monitor"); } Modified: stable/10/usr.sbin/bhyve/mevent.h ============================================================================== --- stable/10/usr.sbin/bhyve/mevent.h Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/mevent.h Thu Jan 23 20:35:32 2014 (r261090) @@ -32,7 +32,8 @@ enum ev_type { EVF_READ, EVF_WRITE, - EVF_TIMER + EVF_TIMER, + EVF_SIGNAL }; struct mevent; Modified: stable/10/usr.sbin/bhyve/mptbl.c ============================================================================== --- stable/10/usr.sbin/bhyve/mptbl.c Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/mptbl.c Thu Jan 23 20:35:32 2014 (r261090) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "acpi.h" #include "bhyverun.h" #include "mptbl.h" @@ -200,13 +201,21 @@ mpt_build_ioint_entries(int_entry_ptr mp mpie->int_type = INTENTRY_TYPE_INT; mpie->src_bus_irq = 0; break; + case SCI_INT: + /* ACPI SCI is level triggered and active-lo. */ + mpie->int_flags = INTENTRY_FLAGS_POLARITY_ACTIVELO | + INTENTRY_FLAGS_TRIGGER_LEVEL; + mpie->int_type = INTENTRY_TYPE_INT; + mpie->src_bus_irq = SCI_INT; + break; case 5: case 10: case 11: /* - * PCI Irqs set to level triggered. + * PCI Irqs set to level triggered and active-lo. */ - mpie->int_flags = INTENTRY_FLAGS_TRIGGER_LEVEL; + mpie->int_flags = INTENTRY_FLAGS_POLARITY_ACTIVELO | + INTENTRY_FLAGS_TRIGGER_LEVEL; mpie->src_bus_id = 0; /* fall through.. */ default: Copied and modified: stable/10/usr.sbin/bhyve/pm.c (from r259826, head/usr.sbin/bhyve/pm.c) ============================================================================== --- head/usr.sbin/bhyve/pm.c Tue Dec 24 16:14:19 2013 (r259826, copy source) +++ stable/10/usr.sbin/bhyve/pm.c Thu Jan 23 20:35:32 2014 (r261090) @@ -29,11 +29,20 @@ __FBSDID("$FreeBSD$"); #include +#include +#include +#include +#include +#include + +#include "acpi.h" #include "inout.h" +#include "mevent.h" -#define PM1A_EVT_ADDR 0x400 -#define PM1A_CNT_ADDR 0x404 +static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER; +static struct mevent *power_button; +static sig_t old_power_handler; /* * Reset Control register at I/O port 0xcf9. Bit 2 forces a system @@ -63,12 +72,75 @@ reset_handler(struct vmctx *ctx, int vcp INOUT_PORT(reset_reg, 0xCF9, IOPORT_F_INOUT, reset_handler); /* + * ACPI's SCI is a level-triggered interrupt. + */ +static int sci_active; + +static void +sci_assert(struct vmctx *ctx) +{ + + if (sci_active) + return; + vm_ioapic_assert_irq(ctx, SCI_INT); + sci_active = 1; +} + +static void +sci_deassert(struct vmctx *ctx) +{ + + if (!sci_active) + return; + vm_ioapic_deassert_irq(ctx, SCI_INT); + sci_active = 0; +} + +/* * Power Management 1 Event Registers * - * bhyve doesn't support any power management events currently, so the - * status register always returns zero. The enable register preserves - * its value but has no effect. + * The only power management event supported is a power button upon + * receiving SIGTERM. */ +static uint16_t pm1_enable, pm1_status; + +#define PM1_TMR_STS 0x0001 +#define PM1_BM_STS 0x0010 +#define PM1_GBL_STS 0x0020 +#define PM1_PWRBTN_STS 0x0100 +#define PM1_SLPBTN_STS 0x0200 +#define PM1_RTC_STS 0x0400 +#define PM1_WAK_STS 0x8000 + +#define PM1_TMR_EN 0x0001 +#define PM1_GBL_EN 0x0020 +#define PM1_PWRBTN_EN 0x0100 +#define PM1_SLPBTN_EN 0x0200 +#define PM1_RTC_EN 0x0400 + +static void +sci_update(struct vmctx *ctx) +{ + int need_sci; + + /* See if the SCI should be active or not. */ + need_sci = 0; + if ((pm1_enable & PM1_TMR_EN) && (pm1_status & PM1_TMR_STS)) + need_sci = 1; + if ((pm1_enable & PM1_GBL_EN) && (pm1_status & PM1_GBL_STS)) + need_sci = 1; + if ((pm1_enable & PM1_PWRBTN_EN) && (pm1_status & PM1_PWRBTN_STS)) + need_sci = 1; + if ((pm1_enable & PM1_SLPBTN_EN) && (pm1_status & PM1_SLPBTN_STS)) + need_sci = 1; + if ((pm1_enable & PM1_RTC_EN) && (pm1_status & PM1_RTC_STS)) + need_sci = 1; + if (need_sci) + sci_assert(ctx); + else + sci_deassert(ctx); +} + static int pm1_status_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) @@ -76,8 +148,20 @@ pm1_status_handler(struct vmctx *ctx, in if (bytes != 2) return (-1); + + pthread_mutex_lock(&pm_lock); if (in) - *eax = 0; + *eax = pm1_status; + else { + /* + * Writes are only permitted to clear certain bits by + * writing 1 to those flags. + */ + pm1_status &= ~(*eax & (PM1_WAK_STS | PM1_RTC_STS | + PM1_SLPBTN_STS | PM1_PWRBTN_STS | PM1_BM_STS)); + sci_update(ctx); + } + pthread_mutex_unlock(&pm_lock); return (0); } @@ -85,25 +169,51 @@ static int pm1_enable_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - static uint16_t pm1_enable; if (bytes != 2) return (-1); + + pthread_mutex_lock(&pm_lock); if (in) *eax = pm1_enable; - else - pm1_enable = *eax; + else { + /* + * Only permit certain bits to be set. We never use + * the global lock, but ACPI-CA whines profusely if it + * can't set GBL_EN. + */ + pm1_enable = *eax & (PM1_PWRBTN_EN | PM1_GBL_EN); + sci_update(ctx); + } + pthread_mutex_unlock(&pm_lock); return (0); } INOUT_PORT(pm1_status, PM1A_EVT_ADDR, IOPORT_F_INOUT, pm1_status_handler); INOUT_PORT(pm1_enable, PM1A_EVT_ADDR + 2, IOPORT_F_INOUT, pm1_enable_handler); +static void +power_button_handler(int signal, enum ev_type type, void *arg) +{ + struct vmctx *ctx; + + ctx = arg; + pthread_mutex_lock(&pm_lock); + if (!(pm1_status & PM1_PWRBTN_STS)) { + pm1_status |= PM1_PWRBTN_STS; + sci_update(ctx); + } + pthread_mutex_unlock(&pm_lock); +} + /* * Power Management 1 Control Register * * This is mostly unimplemented except that we wish to handle writes that * set SPL_EN to handle S5 (soft power off). */ +static uint16_t pm1_control; + +#define PM1_SCI_EN 0x0001 #define PM1_SLP_TYP 0x1c00 #define PM1_SLP_EN 0x2000 #define PM1_ALWAYS_ZERO 0xc003 @@ -112,7 +222,6 @@ static int pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - static uint16_t pm1_control; if (bytes != 2) return (-1); @@ -121,9 +230,11 @@ pm1_control_handler(struct vmctx *ctx, i else { /* * Various bits are write-only or reserved, so force them - * to zero in pm1_control. + * to zero in pm1_control. Always preserve SCI_EN as OSPM + * can never change it. */ - pm1_control = *eax & ~(PM1_SLP_EN | PM1_ALWAYS_ZERO); + pm1_control = (pm1_control & PM1_SCI_EN) | + (*eax & ~(PM1_SLP_EN | PM1_ALWAYS_ZERO)); /* * If SLP_EN is set, check for S5. Bhyve's _S5_ method @@ -137,3 +248,41 @@ pm1_control_handler(struct vmctx *ctx, i return (0); } INOUT_PORT(pm1_control, PM1A_CNT_ADDR, IOPORT_F_INOUT, pm1_control_handler); + +/* + * ACPI SMI Command Register + * + * This write-only register is used to enable and disable ACPI. + */ +static int +smi_cmd_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, void *arg) +{ + + assert(!in); + if (bytes != 1) + return (-1); + + pthread_mutex_lock(&pm_lock); + switch (*eax) { + case BHYVE_ACPI_ENABLE: + pm1_control |= PM1_SCI_EN; + if (power_button == NULL) { + power_button = mevent_add(SIGTERM, EVF_SIGNAL, + power_button_handler, ctx); + old_power_handler = signal(SIGTERM, SIG_IGN); + } + break; + case BHYVE_ACPI_DISABLE: + pm1_control &= ~PM1_SCI_EN; + if (power_button != NULL) { + mevent_delete(power_button); + power_button = NULL; + signal(SIGTERM, old_power_handler); + } + break; + } + pthread_mutex_unlock(&pm_lock); + return (0); +} +INOUT_PORT(smi_cmd, SMI_CMD, IOPORT_F_OUT, smi_cmd_handler); Modified: stable/10/usr.sbin/bhyve/pmtmr.c ============================================================================== --- stable/10/usr.sbin/bhyve/pmtmr.c Thu Jan 23 20:25:38 2014 (r261089) +++ stable/10/usr.sbin/bhyve/pmtmr.c Thu Jan 23 20:35:32 2014 (r261090) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "acpi.h" #include "inout.h" /* @@ -49,11 +50,10 @@ __FBSDID("$FreeBSD$"); * This implementation will be 32-bits */ -#define IO_PMTMR 0x408 /* 4-byte i/o port for the timer */ - #define PMTMR_FREQ 3579545 /* 3.579545MHz */ static pthread_mutex_t pmtmr_mtx; +static pthread_once_t pmtmr_once = PTHREAD_ONCE_INIT; static uint64_t pmtmr_old; @@ -123,6 +123,7 @@ pmtmr_init(void) pmtmr_uptime_old = tsnew; pmtmr_old = timespec_to_pmtmr(&tsnew, &tsold); } + pthread_mutex_init(&pmtmr_mtx, NULL); } static uint32_t @@ -133,13 +134,7 @@ pmtmr_val(void) uint64_t pmtmr_new; int error; - static int inited = 0; - - if (!inited) { - pthread_mutex_init(&pmtmr_mtx, NULL); - pmtmr_init(); - inited = 1; - } + pthread_once(&pmtmr_once, pmtmr_init); pthread_mutex_lock(&pmtmr_mtx); From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 00:41:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80B2827C; Fri, 24 Jan 2014 00:41:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6C75C1F53; Fri, 24 Jan 2014 00:41:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O0f3jV049059; Fri, 24 Jan 2014 00:41:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O0f3o5049058; Fri, 24 Jan 2014 00:41:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401240041.s0O0f3o5049058@svn.freebsd.org> From: Alexander Motin Date: Fri, 24 Jan 2014 00:41:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261093 - stable/10/sys/dev/mfi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 00:41:03 -0000 Author: mav Date: Fri Jan 24 00:41:02 2014 New Revision: 261093 URL: http://svnweb.freebsd.org/changeset/base/261093 Log: MFC r260521: Remove not applicable PI_SDTR_ABLE and PI_WIDE_16 hba_inquiry flags to make CAM to not try negotiate unsupported settings and suppress warnings. While there, enable command queuing on pass-through devices, announced in hba_inquiry, but disabled. Even though queue size is very small, It seems working well enough. Modified: stable/10/sys/dev/mfi/mfi_cam.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/10/sys/dev/mfi/mfi_cam.c Fri Jan 24 00:14:14 2014 (r261092) +++ stable/10/sys/dev/mfi/mfi_cam.c Fri Jan 24 00:41:02 2014 (r261093) @@ -216,7 +216,7 @@ mfip_cam_action(struct cam_sim *sim, uni struct ccb_pathinq *cpi = &ccb->cpi; cpi->version_num = 1; - cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; + cpi->hba_inquiry = PI_TAG_ABLE; cpi->target_sprt = 0; cpi->hba_misc = PIM_NOBUSRESET|PIM_SEQSCAN; cpi->hba_eng_cnt = 0; @@ -244,6 +244,8 @@ mfip_cam_action(struct cam_sim *sim, uni break; case XPT_GET_TRAN_SETTINGS: { + struct ccb_trans_settings_scsi *scsi = + &ccb->cts.proto_specific.scsi; struct ccb_trans_settings_sas *sas = &ccb->cts.xport_specific.sas; @@ -252,6 +254,9 @@ mfip_cam_action(struct cam_sim *sim, uni ccb->cts.transport = XPORT_SAS; ccb->cts.transport_version = 0; + scsi->valid = CTS_SCSI_VALID_TQ; + scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; + sas->valid &= ~CTS_SAS_VALID_SPEED; sas->bitrate = 150000; From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 07:24:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 590B3E6; Fri, 24 Jan 2014 07:24:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 440421D9D; Fri, 24 Jan 2014 07:24:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O7Of5G002917; Fri, 24 Jan 2014 07:24:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O7Of2E002916; Fri, 24 Jan 2014 07:24:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240724.s0O7Of2E002916@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 07:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261096 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 07:24:41 -0000 Author: hselasky Date: Fri Jan 24 07:24:40 2014 New Revision: 261096 URL: http://svnweb.freebsd.org/changeset/base/261096 Log: MFC r260388, r260535 and r260536: Fix XHCI interrupt logic for "Intel Lynx Point" found in MBP2013. Modified: stable/10/sys/dev/usb/controller/xhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Fri Jan 24 02:57:00 2014 (r261095) +++ stable/10/sys/dev/usb/controller/xhci.c Fri Jan 24 07:24:40 2014 (r261096) @@ -1578,23 +1578,26 @@ void xhci_interrupt(struct xhci_softc *sc) { uint32_t status; + uint32_t temp; USB_BUS_LOCK(&sc->sc_bus); status = XREAD4(sc, oper, XHCI_USBSTS); - if (status == 0) - goto done; - /* acknowledge interrupts */ + /* acknowledge interrupts, if any */ + if (status != 0) { + XWRITE4(sc, oper, XHCI_USBSTS, status); + DPRINTFN(16, "real interrupt (status=0x%08x)\n", status); + } - XWRITE4(sc, oper, XHCI_USBSTS, status); + temp = XREAD4(sc, runt, XHCI_IMAN(0)); - DPRINTFN(16, "real interrupt (status=0x%08x)\n", status); + /* force clearing of pending interrupts */ + if (temp & XHCI_IMAN_INTR_PEND) + XWRITE4(sc, runt, XHCI_IMAN(0), temp); - if (status & XHCI_STS_EINT) { - /* check for event(s) */ - xhci_interrupt_poll(sc); - } + /* check for event(s) */ + xhci_interrupt_poll(sc); if (status & (XHCI_STS_PCD | XHCI_STS_HCH | XHCI_STS_HSE | XHCI_STS_HCE)) { @@ -1618,7 +1621,6 @@ xhci_interrupt(struct xhci_softc *sc) __FUNCTION__); } } -done: USB_BUS_UNLOCK(&sc->sc_bus); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 07:32:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 13FBF5C0; Fri, 24 Jan 2014 07:32:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E85EB1E30; Fri, 24 Jan 2014 07:32:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O7W58w006480; Fri, 24 Jan 2014 07:32:05 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O7W5Kj006479; Fri, 24 Jan 2014 07:32:05 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240732.s0O7W5Kj006479@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 07:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261099 - stable/10/sys/dev/usb/serial X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 07:32:06 -0000 Author: hselasky Date: Fri Jan 24 07:32:05 2014 New Revision: 261099 URL: http://svnweb.freebsd.org/changeset/base/261099 Log: MFC r260559: Don't do synchronous USB requests inside USB transfer callbacks. It is technically OK, but not recommended. Modified: stable/10/sys/dev/usb/serial/umcs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/umcs.c ============================================================================== --- stable/10/sys/dev/usb/serial/umcs.c Fri Jan 24 07:29:31 2014 (r261098) +++ stable/10/sys/dev/usb/serial/umcs.c Fri Jan 24 07:32:05 2014 (r261099) @@ -121,8 +121,6 @@ struct umcs7840_softc_oneport { uint8_t sc_lcr; /* local line control register */ uint8_t sc_mcr; /* local modem control register */ - uint8_t sc_lsr; /* local line status register */ - uint8_t sc_msr; /* local modem status register */ }; struct umcs7840_softc { @@ -535,12 +533,7 @@ umcs7840_cfg_open(struct ucom_softc *uco if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_control, data)) return; - /* Read LSR & MSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) - return; - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) - return; - DPRINTF("Port %d has been opened, LSR=%02x MSR=%02x\n", pn, sc->sc_ports[pn].sc_lsr, sc->sc_ports[pn].sc_msr); + DPRINTF("Port %d has been opened\n", pn); } static void @@ -748,9 +741,17 @@ static void umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) { struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + uint8_t hw_lsr = 0; /* local line status register */ + uint8_t hw_msr = 0; /* local modem status register */ + + /* Read LSR & MSR */ + umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &hw_lsr); + umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr); + + *lsr = hw_lsr; + *msr = hw_msr; - *lsr = sc->sc_ports[ucom->sc_portno].sc_lsr; - *msr = sc->sc_ports[ucom->sc_portno].sc_msr; DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr); } @@ -781,21 +782,11 @@ umcs7840_intr_callback(struct usb_xfer * case MCS7840_UART_ISR_RXERR: case MCS7840_UART_ISR_RXHASDATA: case MCS7840_UART_ISR_RXTIMEOUT: - /* Read new LSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) - break; /* Inner switch */ + case MCS7840_UART_ISR_MSCHANGE: ucom_status_change(&sc->sc_ucom[subunit]); - /* Inner switch */ break; - case MCS7840_UART_ISR_TXEMPTY: + default: /* Do nothing */ - break; /* Inner switch */ - case MCS7840_UART_ISR_MSCHANGE: - /* Read new MSR */ - if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) - break; /* Inner switch */ - DPRINTF("Port %d: new MSR %02x\n", pn, sc->sc_ports[pn].sc_msr); - ucom_status_change(&sc->sc_ucom[subunit]); break; } } From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 07:43:47 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B088F12; Fri, 24 Jan 2014 07:43:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F05AE1EE9; Fri, 24 Jan 2014 07:43:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O7hk1U010571; Fri, 24 Jan 2014 07:43:46 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O7hkcb010570; Fri, 24 Jan 2014 07:43:46 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240743.s0O7hkcb010570@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 07:43:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261104 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 07:43:47 -0000 Author: hselasky Date: Fri Jan 24 07:43:46 2014 New Revision: 261104 URL: http://svnweb.freebsd.org/changeset/base/261104 Log: MFC r260563: Make sure reserved fields of the EHCI DMA descriptors are not dirty after previous transfers. Modified: stable/10/sys/dev/usb/controller/ehci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci.c Fri Jan 24 07:42:26 2014 (r261103) +++ stable/10/sys/dev/usb/controller/ehci.c Fri Jan 24 07:43:46 2014 (r261104) @@ -1654,12 +1654,17 @@ restart: } td->len = 0; + /* properly reset reserved fields */ td->qtd_buffer[0] = 0; - td->qtd_buffer_hi[0] = 0; - td->qtd_buffer[1] = 0; + td->qtd_buffer[2] = 0; + td->qtd_buffer[3] = 0; + td->qtd_buffer[4] = 0; + td->qtd_buffer_hi[0] = 0; td->qtd_buffer_hi[1] = 0; - + td->qtd_buffer_hi[2] = 0; + td->qtd_buffer_hi[3] = 0; + td->qtd_buffer_hi[4] = 0; } else { uint8_t x; @@ -1714,6 +1719,12 @@ restart: htohc32(temp->sc, buf_res.physaddr & (~0xFFF)); td->qtd_buffer_hi[x] = 0; + + /* properly reset reserved fields */ + while (++x < EHCI_QTD_NBUFFERS) { + td->qtd_buffer[x] = 0; + td->qtd_buffer_hi[x] = 0; + } } if (td_next) { @@ -2001,6 +2012,18 @@ ehci_setup_standard_chain(struct usb_xfe qh->qh_qtd.qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); + /* properly reset reserved fields */ + qh->qh_qtd.qtd_buffer[0] = 0; + qh->qh_qtd.qtd_buffer[1] = 0; + qh->qh_qtd.qtd_buffer[2] = 0; + qh->qh_qtd.qtd_buffer[3] = 0; + qh->qh_qtd.qtd_buffer[4] = 0; + qh->qh_qtd.qtd_buffer_hi[0] = 0; + qh->qh_qtd.qtd_buffer_hi[1] = 0; + qh->qh_qtd.qtd_buffer_hi[2] = 0; + qh->qh_qtd.qtd_buffer_hi[3] = 0; + qh->qh_qtd.qtd_buffer_hi[4] = 0; + usb_pc_cpu_flush(qh->page_cache); if (xfer->xroot->udev->flags.self_suspended == 0) { From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 07:48:54 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FBDF189; Fri, 24 Jan 2014 07:48:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EE3E81F32; Fri, 24 Jan 2014 07:48:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O7mrNJ011210; Fri, 24 Jan 2014 07:48:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O7mq5D011199; Fri, 24 Jan 2014 07:48:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240748.s0O7mq5D011199@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 07:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261105 - in stable/10/sys/dev/usb: . controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 07:48:54 -0000 Author: hselasky Date: Fri Jan 24 07:48:52 2014 New Revision: 261105 URL: http://svnweb.freebsd.org/changeset/base/261105 Log: MFC r260588 and r260589: - Separate I/O errors from reception of STALL PID. - Implement better error recovery for Transaction Translators, TTs, found in High Speed USB HUBs which translate from High Speed USB into FULL or LOW speed USB. In some rare cases SPLIT transactions might get lost, which might leave the TT in an unknown state. Whenever we detect such an error try to issue either a clear TT buffer request, or if that is not possible reset the whole TT. Modified: stable/10/sys/dev/usb/controller/ehci.c stable/10/sys/dev/usb/controller/uhci.c stable/10/sys/dev/usb/usb_device.c stable/10/sys/dev/usb/usb_device.h stable/10/sys/dev/usb/usb_hub.c stable/10/sys/dev/usb/usb_hub.h stable/10/sys/dev/usb/usb_request.c stable/10/sys/dev/usb/usb_transfer.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/controller/ehci.c Fri Jan 24 07:48:52 2014 (r261105) @@ -1198,9 +1198,16 @@ ehci_non_isoc_done_sub(struct usb_xfer * (status & EHCI_QTD_PINGSTATE) ? "[PING]" : ""); } #endif - - return ((status & EHCI_QTD_HALTED) ? - USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION); + if (status & EHCI_QTD_HALTED) { + if ((xfer->xroot->udev->parent_hs_hub != NULL) || + (xfer->xroot->udev->address != 0)) { + /* try to separate I/O errors from STALL */ + if (EHCI_QTD_GET_CERR(status) == 0) + return (USB_ERR_IOERROR); + } + return (USB_ERR_STALLED); + } + return (USB_ERR_NORMAL_COMPLETION); } static void Modified: stable/10/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/uhci.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/controller/uhci.c Fri Jan 24 07:48:52 2014 (r261105) @@ -1179,8 +1179,13 @@ uhci_non_isoc_done_sub(struct usb_xfer * (status & UHCI_TD_SPD) ? "[SPD]" : ""); } #endif - return (status & UHCI_TD_STALLED) ? - USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION; + if (status & UHCI_TD_STALLED) { + /* try to separate I/O errors from STALL */ + if (UHCI_TD_GET_ERRCNT(status) == 0) + return (USB_ERR_IOERROR); + return (USB_ERR_STALLED); + } + return (USB_ERR_NORMAL_COMPLETION); } static void Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_device.c Fri Jan 24 07:48:52 2014 (r261105) @@ -98,7 +98,7 @@ static void usb_init_attach_arg(struct u struct usb_attach_arg *); static void usb_suspend_resume_sub(struct usb_device *, device_t, uint8_t); -static void usbd_clear_stall_proc(struct usb_proc_msg *_pm); +static usb_proc_callback_t usbd_clear_stall_proc; static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); #if USB_HAVE_DEVCTL @@ -1474,7 +1474,7 @@ usb_suspend_resume(struct usb_device *ud static void usbd_clear_stall_proc(struct usb_proc_msg *_pm) { - struct usb_clear_stall_msg *pm = (void *)_pm; + struct usb_udev_msg *pm = (void *)_pm; struct usb_device *udev = pm->udev; /* Change lock */ Modified: stable/10/sys/dev/usb/usb_device.h ============================================================================== --- stable/10/sys/dev/usb/usb_device.h Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_device.h Fri Jan 24 07:48:52 2014 (r261105) @@ -53,7 +53,7 @@ struct usb_symlink; /* UGEN */ #define USB_UNCFG_FLAG_NONE 0x00 #define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */ -struct usb_clear_stall_msg { +struct usb_udev_msg { struct usb_proc_msg hdr; struct usb_device *udev; }; @@ -179,8 +179,8 @@ union usb_device_scratch { * these structures for every USB device. */ struct usb_device { - struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall - * messages */ + /* generic clear stall message */ + struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; struct mtx device_mtx; @@ -316,4 +316,10 @@ void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); +#if USB_HAVE_TT_SUPPORT +void uhub_tt_buffer_reset_async_locked(struct usb_device *, struct usb_endpoint *); +#endif + +uint8_t uhub_count_active_host_ports(struct usb_device *, enum usb_dev_speed); + #endif /* _USB_DEVICE_H_ */ Modified: stable/10/sys/dev/usb/usb_hub.c ============================================================================== --- stable/10/sys/dev/usb/usb_hub.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_hub.c Fri Jan 24 07:48:52 2014 (r261105) @@ -74,7 +74,13 @@ #endif /* USB_GLOBAL_INCLUDE_FILE */ #define UHUB_INTR_INTERVAL 250 /* ms */ -#define UHUB_N_TRANSFER 1 +enum { + UHUB_INTR_TRANSFER, +#if USB_HAVE_TT_SUPPORT + UHUB_RESET_TT_TRANSFER, +#endif + UHUB_N_TRANSFER, +}; #ifdef USB_DEBUG static int uhub_debug = 0; @@ -129,6 +135,9 @@ static bus_child_location_str_t uhub_chi static bus_child_pnpinfo_str_t uhub_child_pnpinfo_string; static usb_callback_t uhub_intr_callback; +#if USB_HAVE_TT_SUPPORT +static usb_callback_t uhub_reset_tt_callback; +#endif static void usb_dev_resume_peer(struct usb_device *udev); static void usb_dev_suspend_peer(struct usb_device *udev); @@ -136,7 +145,7 @@ static uint8_t usb_peer_should_wakeup(st static const struct usb_config uhub_config[UHUB_N_TRANSFER] = { - [0] = { + [UHUB_INTR_TRANSFER] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_ANY, @@ -146,6 +155,17 @@ static const struct usb_config uhub_conf .callback = &uhub_intr_callback, .interval = UHUB_INTR_INTERVAL, }, +#if USB_HAVE_TT_SUPPORT + [UHUB_RESET_TT_TRANSFER] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control pipe */ + .direction = UE_DIR_ANY, + .bufsize = sizeof(struct usb_device_request), + .callback = &uhub_reset_tt_callback, + .timeout = 1000, /* 1 second */ + .usb_mode = USB_MODE_HOST, + }, +#endif }; /* @@ -215,6 +235,199 @@ uhub_intr_callback(struct usb_xfer *xfer } /*------------------------------------------------------------------------* + * uhub_reset_tt_proc + * + * This function starts the TT reset USB request + *------------------------------------------------------------------------*/ +#if USB_HAVE_TT_SUPPORT +static void +uhub_reset_tt_proc(struct usb_proc_msg *_pm) +{ + struct usb_udev_msg *pm = (void *)_pm; + struct usb_device *udev = pm->udev; + struct usb_hub *hub; + struct uhub_softc *sc; + + hub = udev->hub; + if (hub == NULL) + return; + sc = hub->hubsoftc; + if (sc == NULL) + return; + + /* Change lock */ + USB_BUS_UNLOCK(udev->bus); + mtx_lock(&sc->sc_mtx); + /* Start transfer */ + usbd_transfer_start(sc->sc_xfer[UHUB_RESET_TT_TRANSFER]); + /* Change lock */ + mtx_unlock(&sc->sc_mtx); + USB_BUS_LOCK(udev->bus); +} +#endif + +/*------------------------------------------------------------------------* + * uhub_tt_buffer_reset_async_locked + * + * This function queues a TT reset for the given USB device and endpoint. + *------------------------------------------------------------------------*/ +#if USB_HAVE_TT_SUPPORT +void +uhub_tt_buffer_reset_async_locked(struct usb_device *child, struct usb_endpoint *ep) +{ + struct usb_device_request req; + struct usb_device *udev; + struct usb_hub *hub; + struct usb_port *up; + uint16_t wValue; + uint8_t port; + + if (child == NULL || ep == NULL) + return; + + udev = child->parent_hs_hub; + port = child->hs_port_no; + + if (udev == NULL) + return; + + hub = udev->hub; + if ((hub == NULL) || + (udev->speed != USB_SPEED_HIGH) || + (child->speed != USB_SPEED_LOW && + child->speed != USB_SPEED_FULL) || + (child->flags.usb_mode != USB_MODE_HOST) || + (port == 0) || (ep->edesc == NULL)) { + /* not applicable */ + return; + } + + USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); + + up = hub->ports + port - 1; + + if (udev->ddesc.bDeviceClass == UDCLASS_HUB && + udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) + port = 1; + + /* if we already received a clear buffer request, reset the whole TT */ + if (up->req_reset_tt.bRequest != 0) { + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_RESET_TT; + USETW(req.wValue, 0); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + } else { + wValue = (ep->edesc->bEndpointAddress & 0xF) | + ((child->address & 0x7F) << 4) | + ((ep->edesc->bEndpointAddress & 0x80) << 8) | + ((ep->edesc->bmAttributes & 3) << 12); + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_CLEAR_TT_BUFFER; + USETW(req.wValue, wValue); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + } + up->req_reset_tt = req; + /* get reset transfer started */ + usb_proc_msignal(USB_BUS_NON_GIANT_PROC(udev->bus), + &hub->tt_msg[0], &hub->tt_msg[1]); +} +#endif + +#if USB_HAVE_TT_SUPPORT +static void +uhub_reset_tt_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct uhub_softc *sc; + struct usb_device *udev; + struct usb_port *up; + uint8_t x; + + DPRINTF("TT buffer reset\n"); + + sc = usbd_xfer_softc(xfer); + udev = sc->sc_udev; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + case USB_ST_SETUP: +tr_setup: + USB_BUS_LOCK(udev->bus); + /* find first port which needs a TT reset */ + for (x = 0; x != udev->hub->nports; x++) { + up = udev->hub->ports + x; + + if (up->req_reset_tt.bRequest == 0) + continue; + + /* copy in the transfer */ + usbd_copy_in(xfer->frbuffers, 0, &up->req_reset_tt, + sizeof(up->req_reset_tt)); + /* reset buffer */ + memset(&up->req_reset_tt, 0, sizeof(up->req_reset_tt)); + + /* set length */ + usbd_xfer_set_frame_len(xfer, 0, sizeof(up->req_reset_tt)); + xfer->nframes = 1; + USB_BUS_UNLOCK(udev->bus); + + usbd_transfer_submit(xfer); + return; + } + USB_BUS_UNLOCK(udev->bus); + break; + + default: + if (error == USB_ERR_CANCELLED) + break; + + DPRINTF("TT buffer reset failed (%s)\n", usbd_errstr(error)); + goto tr_setup; + } +} +#endif + +/*------------------------------------------------------------------------* + * uhub_count_active_host_ports + * + * This function counts the number of active ports at the given speed. + *------------------------------------------------------------------------*/ +uint8_t +uhub_count_active_host_ports(struct usb_device *udev, enum usb_dev_speed speed) +{ + struct uhub_softc *sc; + struct usb_device *child; + struct usb_hub *hub; + struct usb_port *up; + uint8_t retval = 0; + uint8_t x; + + if (udev == NULL) + goto done; + hub = udev->hub; + if (hub == NULL) + goto done; + sc = hub->hubsoftc; + if (sc == NULL) + goto done; + + for (x = 0; x != hub->nports; x++) { + up = hub->ports + x; + child = usb_bus_port_get_device(udev->bus, up); + if (child != NULL && + child->flags.usb_mode == USB_MODE_HOST && + child->speed == speed) + retval++; + } +done: + return (retval); +} + +/*------------------------------------------------------------------------* * uhub_explore_sub - subroutine * * Return values: @@ -1114,7 +1327,12 @@ uhub_attach(device_t dev) hub->explore = &uhub_explore; hub->nports = nports; hub->hubudev = udev; - +#if USB_HAVE_TT_SUPPORT + hub->tt_msg[0].hdr.pm_callback = &uhub_reset_tt_proc; + hub->tt_msg[0].udev = udev; + hub->tt_msg[1].hdr.pm_callback = &uhub_reset_tt_proc; + hub->tt_msg[1].udev = udev; +#endif /* if self powered hub, give ports maximum current */ if (udev->flags.self_powered) { hub->portpower = USB_MAX_POWER; @@ -1216,11 +1434,9 @@ uhub_attach(device_t dev) /* Start the interrupt endpoint, if any */ - if (sc->sc_xfer[0] != NULL) { - mtx_lock(&sc->sc_mtx); - usbd_transfer_start(sc->sc_xfer[0]); - mtx_unlock(&sc->sc_mtx); - } + mtx_lock(&sc->sc_mtx); + usbd_transfer_start(sc->sc_xfer[UHUB_INTR_TRANSFER]); + mtx_unlock(&sc->sc_mtx); /* Enable automatic power save on all USB HUBs */ @@ -1250,6 +1466,7 @@ uhub_detach(device_t dev) { struct uhub_softc *sc = device_get_softc(dev); struct usb_hub *hub = sc->sc_udev->hub; + struct usb_bus *bus = sc->sc_udev->bus; struct usb_device *child; uint8_t x; @@ -1262,7 +1479,7 @@ uhub_detach(device_t dev) /* Detach all ports */ for (x = 0; x != hub->nports; x++) { - child = usb_bus_port_get_device(sc->sc_udev->bus, hub->ports + x); + child = usb_bus_port_get_device(bus, hub->ports + x); if (child == NULL) { continue; @@ -1274,6 +1491,14 @@ uhub_detach(device_t dev) usb_free_device(child, 0); } +#if USB_HAVE_TT_SUPPORT + /* Make sure our TT messages are not queued anywhere */ + USB_BUS_LOCK(bus); + usb_proc_mwait(USB_BUS_NON_GIANT_PROC(bus), + &hub->tt_msg[0], &hub->tt_msg[1]); + USB_BUS_UNLOCK(bus); +#endif + #if (USB_HAVE_FIXED_PORT == 0) free(hub, M_USBDEV); #endif Modified: stable/10/sys/dev/usb/usb_hub.h ============================================================================== --- stable/10/sys/dev/usb/usb_hub.h Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_hub.h Fri Jan 24 07:48:52 2014 (r261105) @@ -35,6 +35,9 @@ struct usb_port { #define USB_RESTART_MAX 5 uint8_t device_index; /* zero means not valid */ enum usb_hc_mode usb_mode; /* host or device mode */ +#if USB_HAVE_TT_SUPPORT + struct usb_device_request req_reset_tt __aligned(4); +#endif }; /* @@ -44,6 +47,9 @@ struct usb_hub { struct usb_device *hubudev; /* the HUB device */ usb_error_t (*explore) (struct usb_device *hub); void *hubsoftc; +#if USB_HAVE_TT_SUPPORT + struct usb_udev_msg tt_msg[2]; +#endif usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX]; uint16_t portpower; /* mA per USB port */ uint8_t isoc_last_time; Modified: stable/10/sys/dev/usb/usb_request.c ============================================================================== --- stable/10/sys/dev/usb/usb_request.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_request.c Fri Jan 24 07:48:52 2014 (r261105) @@ -721,6 +721,17 @@ done: if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); + switch (err) { + case USB_ERR_NORMAL_COMPLETION: + case USB_ERR_SHORT_XFER: + case USB_ERR_STALLED: + case USB_ERR_CANCELLED: + break; + default: + DPRINTF("I/O error - waiting a bit for TT cleanup\n"); + usb_pause_mtx(mtx, hz / 16); + break; + } return ((usb_error_t)err); } @@ -2010,6 +2021,7 @@ usbd_req_re_enumerate(struct usb_device return (USB_ERR_INVAL); } retry: +#if USB_HAVE_TT_SUPPORT /* * Try to reset the High Speed parent HUB of a LOW- or FULL- * speed device, if any. @@ -2017,15 +2029,24 @@ retry: if (udev->parent_hs_hub != NULL && udev->speed != USB_SPEED_HIGH) { DPRINTF("Trying to reset parent High Speed TT.\n"); - err = usbd_req_reset_tt(udev->parent_hs_hub, NULL, - udev->hs_port_no); + if (udev->parent_hs_hub == parent_hub && + (uhub_count_active_host_ports(parent_hub, USB_SPEED_LOW) + + uhub_count_active_host_ports(parent_hub, USB_SPEED_FULL)) == 1) { + /* we can reset the whole TT */ + err = usbd_req_reset_tt(parent_hub, NULL, + udev->hs_port_no); + } else { + /* only reset a particular device and endpoint */ + err = usbd_req_clear_tt_buffer(udev->parent_hs_hub, NULL, + udev->hs_port_no, old_addr, UE_CONTROL, 0); + } if (err) { DPRINTF("Resetting parent High " "Speed TT failed (%s).\n", usbd_errstr(err)); } } - +#endif /* Try to warm reset first */ if (parent_hub->speed == USB_SPEED_SUPER) usbd_req_warm_reset_port(parent_hub, mtx, udev->port_no); Modified: stable/10/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/10/sys/dev/usb/usb_transfer.c Fri Jan 24 07:43:46 2014 (r261104) +++ stable/10/sys/dev/usb/usb_transfer.c Fri Jan 24 07:48:52 2014 (r261105) @@ -2432,7 +2432,9 @@ usbd_transfer_enqueue(struct usb_xfer_qu void usbd_transfer_done(struct usb_xfer *xfer, usb_error_t error) { - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); + struct usb_xfer_root *info = xfer->xroot; + + USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); DPRINTF("err=%s\n", usbd_errstr(error)); @@ -2446,10 +2448,10 @@ usbd_transfer_done(struct usb_xfer *xfer xfer->flags_int.control_act = 0; return; } - /* only set transfer error if not already set */ - if (!xfer->error) { + /* only set transfer error, if not already set */ + if (xfer->error == USB_ERR_NORMAL_COMPLETION) xfer->error = error; - } + /* stop any callouts */ usb_callout_stop(&xfer->timeout_handle); @@ -2461,14 +2463,14 @@ usbd_transfer_done(struct usb_xfer *xfer usbd_transfer_dequeue(xfer); #if USB_HAVE_BUSDMA - if (mtx_owned(xfer->xroot->xfer_mtx)) { + if (mtx_owned(info->xfer_mtx)) { struct usb_xfer_queue *pq; /* * If the private USB lock is not locked, then we assume * that the BUS-DMA load stage has been passed: */ - pq = &xfer->xroot->dma_q; + pq = &info->dma_q; if (pq->curr == xfer) { /* start the next BUS-DMA load, if any */ @@ -2478,10 +2480,10 @@ usbd_transfer_done(struct usb_xfer *xfer #endif /* keep some statistics */ if (xfer->error) { - xfer->xroot->bus->stats_err.uds_requests + info->bus->stats_err.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } else { - xfer->xroot->bus->stats_ok.uds_requests + info->bus->stats_ok.uds_requests [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++; } @@ -2847,6 +2849,22 @@ usbd_callback_wrapper_sub(struct usb_xfe /* end of control transfer, if any */ xfer->flags_int.control_act = 0; +#if USB_HAVE_TT_SUPPORT + switch (xfer->error) { + case USB_ERR_NORMAL_COMPLETION: + case USB_ERR_SHORT_XFER: + case USB_ERR_STALLED: + case USB_ERR_CANCELLED: + /* nothing to do */ + break; + default: + /* try to reset the TT, if any */ + USB_BUS_LOCK(bus); + uhub_tt_buffer_reset_async_locked(xfer->xroot->udev, xfer->endpoint); + USB_BUS_UNLOCK(bus); + break; + } +#endif /* check if we should block the execution queue */ if ((xfer->error != USB_ERR_CANCELLED) && (xfer->flags.pipe_bof)) { From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 08:10:09 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F33EBAB; Fri, 24 Jan 2014 08:10:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4183310B6; Fri, 24 Jan 2014 08:10:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O8A9Lo019618; Fri, 24 Jan 2014 08:10:09 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O8A8pP019615; Fri, 24 Jan 2014 08:10:08 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240810.s0O8A8pP019615@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 08:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261110 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 08:10:09 -0000 Author: hselasky Date: Fri Jan 24 08:10:08 2014 New Revision: 261110 URL: http://svnweb.freebsd.org/changeset/base/261110 Log: MFC r260808 and r260814: - Close a minor deadlock. - Fix a possible memory use after free and leak situation associated with USB device detach when using character device handles. This also includes LibUSB. It turns out that "usb_close()" cannot always get a reference to clean up its USB transfers and such, if called during the kernel USB device detach. Modified: stable/10/sys/dev/usb/usb_dev.c stable/10/sys/dev/usb/usb_device.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_dev.c ============================================================================== --- stable/10/sys/dev/usb/usb_dev.c Fri Jan 24 08:08:28 2014 (r261109) +++ stable/10/sys/dev/usb/usb_dev.c Fri Jan 24 08:10:08 2014 (r261110) @@ -207,6 +207,11 @@ usb_ref_device(struct usb_cdev_privdata DPRINTFN(2, "no device at %u\n", cpd->dev_index); goto error; } + if (cpd->udev->state == USB_STATE_DETACHED && + (need_uref != 2)) { + DPRINTFN(2, "device is detached\n"); + goto error; + } if (cpd->udev->refcount == USB_DEV_REF_MAX) { DPRINTFN(2, "no dev ref\n"); goto error; @@ -597,6 +602,13 @@ usb_fifo_free(struct usb_fifo *f) mtx_unlock(f->priv_mtx); mtx_lock(&usb_ref_lock); + /* + * Check if the "f->refcount" variable reached zero + * during the unlocked time before entering wait: + */ + if (f->refcount == 0) + break; + /* wait for sync */ cv_wait(&f->cv_drain, &usb_ref_lock); } @@ -915,23 +927,12 @@ usb_close(void *arg) DPRINTFN(2, "cpd=%p\n", cpd); - err = usb_ref_device(cpd, &refs, 0); - if (err) + err = usb_ref_device(cpd, &refs, + 2 /* uref and allow detached state */); + if (err) { + DPRINTFN(0, "Cannot grab USB reference when " + "closing USB file handle\n"); goto done; - - /* - * If this function is not called directly from the root HUB - * thread, there is usually a need to lock the enumeration - * lock. Check this. - */ - if (!usbd_enum_is_locked(cpd->udev)) { - - DPRINTFN(2, "Locking enumeration\n"); - - /* reference device */ - err = usb_usb_ref_device(cpd, &refs); - if (err) - goto done; } if (cpd->fflags & FREAD) { usb_fifo_close(refs.rxfifo, cpd->fflags); Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Fri Jan 24 08:08:28 2014 (r261109) +++ stable/10/sys/dev/usb/usb_device.c Fri Jan 24 08:10:08 2014 (r261110) @@ -2070,6 +2070,8 @@ usb_free_device(struct usb_device *udev, DPRINTFN(4, "udev=%p port=%d\n", udev, udev->port_no); bus = udev->bus; + + /* set DETACHED state to prevent any further references */ usb_set_device_state(udev, USB_STATE_DETACHED); #if USB_HAVE_DEVCTL @@ -2085,16 +2087,7 @@ usb_free_device(struct usb_device *udev, usb_free_symlink(udev->ugen_symlink); udev->ugen_symlink = NULL; } -#endif - /* - * Unregister our device first which will prevent any further - * references: - */ - usb_bus_port_set_device(bus, udev->parent_hub ? - udev->parent_hub->hub->ports + udev->port_index : NULL, - NULL, USB_ROOT_HUB_ADDR); -#if USB_HAVE_UGEN /* wait for all pending references to go away: */ mtx_lock(&usb_ref_lock); udev->refcount--; @@ -2114,6 +2107,11 @@ usb_free_device(struct usb_device *udev, /* the following will get the device unconfigured in software */ usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_EP0); + /* final device unregister after all character devices are closed */ + usb_bus_port_set_device(bus, udev->parent_hub ? + udev->parent_hub->hub->ports + udev->port_index : NULL, + NULL, USB_ROOT_HUB_ADDR); + /* unsetup any leftover default USB transfers */ usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX); @@ -2647,8 +2645,14 @@ usb_set_device_state(struct usb_device * DPRINTF("udev %p state %s -> %s\n", udev, usb_statestr(udev->state), usb_statestr(state)); - udev->state = state; +#if USB_HAVE_UGEN + mtx_lock(&usb_ref_lock); +#endif + udev->state = state; +#if USB_HAVE_UGEN + mtx_unlock(&usb_ref_lock); +#endif if (udev->bus->methods->device_state_change != NULL) (udev->bus->methods->device_state_change) (udev); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 08:15:21 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF7A4D73; Fri, 24 Jan 2014 08:15:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C91E5115C; Fri, 24 Jan 2014 08:15:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O8FLeC023010; Fri, 24 Jan 2014 08:15:21 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O8FLKA023009; Fri, 24 Jan 2014 08:15:21 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240815.s0O8FLKA023009@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 08:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261111 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 08:15:22 -0000 Author: hselasky Date: Fri Jan 24 08:15:21 2014 New Revision: 261111 URL: http://svnweb.freebsd.org/changeset/base/261111 Log: MFC r258545: Comply to the XHCI specification. Certain input context fields should always be zero. Modified: stable/10/sys/dev/usb/controller/xhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Fri Jan 24 08:10:08 2014 (r261110) +++ stable/10/sys/dev/usb/controller/xhci.c Fri Jan 24 08:15:21 2014 (r261111) @@ -2614,7 +2614,11 @@ xhci_configure_device(struct usb_device xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx2, temp); - temp = XHCI_SCTX_3_DEV_ADDR_SET(udev->address) | + /* + * These fields should be initialized to zero, according to + * XHCI section 6.2.2 - slot context: + */ + temp = XHCI_SCTX_3_DEV_ADDR_SET(0) | XHCI_SCTX_3_SLOT_STATE_SET(0); xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx3, temp); From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 08:22:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F6413F7; Fri, 24 Jan 2014 08:22:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EE33F11FB; Fri, 24 Jan 2014 08:22:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O8MTQZ026871; Fri, 24 Jan 2014 08:22:29 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O8MTvp026870; Fri, 24 Jan 2014 08:22:29 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240822.s0O8MTvp026870@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 08:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261115 - stable/10/sys/dev/usb/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 08:22:30 -0000 Author: hselasky Date: Fri Jan 24 08:22:29 2014 New Revision: 261115 URL: http://svnweb.freebsd.org/changeset/base/261115 Log: MFC r260534: Move USB ID from u3g driver to uhso driver. Modified: stable/10/sys/dev/usb/net/uhso.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/net/uhso.c ============================================================================== --- stable/10/sys/dev/usb/net/uhso.c Fri Jan 24 08:19:50 2014 (r261114) +++ stable/10/sys/dev/usb/net/uhso.c Fri Jan 24 08:22:29 2014 (r261115) @@ -268,6 +268,8 @@ static const STRUCT_USB_HOST_ID uhso_dev UHSO_DEV(OPTION, ICON401, UHSO_AUTO_IFACE), /* Option GlobeTrotter Module 382 */ UHSO_DEV(OPTION, GMT382, UHSO_AUTO_IFACE), + /* Option GTM661W */ + UHSO_DEV(OPTION, GTM661W, UHSO_AUTO_IFACE), /* Option iCON EDGE */ UHSO_DEV(OPTION, ICONEDGE, UHSO_STATIC_IFACE), /* Option Module HSxPA */ From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 08:27:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D729B64D; Fri, 24 Jan 2014 08:27:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C21471281; Fri, 24 Jan 2014 08:27:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0O8RJ1I027474; Fri, 24 Jan 2014 08:27:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0O8RJYt027473; Fri, 24 Jan 2014 08:27:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401240827.s0O8RJYt027473@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 24 Jan 2014 08:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261116 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 08:27:19 -0000 Author: hselasky Date: Fri Jan 24 08:27:19 2014 New Revision: 261116 URL: http://svnweb.freebsd.org/changeset/base/261116 Log: MFC r257132: Add id for GTM661W. This also fixes kernel build breakage since last revision. Modified: stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Fri Jan 24 08:22:29 2014 (r261115) +++ stable/10/sys/dev/usb/usbdevs Fri Jan 24 08:27:19 2014 (r261116) @@ -3226,6 +3226,7 @@ product OPTION GMT382 0x7501 Globetrott product OPTION GE40X_1 0x7301 Globetrotter HSUPA product OPTION GE40X_2 0x7361 Globetrotter HSUPA product OPTION GE40X_3 0x7381 Globetrotter HSUPA +product OPTION GTM661W 0x9000 GTM661W product OPTION ICONEDGE 0xc031 GlobeSurfer iCON EDGE product OPTION MODHSXPA 0xd013 Globetrotter HSUPA product OPTION ICON321 0xd031 Globetrotter HSUPA From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 24 15:30:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9291033F; Fri, 24 Jan 2014 15:30:14 +0000 (UTC) Received: from valery.van-laarhoven.org (unknown [IPv6:2a02:2308::216:3eff:fe79:3a6c]) by mx1.freebsd.org (Postfix) with ESMTP id 52E541850; Fri, 24 Jan 2014 15:30:14 +0000 (UTC) Received: from hitske.fritz.box (thuis.van-laarhoven.org [80.100.41.4]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by valery.van-laarhoven.org (Postfix) with ESMTPSA id CFA6F67ED43; Fri, 24 Jan 2014 16:30:10 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_C218300F-9AA9-46CD-AE0D-8C587BCDF7FA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r261115 - stable/10/sys/dev/usb/net From: Nick Hibma In-Reply-To: <201401240822.s0O8MTvp026870@svn.freebsd.org> Date: Fri, 24 Jan 2014 16:30:09 +0100 Message-Id: <1B976032-5B0E-488B-806F-E71FE2F04803@van-laarhoven.org> References: <201401240822.s0O8MTvp026870@svn.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1827) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 15:30:14 -0000 --Apple-Mail=_C218300F-9AA9-46CD-AE0D-8C587BCDF7FA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 It=92s not just the GTM661 that supports uhso, the GTM382 does so to I = think. Perhaps you want to move them all in that case? Or add them to both and let devd decide? Nick On 24 Jan 2014, at 09:22, Hans Petter Selasky = wrote: > Author: hselasky > Date: Fri Jan 24 08:22:29 2014 > New Revision: 261115 > URL: http://svnweb.freebsd.org/changeset/base/261115 >=20 > Log: > MFC r260534: > Move USB ID from u3g driver to uhso driver. >=20 > Modified: > stable/10/sys/dev/usb/net/uhso.c > Directory Properties: > stable/10/ (props changed) >=20 > Modified: stable/10/sys/dev/usb/net/uhso.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/dev/usb/net/uhso.c Fri Jan 24 08:19:50 2014 = (r261114) > +++ stable/10/sys/dev/usb/net/uhso.c Fri Jan 24 08:22:29 2014 = (r261115) > @@ -268,6 +268,8 @@ static const STRUCT_USB_HOST_ID uhso_dev > UHSO_DEV(OPTION, ICON401, UHSO_AUTO_IFACE), > /* Option GlobeTrotter Module 382 */ > UHSO_DEV(OPTION, GMT382, UHSO_AUTO_IFACE), > + /* Option GTM661W */ > + UHSO_DEV(OPTION, GTM661W, UHSO_AUTO_IFACE), > /* Option iCON EDGE */ > UHSO_DEV(OPTION, ICONEDGE, UHSO_STATIC_IFACE), > /* Option Module HSxPA */ > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" --Apple-Mail=_C218300F-9AA9-46CD-AE0D-8C587BCDF7FA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlLihwEACgkQBxE2H56uaYm/8wCfRgENDtTXND58TCQk3PChMXod xJMAoIZLG131JOp5dB10c13Yr44JKSWr =D2uX -----END PGP SIGNATURE----- --Apple-Mail=_C218300F-9AA9-46CD-AE0D-8C587BCDF7FA-- From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 25 01:06:20 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D50DDDE6; Sat, 25 Jan 2014 01:06:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C03D11C9F; Sat, 25 Jan 2014 01:06:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0P16KU1029728; Sat, 25 Jan 2014 01:06:20 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0P16KN2029727; Sat, 25 Jan 2014 01:06:20 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401250106.s0P16KN2029727@svn.freebsd.org> From: Baptiste Daroussin Date: Sat, 25 Jan 2014 01:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261143 - stable/10/etc/defaults X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 01:06:20 -0000 Author: bapt Date: Sat Jan 25 01:06:20 2014 New Revision: 261143 URL: http://svnweb.freebsd.org/changeset/base/261143 Log: MFH: r261027 Remove pkg_* related info from periodic.conf Reported by Robin Brocks Modified: stable/10/etc/defaults/periodic.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/defaults/periodic.conf ============================================================================== --- stable/10/etc/defaults/periodic.conf Sat Jan 25 00:03:33 2014 (r261142) +++ stable/10/etc/defaults/periodic.conf Sat Jan 25 01:06:20 2014 (r261143) @@ -140,10 +140,6 @@ daily_status_mail_rejects_shorten="NO" # 480.status-ntpd daily_status_ntpd_enable="NO" # Check NTP status -# 490.status-pkg-changes -daily_status_pkg_changes_enable="NO" # Show package changes -pkg_info="pkg_info" # Use this program - # 500.queuerun daily_queuerun_enable="YES" # Run mail queue daily_submit_queuerun="YES" # Also submit queue @@ -183,11 +179,6 @@ weekly_catman_enable="NO" # Preformat weekly_noid_enable="NO" # Find unowned files weekly_noid_dirs="/" # Look here -# 400.status-pkg -weekly_status_pkg_enable="NO" # Find out-of-date pkgs -pkg_version=pkg_version # Use this program -pkg_version_index=/usr/ports/INDEX-10 # Use this index file - # 450.status-security weekly_status_security_enable="YES" # Security check # See also "Security options" above for more options From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 25 01:08:36 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70E94DB; Sat, 25 Jan 2014 01:08:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5C0291CC5; Sat, 25 Jan 2014 01:08:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0P18afL030084; Sat, 25 Jan 2014 01:08:36 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0P18aP2030083; Sat, 25 Jan 2014 01:08:36 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201401250108.s0P18aP2030083@svn.freebsd.org> From: Baptiste Daroussin Date: Sat, 25 Jan 2014 01:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261144 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 01:08:36 -0000 Author: bapt Date: Sat Jan 25 01:08:35 2014 New Revision: 261144 URL: http://svnweb.freebsd.org/changeset/base/261144 Log: Implicit include of sys/queue.h instead of relying on gelf.h/libelf.h to bring it Newer version of gelf.h and libelf.h does not include sys/queue.h anymore Submitted by: kaiw Modified: stable/10/usr.sbin/pkg/config.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/config.c ============================================================================== --- stable/10/usr.sbin/pkg/config.c Sat Jan 25 01:06:20 2014 (r261143) +++ stable/10/usr.sbin/pkg/config.c Sat Jan 25 01:08:35 2014 (r261144) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 25 01:58:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 27E90BF6; Sat, 25 Jan 2014 01:58:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 138F2102E; Sat, 25 Jan 2014 01:58:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0P1wFJ7048763; Sat, 25 Jan 2014 01:58:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0P1wFgv048762; Sat, 25 Jan 2014 01:58:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401250158.s0P1wFgv048762@svn.freebsd.org> From: Alexander Motin Date: Sat, 25 Jan 2014 01:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261145 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 01:58:16 -0000 Author: mav Date: Sat Jan 25 01:58:15 2014 New Revision: 261145 URL: http://svnweb.freebsd.org/changeset/base/261145 Log: MFC r260549: Move xpt_run_devq() call before request completion callback where it was originally. I am not sure why exactly have I moved it during one of many refactorings during camlock project, but obviously it opens race window that may cause use after free panics during SIM (in reported cases umass(4)) detach. Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Sat Jan 25 01:08:35 2014 (r261144) +++ stable/10/sys/cam/cam_xpt.c Sat Jan 25 01:58:15 2014 (r261145) @@ -5186,8 +5186,7 @@ xpt_done_process(struct ccb_hdr *ccb_h) if ((ccb_h->flags & CAM_DEV_QFRZDIS) && (ccb_h->status & CAM_DEV_QFRZN)) { - xpt_release_devq(ccb_h->path, /*count*/1, - /*run_queue*/FALSE); + xpt_release_devq(ccb_h->path, /*count*/1, /*run_queue*/TRUE); ccb_h->status &= ~CAM_DEV_QFRZN; } @@ -5216,6 +5215,7 @@ xpt_done_process(struct ccb_hdr *ccb_h) if (!device_is_queued(dev)) (void)xpt_schedule_devq(devq, dev); + xpt_run_devq(devq); mtx_unlock(&devq->send_mtx); if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0) { @@ -5245,10 +5245,6 @@ xpt_done_process(struct ccb_hdr *ccb_h) (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h); if (mtx != NULL) mtx_unlock(mtx); - - mtx_lock(&devq->send_mtx); - xpt_run_devq(devq); - mtx_unlock(&devq->send_mtx); } void From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 25 10:43:47 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABCED6D1; Sat, 25 Jan 2014 10:43:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9709E15A3; Sat, 25 Jan 2014 10:43:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0PAhlHV054130; Sat, 25 Jan 2014 10:43:47 GMT (envelope-from demon@svn.freebsd.org) Received: (from demon@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0PAhl5J054129; Sat, 25 Jan 2014 10:43:47 GMT (envelope-from demon@svn.freebsd.org) Message-Id: <201401251043.s0PAhl5J054129@svn.freebsd.org> From: Dmitry Sivachenko Date: Sat, 25 Jan 2014 10:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r261153 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 10:43:47 -0000 Author: demon (ports committer) Date: Sat Jan 25 10:43:47 2014 New Revision: 261153 URL: http://svnweb.freebsd.org/changeset/base/261153 Log: Merge r260987: Do not exit with non-zero return code if sysctl.conf or sysctl.conf.local files are absent. Approved by: delphij Modified: stable/10/etc/rc.d/sysctl Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/sysctl ============================================================================== --- stable/10/etc/rc.d/sysctl Sat Jan 25 09:07:55 2014 (r261152) +++ stable/10/etc/rc.d/sysctl Sat Jan 25 10:43:47 2014 (r261153) @@ -27,7 +27,9 @@ sysctl_start() esac for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do - [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null + if [ -r ${_f} ]; then + ${command} ${command_args} ${_f} > /dev/null + fi done }